TCL code to select SURF/SET element edges

Wesley Peijnenburg
Wesley Peijnenburg Altair Community Member
edited January 2023 in Community Q&A

Hi all,

 

I'm trying to automate the SURF/SET element edge selection for a mesh refinement study. In the GUI, three steps are required as shown below:

image

This generates the following TCL code:

*createentity sets cardimage=SURF name="set1"
*addedgesorfaces sets id=1 reversenormal=1 "user_ids={5 1 6 2 }" "edge_indices={{3} {3} {3} {3} }"
*setvalue sets id=1 STATUS=2 3150=0

 

For a slightly finer mesh, only the second line is different;

*addedgesorfaces sets id=1 reversenormal=1 "user_ids={30 31 27 37 10 9 33 3 4 6 36 }" "edge_indices={{1} {1} {3} {1} {1} {1} {3} {1} {1} {3} {1} }"

 

My question:

How can I automate in TCL the selection of both "user_ids" and "edge_indices"? I tried to use line #7 (inner contour line) but this is where I am stuck. Attached is the model.

Answers

  • Adriano A. Koga
    Adriano A. Koga
    Altair Employee
    edited January 2023

    hi,

     

    I don't have an exact answer to your question but maybe you could use this command below.

    With this one, you have to supply a mark of element selection, and then a mark of edge nodes selection.

    Not exact, but you could create a mark with all your elements and for the nodes, you could use the 'edges' command to extract a component named '^edges' and then create a mark of nodes based on this component in order to give this to the below command.

    *contactsurfcreatewithfaces

    Creates a contact surface using 2D element edges or 2D/3D element faces.

    Syntax

    *contactsurfcreatewithfaces name color elem_mark_id node_mark_id break_angle reverse_normals on_face

    Type

    HyperMesh Tcl Modify Command

    Description

    Creates a contact surface using 2D element edges or 2D/3D element faces.

    Inputs

    name
    The name of the contact surface to create.
    color
    The color of the contact surface. Valid values are 1 through 64.
    elem_mark_id
    The ID of the mark that contains the elements to use. Valid values are 1 and 2.
    node_mark_id
    The ID of the mark that contains the nodes that define an edge or a face of an element. Valid values are 1 and 2.
    break_angle
    The break angle for finding adjacent elements.
    reverse_normals
    0 - Create contact surface along element normal.
    1 - Create contact surface opposite element normal.
    of_face
    0 - Create contact surface on edge.
    1 - Create contact surface on face.

     

     

    image

  • Wesley Peijnenburg
    Wesley Peijnenburg Altair Community Member
    edited January 2023

    @Adriano A. Koga:

    Thanks a lot for this partial solution!

     

    I was able to combine the code from your screenshot with the element selection code found here:

    https://community.altair.com/community?id=community_question&sys_id=4f56c8f61b2bd0908017dc61ec4bcb2a

     

    With that, the complete solution is as follows:

    *createmark nodes 2 "by lines" 7
    *createmark elems 1 "by node" {*}[hm_getmark nodes 2] 
    *contactsurfcreatewithfaces "set_edges" 6 1 2 30.0 1 0
    *setvalue sets id=1 cardimage="SURF"
    *setvalue sets id=1 STATUS=2 3150=0

     

    I appreciate your help!