🎉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

tcl programme for node move

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

hello 

 

I am working on tcl programme  which will move selected node 

 

in a vector defined by selecting nodes

 

I have written programme for that put node is not moving in direction I wanted

 

have look at programme 

 

and how clearmark command works??

Unable to find an attachment - read this blog

Find more posts tagged with

Sort by:
1 - 16 of 161
    User: "Altair Forum User"
    Altair Employee
    OP
    Updated by Altair Forum User

    hello 

     

    so I continue working on my script

     

    So I think error lies in the  *createvector comand I am not able to provide proper x and y component for the vector creation

     

    So am I right??


     

    *createmarkpanel nodes 1 'select node'

    set node_list [hm_getmark nodes 1 ]  

    if {[llength $node_list] == 0} {
        hm_errormessage 'no'
        return
        }
    #*clearmark nodes 1


    *createlistpanel nodes 2 'Select direction by node1->node2'

    set vectnodelist [hm_getlist nodes 2]

    set nodeid1 [hm_getentityvalue nodes [lindex $vectnodelist 0] 'id' 0];

    set nodeid2 [hm_getentityvalue nodes [lindex $vectnodelist 1] 'id' 0];

    *createvector 1 $nodeid1 $nodeid2 0

    *translatemark nodes 1 1 5 

    *clearmark nodes 1

     

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

    so finally I have found solution for this problem

     

    *createmarkpanel nodes 1 'select node'

    set node_list [hm_getmark nodes 1 ]  

    if {[llength $node_list] == 0} {
        hm_errormessage 'no'
        return
        }
    #*clearmark nodes 1


    *createlistpanel nodes 2 'Select direction by node1->node2'
    set vectnodelist [hm_getlist nodes 2]

    set nodeid1 [hm_getentityvalue nodes [lindex $vectnodelist 0] 'id' 0];

    set nodeid2 [hm_getentityvalue nodes [lindex $vectnodelist 1] 'id' 0];


    foreach {tot x y z} [hm_getdistance nodes $nodeid1 $nodeid2 0] { 
        *createvector 1 $x $y $z

    set elemsize [hm_getfloat 'elemsize' 'Enter elem size']


        *translatemark nodes 1 1 $elemsize
    }

    *clearmark nodes 1
     

     

     

    Thank you everyone on forum 

    I have made this based on previous post only 

     

    thank you

    User: "tinh"
    Altair Community Member
    Updated by tinh

    It's fine

    hint for you to create a vector:

    lassign [lindex [hm_getplanepanel] 0 0] vx vy vz

    (from version HM13)

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

    thank you tinh

     

    I will work on that

     

    I want to write a program  where while midsurfacing hm should capture the thickness of plate and auto assign it afterwards ???

    User: "tinh"
    Altair Community Member
    Updated by tinh

    Hi,

    did you try using Midmesh thickness tool? 

    menu Mesh>assign>Midmesh Thickness

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

    thanks for that I will try that option

     

    I want to cycle a particular tcl until I say to stop it

     

    so how can I do it

     

    like cycling particular command e.g. like program for translate and split it should continue to repeat same commands until I stop it

     

    ??

    User: "tinh"
    Altair Community Member
    Updated by tinh

    Hi

    maybe:

    while 1 {

       *createmarkpanel nodes 1 'Select nodes to translate:'

       if {[hm_marklength nodes 1]==0} break

       #create vector and translate...

     

    }

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

    while 1 {

     

    *createmarkpanel nodes 1 'select node'

     

    set node_list [hm_getmark nodes 1 ]

     

    if {[llength $node_list] == 0} {

    hm_errormessage 'no'

    return

    }

    #*clearmark nodes 1

     

     

    *createlistpanel nodes 2 'Select direction by node1->node2'

    set vectnodelist [hm_getlist nodes 2]

     

    set nodeid1 [hm_getentityvalue nodes [lindex $vectnodelist 0] 'id' 0];

     

    set nodeid2 [hm_getentityvalue nodes [lindex $vectnodelist 1] 'id' 0];

     

     

    foreach {tot x y z} [hm_getdistance nodes $nodeid1 $nodeid2 0] {

    *createvector 1 $x $y $z

     

    #set elemsize [hm_getfloat 'elemsize' 'Enter elem size']

     

     

    *translatemark nodes 1 1 0.196

     

    }

     

    *clearmark nodes 1

     

    hm_setpanelproc {hm_callpanel 'edit element';}

     

    return

     

    }

     

     

    so this is my program

     

    at the end there is a call panel so I think because of that its not working

     

    after I split when I press return it should return to  '*createmarkpanel nodes 1 'select node''

     

    so????

    User: "tinh"
    Altair Community Member
    Updated by tinh

    no, the cause is command 'return' at the end

    remove it

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

    I tried it without return command but

     

    when I press return command on the edit element panel it wont return to first command

     

    so??

    User: "tinh"
    Altair Community Member
    Updated by tinh

    yes,

    maybe you cannot use hm_setpanelproc to call a panel. this function will return immediately, moreover it will clear panel created by *createmarkpanel

    so you don't see the panel repeated by 'while' loop

    Thinking another way

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

    So is there any other way to call up that panel and continue the while loop??

     

    so how can I do this whole process other way with while loop??

     

    Or at least tell how to create a button on user tab I followed tut but I am not able to create it??

     

     

    User: "tinh"
    Altair Community Member
    Updated by tinh

    I think it is not possible to call hm panels in a loop as you expect

    So try redefining your problem

     

    Your button had wrong constructor:

    *createbutton(5,'SURFACETRIM',00,5,GRAY,'Launch the succsesful.tcl script','EvalTcl','succsesful.tcl')

     

    should be

    *createbutton(5,'SURFACETRIM',0,0,5,GRAY,'Launch the succsesful.tcl script','EvalTcl','succsesful.tcl')

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

    sorry for wrong file

     

    I already have corrected that mistake

    Your button had wrong constructor:

    *createbutton(5,'SURFACETRIM',00,5,GRAY,'Launch the succsesful.tcl script','EvalTcl','succsesful.tcl')

     

    still its not working?? I am win7 user and I have located this userpage.mac panel in DOCUENTS FOLDER

     

    User: "tinh"
    Altair Community Member
    Updated by tinh

    check again initial directory

    menu View>command window

    type in :

    pwd

     

    ==> userpage.mac should be in that folder

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

    Thank you 

     

    That worked I was placing it in wrong directory

    now it works fine 

     

    Thank you very much