How does units are represented in HOOPS Exchange ?
All units inside of PRC files are stored with decimal numbers, representing multiples of mm.
So 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 through 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 ?
The easiest and fastest way to 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)To learn more about units and to get the answer to this question, check out our forum post.