Scale segments of splineshape


#1

I can scale a splineshape,but I can’t scale the segments of splineshape.Is there anyone who can help?
I mean,How can I use maxscript to achieve it


#2

delete objects
gc()



-- #1
r = Rectangle isSelected:true
with redraw off
(
	convertToSplineShape r
	max modify mode
	setSegSelection r 1 #(1,2)
	subObjectLevel = 2
	modPanel.addModToSelection (XForm() )
	r.modifiers[1].gizmo.scale *= 1.5
	collapseStack r
)

-- #2
r = Rectangle position:[0,-20,0]
with redraw off
(
	convertToSplineShape r
	
	in coordsys r
	(
		tm = TransMatrix r.center
		tm.scale *= 1.5
		
		for i=1 to 3 do
		(
			setKnotPoint r 1 i ((getKnotPoint r 1 i) * tm)
			
			in_vec = getInVec r 1 i
			setInVec r 1 i (in_vec * tm)
			
			out_vec = getOutVec r 1 i
			setOutVec r 1 i (out_vec * tm)
		)
	
	)
	
	updateShape r
	
)

#3

thank you ! Serejah
I think the first way is more convenient, XForm() is Magical thing


#4

If I do it the first way,the new problem is that if there are multiple splines in the line, the scaling center is not in itself


#5
spl = getCurrentSelection()
for i=1 to 2 do 
(
     select spl
	setSegSelection spl i  #(2,3) 
	subobjectLevel = 2
	modPanel.addModToSelection (XForm()) ui:on
	modPanel.setCurrentObject spl.modifiers[#XForm]
	spl.modifiers[1].gizmo.scale *=0.5
    collapseStack spl
)

:sweat_smile:
This doesn’t seem to get you the right answer, because the second loop picks the last segments,I don’t know why!The result is incorrect because the axis is not in itself,and select more segments


#6

Have you noticed this new problem?


#7

Why don’t you just use the second method for move/scale/rotate instead?


#8

The second method works, but I have to get points of segments first, which is kind of a tedious step.Is XForm a problematic modifier,I want to know how to use XForm correctly!


#9

In case of operation on more than one segment/spline I wouldn’t recommend to use XForm at all. Modify panel updates will slow down things drastically. Second method will perform much much faster in case of transformation of many splines.


#10

thank you ,Serejah.You’re absolutely right, the Modify panel flashes frequently