<?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: File name in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/file-name/m-p/3703790#M52450</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;try to use the "Session"-flag for your command-definition:&lt;/P&gt;&lt;P&gt;&lt;FONT color="#666699" face="lucida sans unicode,lucida sans"&gt;&amp;nbsp;&amp;nbsp; &amp;lt;CommandMethod("SaveTwoDrawings", Autodesk.AutoCAD.Runtime.CommandFlags.Session)&amp;gt; _&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#666699" face="lucida sans unicode,lucida sans"&gt;&amp;nbsp;&amp;nbsp; Public Shared Sub SaveTwoDrawings()&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#666699" face="lucida sans unicode,lucida sans"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ...&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;- alfred -&lt;/P&gt;</description>
    <pubDate>Mon, 19 Nov 2012 10:07:13 GMT</pubDate>
    <dc:creator>Alfred.NESWADBA</dc:creator>
    <dc:date>2012-11-19T10:07:13Z</dc:date>
    <item>
      <title>File name</title>
      <link>https://forums.autodesk.com/t5/net-forum/file-name/m-p/3703762#M52449</link>
      <description>&lt;P&gt;Hi to all.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to save two drawings sequentially with the following code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Imports Autodesk.AutoCAD.DatabaseServices&lt;BR /&gt;Imports Autodesk.AutoCAD.ApplicationServices&lt;BR /&gt;Imports Autodesk.AutoCAD.Runtime&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Public Class Class1&lt;/P&gt;&lt;P&gt;&amp;lt;CommandMethod("SaveTwoDrawings")&amp;gt; _&lt;BR /&gt;Public Sub SaveTwoDrawings()&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Dim doc As Document&lt;BR /&gt;Dim strDWGName As String&lt;BR /&gt;Dim acDocMgr As DocumentCollection = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager&lt;BR /&gt;Dim obj As Object&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;doc = acDocMgr(0)&lt;BR /&gt;strDWGName = doc.Name&lt;BR /&gt;strDWGName = "c:\MyDrawing#1.dwg"&lt;/P&gt;&lt;P&gt;doc.Database.SaveAs(strDWGName, True, DwgVersion.Current, doc.Database.SecurityParameters)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;doc = acDocMgr(1)&lt;BR /&gt;strDWGName = doc.Name&lt;BR /&gt;strDWGName = "c:\MyDrawing#2.dwg"&lt;/P&gt;&lt;P&gt;doc.Database.SaveAs(strDWGName, True, DwgVersion.Current, doc.Database.SecurityParameters)&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;End Sub&lt;BR /&gt;End Class&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;While the two drawings are correctly saved in the desired position whith the desired names, only the name of the last drawing is updated (&lt;EM&gt;"Drawing2.dwg"---&amp;gt;"&lt;/EM&gt;&lt;SPAN&gt;&lt;EM&gt;MyDrawing#2.dwg"&lt;/EM&gt;), but the name of the first drawing still remains the original assigned by autocad "Drawing1.dwg", the autocad title bar is not updated too.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Some suggestions?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Nov 2012 09:46:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/file-name/m-p/3703762#M52449</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-11-19T09:46:47Z</dc:date>
    </item>
    <item>
      <title>Re: File name</title>
      <link>https://forums.autodesk.com/t5/net-forum/file-name/m-p/3703790#M52450</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;try to use the "Session"-flag for your command-definition:&lt;/P&gt;&lt;P&gt;&lt;FONT color="#666699" face="lucida sans unicode,lucida sans"&gt;&amp;nbsp;&amp;nbsp; &amp;lt;CommandMethod("SaveTwoDrawings", Autodesk.AutoCAD.Runtime.CommandFlags.Session)&amp;gt; _&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#666699" face="lucida sans unicode,lucida sans"&gt;&amp;nbsp;&amp;nbsp; Public Shared Sub SaveTwoDrawings()&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#666699" face="lucida sans unicode,lucida sans"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ...&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;- alfred -&lt;/P&gt;</description>
      <pubDate>Mon, 19 Nov 2012 10:07:13 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/file-name/m-p/3703790#M52450</guid>
      <dc:creator>Alfred.NESWADBA</dc:creator>
      <dc:date>2012-11-19T10:07:13Z</dc:date>
    </item>
    <item>
      <title>Re: File name</title>
      <link>https://forums.autodesk.com/t5/net-forum/file-name/m-p/3703942#M52451</link>
      <description>&lt;P&gt;Thanks Alfred.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Tried the suggestion, but still not working.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Nov 2012 12:40:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/file-name/m-p/3703942#M52451</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-11-19T12:40:39Z</dc:date>
    </item>
    <item>
      <title>Re: File name</title>
      <link>https://forums.autodesk.com/t5/net-forum/file-name/m-p/3705330#M52452</link>
      <description>&lt;P&gt;Hi Alfred,&amp;nbsp;I modified the code like this (including your suggestion).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000" face="arial,helvetica,sans-serif"&gt;Imports Autodesk.AutoCAD.DatabaseServices&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#000000" face="arial,helvetica,sans-serif"&gt;Imports Autodesk.AutoCAD.ApplicationServices&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#000000" face="arial,helvetica,sans-serif"&gt;Imports Autodesk.AutoCAD.Runtime&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;FONT color="#000000" face="arial,helvetica,sans-serif"&gt;Public Class Class1&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000" face="arial,helvetica,sans-serif"&gt;&amp;lt;CommandMethod("SaveTwoDrawings", &lt;STRONG&gt;CommandFlags.Session&lt;/STRONG&gt;)&amp;gt; _&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#000000" face="arial,helvetica,sans-serif"&gt; Public &lt;STRONG&gt;Shared&lt;/STRONG&gt; Sub SaveTwoDrawings()&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;FONT color="#000000" face="arial,helvetica,sans-serif"&gt;Dim doc As Document&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#000000" face="arial,helvetica,sans-serif"&gt;Dim strDWGName As String&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#000000" face="arial,helvetica,sans-serif"&gt;Dim acDocMgr As DocumentCollection = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#000000" face="arial,helvetica,sans-serif"&gt;Dim obj As Object&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000" face="arial,helvetica,sans-serif"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000" face="arial,helvetica,sans-serif"&gt;doc = acDocMgr(0)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000" face="arial,helvetica,sans-serif"&gt;&lt;STRONG&gt;acDocMgr.MdiActiveDocument = doc&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#000000" face="arial,helvetica,sans-serif"&gt;strDWGName = doc.Name&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#000000" face="arial,helvetica,sans-serif"&gt;strDWGName = "c:\MyDrawing#1.dwg"&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000" face="arial,helvetica,sans-serif"&gt;doc.Database.SaveAs(strDWGName, True, DwgVersion.Current, doc.Database.SecurityParameters)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000" face="arial,helvetica,sans-serif"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000" face="arial,helvetica,sans-serif"&gt;doc = acDocMgr(1)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000" face="arial,helvetica,sans-serif"&gt;&lt;STRONG&gt;acDocMgr.MdiActiveDocument = doc&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#000000" face="arial,helvetica,sans-serif"&gt;strDWGName = doc.Name&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#000000" face="arial,helvetica,sans-serif"&gt;strDWGName = "c:\MyDrawing#2.dwg"&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000" face="arial,helvetica,sans-serif"&gt;doc.Database.SaveAs(strDWGName, True, DwgVersion.Current, doc.Database.SecurityParameters)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;FONT color="#000000" face="arial,helvetica,sans-serif"&gt;End Sub&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#000000" face="arial,helvetica,sans-serif"&gt;End Class&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In this case the routine works fine.&lt;/P&gt;&lt;P&gt;It seems that there is a need to make the&amp;nbsp;&lt;SPAN style="line-height: 14px;"&gt;document&lt;/SPAN&gt;&amp;nbsp;active. When the document is active the doc.Name property is updated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Using Autocad 2010 32bit, Visual Studio Espress 2008&lt;/P&gt;</description>
      <pubDate>Tue, 20 Nov 2012 08:22:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/file-name/m-p/3705330#M52452</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-11-20T08:22:55Z</dc:date>
    </item>
  </channel>
</rss>

