Message 1 of 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
With very limited scripting experience I have cobbled together the following Maxscript to modify the pivot of a selected spline such that the Z axis aligns with the first to second vertex of the spline. The program works for a selected spline. I have been trying to add a for loop to cycle through all selected splines with no success.
How can looping be added to the following code to cycle through and modify all selected splines? I have tried several for-loop formats with no success.
spl = selection[1] s = 1 e1 = getKnotPoint spl s 1 e2 = getKnotPoint spl s 2 mid12 = (e1+e2)/2 v = e2-e1 vlen = length(v) vu = v/vlen m = spl.transform ftm = translate (matrixfromnormal vu) mid12 itm = ftm*(inverse m) spl.transform = ftm spl.objectOffsetPos *= inverse itm spl.objectOffsetRot *= inverse itm.rotation spl.transform
lee.minardi
Solved! Go to Solution.
