Developer: RhinoScript
Summary: Demonstrates how to mark points on a line using RhinoScript.
I frequently use lines for relative measuring and splitting. But, I always end up deleting the original line. So, what I would like is a tool where I could “draw” a line but just add the line's starting, mid, and ending points, not the line, to Rhino. Can this be scripted?
The following sample script should be useful to you.
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' MarkLine.rvb -- March 2010 ' If this code works, it was written by Dale Fugier. ' If not, I don't know who wrote it. ' Works with Rhino 4.0. ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Sub MarkLine() Dim arrLast Call Rhino.Command("_Line _Pause _Pause") If (Rhino.LastCommandResult() = 0) Then Call Rhino.EnableRedraw(False) arrLast = Rhino.LastCreatedObjects() If IsArray(arrLast) Then Call Rhino.AddPoint(Rhino.CurveStartPoint(arrLast(0))) Call Rhino.AddPoint(Rhino.CurveMidPoint(arrLast(0))) Call Rhino.AddPoint(Rhino.CurveEndPoint(arrLast(0))) Call Rhino.DeleteObjects(arrLast) End If Call Rhino.EnableRedraw(True) End If End Sub ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Call Rhino.AddStartupScript(Rhino.LastLoadedScriptFile) Call Rhino.AddAlias("MarkLine", "_NoEcho _-RunScript (MarkLine)")