Robert
1
How to set the test from a LinearDimension Horizontal to view
by hand it work with the Dim Style Overrides
Text Aligment and Horizintal to view,
but how I can du it automatily by c#
I can change the text but how I can changed the aligment
LinearDimension dim = new LinearDimension(dim_plane, p_1, p_2, p_3);
dim.Text = text;
Guid id;
id = doc.Objects.AddLinearDimension(dim);
Thanks Robert
dale
(Dale Fugier)
2
As far as I can tell, this isn’t something you can do from RhinoCommon yet.
If you are curious how to do this in C++, see the following example:
https://github.com/mcneel/Rhino5Samples_CPP/blob/master/SampleCommands/cmdSampleDimLinearOverride.cpp
I’ve added a wish list item to implement this in RhinoCommon.
http://mcneel.myjetbrains.com/youtrack/issue/RH-28704
Robert
3
Hi Dale,
this C++ help me very much.
so I creat new DimStyle…
public static void creat_dim_style_horizontal_text(RhinoDoc doc)
{
//add all dim style
double scale;
scale = sheet_info._factor;
string dimstyle_name;
dimstyle_name = "RH_" + scale.ToString() + "_horizontal";
Rhino.DocObjects.DimensionStyle dimstyle = doc.DimStyles.Find(dimstyle_name, true);
if (null != dimstyle)
{
//Rhino.RhinoApp.WriteLine(string.Format("Dimstyle \"{0}\" found.", dimstyle_name));
doc.DimStyles.SetCurrentDimensionStyleIndex(dimstyle.Index, false);
}
else
{
int dimstyle_index = doc.DimStyles.Add(dimstyle_name);
if (dimstyle_index >= 0)
{
dimstyle = doc.DimStyles[dimstyle_index];
if (null != dimstyle)
{
dimstyle.ArrowLength = 18 * scale;
dimstyle.TextHeight = 18 * scale;
dimstyle.TextGap = 6.8 * scale;
dimstyle.ExtensionLineOffset = 0;
dimstyle.ExtensionLineExtension = scale;
dimstyle.LengthFormat = 0;
dimstyle.LengthResolution = 0;
dimstyle.TextAlignment = Rhino.DocObjects.TextDisplayAlignment.Horizontal;
dimstyle.CommitChanges();
//Rhino.RhinoApp.WriteLine(string.Format("Dimstyle \"{0}\" added.", dimstyle_name));
doc.DimStyles.SetCurrentDimensionStyleIndex(dimstyle.Index, false);
}
}
else
{
Rhino.RhinoApp.WriteLine(string.Format("Dimstyle \"{0}\" not added.", dimstyle_name));
doc.DimStyles.SetCurrentDimensionStyleIndex(-1, false);
}
}
// end dimstyle
and it woked
Thanks Robert
dale
(Dale Fugier)
4
Just to clarify Robert’s solution, instead of overriding an existing dimension style, he just created a new one.
Robert
5
Hi Dale,
for me it was the easy way, but without you I think I can´t find this line.
dimstyle.TextAlignment = Rhino.DocObjects.TextDisplayAlignment.Horizontal;
Thanks Robert