×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

ccommand in hypermesh

ccommand in hypermesh

ccommand in hypermesh

(OP)
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  

RE: ccommand in hypermesh

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 http://www.tcl.tk/man/tcl8.4/TclCmd/contents.htm

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

RE: ccommand in hypermesh

(OP)
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
}
********************

RE: ccommand in hypermesh

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
 

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources