Lost Adventurer, Aleks Kirilenko (3D)
LC #42 Pipers Alley

View Full Version : detach splines to objects

07-04-2011, 11:56 AM
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...

07-04-2011, 02:35 PM
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.

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

07-04-2011, 03:32 PM
will try that. thanks!

CGTalk Moderation
07-04-2011, 03:32 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.