How to get number dofs on node with TCL script

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

Hello everyone,

 

This is my first time that i make a macro TCL, i have a question : which command can i get the number of dof on one node ? for example : in my screen HM, my node's dof is 245, but i can't get this number in the 'mark' to continue my script, thank you in advance !!!

Tagged:

Answers

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited March 2016

    What do you mean 'number of dof of node' ? 

    Do you mean the numbers displayed when you apply constraints ?

     

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited March 2016

    Dear Q.NGUYEN-DAI,

     

    Yes, exactly what i mean, can i get the numbers displayed in the node with TCL script ? Can you help me ? Thank you in advance

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited March 2016

    Here's my (testing) code:

     hm_markclear loads 1 hm_createmark loads 1 'by config' 'constraint'  set ids [hm_getmark loads 1] proc get_dof {id} { set comp1 [hm_getentityvalue loads $id comp1 0] set comp2 [hm_getentityvalue loads $id comp2 0] set comp3 [hm_getentityvalue loads $id comp3 0] set comp4 [hm_getentityvalue loads $id comp4 0] set comp5 [hm_getentityvalue loads $id comp5 0] set comp6 [hm_getentityvalue loads $id comp6 0] set dof '' if {$comp1==0} { append dof '1'; } if {$comp2==0} { append dof '2'; } if {$comp3==0} { append dof '3'; } if {$comp4==0} { append dof '4'; } if {$comp5==0} { append dof '5'; } if {$comp6==0} { append dof '6'; } return $dof; } foreach id $ids { set type [hm_getentityvalue loads $id entitytype 0] set myid [hm_getentityvalue loads $id entityid 0] set dof [get_dof $id] puts 'ID= $id ; type= $type ; NodeID= $myid ; DOF= $dof' }

    Have a look also at my screenshot.

    <?xml version="1.0" encoding="UTF-8"?>dof_constraints.png

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited March 2016

    Dear Q.NGUYEN-DAI,

     

    Thank you so much, it's worked.

     

    Best regard.

     

    Huy NGUYEN