View Full Version : Automatically disconnecting faces

04 April 2007, 10:17 PM
Okay here is what Iím trying to do:

My goal is to make an exploding disco ball. I can use the Shatter plugin on a sphere, but it makes the sections too long. I need to somehow make 100 little cubes out of a sphere without manually modeling each one. If I cant do that, is there a plugin that will automatically disconnect every face of a model into a new object?

04 April 2007, 12:59 AM
This script will extract copies of all the polygons in the selected object and move their centers to the center of the polygon's vertices. It's slow and poorly written with no error checking, but still faster than doing it by hand.

I haven't tried this on anything over 600 polygons, so your system may lock up on anything larger than that.

Be sure to save your work before running this!

Logging False

set oObj = Selection(0)

set oPoly = oObj.activeprimitive.geometry.polygons

polycnt= oPoly.count

for i = 1 to polycnt

mynum = polycnt -i

logmessage mynum

SelectGeometryComponents oObj &".poly["&mynum&"]"

ExtractFromComponents "ExtractPolygonsOp" , , oObj&"poly_1", ,SiImmediateOperation, siKeepGenOpInputs

MoveCtr2Vertices selection(0)


Logging True

Function Logging(value)

SetValue "preferences.scripting.cmdlog", value

SetValue "preferences.scripting.msglogrealtime", value

SetValue "preferences.scripting.msglogverbose", value

SetValue "preferences.scripting.msglog", value

SetValue "preferences.scripting.cmdlogfile", value

End Function

04 April 2007, 03:52 PM
somehow i cant get it to work.. does this script work with xsi 6?

04 April 2007, 06:37 PM
Post the error that is being shown in the script editor. The script is VBScript, you'll want to right click in the script editor and make sure it is set to that and not JScript (JavaScript), or the syntax will be wrong.

04 April 2007, 09:18 PM
somehow i cant get it to work.. does this script work with xsi 6?

Works fine for me in 6.01.

What you need to do is:
1) make sure the script editor is set to vbscript. (in the script editor select File/preferences/scripting tab/script language)
2) Copy and paste the script into the script editor
3) select the object
4) run the script
5) wait for a bit (took about 30 seconds on a 1000 poly mesh)

I have logging disabled while it runs to speed things up, because it's extremely slow with logging enabled turned on. It also leaves the original object alone and only makes copies of the original object's polygons, so you will need to hide or delete it.

If this still doesn't work, change the first line from Logging False to Logging True and let me know what error messages you are getting.

CGTalk Moderation
04 April 2007, 09:18 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.