🎉Community Raffle - Win $25

An exclusive raffle opportunity for active members like you! Complete your profile, answer questions and get your first accepted badge to enter the raffle.
Join and Win

How to get number dofs on node with TCL script

User: "Altair Forum User"
Altair Employee
Updated by Altair Forum User

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 !!!

Find more posts tagged with

Sort by:
1 - 4 of 41
    User: "Altair Forum User"
    Altair Employee
    OP
    Updated by Altair Forum User

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

    Do you mean the numbers displayed when you apply constraints ?

     

    User: "Altair Forum User"
    Altair Employee
    OP
    Updated by Altair Forum User

    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

    User: "Altair Forum User"
    Altair Employee
    OP
    Updated by Altair Forum User

    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

    User: "Altair Forum User"
    Altair Employee
    OP
    Updated by Altair Forum User

    Dear Q.NGUYEN-DAI,

     

    Thank you so much, it's worked.

     

    Best regard.

     

    Huy NGUYEN