CurveObject.GetLinetypeSegments Method (mcneel.github.io)
This method fails if the curve has a length less than the sum of the LineType Segment lengths.
E.g. a 5,5 segment pattern will return no segments if the line is 9 units long.
Example 3dm attached and test script
GetLineSegments.3dm (51.4 KB)
using System;
using Rhino;
using Rhino.Geometry;
using Rhino.DocObjects;// Select objects to orient
Rhino.Input.Custom.GetObject go = new Rhino.Input.Custom.GetObject();
go.SetCommandPrompt(“Select line to test”);
go.SubObjectSelect = false;
go.GroupSelect = true;
go.GetMultiple(1,1);
if (go.CommandResult() != Rhino.Commands.Result.Success) return;var o = go.Object(0); if (o.Object() is CurveObject c) { var segments = c.GetLinetypeSegments(); Console.WriteLine("Found "+segments.Length+" Segments - we expect at least 1 segment"); }