- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi all, I have a drawing for which I am trying to determine the adopted drawing units in order to apply the correct scale factor when importing the entities in our application which is unit-aware. So far, I have found the following two member functions that provide unit information:
- AcDbDatabase::insunits
- AcDbBlockTableRecord::blockInsertUnits
However, for the case at hand, both functions return AcDb::kUnitsUndefined (0).
Now when I open the drawing in the Autodesk online viewer and measure the length of one of the line segments, it shows the expected value in millimeters, which is in line with my expectation. When I change the unit to something else (say, meters), the numerical value is updated accordingly (i.e. the product of value and unit is invariant). This implies that the viewer is somehow aware of the length unit used (i.e. it is not undefined). Otherwise, if the length unit would be truly unknown, I would expect to see the same numerical value regardless the unit I select.
This observation leaves me with the following questions:
- I am under the impression that there are more functions that may provide drawing unit information. Is that correct and, if so, what are these functions?
- Since there are at least two functions that serve this purpose (at the level of the database as well as the block table record) there is probably some kind of preferred evaluation order. For the two functions that I have found, it makes sense to start with the one at the lowest level (the BTR). If that does not yield any valid unit (i.e. AcDb::kUnitsUndefined) then I would query the database itself. Now if there are more such functions, how do they fit in this ordering? Preferably, I would the drawing unit lookup to follow the same set of rules as in native Autodesk products (assuming such rules exist and are well-defined).
Any suggestions or constructive comments are greatly appreciated. For your information: we are using RealDWG 2020.
Solved! Go to Solution.