...
It’s possible to have multiple different units used inside of a same model, so that’s why the ModelFile and each product occurrence 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 A3DAsmProductOccurrenceData:: m_bUnitFromCAD is set to true.
That’s basically what the function A3DAsmModelFileGetUnit (introduced since HE 2019) does.
...
So the easiest and fastest way to change the default unit in a model is to create a new modelFile (with the A3DAsmModelFileCreate function) or to edit the root PO (by using you can use A3DAsmProductOccurrenceEdit for example), set by setting m_bUnitFromCAD to true and put the desired m_dUnit (defined as a mm multiple).
...