Change unit of a surface


#1

Hi,
i store my surface control points internally in microns. Is there a way to scale/convert it to millimeters? I knot i just can scale all the control points with 0.001, but is there a nicer way?

When i export the surface i use an ONX_Model

ONX_Model model;
model.m_settings.m_ModelUnitsAndTolerances.m_unit_system = ON::millimeters;
...

There i can set the unit system, but it actually has no effect on the surface!

Thanks!


(Menno Deij - van Rijswijk) #2

No, the unit system is meta information, and has nothing to do with the numerical representation of geometry.


(Dale Fugier) #3

Hi @Andreas2,

If you change the unit system of the model and you want you geometry to scale with the change, then this is something you will need to do on your own - the openNURBS toolkit will not do this for you.

const double scale = ON::UnitScale(ON::microns, ON::millimeters);
ON_Xform xform;
xform.Diagonal(scale);

// TODO: transform objects...
surface->Transform(xform);

– Dale