If I want to change the Model space scale and Adjusted text height on the default of the Annotation Styles on Document Properties by coding, how to do?
Hello,
Here’s a Python sample:
from scriptcontext import doc
ds = doc.DimStyles.FindName('Default')
ds.DimensionScale += 1.0
ds.TextHeight += 1.0
doc.DimStyles.Modify(ds, ds.Id, True)
print 'ModelSpaceScale: ', ds.DimensionScale
print 'AdjustedTextHeight: ', ds.TextHeight * ds.DimensionScale
Hi @Alain
Thank you for your reply.
But I use C++ to coding and how to do?
Hi @angelwang,
How about this?
CRhinoCommand::result CCommandTest::RunCommand(const CRhinoCommandContext& context)
{
CRhinoDimStyleTable& dimstyle_table = context.m_doc.m_dimstyle_table;
int dimstyle_index = dimstyle_table.FindDimStyleFromName(L"Default", false, -1);
if (dimstyle_index < 0)
return CRhinoCommand::cancel;
ON_DimStyle dimstyle(context.m_doc.m_dimstyle_table[dimstyle_index]);
dimstyle.SetDimScale(2.0);
dimstyle_table.ModifyDimStyle(dimstyle, dimstyle_index);
context.m_doc.Redraw();
return CRhinoCommand::success;
}
– Dale