Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

DONE:

See the following article about units usage in HOOPS: How-To: Use unit in a PRC model

What is HOOPS default unit ?

By default, all units in HOOPS Exchange and PRC files are stored as multiples of mm.
For example, a meter will correspond to a value of 1000 while an inch is represented by 25.4

How can I determine a model’s global unit ?

It’s possible to have multiple different units used inside of a same model, so that’s why the ModelFile and each ProductOccurrence can have its own unit (see both A3DAsmModelFileData::m_dUnit and A3DAsmProductOccurrenceData::m_dUnit).
In order to find the one global to the whole model, you’ll need to browse trough its modelFile and sub-POs and find the first one for which m_bUnitFromCAD is set to true.
That’s basically what the function A3DAsmModelFileGetUnit (introduced since HE 2019) does.

Note

Be careful because the model unit found may look slightly different from what is rendered if a scale is also set inside of the A3DTopoContextData.

...

How can I overwrite units inside of a PRC file ?

So the The easiest and fastest way to change the default unit in a model proceed is to create a new modelFile (with the A3DAsmModelFileCreate function) or to edit the root PO (you can use A3DAsmProductOccurrenceEdit for example), by setting m_bUnitFromCAD to true and put the desired m_dUnit (defined as a mm multiple).

...