[Rhino Common] - [Bug] - GetLinetypeSegments fails for short lines

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");
}

Hi @david.birch.uk,

If the results of Curve.GetLinetypeSegments is just the curve itself (i.e. no segments), then nothing is returned.

– Dale

Thanks @dale

The documentation says the method returns "An array of curve and point objects if successful." So i assumed it had failed.

Perhaphs the documentation could be updated to reflect this behaviour?