Notifications
Clear all

[Closed] MULTIPLE SPLINE DETACH anyone??

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.

8 Replies

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
 )
)

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:(x.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

Josh.

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!

Here’s one I wrote:
http://home.iprimus.com.au/wickergray/CgRay-SeperateSplines.mcr

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.

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

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.

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,

Josh.

Thank u so much guys…i think it finally saves my day!:arteest:
wat wud i do without u all