attaching multiple splines

Hi,

I can't seem to find clearly how this should work. I like to select a bunch of splines and then executing a script to attach all of them into a single spline, from there to move that spline to z=0.

I've been searching and reading at the help menu at "attach()" but i still find it hard to bring it together yet.

Some help is appreciated :)

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
miauu's picture

.

(
	function AttachSplines sp splines: =
    (    	
    	convertToSplineShape sp
    	for s in splines where s != sp do addandweld sp (converttosplineshape s) -1
    	sp
    )
 
	if selection.count != 0 do
	(
		splObjsArr = for o in selection where canConvertTo o SplineShape collect o
		newSpl = AttachSplines splObjsArr[1] splines:splObjsArr	
		newSpl.pos.z = 0
	)
 
)

The code will move the spline to z=0 not all of its knots.

remykonings's picture

*

Thank you, that works great.

johnim's picture

UtilitiesEx.attachAll

try this:
UtilitiesEx.attachAll (selection as array)
for k in selection do (k.pos = [k.pos.x,k.pos.y,0] ; k.pivot = ((k.max + k.min)/2))

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.