Unable to add new dimension style to document (File3dm). I create a new instance of the Rhino.DocObjects.DimensionStyle() class and set some properties there. However, when I later save the Document, there is no new style in it. Of all my attempts to add a new style, only one has worked: when I copy an existing style via dimStyle.Duplicate() and change its name. But I need to create a new style without copying the existing ones.
using (var file = File3dm.Read("D:\\Template.3dm"))
{
var dimStyle = new Rhino.DocObjects.DimensionStyle()
{
Name = "NewStyle",
Id = Guid.NewGuid(),
DimensionScale = 25,
LengthResolution = 0,
ArrowLength = 2.5,
TextGap = 1,
TextHeight = 2.5,
FixedExtensionOn = true,
FixedExtensionLength = 5
};
file.AllDimStyles.Add(dimStyle);
file.Write("D:\\NewFile.3dm", 7);
}