( local sel = selection as array if sel.count > 0 then ( for obj in sel where (canConvertTo obj SplineShape) do ( -- 1. Convert to Spline if necessary if classOf obj != SplineShape and classOf obj != Line do (convertToSplineShape obj) -- 2. Get position and tangent at start (0.0) local p1 = interpCurve3D obj 1 0.0 local vX = normalize (tangentCurve3D obj 1 0.0) -- 3. Build orientation vectors local vUp = [0,0,1] if (abs (dot vX vUp)) > 0.99 do vUp = [0,1,0] local vY = normalize (cross vUp vX) local vZ = normalize (cross vX vY) -- 4. Store current visual state local oldObjTM = obj.objecttransform local targetRotTM = matrix3 vX vY vZ p1 -- 5. Apply transformation to the pivot obj.transform = targetRotTM -- 6. Offset the geometry back to original world position local invRot = inverse targetRotTM.rotation obj.objectoffsetpos = (oldObjTM.translation - p1) * invRot obj.objectoffsetrot = oldObjTM.rotation * invRot ) format "Done: Processed % objects.\n" sel.count ) else (messageBox "Select at least one Spline object."))
Вот так получилось с поворотом , вроде тоже работает