Hi,
was doing a custom string pattern for a dashed linetype and I’ve noticed the method only works if both numbers are positive like below.
string pattern = "5,5";
var linetype = Rhino.DocObjects.Linetype.CreateFromPatternString(pattern, true);
The documentation suggests otherwise:
Values greater than zero represent line segments, and values less than or equal to zero represent space segments.
… which is not true, since string pattern = "5,-5"; silently fails and just returns continuous line…
Cheers
mc_rash
(mc_rash)
May 9, 2026, 9:23pm
2
Out of curiosity, what is the output of PatternString? Should also be something like “+, -” according to the documentation.
Tom_P
May 9, 2026, 10:06pm
3
maybe AppendSegement(double length, bool isSolid) is the better choice to create the pattern ?
and you may also want to check the output of PatternString
what s your system 's language / location / culture/ globalization setting … just a guess - maybe the implementation is (buggy and ..) interpreting “5,5” as “5.5” ?
It is also two positive numbers, “5.00, 5.00” (cc @Tom_P )
The system language doesn’t interpret the pattern wrong… I haven’t worked with append segment yet, so can’t tell.
Tom_P
May 11, 2026, 11:07am
5
looks like a wrong documentation - yes.
// #! csharp
using System;
using Rhino;
using Rhino.DocObjects;
Linetype myLineType = new Linetype();
myLineType.Name = "test";
myLineType.AppendSegment(1,true);
myLineType.AppendSegment(2,false);
myLineType.AppendSegment(3,true);
myLineType.AppendSegment(4,false);
myLineType.AppendSegment(5,true);
myLineType.AppendSegment(6,false);
RhinoApp.WriteLine(myLineType.PatternString(true));
will also output no negative values.
1.00, 2.00, 3.00, 4.00, 5.00, 6.00
dale
(Dale Fugier)
May 11, 2026, 4:03pm
6
Hi @Sven_Duplić ,
Looks like a bug to me - I’ll see to tuning up this function.
For now, you can just pass a comma-delimited string of numbers >= 0. The first number, in the parsed array, will be a line segment, the second a space, the third a line segment, etc. alternating to the end of the array.
#! python 3
import Rhino
import scriptcontext as sc
def TestLinetype():
# line, space, line, space, line, space
pattern = "1.25, 0.25, 0, 0.25, 0, 0.25"
lt = Rhino.DocObjects.Linetype()
lt = Rhino.DocObjects.Linetype.CreateFromPatternString(pattern, True)
lt.Name = "Property Line"
print(lt.PatternString(True))
sc.doc.Linetypes.Add(lt)
if __name__ == "__main__":
TestLinetype()
– Dale
brian
(Brian Gillespie)
May 12, 2026, 11:08pm
7