Quantcast
Channel: Rhino Developer - McNeel Forum
Viewing all articles
Browse latest Browse all 8562

Facing issues with converting the units of Rhino objects?

$
0
0

@binigya wrote:

Hello,

Currently, I am having trouble when converting an object’s unit to a fixed value (“centimeters”) and then change its scale accordingly, i.e if it is in mm, its scale should be increased to match the cm value, and so on.

I thought I had found a solution, when I wrote this piece of code :

const CRhinoDocProperties& doc_props = context.m_doc.Properties();
ON_UnitSystem cm_unit_system = ON_UnitSystem::Centimeters;
bool scaleAfterChangingUnitSystem = true;

ON_3dmUnitsAndTolerances& units = ON_3dmUnitsAndTolerances::ON_3dmUnitsAndTolerances();
units.m_unit_system = ON::LengthUnitSystem::Centimeters;

context.m_doc.Properties().SetModelUnitsAndTolerances(units, scaleAfterChangingUnitSystem);

But, I was wrong as this did not give me the desired result as I had hoped for. The document’s units were changed, I could see cm in the bottom of Rhino, but the actual object was left unaffected.

How would I do so?

(I am using C++ API and Rhino 6)

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 8562

Trending Articles