View Full Version : MULTIPLE SPLINE DETACH anyone??

02 February 2009, 01:21 PM
Hi friends,
I have been working on some heavy spline based work and am frequently having to detach splines one by one frm a editable spline containing more than over 100 unwelded splines. Is there anyway in max that I can get all the splines to separate in one click?

The explode button just explodes it to separate segments than as separate splines!

Is there any script for the same?
Please help.
any help is highly appreciated.

Alex Morris
02 February 2009, 02:12 PM
try this:

--script to explode splines from a shape leaving the original intact
baseSpline = $
indx = baseSpline.numSplines
i_array = #()
for i = 1 to indx do
newspline = copy baseSpline name:(uniqueName "exploded spline")
for a = indx to 1 by -1 where a != i do
deleteSpline newspline a
CenterPivot newspline
updateShape newspline

02 February 2009, 03:33 PM
Here is another take.

It's a little different to Alex's, I always like to see how other people do things. His copies the shape and deletes all the splines except one, repeating for every spline.
My take re-builds each splines knot by knot.

fn explodesplines x=
for j=1 to numsplines x do
s=splineshape pos:x.pos name:("-SHAPE"+(j as string))
a=addnewspline s
for i=1 to numknots x j do
try seg=(getsegmenttype x j i)
catch seg=#line
addknot s a (getknottype x j i) (seg) (getknotpoint x j i) (getinvec x j i) (getoutvec x j i)
if (isclosed x j) then close s 1
updateshape s

for s in selection do if classof s==SplineShape then explodesplines s


02 February 2009, 03:50 AM
Thank you so much Alex and Josh.
But I dint get them to work. I hope its an issue with how I use it...
Let me admit my ignorance abt using maxscripts here...always been a tool using artist.
Could u guide me how to use the script in a scene with a combined spline object selected.

What I did was..
Open Maxscript>New Script> and pasted the code..
Saved it as a .ms file.
Maxscript>Run Script> the ms file.

For Alex's code one it showd 1 error
(--unknown property: "numSplines"in $Line:Line01@ [0.000000,0.000000,0.000000]
and dint perform anything..
For Josh's code there was no error message...but dint perform anything either.
Please guide me!

3rd Dimentia
02 February 2009, 05:26 AM
Here's one I wrote:

Hopefully it'll do the trick. However I'm thikning that if the other 2 didn't work, then there's more of a chance that this one won't work either.

Good luck though.

02 February 2009, 08:16 AM
my job to fix typos today ..;)

at Alex's code:
indx = numSplines baseSpline

and at Josh's code include 'line' class also:
for s in selection do if classof s == splineshape or classof s == line do explodesplines s

Alex Morris
03 March 2009, 10:01 AM
thanks Decon,

Have to admit that I don't think that I wrote this - just had it lying around in my misc code folder. Probably downloaded it from here at some point. So thanks to whoever is responsible.

03 March 2009, 11:44 AM
indeed Decons correction is right, I dropped that last line on when I posted the script. I usually call the script on the fly, but thought I needed to add a safety device so it didn't go off accidentally when used in the public domain! should have done it properly though <:

BTW you usage is correct. New script, paste the code, then hit CTRL+E. Make sure you have a selection of splines first

Good luck,


03 March 2009, 12:56 PM
Thank u so much guys...i think it finally saves my day!:arteest:
wat wud i do without u all :thumbsup:

CGTalk Moderation
03 March 2009, 12:56 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.