DimensionStyle and LinearDimension Trouble RhinoCommon 6


First :
I’ve some trouble with the DimensionStyle , I use this code and it look that the value are not set and always stay in default value.

Rhino.DocObjects.DimensionStyle MyDim;
indexstyle = RhinoDoc.ActiveDoc.DimStyles.Add(stylename);
if (indexstyle > -1)
MyDim = RhinoDoc.ActiveDoc.DimStyles[indexstyle];
MyDim.TextHeight = 15;
MyDim.TextGap = 5;


Second :
The property LinearDimension.Index look to be not valid

Maybe I’ve miss somthing ?
If anyone could help me


Does this Python code work for you?

import rhinoscriptsyntax as rs
from scriptcontext import doc

name = rs.AddDimStyle('aDimStyle')
ds = doc.DimStyles.FindName(name)
ds.TextHeight = 15
ds.TextGap = 5
doc.DimStyles.Modify(ds, ds.Id, True)
1 Like

Thanks, it works in c# with doc.DimStyles.Modify