<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to determine the drawing units using RealDWG? in ObjectARX Forum</title>
    <link>https://forums.autodesk.com/t5/objectarx-forum/how-to-determine-the-drawing-units-using-realdwg/m-p/9292572#M4813</link>
    <description>&lt;P&gt;Hi Alexander, I have tried your suggestion, and this particular function returns&amp;nbsp;&lt;SPAN class="pln"&gt;kMetric (1) for the drawing at hand. However, I'm not sure how to interpret the meaning of this function. The &lt;A href="https://knowledge.autodesk.com/support/autocad/learn-explore/caas/CloudHelp/cloudhelp/2018/ENU/AutoCAD-Core/files/GUID-1D074C55-0B63-482E-8A37-A52AC0C7C8FE-htm.html" target="_blank" rel="noopener"&gt;documentation&lt;/A&gt; states:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;SPAN class="pln"&gt;Controls whether the current drawing uses imperial or metric hatch pattern and linetype files.&lt;/SPAN&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="pln"&gt;To me it appears to be a setting specifically targeted at hatching and line types, and not so much the general drawing units. But I could be wrong, of course. Perhaps MEASUREMENT has a more general meaning? Could someone affiliated with Autodesk confirm this? In addition, could you please indicate where in the documentation you have found that if measurement() returns kMetric, the unit is "millimeters" and not, say, "meters"? Thank you.&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 03 Feb 2020 13:33:29 GMT</pubDate>
    <dc:creator>a.vandegraaf</dc:creator>
    <dc:date>2020-02-03T13:33:29Z</dc:date>
    <item>
      <title>How to determine the drawing units using RealDWG?</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/how-to-determine-the-drawing-units-using-realdwg/m-p/9291976#M4805</link>
      <description>&lt;P&gt;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:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;AcDbDatabase::insunits&lt;/LI&gt;&lt;LI&gt;AcDbBlockTableRecord::blockInsertUnits&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;However, for the case at hand, both functions return&amp;nbsp;AcDb::kUnitsUndefined (0).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;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 &lt;STRONG&gt;millimeters&lt;/STRONG&gt;, 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.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This observation leaves me with the following questions:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;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?&lt;/LI&gt;&lt;LI&gt;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.&amp;nbsp;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).&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any suggestions or constructive comments are greatly appreciated. For your information: we are using RealDWG 2020.&lt;/P&gt;</description>
      <pubDate>Mon, 03 Feb 2020 08:47:13 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/how-to-determine-the-drawing-units-using-realdwg/m-p/9291976#M4805</guid>
      <dc:creator>a.vandegraaf</dc:creator>
      <dc:date>2020-02-03T08:47:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to determine the drawing units using RealDWG?</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/how-to-determine-the-drawing-units-using-realdwg/m-p/9292039#M4806</link>
      <description>&lt;P&gt;According to the online help AutoCAD uses the varibales INSUNITSDEFSOURCE and INSUNITSDEFTARGET which are stored in the registry if INSUNITS is 0.&lt;/P&gt;
&lt;P&gt;It looks like this variable can't be retrieved via AcRxVariablesDictionary, only by acedGetVar().&amp;nbsp; So I have no idea how to retrieve it via RealDWG. I think your app should use a "locale default unit" i.e. inch for US and mm for Europe and make the unit configurable for the user.&lt;/P&gt;</description>
      <pubDate>Mon, 03 Feb 2020 09:27:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/how-to-determine-the-drawing-units-using-realdwg/m-p/9292039#M4806</guid>
      <dc:creator>tbrammer</dc:creator>
      <dc:date>2020-02-03T09:27:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to determine the drawing units using RealDWG?</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/how-to-determine-the-drawing-units-using-realdwg/m-p/9292087#M4807</link>
      <description>&lt;P&gt;Hi Thomas, many thanks for your reply. I had come across these system variables that you mentioned when I was searching the web. To me, it was unclear how to retrieve their values, but your answer gives me a hint:&amp;nbsp;&lt;SPAN&gt;acedGetVar(). I think I can call that function from our application code. I will give that a try later today. One more question: when we talk about the units of the current drawing, would that mean that I have to inspect the value of&amp;nbsp;INSUNITSDEFSOURCE or the other one? In other words, is the current drawing thought of as the source or the target?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;If there is no drawing unit detected, the import mechanism relies on the units currently set in our application. So the user has full control for this particular situation. I just want to make sure that I have checked all relevant information before resorting to this fallback mechanism. Since the Autodesk online viewer gave me the impression that the drawing units could be detected for this particular drawing, I just wanted to know whether I might have missed any relevant information.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 03 Feb 2020 09:54:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/how-to-determine-the-drawing-units-using-realdwg/m-p/9292087#M4807</guid>
      <dc:creator>a.vandegraaf</dc:creator>
      <dc:date>2020-02-03T09:54:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to determine the drawing units using RealDWG?</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/how-to-determine-the-drawing-units-using-realdwg/m-p/9292294#M4808</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You should use db.insunits() API, I was wondering you are getting undefined values, I have tested on two attached drawings, I get values as expected.&lt;/P&gt;
