Tool to move spline like outline command


#1

hello,
I am trying to create a tool to move a spline like outline command so when i drag the spline with mouse all vertices move like that.

here’s my script

		tool OutlineOffset
		(
		local fs, copSpl, closedFlag, knot_n
		on mousePoint click do coordsys grid
		(
			if click == 1 then 
			(
				spl=$		
				copSpl=copy spl
				convertToSplineShape copSpl
				closedFlag=(isClosed copSpl 1)
				knot_n=numKnots copSpl 1
				print copSpl
			)
			if click == 3 then
				(
					applyOffset copSpl (length gridDist)
					/*
						Code to delete unwanted and recreate spline
					*/
					#stop 
				)
		)
			on mouseMove click do
			(
		-- 		applyOffset copSpl (length gridDist)   --doesn't work here                         
				
			)
		)

applyOffset does not show result interactively
splineOps.startOutline does get activated in mouse click events

this must be done before if anyone know.

this is what i want with mouse drag
Untitled%20Project

Thanks


#3

hi
for now im using itoo free plugin for this in my script with measureOffset function as input value

but this function doesn’t give correct value if spline objectoffsetpos value is not [0,0,0]

sp=$spine
with redraw off
(
t=sp.objectoffsetpos
sp.objectoffsetpos=[0,0,0]
in coordsys local move sp t
)
this moves pivot position which i dont want

resetxform is slow

here i am attaching with rectangle is there any better way
with redraw off
(
k=convertToSplineShape(rectangle pos:sp.center Length:10 Width:10)
for i=(numsplines k) to 1 by -1 do (deleteSpline k i)
addAndWeld k sp -1
updateshape k
)