Create either a tetra element or a pyramid element

Altair Forum User
Altair Forum User
Altair Employee
edited October 2020 in Community Q&A

Create either a tetra element or a pyramid element using the original element node list and the new node created by the script.

Tagged:

Answers

  • QuyNguyenDai
    QuyNguyenDai Altair Community Member
    edited April 2018

    Look like .... homework ???

  • Pandurang
    Pandurang Altair Community Member
    edited May 2018

    Help me to Create a node at the centroid of the element. Translate the node in the positive direction of the element normal by an amount equal to the shortest diagonal of a quad element and the shortest side of a tria element. Create either a tetra element or a pyramid element using the original element node list and the new node created by the script.

     

     

    Hi,

    Please try this:

     

    *createmarkpanel elems 1 'Select elements'
    set elem_id [hm_getmark elems 1]
    *clearmark  elems 1
    set config [hm_getentityvalue elems $elem_id config 0]
    # element normal
    set elem_normal [hm_getelementnormal $elem_id edge 1]

    #node list
    set node_list [hm_getvalue elems id=$elem_id dataname=nodes];

    # centroid
    set centerX [hm_getentityvalue elems $elem_id centerx 0]
    set centerY [hm_getentityvalue elems $elem_id centery 0]
    set centerZ [hm_getentityvalue elems $elem_id centerz 0]


    #create node at Center
    *createnode $centerX $centerY $centerZ 0;

    #translate node
    *createmark nodes 1 -1;
    set center_node [hm_getmark nodes 1]
    # create vector
    *vectorcreate 1 {*}$elem_normal 0;

        switch $config {
        
            104 {  
                
                set Short_dia [hm_getentityvalue elems $elem_id shortestdiagonal 0]
                *translatemark nodes 1 1 $Short_dia;
                
                #create pyramid
                *createlist nodes 1 {*}$node_list $center_node
                *createelement 205 1 1 1

            } 
            103 {
                
                set Short_side [hm_getentityvalue elems $elem_id shortestside 0]
                *translatemark nodes 1 1 $Short_side;
                
                #create tetra
                *createlist nodes 1 {*}$node_list $center_node
                *createelement 204 1 1 1

                
            }

        }
    *clearmark  nodes 1
    *clearlist nodes 1
    #delete vector
    *createmark vector 1 -1;
    *deletemark vector 1

    *nodecleartempmark