&lt;P&gt;Can you share the code snippet with us or the drawing that is failing ?, I suspect you might have initialized database properly .&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;acdbHostApplicationServices()-&amp;gt;setWorkingDatabase(pDb);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="metric-imperial.jpg" style="width: 999px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/725106i7969C82E17918BB8/image-size/large?v=v2&amp;amp;px=999" role="button" title="metric-imperial.jpg" alt="metric-imperial.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 03 Feb 2020 11:29:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/how-to-determine-the-drawing-units-using-realdwg/m-p/9292294#M4808</guid>
      <dc:creator>moogalm</dc:creator>
      <dc:date>2020-02-03T11:29:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to determine the drawing units using RealDWG?</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/how-to-determine-the-drawing-units-using-realdwg/m-p/9292404#M4809</link>
      <description>&lt;P&gt;Hi Madhukar, we already do what you suggest. First, we ensure that a working database has been set ...&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;acdbHostApplicationServices&lt;/SPAN&gt;()-&amp;gt;&lt;SPAN&gt;setWorkingDatabase&lt;/SPAN&gt;( &lt;SPAN&gt;m_database&lt;/SPAN&gt; );&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;... and later on, we call:&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;auto units&lt;/SPAN&gt; = m_&lt;SPAN&gt;database&lt;/SPAN&gt;&lt;SPAN&gt;-&amp;gt;&lt;/SPAN&gt;&lt;SPAN&gt;insunits&lt;/SPAN&gt;();&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have seen other drawings where this works as expected, but it doesn't for this particular one. Since I received the drawing from one of our users, it is deemed confidential, so I can't share it in this public forum. But it appears that you are affiliated with Autodesk, so if I could send it in some way to you in private, that would be okay. Would that be possible?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The file is stored in DXF format, so I am able to inspect its contents with a text editor. These are probably the relevant lines that I have extracted from the file:&lt;/P&gt;&lt;PRE&gt;$INSUNITS&lt;BR /&gt; 70&lt;BR /&gt;     0&lt;BR /&gt;  9&lt;/PRE&gt;&lt;P&gt;Does the 0 at the third line stand for&amp;nbsp;&lt;SPAN&gt;AcDb&lt;/SPAN&gt;::&lt;SPAN&gt;kUnitsUndefined?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 03 Feb 2020 12:23:20 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/how-to-determine-the-drawing-units-using-realdwg/m-p/9292404#M4809</guid>
      <dc:creator>a.vandegraaf</dc:creator>
      <dc:date>2020-02-03T12:23:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to determine the drawing units using RealDWG?</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/how-to-determine-the-drawing-units-using-realdwg/m-p/9292441#M4810</link>
      <description>&lt;P&gt;It appears from dxf text, the drawing is unitless.&lt;/P&gt;
