Hello everyone.
I need your help to '' improve '' a macro.
The macro base is as follows and it works like this:
I manually selected a compcurve and the macro creates a circle in the center of it X Y, and Z minimum.
This macro works by selecting one compcurve.
********************************************
STRING name = selection.name[0]
REAL X = compcurve[$name].cog.x
REAL Y = compcurve[$name].cog.y
REAL Z = selection.min_range.z
create arc FULL
r 3.5
$X $Y $Z
********************************************
Now I would like to select more than one compcurve and apply the macro to each one of them
How can I do that?
Thank you
Giacomo
Solved! Go to Solution.
Solved by rafael.sansao. Go to Solution.
Try this:
LET $i = 1 LET $num = selection.number LIST $select_names = SELECTION.NAMES LET carry_on = ($i <= $num) WHILE $carry_on { SELECT CLEARLIST STRING $name = $select_names[$i] add CompCurve $name REAL $X = compcurve[$name].cog.x REAL $Y = compcurve[$name].cog.y REAL $Z = selection.min_range.z create arc FULL r 3.5 $X $Y $Z LET $i = $i + 1 LET carry_on = ($i <= $num) }
Rafael Sansão
Thank you
Is perfect working properly.
A curiosity.
I have tried this way but it doesn't work
***************************************
LET numturn = selection.number
WHILE $numturn {
LET numturn = $numturn - 1
STRING name = selection.name[$numturn]
REAL X = compcurve[$name].cog.x
REAL Y = compcurve[$name].cog.y
REAL Z = selection.min_range.z
create arc FULL
r 3.5
$X $Y $Z
}
***************************************
What's wrong in my macro?
Thank you
When you create the first circle, the selection of composite curves is lost. This generates the error in your macro.
Try "RESTORE_SELECTION"
LET numturn = selection.number WHILE $numturn { LET numturn = $numturn - 1 STRING name = selection.name[$numturn] REAL X = compcurve[$name].cog.x REAL Y = compcurve[$name].cog.y REAL Z = selection.min_range.z create arc FULL r 3.5 $X $Y $Z RESTORE_SELECTION RESTORE_SELECTION }
Rafael Sansão