PDA

View Full Version : Explode Script?


Maven
09-27-2005, 01:34 PM
I'm looking for a script that would take a piece of geometry and detach every face into seperate objects.

Does anybody know if one exsists?

Thanks.

j-man
09-27-2005, 01:54 PM
Hi Maven,

This is easy with a script, but you don't need one.

From the modify panel, go to the face SO level, select all of the faces and then explode them to objects with a face tolerence value of 0.
This will detach every face to a seperate object.

If you did want to do it with a script it would loko a little something like this.


-- www.joshuanewman.net (http://www.joshuanewman.net)
obj=selection[1]
while obj.faces.count>0 do
(
newmesh=editable_mesh() -- create an empty mesh object
newmesh.pos=obj.pos -- position the new mesh
newmesh.name=(obj.name+"_"+(i as String)) -- name the new mesh
newmesh.mesh=meshop.detachFaces obj #(1) delete:true asmesh:true
update newmesh -- update the new mesh
update obj -- update the old mesh
)


If you want this to be a function you would structure it differently.


Maven
09-27-2005, 02:02 PM
Thanks alot Jman!

But I meant to say polygons not faces. Is it the same?

j-man
09-27-2005, 02:09 PM
ah-ha! I guess you can see it isn' the same!


-- www.joshuanewman.net (http://www.joshuanewman.net/)
obj=selection[1]
while obj.faces.count>0 do
(
newmesh=editable_mesh() -- create an empty mesh object
newmesh.pos=obj.pos -- position the new mesh
newmesh.name=(obj.name+"_"+(i as String)) -- name the new mesh
fce=(meshop.getpolysusingface obj #(1) threshold:100) as array
newmesh.mesh=meshop.detachFaces obj fce delete:true asmesh:true
update newmesh -- update the new mesh
update obj -- update the old mesh
)


Cheers,


Maven
09-27-2005, 02:20 PM
thanks again.

CGTalk Moderation
09-27-2005, 02:20 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.