Normally yes but you add a dimension style whenever you do this in your code:
doc.DimStyles.Add(dimStyle, true);
Check if your leader has the correct dimension style after you added it to the document. I made a quick test and found that in my case, using a code similar to yours, it used the Default dim style and not the one which was added.
To circumvent that, i’ve got the index returned from DimStyles.Add and then got the ds which i’ve used to create the leader. Funny about this is, if you call dim_style.IsValid before adding it to the DimStyles table, it returns False. But if you call ds.IsValid after adding it to the table, it returns True
It looks like this in python:
import Rhino
import scriptcontext
import System
def DoSomething():
dim_style = Rhino.DocObjects.DimensionStyle()
dim_style.LeaderArrowType = Rhino.DocObjects.DimensionStyle.ArrowType.Dot
# get index and dim style by index
index = scriptcontext.doc.DimStyles.Add(dim_style, True)
ds = scriptcontext.doc.DimStyles[index]
plane = Rhino.Geometry.Plane.WorldXY
pts = System.Array.CreateInstance(Rhino.Geometry.Point3d, 3)
pts[0] = Rhino.Geometry.Point3d(0,0,0)
pts[1] = Rhino.Geometry.Point3d(10,10,0)
pts[2] = Rhino.Geometry.Point3d(20,10,0)
leader = Rhino.Geometry.Leader.Create("Hello", plane, ds, pts)
scriptcontext.doc.Objects.AddLeader(leader)
scriptcontext.doc.Views.Redraw()
DoSomething()
Seems to work but my first example does not require to create a new dim style. Above creates one on every run. Are you sure you want this ?
_
c.