<?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 Getting name of autocad drawing. in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/getting-name-of-autocad-drawing/m-p/5667291#M39724</link>
    <description>&lt;P&gt;Hello everyone,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;i have developed a dll flile in vb.net. After loading dll file in autocad, i want to do following.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1. To get name of opened active autocad file in which i running my command in text box of opened form.&lt;/P&gt;
&lt;P&gt;2. To save some information in that autocad drawing . And also to read/modify that infomation when required.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Kindly some help me to do above through vb.net.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks &amp;amp; Regards&lt;/P&gt;
&lt;P&gt;Amit&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 06 Jun 2015 10:36:15 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2015-06-06T10:36:15Z</dc:date>
    <item>
      <title>Getting name of autocad drawing.</title>
      <link>https://forums.autodesk.com/t5/net-forum/getting-name-of-autocad-drawing/m-p/5667291#M39724</link>
      <description>&lt;P&gt;Hello everyone,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;i have developed a dll flile in vb.net. After loading dll file in autocad, i want to do following.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1. To get name of opened active autocad file in which i running my command in text box of opened form.&lt;/P&gt;
&lt;P&gt;2. To save some information in that autocad drawing . And also to read/modify that infomation when required.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Kindly some help me to do above through vb.net.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks &amp;amp; Regards&lt;/P&gt;
&lt;P&gt;Amit&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 06 Jun 2015 10:36:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/getting-name-of-autocad-drawing/m-p/5667291#M39724</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-06-06T10:36:15Z</dc:date>
    </item>
    <item>
      <title>Re: Getting name of autocad drawing.</title>
      <link>https://forums.autodesk.com/t5/net-forum/getting-name-of-autocad-drawing/m-p/5667509#M39725</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You need to get the value of&amp;nbsp;&amp;nbsp;DWGNAME&amp;nbsp;variable in order to obtain the dwg name. But if the file has no name, it will return just "DrawingX", with X a number, so you may need to check if the file has been saved with the "&lt;SPAN&gt;DWGTITLED" system variable.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;The code to retrieve a variable value is just: Application.GetSystemVariable("TheVariableNameHere")&lt;/P&gt;
&lt;P&gt;The code to set a variable to a value is just: Application.SetSystemVariable("SomeVariableName", TheValue)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can type F1 in AutoCAD to get the help system and read about variables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Gaston Nunez&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 07 Jun 2015 00:34:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/getting-name-of-autocad-drawing/m-p/5667509#M39725</guid>
      <dc:creator>hgasty1001</dc:creator>
      <dc:date>2015-06-07T00:34:22Z</dc:date>
    </item>
    <item>
      <title>Re: Getting name of autocad drawing.</title>
      <link>https://forums.autodesk.com/t5/net-forum/getting-name-of-autocad-drawing/m-p/6381528#M39726</link>
      <description>&lt;P&gt;For those researching in the future, this is my method:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Document doc = Autodesk.AutoCAD.ApplicationServices.Core.Application.DocumentManager.MdiActiveDocument;
string drawingName = Path.GetFileName(doc.Name);&lt;/PRE&gt;&lt;P&gt;the string drawingName does also come with the extension. you can remove it from the string if you wish, I suppose.&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jun 2016 01:07:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/getting-name-of-autocad-drawing/m-p/6381528#M39726</guid>
      <dc:creator>BKSpurgeon</dc:creator>
      <dc:date>2016-06-14T01:07:15Z</dc:date>
    </item>
    <item>
      <title>Re : Getting name of autocad drawing.</title>
      <link>https://forums.autodesk.com/t5/net-forum/getting-name-of-autocad-drawing/m-p/6381805#M39727</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1. Assuming &lt;STRONG&gt;doc&lt;/STRONG&gt; is the active document (Application.DocumentManager.MdiActiveDocument) and &lt;STRONG&gt;db&lt;/STRONG&gt; the related database (doc.Database),&lt;/P&gt;
&lt;P&gt;- if the drawing is unsaved:&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;doc.Name&lt;/STRONG&gt; returns the incremented default drawing name (DrawingN.dwg)&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;db.Filename&lt;/STRONG&gt; returns the template path&lt;/P&gt;
&lt;P&gt;- if the drawing have been saved:&lt;/P&gt;
&lt;P&gt;both &lt;STRONG&gt;doc.Name&lt;/STRONG&gt; and &lt;STRONG&gt;db.Filename&lt;/STRONG&gt; return the drawing path.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2. To store data in a drawing&lt;/P&gt;
&lt;P&gt;For persisting data, you should store them in &lt;A href="http://help.autodesk.com/view/ACD/2017/FRA/?guid=GUID-92D663FA-0452-44F4-BDAC-0EEF0AF3BD88" target="_blank"&gt;Xdata&lt;/A&gt; or in Xrecord contained in a Dictionary (&lt;A href="http://adndevblog.typepad.com/autocad/2012/06/adding-extension-dictionary.html" target="_blank"&gt;extension dictionary&lt;/A&gt; or &lt;A href="http://aucache.autodesk.com/au2012/sessionsFiles/2146/2646/handout_2146_CP2146.pdf" target="_blank"&gt;named dictionary&lt;/A&gt;)&lt;/P&gt;
&lt;P&gt;For transient data, you can store them as instance members (typically fields) of the class where the command is defined (see &lt;A href="http://through-the-interface.typepad.com/through_the_interface/2006/10/perdocument_dat_1.html" target="_blank"&gt;this topic&lt;/A&gt;) or use the document.UserData property (see &lt;A href="http://through-the-interface.typepad.com/through_the_interface/2006/10/perdocument_dat_2.html" target="_blank"&gt;this topic&lt;/A&gt;).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Sorry but as you can see most examples are in C#. You can use some &lt;A href="http://converter.telerik.com/" target="_blank"&gt;converter&lt;/A&gt; or, better IMO, if you just start learning VB, switch to C#.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jun 2016 06:59:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/getting-name-of-autocad-drawing/m-p/6381805#M39727</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2016-06-14T06:59:56Z</dc:date>
    </item>
  </channel>
</rss>

