Jump to content
Guest

How to create a simple loop?

Recommended Posts

Guest

I would like to create a simple loop however I'm not very good in programing... My script is like this but instead of "..." I would like to create a loop which would work till I press return or escape. Is there any simple method?

*createbutton(5, "Triad", 18, 0, 4, BUTTON, "Create Triad", "macroTriad")

*beginmacro(macroTriad) <cr>

*createlistpanel(nodes,1,"Select nodes") <cr>

*createelement(103,1,1,1) <cr>

...

*createlistpanel(nodes,1,"Select nodes") <cr>

*createelement(103,1,1,1) <cr>

*endmacro() <cr>

Kind regards,

Lukasz

Share this post


Link to post
Share on other sites
Guest

Hi,

I don't understand what you want exactly, a simple loop looks like this ...

------------------------------------------------------------------------------

*createmarkpanel elements 1 "Select elements ..."

set element_mark [hm_getmark elements 1]

foreach eid $element_mark {

tk_messageBox -message "Element : $eid"

}

------------------------------------------------------------------------------

or

------------------------------------------------------------------------------

set stop 0

while {$stop == 0} {

# your code here

set stop 1

}

------------------------------------------------------------------------------

Regards,

Mario

Share this post


Link to post
Share on other sites

Hi

Use while loop:

Condition is 'remain emptied assem' use *EntityPreviewEmpty and hm_marklength to check that condition

 

Body is 'delete them' , use *deletemark

 

Share this post


Link to post
Share on other sites

If you don't know how to make script I recommend you to learn tcl programming first, not to make tons of questions.

Tcl is easy.

Share this post


Link to post
Share on other sites
On 3/4/2019 at 12:38 PM, tinh said:

If you don't know how to make script I recommend you to learn tcl programming first, not to make tons of questions.

Tcl is easy.

Thank you

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
You are posting as a guest. If you have an account, please sign in.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...