Hi all,
I need a little help about reading 3dm files and unit system. I will try to explain with more details.
I open Rhino project with unit system in millimeters, then export one object in the 3dm file. I guess that in the 3dm model also there are information about unit system beside geometry. Then I open project in Rhino with unit system in inches and try to read 3dm file via code, made some transformations and drawn the object in the project. When I measure the object (let’s say from one end point to another) it gives me the same value in inches and millimeters (same number, for example distance is 1000 mm and 1000 inches when I open the 3dm file in Rhino project in millimeters and inches). For test, I try Import command and Import option from Rhino to load the object and the object in imported successfully and the dimensions that I measure were OK. Is there any changes that I should made via
code to import 3dm object correctly?
I also made another test: export 3dm file only with geometry included (Save only geometry) and try to import via code and then the object dimensions was correctly.
To make correct importing of the objects in the 3dm file I also try to made some changes in the code to force unit system like this:
// read 3dm file and get the object and try to change model unit settings
const ONX_Model& model = readFile.GetONXModel();
ONX_Model& model1 = const_cast<ONX_Model&>(model);
model1.m_settings.m_ModelUnitsAndTolerances.m_unit_system = ON::UnitSystem(ON::inches);
model1.m_settings.m_PageUnitsAndTolerances.m_unit_system = ON::UnitSystem(ON::inches);
// try to use correct model scale
ON_Xform rotationTranform, translationTransform;
const double modelScale = ON::UnitScale(ON::millimeters, ON::inches);
rotationTranform.Diagonal(modelScale);
translationTransform.Diagonal(modelScale);
Can you please tell me how I should export objects in 3dm model or how to made correct conversion between unit systems via code ( I want my 3dm files to be independed from the unit system). I still work in Rhino 5
Thanks a lot,
Best regards,
Iv