&lt;P&gt;You should expect '1' if drawing is set imperial, 4 if it is metric [precisely mm]&lt;/P&gt;
&lt;P&gt;$INSUNITS&lt;BR /&gt;70&lt;BR /&gt;1&lt;BR /&gt;9&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Refer:&amp;nbsp;&lt;A href="https://www.autodesk.com/techpubs/autocad/acad2000/dxf/header_section_group_codes_dxf_02.htm" target="_blank"&gt;https://www.autodesk.com/techpubs/autocad/acad2000/dxf/header_section_group_codes_dxf_02.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE border="0" cellspacing="4" cellpadding="2"&gt;
&lt;TBODY&gt;
&lt;TR valign="TOP"&gt;
&lt;TD bgcolor="#F9F6ED"&gt;
&lt;P&gt;&lt;FONT face="verdana,arial" size="2"&gt;$INSUNITS&lt;/FONT&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD bgcolor="#F9F6ED"&gt;
&lt;P&gt;&lt;FONT face="verdana,arial" size="2"&gt;70&lt;/FONT&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;TD bgcolor="#F9F6ED"&gt;
&lt;P&gt;&lt;FONT face="verdana,arial" size="2"&gt;Default drawing units for AutoCAD DesignCenter blocks:&lt;BR /&gt;0 = Unitless; 1 = Inches; 2 = Feet; 3 = Miles; 4 = Millimeters;&lt;BR /&gt;5 = Centimeters; 6 = Meters; 7 = Kilometers; 8 = Microinches;&lt;BR /&gt;9 = Mils; 10 = Yards; 11 = Angstroms; 12 = Nanometers;&lt;BR /&gt;13 = Microns; 14 = Decimeters; 15 = Decameters;&lt;BR /&gt;16 = Hectometers; 17 = Gigameters; 18 = Astronomical units;&lt;BR /&gt;19 = Light years; 20 = Parsecs&lt;/FONT&gt;&lt;/P&gt;
&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;</description>
      <pubDate>Mon, 03 Feb 2020 12:39:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/how-to-determine-the-drawing-units-using-realdwg/m-p/9292441#M4810</guid>
      <dc:creator>moogalm</dc:creator>
      <dc:date>2020-02-03T12:39:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to determine the drawing units using RealDWG?</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/how-to-determine-the-drawing-units-using-realdwg/m-p/9292452#M4811</link>
      <description>&lt;P&gt;In addition, I have imported your attached drawings in our application and the results are as expected:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Imperial.dwg: insunits() returns kUnitsInches (1)&lt;/LI&gt;&lt;LI&gt;metric-drawing.dwg: insunits() returns kUnitsMillimeters (4)&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So, assuming the drawing doesn't have any unit defined (i.e.&amp;nbsp;&lt;SPAN&gt;kUnitsUndefined)&lt;/SPAN&gt;, then how does the Autodesk online viewer determine the applicable unit? Is there perhaps some database value which tells whether we are working with Imperial or metric units (or perhaps this is derived from my locale settings)? And, if yes, is there perhaps a default unit assumed once the unit system is known (e.g. "inches" for Imperial, and "millimeters" for metric)?&lt;/P&gt;</description>
      <pubDate>Mon, 03 Feb 2020 12:43:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/how-to-determine-the-drawing-units-using-realdwg/m-p/9292452#M4811</guid>
      <dc:creator>a.vandegraaf</dc:creator>
      <dc:date>2020-02-03T12:43:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to determine the drawing units using RealDWG?</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/how-to-determine-the-drawing-units-using-realdwg/m-p/9292481#M4812</link>
      <description>&lt;P&gt;Try check value of AcDbDatabase::measurement. If value is 1 (metric) - default units is mm, if value is 0 - default units is inch.&lt;/P&gt;</description>
      <pubDate>Mon, 03 Feb 2020 12:51:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/how-to-determine-the-drawing-units-using-realdwg/m-p/9292481#M4812</guid>
      <dc:creator>Alexander.Rivilis</dc:creator>
      <dc:date>2020-02-03T12:51:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to determine the drawing units using RealDWG?</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/how-to-determine-the-drawing-units-using-realdwg/m-p/9292572#M4813</link>
      <description>&lt;P&gt;Hi Alexander, I have tried your suggestion, and this particular function returns&amp;nbsp;&lt;SPAN class="pln"&gt;kMetric (1) for the drawing at hand. However, I'm not sure how to interpret the meaning of this function. The &lt;A href="https://knowledge.autodesk.com/support/autocad/learn-explore/caas/CloudHelp/cloudhelp/2018/ENU/AutoCAD-Core/files/GUID-1D074C55-0B63-482E-8A37-A52AC0C7C8FE-htm.html" target="_blank" rel="noopener"&gt;documentation&lt;/A&gt; states:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;SPAN class="pln"&gt;Controls whether the current drawing uses imperial or metric hatch pattern and linetype files.&lt;/SPAN&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="pln"&gt;To me it appears to be a setting specifically targeted at hatching and line types, and not so much the general drawing units. But I could be wrong, of course. Perhaps MEASUREMENT has a more general meaning? Could someone affiliated with Autodesk confirm this? In addition, could you please indicate where in the documentation you have found that if measurement() returns kMetric, the unit is "millimeters" and not, say, "meters"? Thank you.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 03 Feb 2020 13:33:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/how-to-determine-the-drawing-units-using-realdwg/m-p/9292572#M4813</guid>
      <dc:creator>a.vandegraaf</dc:creator>
      <dc:date>2020-02-03T13:33:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to determine the drawing units using RealDWG?</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/how-to-determine-the-drawing-units-using-realdwg/m-p/9292656#M4814</link>
      <description>&lt;P&gt;acedGetVar() is not available in RealDWG. The "&lt;U&gt;&lt;STRONG&gt;ed&lt;/STRONG&gt;&lt;/U&gt;"&amp;nbsp; in ac&lt;U&gt;&lt;STRONG&gt;ed&lt;/STRONG&gt;&lt;/U&gt;XXX() function names usually implies that they refer to the AutoCAD editor.&lt;/P&gt;</description>
      <pubDate>Mon, 03 Feb 2020 14:01:53 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/how-to-determine-the-drawing-units-using-realdwg/m-p/9292656#M4814</guid>
      <dc:creator>tbrammer</dc:creator>
      <dc:date>2020-02-03T14:01:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to determine the drawing units using RealDWG?</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/how-to-determine-the-drawing-units-using-realdwg/m-p/9292729#M4815</link>
      <description>&lt;P&gt;I didn't know that. Thank you for making me aware of this.&lt;/P&gt;</description>
      <pubDate>Mon, 03 Feb 2020 14:21:53 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/how-to-determine-the-drawing-units-using-realdwg/m-p/9292729#M4815</guid>
      <dc:creator>a.vandegraaf</dc:creator>
      <dc:date>2020-02-03T14:21:53Z</dc:date>
    </item>
  </channel>
</rss>

