<?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: Variable for DWG Version in Visual LISP, AutoLISP and General Customization Forum</title>
    <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/variable-for-dwg-version/m-p/10206652#M61961</link>
    <description>&lt;P&gt;To quote someone "the first 6 bits of the DWG Header variable stands for the version string"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ok now to read the 1st 6 bits via Lisp I am sure found something once.&lt;/P&gt;</description>
    <pubDate>Fri, 02 Apr 2021 06:31:34 GMT</pubDate>
    <dc:creator>Sea-Haven</dc:creator>
    <dc:date>2021-04-02T06:31:34Z</dc:date>
    <item>
      <title>Variable for DWG Version</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/variable-for-dwg-version/m-p/10205106#M61955</link>
      <description>&lt;P&gt;Dear community,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to display in the status bar the dwg version of the currently active document = "2013", "2018", etc., or in a similar form. Which variabel will allow me to get back such a value? Unfortunately, I didn't find any. I already have a suitable LISP.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Or do I have another way to do it?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Reason: We save the DWG in the currently used version (eg 2018) and also in the version for other uses (eg 2013). However, it happens that a person accidentally modifies the other version, because he accidentally opened it for any reason.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you in advance and have a nice Easter&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 01 Apr 2021 15:12:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/variable-for-dwg-version/m-p/10205106#M61955</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-04-01T15:12:24Z</dc:date>
    </item>
    <item>
      <title>Re: Variable for DWG Version</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/variable-for-dwg-version/m-p/10205144#M61956</link>
      <description>&lt;P&gt;It's the &lt;FONT color="#000000"&gt;&lt;STRONG&gt;ACADVER&lt;/STRONG&gt;&lt;/FONT&gt; System Variable.&amp;nbsp; Read &lt;A href="https://help.autodesk.com/view/ACD/2021/ENU/?guid=GUID-793238B6-F8B8-4D20-BB3A-001700AECD75" target="_self"&gt;Help about it&lt;/A&gt; to see the relationship between its number and the AutoCAD version.&amp;nbsp; You can get the number part as a number with the one decimal place, without the occasion 's' or parenthetical part, with:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000000"&gt;&lt;STRONG&gt;(atof (getvar 'acadver))&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You would probably need to make a &lt;FONT color="#00CCFF"&gt;list&lt;/FONT&gt; of pairings such as&amp;nbsp; &lt;FONT color="#000000"&gt;'((24.0 "2021") (23.1 "2020")&amp;nbsp;(23.0 "2019"))&lt;/FONT&gt;&amp;nbsp; [etc,] then use something like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000000"&gt;&lt;STRONG&gt;&lt;FONT color="#000000"&gt;(cadr (assoc&amp;nbsp;&lt;/FONT&gt;(atof (getvar 'acadver)) &lt;/STRONG&gt;&lt;FONT color="#00CCFF"&gt;&lt;EM&gt;theList&lt;/EM&gt;&lt;/FONT&gt;&lt;STRONG&gt;))&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;to extract the version year for inclusion in something that needs it in text-string form, or without the quotation marks if you can use the year as an integer.&lt;/P&gt;</description>
      <pubDate>Thu, 01 Apr 2021 15:32:20 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/variable-for-dwg-version/m-p/10205144#M61956</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2021-04-01T15:32:20Z</dc:date>
    </item>
    <item>
      <title>Betreff: Variable for DWG Version</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/variable-for-dwg-version/m-p/10205202#M61957</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/69526"&gt;@Kent1Cooper&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;very good, many thanks for your help.&lt;/P&gt;</description>
      <pubDate>Thu, 01 Apr 2021 15:43:20 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/variable-for-dwg-version/m-p/10205202#M61957</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2021-04-01T15:43:20Z</dc:date>
    </item>
    <item>
      <title>Re: Variable for DWG Version</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/variable-for-dwg-version/m-p/10205326#M61958</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/69526"&gt;@Kent1Cooper&lt;/a&gt;&amp;nbsp;&lt;A href="https://knowledge.autodesk.com/support/autocad/learn-explore/caas/CloudHelp/cloudhelp/2021/ENU/AutoCAD-Core/files/GUID-793238B6-F8B8-4D20-BB3A-001700AECD75-htm.html" target="_blank" rel="noopener"&gt;&lt;STRONG&gt;ACADVER&lt;/STRONG&gt;&lt;/A&gt; does not return the version of the opened drawing ( which is what I think the OP wants? ), it returns the version of AutoCAD being used.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think this would be more suitable:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;(defun mp-get-dwg-ver ( dwg / handle stream )
    ;; SOURCE
    ;; http://www.theswamp.org/index.php?topic=56316.msg602004#msg602004
    ;;  Return the specified drawing's version as a string representing
    ;;  the AutoCAD versions that create and support the version natively,
    ;;  e.g. "2018/2019/2020/2021". Of course drawings saved by Civil3D
    ;;  enjoy a special versioning hell that doesn't precisely follow this
    ;;  schema. Thanks Autodesk.
 
    (cond
        ((null (setq handle (open dwg "r"))) nil) ;; could not open drawing, return nil
        ((progn (setq stream (substr (read-line handle) 1 6))(close handle)))
        ((eq "AC1032" stream) "2018/2019/2020/2021")
        ((eq "AC1027" stream) "2013/2014/2015/2016/2017")
        ((eq "AC1024" stream) "2010/2011/2012")
        ((eq "AC1021" stream) "2007/2008/2009")
        ((eq "AC1018" stream) "2004/2005/2006")
        ((eq "AC1015" stream) "2000/2000I/2002") ;; was 2000i, forced uppercase
        ((eq "AC1014" stream) "R14")
        ((eq "AC1012" stream) "13")
        ((eq "AC1009" stream) "11,12")
        ((eq "AC1006" stream) "10")
        ((eq "AC1004" stream) "9")
        ((eq "AC1003" stream) "2.6")
        ((eq "AC1002" stream) "2.5")
        ((eq "AC2.10" stream) "2.10")
        ((eq "AC1.50" stream) "2.0")
        ((eq "AC1.4" (setq stream (substr stream 1 5))) "1.4")
        ((eq "AC1.2" stream) "1.2")
        ((eq "MC0.0" stream) "1.1")
        ("Doesn't appear to be an AutoCAD dwg, cue sad trombone.")
    )
)
;; Usage
(mp-get-dwg-ver (strcat (getvar 'dwgprefix)(getvar 'dwgname)))&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 01 Apr 2021 16:50:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/variable-for-dwg-version/m-p/10205326#M61958</guid>
      <dc:creator>ronjonp</dc:creator>
      <dc:date>2021-04-01T16:50:56Z</dc:date>
    </item>
    <item>
      <title>Re: Variable for DWG Version</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/variable-for-dwg-version/m-p/10205399#M61960</link>
      <description>&lt;P&gt;To see the version you have to read the header of the file ( posted an example from TheSwamp in my previous post )&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ronjonp_0-1617296155588.png" style="width: 400px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/901263i252825548EFF6A85/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ronjonp_0-1617296155588.png" alt="ronjonp_0-1617296155588.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 01 Apr 2021 16:56:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/variable-for-dwg-version/m-p/10205399#M61960</guid>
      <dc:creator>ronjonp</dc:creator>
      <dc:date>2021-04-01T16:56:03Z</dc:date>
    </item>
    <item>
      <title>Re: Variable for DWG Version</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/variable-for-dwg-version/m-p/10206652#M61961</link>
      <description>&lt;P&gt;To quote someone "the first 6 bits of the DWG Header variable stands for the version string"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ok now to read the 1st 6 bits via Lisp I am sure found something once.&lt;/P&gt;</description>
      <pubDate>Fri, 02 Apr 2021 06:31:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/variable-for-dwg-version/m-p/10206652#M61961</guid>
      <dc:creator>Sea-Haven</dc:creator>
      <dc:date>2021-04-02T06:31:34Z</dc:date>
    </item>
  </channel>
</rss>

