Tool to move spline like outline command


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 
				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
			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



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]

with redraw off
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 Length:10 Width:10)
for i=(numsplines k) to 1 by -1 do (deleteSpline k i)
addAndWeld k sp -1
updateshape k


With math functions you can calculate position of verts
by InVec and OutVec you can get normal , then the azimuth , then calculate the length to move , move verts , that’s all
you may use sin , cos and atan2 to calculate