hexagon logo

How to get the erased entities using PCL?

Is there a PCL function which can get the erased entities?

Attached Files (1)
  • Try this:
     
    # Patran 2021.4 Session File
     
    # Creates model, erases nodes and elements, creates lists and groups
    # a) with all nodes and elements in the viewport
    # b) with all plot nodes and elements in the viewport
    # c) with all erased nodes and elements in the viewport
     
    uil_file_new.go("","new.db")
     
    # Model
    STRING ids[VIRTUAL]
    asm_const_patch_xyz("1","<1 1 0>","[0 0 0]","Coord 0",ids)
    $# 1 Patch created: Patch 1
    ui_exec_function( "mesh_seed_display_mgr", "init" )
    INTEGER fem_create_mesh_surfa_num_nodes
    INTEGER fem_create_mesh_surfa_num_elems
    STRING fem_create_mesh_s_nodes_created[VIRTUAL]
    STRING fem_create_mesh_s_elems_created[VIRTUAL]
    fem_create_mesh_surf_4( "IsoMesh", 49152, "Surface 1", 1, ["0.2"], "Quad4", @
    "#", "#", "Coord 0", "Coord 0", fem_create_mesh_surfa_num_nodes, @
    fem_create_mesh_surfa_num_elems, fem_create_mesh_s_nodes_created, @
    fem_create_mesh_s_elems_created )
    $# 36 nodes and 25 elements created for Surface 1.
    $# === 36 nodes created. IDs = 217:252.
    $# === 25 elements created. IDs = 126:150.
    gm_visibility_widget( "elm 6:# n 6:#", TRUE )
    gm_visibility_widget( "elm 6:# n 6:#", FALSE )
     
     
    # Variable Declarations
    INTEGER i_viewport_count
    STRING  sa_viewport_name[32](1)
    INTEGER i_entity_count
    STRING  sa_entity_name[32](2)
    INTEGER i_pick_type
    INTEGER i_pick_erased
    STRING  sv_return_list[VIRTUAL]
    INTEGER i_return_value
    STRING  sv_ids_of_created_entities[VIRTUAL]
     
     
    # Get the list of entities in "default_viewport"
    i_return_value =                                               @
      list_create_ent_ass_vp( 1, ["default_viewport"], 2,        @
      ["node","element"], sv_return_list )
    dump i_return_value
    dump sv_return_list
     
    # Create Group for all nodes and elements in the viewport
    ga_group_create( "all" )
    ga_group_entity_add( "all", sv_return_list )
     
    # Get the list of all entities in "default_viewport" that are not erased
     
    i_viewport_count   = 1
    sa_viewport_name(1) = "default_viewport"
    i_entity_count     = 2
    sa_entity_name(1)  = "node"
    sa_entity_name(2)  = "element"
    i_pick_type        = 1
    i_pick_erased      = 0   /* Do not get erased entities */
     
    i_return_value =                                               @
      list_create_ent_att_vp_vis                                  @
         ( i_viewport_count,                                     @
            sa_viewport_name,                                     @
            i_entity_count,                                       @
            sa_entity_name,                                       @
            i_pick_type,                                          @
            i_pick_erased,                                        @
            sv_return_list )
    dump i_return_value
    dump sv_return_list
     
    # Create Group for all plot nodes and elements in the viewport
    ga_group_create( "plot" )
    ga_group_entity_add( "plot", sv_return_list )
     
    sys_free_string( sv_return_list)
    sys_free_string( sv_ids_of_created_entities)
     
    # Create Group for all erased nodes and elements in the viewport
    ga_group_create_groups( 75826176, "erased", 1, ["all"], 1, ["plot"] )
  • Thanks a lot. I have tried list_create_ent_att_vp_vis() before. But it cannot get the entities out of window.

    Attached Files (1)
  • I took a look and can find no way to directly get this detail.
    If your PCL is erasing/plotting items then keep a track of what you erase/plot by also adding/removing them from a group. If the user is doing erasing of items and you then want to find out what is erased you will have to get the user to use the "Pick All" option on a select menu to fill a select databox so that you can then boolean this with the contents of the posted groups. I could find no way to simulate clicking a select menu item via pcl to do this.