Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ccommand in hypermesh

Status
Not open for further replies.

mehrmashhadi18

Mechanical
Sep 13, 2010
2
0
0
DE
hi
I need to use a script in hypermesh that includes a for loop.

could u please tell me how to use a for loop command. i can't find it in the manual
 
Replies continue below

Recommended for you

Hi,

you need TCL to do this.
TCL language manual is not included in the Hyperworks help, but can easily be reviewed e.g. at
Usually you should rather use foreach to loop over hm entities than a counter with a for statement.

So a loop over all comps is

foreach compID [hm_complist id] {
puts "Another ID: $compID"
}

You can run the script from the GUI by files->run->tcl or
by the right most button of the standard toolbar.
If you need it in batch, you can run hmbatch / hmopengl with "-tcl SCRIPTFILE" (note this inclues a space whereas -cCOMMANDFILE won't).

Regards
Thomas
 
thanks for your reply
it was helpful
but actually i need to detach all element in my model and it is not possible with using GUI commands.
So i decide to use programming like ansys.
now i can use while and for command but the problem is how to detach elements within a while loop
i wrote these commands and I ran it as u said but *createmark is not tcl command

*******************
set a 1
while {$a<100} {

*createmark(elements,1) $a
*detachelements(1,0)
incr a
}
********************
 
To convert HM Command file commands to TCL commands, replace all the parentheses and commas with spaces:

*******************
set a 1
while {$a<100} {

*createmark elements 1 $a
*detachelements 1 0
incr a
}
*******************

Regards,
Ben
 
Status
Not open for further replies.
Back
Top