Help: Creating Springs in HM-Optistruct
Hi I am new to command file script/tcl script. I need to create springs from the given points:
*createnode(0,0,0,0,0,0)
*createnode(0,10,0,0,0,0)
*createnode(10,10,0,0,0,0)
*createnode(10,0,0,0,0,0)
*createmark(nodes,1) 1-4
*duplicatemark(nodes,1,28)
*translatemark(nodes,1,1,10)
*elementtype(21,6)
*spring(1,5,3,'CBUSH',0)
*spring(4,8,3,'CBUSH',0)
*spring(3,7,3,'CBUSH',0)
*spring(2,6,3,'CBUSH',0)
The above codes will work only on new HM session. But when the script is run on a model it will not behave as intended. Can someone correct the codes for me please...
Thanks,
Bobet
Answers
-
It seems no one knows how... /emoticons/default_ohmy.png' alt=':o' srcset='/emoticons/ohmy@2x.png 2x' width='20' height='20'>
0 -
I can only suggest you learn customization, especially tutorials like - HyperWorks Desktop Applications > HyperMesh > HyperMesh Tutorials > Customization > Scripts:
HM-8020: Create a Utility Menu Macro From a Command File
can help you very much,
Also this is too simple to need a script, it should be easy to do this manually without automating it with TCL.
0 -
Thanks for the advice. Actually I started to read the cmf & tcl tutorials...
The script above is shown as an example only. It has four points only but I need about a set by the thousand points. A script is the only logical option.
The trouble with the spring command is that it uses the ID of the point created. When the script is used in a model we can not guarantee the point id is the spring command uses is the correct id of the point intended.
What I need in the script is to save the recently created point ID that I can pass on later to the spring command.
Thank anyway.
0 -
Moving to customization forum - perhaps customization experts can help you from there
0 -
Hi
to retrieve ID of nodes you've just created:
(hm12)
set NodeID [hm_latestentityid nodes]if you create 4 nodes:
foreach i {1 2 3 4} {set NodeId_$i [hm_latestentityid nodes [expr {4-$i}]]}if you duplicate some nodes, perhaps new node IDs will increase in same order with original nodes ( i am not sure, but please test several before applying):
*createmark nodes 1 -1 -2 -3 -4 ; # -1 means node 4 and -4 means node 1
*duplicatemark nodes 1; # so node 5 will be at position of node 1, node 8 will be at postion of node 4 (please check these because I am not sure)
foreach i {5 6 7 8} {set NodeId_$i [hm_latestentityid nodes [expr {8-$i}]]}0