Notifications
Clear all

[Closed] Scale segments of splineshape

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

9 Replies

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
	
)

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

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

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
)

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

Have you noticed this new problem?

1 Reply
(@serejah)
Joined: 10 months ago

Posts: 0

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

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!

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.

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