Script for transforming primitive cylinders to splines ?

Hello Forum,

last time I asked for a solution to select cylinders by its radius and luckily plastic helped me out with a little script that solved that problem.

Now my second question (I promise I will start learning maxscript!):

Is there a way to transform or generate splines from the cylindres based on their middle axis ? I dont want their edges to be used to generate splines, there is already a button for this…

Thanks,

Daniel

select your cylinder and go

for i in selection do
(valrad = i.radius 
Circle radius:valrad rotation:i.rotation pos:i.pos)

hope it works,
michael

btw, it works on the pivots of the cylinders.

edit: ooops, was too quick on that on, as i thought at circles right away… for the middle axis it’s something different, but you gotta draw up a spline adding vertices, a little more work - probably later :wink:

ThX sushi, I would appreciate to hear something from you again…:wink:

This creates a spline for each cylinder - assuming the cylinders are vertical.
Diego

for o in $cyl* do
	(
	NS = splineShape pos:o.pos
	addNewSpline NS
	addKnot NS 1 #smooth #curve o.pos
	addKnot NS 1 #smooth #curve (o.pos + [0,0,o.height])
	updateShape NS
	)