Hi,
I am currently working on creating a macro just to learn the process. I want this macro to check the components and see if a component labeled '^2D' exists. If it does not, I want the macro to create this component. The macro will then move all 2D quad and tria elements to this collector. The reason for this is I like to save my 2D mesh in a collector that I can turn export off before output to a .inp.
I have used this code to verify that I am able to create the collector and move the elements:
*beginmacro('Move2D')
*createentity(comps,name=^2D)
*createmark(element,1) 'by config' tria3, tria6, quad4, quad8
*movemark(elements,1,'^2D')
*endmacro()
However I am having trouble when attempting to do a loop check. I am 99% sure that my formatting for Tcl is completely wrong (I just began learning the code yesterday). When attempting to load the userpage.mac hyperworks freezes with the code how it is.
*beginmacro('Move2D')
set exists 'False'
set entitylist (hm_entitylist comps name)
foreach title $entitylist {
if {$title == '^2D'} {
set exists 'True'
return
}
if {$exists == 'True'} {
*createentity(comps,name=^2D)
}
*createmark(element,1) 'by config' tria3, tria6, quad4, quad8
*movemark(elements,1,'^2D')
}
*endmacro()
Thank you in advance for any help,
-Clay