issue calling process within tcl
Hi All,
I am trying to break down a 3d mesh to resolve it down to a single plane of elements generated by finding faces, such that I can then find the hole centroids in this 3d mesh.
I ask the user to select a component, the Z dimension representing the offset X-Y plane that the circles are in, and then proceed to start marking / selecting / organizing elements such that I end up with planar surface elements in a new component.
All of these commands work when I play with them manually in hypermesh
however when I try to call the process in tcl:
set CompIDFaces1 [Test1 $CompIDList1 $Z $tol]
I get the error:
invalid command name 'Test1'
My code is below, I suspect this is some kind of syntax error. Would be much appreciated if anyone help out with this issue.
#Ask for user to select Bolt component
*createmarkpanel components 1 'Select Bolted Flange Components.'
#Retrieve component IDs in Array
set CompIDList1 [ hm_getmark components 1 ]
#Unselect components
*clearmark components 1
set Z 152.525
set tol 0.01
set CompIDFaces1 [Test1 $CompIDList1 $Z $tol]
Proc Test1 { CompIDList1 Z tol } {
#Select component previously provided by user
*createmark comp 1 $CompIDList1
#Find Faces
*findfaces components 1
#Hide everything but ^Faces
*isolateonlyentity comp 'by name' ^faces
#Locally select faces in flange plane
*hm_createmark elems 1 'by box' '-999 -999 [expr $Z-$tol] 999 999 [expr $Z+$tol] 0 inside 1 0 0'
#Hide all other elements
*isolateonlyentitybymark 1
*createentity comps cardimage=Part name=Hole_Surface
*createmark elements 1 'displayed'
*movemark elements 1 'Hole_Surface'
*createmark components 1 '^faces'
*deletemark components 1
return 'Hole_Surface'
}
Thanks,
Tyler
Answers
-
Hi,
please try changing 'Proc' to 'proc'
if you use 'Proc', then Test1 seems to be defined in ::hwt namespace
moreover, change ' *createmark comps 1 $CompIdList1 ' to ' eval *createmark comps 1 $CompIdList1 '
and *hm_createmark to hm_createmark
0 -
Thank you for the information.
It turned out that I needed to define the proc prior to issueing it. So I just moved the proc to the top of the tcl file and it worked out!
0