| McNeel Wiki | |||||
| edit · print · help · all topics | |||||
Main Pages
Languages
| The unit system of the active document is stored on an ON_3dmUnitsAndTolerances class that is located on the CRhinoDoc object. If you inside of a CRhinoCommand-derived object's RunCommand() member, you can get the current units system as follows: const CRhinoDocProperties& doc_props = context.m_doc.Properties(); const ON_3dmUnitsAndTolerances& units = doc_props.ModelUnitsAndTolerances(); ON::unit_system units_system = units.m_unit_system; As a shortcut, you can do the following: ON::unit_system units_system = context.m_doc.UnitSystem(); If you outside of a CRhinoCommand-derived object's RunCommand() member, you can get the current units system as follows:
CRhinoDoc* doc = RhinoApp().ActiveDoc();
if( doc )
{
ON::unit_system units_system = doc->UnitSystem();
}
This has changed for Rhino 4With the addition of layouts in Rhino 4, there are now two unit systems associated with a document, model and page units. A new class has been added to OpenNURBS call ON_UnitSystem which makes it easier to work with custom units. The Rhino document class now contains two functions
C++ ON_UnitSystem units = doc->ModelUnits(); VB.NET Dim units as IOnUnitSystem = doc.ModelUnits() C# IOnUnitSystem units = doc.ModelUnits(); | ||||
| rename · changes · history · subscriptions · lost and found · references · file upload | |||||