with my OCCT based program I check and modify geometry and I am expecting lengths to be given in millimeter. For example when I measure distances between shapes, I expect the distance value to have unit millimeter.
Now I have recognized that STEP files can define geometry with arbitrary units and I can query the used units with STEPControl_Reader::FileUnits(...). To prevent having to mess around with inch, meter and so on I had intended to prevent reading in STEP files with non-standard units. Therefore I check whether the length unit is "millimetre", the planar angle unit is "radian" and the solid angle unit is "steradian". If this is not the case I refuse to read in that STEP file.
Unfortunately I have met a STEP file now that cannot be read in. STEPControl_Reader::FileUnits(...) returns one (planar) angle unit, which is "DEGREE". When I look into the STEP file, it contains the following lines:
This seems to me as if the planar angle unit was actually radian (see line staring with #309), but there is one measure given in degree (see line starting with #311). I wonder why STEPControl_Reader::FileUnits(...) states there was only one planar angle unit which is degree.
Now I have two questions:
- Is my way to care for STEP file units correct? Do I have to prevent reading in geometry with wrong units? Or is the STEP geometry converted to millimeter/radian/steradian anyway during read-in?
- Do I have to do some conversion when reading in STEP files with wrong units? Do I have to convert degree measures to radian measures? How and where can I do that?
- Why does STEPControl_Reader::FileUnits(...) state that the planar angle unit is degree?
- How do you handle units in your code?
Thank you very much,