Notifications
Clear all

[Closed] detach splines to objects

Hello.
I was wondering if there is a way to bypass the ‘name window’ that results from the detach() Spline Operation. I have a shape containing several splines and I want to detach each of the splines to a new object. I am able to do it without using the detach() with the following:

myShape = $
  for s = 1 to (numSplines myShape) do
  (
  	indAr = for i = 1 to (numSplines myShape) collect i
  	newShape = copy myShape
  	newShape.name = myShape.name + "_dt_" + s as string
  	delAr = deleteItem indAr s
  	select newShape
  	subobjectLevel = 3
  	setSplineSelection newShape delAr
  	modPanel.addModToSelection (deleteSplineModifier())
  	collapseStack newShape
  	subobjectLevel = 0
  )

but it is slow and it looks a little strange…
thanks!

2 Replies

Instead of using the DeleteSplineModifier use the deleteSpline spline method. It works faster than built-in splineops.detach method because it doesn’t require #modify mode.[b]


 fn detachSplines sp name: = if iskindof sp SplineShape do
 (
 	if (num = numsplines sp) > 1 do
 	(
 		splines = for i=1 to num collect
 		(
 			s = copy sp name:(if name != unsupplied then (name + (formattedprint i format:"02d")) else name)
 			maxOps.colorById s.inode.handle &s.wirecolor
 				
 			for k=1 to (i-1) do deletespline s 1
 			for k=i to (num-1) do deletespline s 2
 			updateshape s 
 			s
 		)
 	)
 )
 

[/b]

will try that. thanks!