Hello there,
testing a little C# script I came across something that I found odd.
Consider the following runscript:
private void RunScript(object x, object y, ref object a, ref object b)
{
var style = (DimensionStyle)y;
var dim = LinearDimension.Create(
AnnotationType.Aligned,
style,
Plane.WorldXY,
Plane.WorldXY.XAxis,
new Point3d(-10.0,0,0),
new Point3d(10.0,0,0),
new Point3d(0.0,2,0),
0.0
);
a = dim;
var dup = dim.Duplicate();
b = dup;
}
Gives me the result below:
The small red dimension is the original, the big green is the duplicate. It appears that during duplication the style got lost and the duplicate uses some default style, completely changing its appearance. Please note, that this style is present in the Rhino file, it is not created on the fly.
I tried explicitely setting the style Id like dup.DimensionStyleId = style.Id without success. As a workaround I could basically recreate a new linear dimension from the old one instead of using Duplicate(). However, I need to duplicate a lot of different AnnotationBase types (Labels, RadialDims, etc.) .. which would make this a lot of work.
Am I missing something here? Is there another straight-forward way of duplicating annotations while retaining their style?
Cheers
Ben
