Is there a command to “unroll” a profile with markers on it, or do I have to split it at the points and use “Length” on each section?
You can use the Length command to measure the curve, then draw a straight line with that length. After that, use the Flow command to map the markers from the original curve onto the straight line.
I do not know where the markers are , in relation to the length of the curve.
I ended up splitting it using the markers, then did “Length” on each section, and drew a straight line from that information.
Actually “flow” worked, after some fumbling around - Thanks!
You don’t need to know where the markers are—Flow keeps their relative position along the curve when mapping to the straight line with the same length.
You can also use this updated script — it’s a newer version of the one I shared earlier in this thread:
import Rhino
import scriptcontext as sc
def UnrollCurve():
# Get the base curve
result, curve_ref = Rhino.Input.RhinoGet.GetOneObject("Select curve", False, Rhino.DocObjects.ObjectType.Curve)
if result != Rhino.Commands.Result.Success: return result
base_curve = curve_ref.Curve()
if not base_curve: return Rhino.Commands.Result.Failure
# Create a straight line with the same length as the curve
straight_line = Rhino.Geometry.Line(
Rhino.Geometry.Point3d.Origin,
Rhino.Geometry.Vector3d.XAxis,
base_curve.GetLength()
)
sc.doc.Objects.AddLine(straight_line)
# Get the objects to unroll along the curve
result, object_refs = Rhino.Input.RhinoGet.GetMultipleObjects(
"Select objects to unroll along curve",
False,
Rhino.DocObjects.ObjectType.AnyObject
)
if result == Rhino.Commands.Result.Success:
flow_morph = Rhino.Geometry.Morphs.FlowSpaceMorph(base_curve, straight_line.ToNurbsCurve(), False)
for obj_ref in object_refs:
original_geometry = obj_ref.Geometry()
if original_geometry:
morphed_geometry = original_geometry.Duplicate()
flow_morph.Morph(morphed_geometry)
sc.doc.Objects.Add(morphed_geometry)
sc.doc.Views.Redraw()
return Rhino.Commands.Result.Success
if __name__ == "__main__":
UnrollCurve()
That’s cool. I had to use roadlike=yes, the markers were being drawn as if the new line was not straight?
I got what I need for now, but will further explore the script and it’s uses.
Thanks again!