PDA

View Full Version : "Detach every poly to element" using Edit Poly Modifier


cganimator
02-24-2006, 09:21 PM
Hi

I,m trying to make "Detach every poly to element" using Edit Poly Modifier


-----------------------------------------
macroscript DetachAllPolygonAsElements category:"My"

(

on isEnabled return

(

selection.count == 1 and classof (modPanel.getCurrentObject()) == Edit_Poly) and subObjectLevel == 4

)

on execute do

(

theObject = modPanel.getCurrentObject()

thePolys = (theObject.GetSelection #Face node:selection[1]) as array

PolyNumber = thePolys.count

for p = 1 to PolyNumber do

theObject.detachFaces obj #{p}



)

)
-----------------------------------------

This is my script, but it keep causing "Runtime error: No such handler: #execute". I can not figure out what is wrong.

Please sombody help me.

d3coy
02-25-2006, 12:17 AM
Looks like you're missing an opening parenthesis

classof (modPanel.getCurrectObject()) == Edit_Poly)
should be:
classof ((modPanel.getCurrectObject()) == Edit_Poly)

arketip
02-25-2006, 06:48 PM
Hi,
This script should make what you want:

macroscript DetachAllPolygonAsElements category:"My"
(
on isEnabled return ( selection.count == 1 and classof (modPanel.getCurrentObject()) == Edit_Poly and subObjectLevel == 4 )

on execute do (
local theObject = modPanel.getCurrentObject()
local thePolys = ( theObject.GetSelection #Face node:selection[1] ) as array
for i=1 to thePolys.count do (
local thePolyToDetach = #{thePolys[thePolys.count]}
theObject.SetSelection #Face thePolyToDetach node:selection[1]
theObject.ButtonOp #DetachFace
deleteItem thePolys thePolys.count
)
)
)

And if you want just to detach all selected polygons in one object, it is:

on execute do (
local theObject = modPanel.getCurrentObject()
theObject.ButtonOp #DetachFace
)

I hope this helps

CGTalk Moderation
02-25-2006, 06:48 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.