Hello,
I am trying to programmatically create some linear dimensions and I 've got stuck trying to set the size of the font and the arrow heads. Through Rhino’s user interface I do that from
Properties->Property overrides->Text Height and
Properties->Property overrides->Dimension Arrows.
Unfortunately I cannot find a method in the Sdk that allows me to do something equivalent (I am using the Rhino.NET SDK).
The last thing I tried was setting the height via OnLinearDimension::SetHeight method. Here is my code (tries to create a linear dimension along the x-axis given a bounding box) :
using namespace RMA::OpenNURBS;
using namespace RMA::Rhino;
void CalculateXDimension ( IOnBoundingBox^ bbox )
{
On3dPoint^ pt000 = gcnew On3dPoint ( bbox->m_min );
On3dPoint^ pt100 = gcnew On3dPoint ( bbox->m_max->x, bbox->m_min->y, bbox->m_min->z );
OnPlane^ plane = gcnew OnPlane ( pt000, gcnew On3dVector ( 0, 0, 1) );
MRhinoLinearDimension^ dim = gcnew MRhinoLinearDimension ();
dim->SetPlane ( plane );
dim->SetPoint ( 0, gcnew On2dPoint(0,0) );
System::Double u,v;
plane->ClosestPointTo ( pt100, u, v );
dim->SetPoint ( 2, gcnew On2dPoint(u,v) );
// here I am trying to set the height but it doesn't seem to work.
double textHeight = dim->m_linear_dimension->m_textheight;
dim->m_linear_dimension->SetHeight ( textHeight*5 );
dim->UpdateText();
RhUtil::RhinoApp()->ActiveDoc()->AddObject ( dim );
return;
}
I 've tried a few other ways, including creating a dimension style and adding it to the document’s MRhinoDimStyleTable, then assigning by index to the my MRhinoLinearDimensionObject but didn’t work either.
Could you direct me what is the recommended way to achieve what I want? Any help will be greatly appreciated.
Thanks
Odysseas