<?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: Creating DWG using .Net in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/creating-dwg-using-net/m-p/3361435#M57030</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;you can define your own commands in your DLL, these commands do work either in document-context or in application-context. If they are working in document-context you can't activate an other document then that and that may be a problem if you try to open and/or to save another document then that where you started the command.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So take care of the attribtutes for your command-definition, one sample including the .Session flag:&lt;/P&gt;&lt;PRE&gt;&amp;lt;Autodesk.AutoCAD.Runtime.CommandMethod("OOCLoad", Autodesk.AutoCAD.Runtime.CommandFlags.Redraw Or Autodesk.AutoCAD.Runtime.CommandFlags.UsePickSet Or Autodesk.AutoCAD.Runtime.CommandFlags.&lt;STRONG&gt;&lt;FONT color="#0000FF"&gt;Session&lt;/FONT&gt;&lt;/STRONG&gt;)&amp;gt; _
Public Shared Sub OOCLoad()
   '....
End Sub&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;HTH, - alfred -&lt;/P&gt;</description>
    <pubDate>Wed, 07 Mar 2012 13:50:31 GMT</pubDate>
    <dc:creator>Alfred.NESWADBA</dc:creator>
    <dc:date>2012-03-07T13:50:31Z</dc:date>
    <item>
      <title>Creating DWG using .Net</title>
      <link>https://forums.autodesk.com/t5/net-forum/creating-dwg-using-net/m-p/3357733#M57024</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How i can create DWG using .Net.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;While creating DWG file, i have to choose one of the dwg template and&lt;/P&gt;&lt;P&gt;location for created DWG file.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Raman&lt;/P&gt;</description>
      <pubDate>Mon, 05 Mar 2012 04:36:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/creating-dwg-using-net/m-p/3357733#M57024</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-03-05T04:36:58Z</dc:date>
    </item>
    <item>
      <title>Re: Creating DWG using .Net</title>
      <link>https://forums.autodesk.com/t5/net-forum/creating-dwg-using-net/m-p/3357795#M57025</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;do you want to have it opened in AutoCAD or do you just want to create a new file and open it just in memory?&lt;/P&gt;&lt;P&gt;Both samples:&lt;/P&gt;&lt;PRE&gt;      'first lines in the class have to include:
      'Imports Autodesk.AutoCAD

      Dim tTemplateFileName As String = "C:\TEMP\myTemplate.DWT"
      Dim tNewFileName As String = "C:\TEMP\newFile.DWG"

      'open it in editor
      Dim tNewDoc As ApplicationServices.Document = ApplicationServices.Application.DocumentManager.Add(tTemplateFileName)
      tNewDoc.CloseAndSave(tNewFileName)

      'open it as database in memory
      Dim tDb As DatabaseServices.Database = New DatabaseServices.Database(False, True)
      tDb.SaveAs(tNewFileName, DatabaseServices.DwgVersion.Current)&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;- alfred -&lt;/P&gt;</description>
      <pubDate>Mon, 05 Mar 2012 07:09:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/creating-dwg-using-net/m-p/3357795#M57025</guid>
      <dc:creator>Alfred.NESWADBA</dc:creator>
      <dc:date>2012-03-05T07:09:29Z</dc:date>
    </item>
    <item>
      <title>Re: Creating DWG using .Net</title>
      <link>https://forums.autodesk.com/t5/net-forum/creating-dwg-using-net/m-p/3357919#M57027</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Just I have to create a DWG with given template and and open it in AUTOCAD.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So, I have written below statements&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;'open it in editor&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim tNewDoc As ApplicationServices.Document = ApplicationServices.Application.DocumentManager.Ad​d(tTemplateFileName)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; tNewDoc.CloseAndSave(tNewFileName)&lt;/P&gt;&lt;P&gt;But "&amp;nbsp;tNewDoc.CloseAndSave(tNewFileName)" is not working ... means it is not creating file in given path&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then i changed to&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;tNewDoc.Database.SaveAs(tNewFileName,&amp;nbsp;&lt;SPAN style="color: blue;"&gt;true&lt;/SPAN&gt;,&amp;nbsp;&lt;SPAN style="color: #2b91af;"&gt;DwgVersion&lt;/SPAN&gt;.Current, &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;tNewDoc.Database.SecurityParameters);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and it is creating file in given location.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for helping me.....&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Mar 2012 09:51:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/creating-dwg-using-net/m-p/3357919#M57027</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-03-05T09:51:33Z</dc:date>
    </item>
    <item>
      <title>Re: Creating DWG using .Net</title>
      <link>https://forums.autodesk.com/t5/net-forum/creating-dwg-using-net/m-p/3358429#M57028</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;FONT color="#666699"&gt;&amp;gt;&amp;gt; But "&amp;nbsp;tNewDoc.CloseAndSave(tNewFileName)" is not working&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;Have you started that by a self-defined command? If so have you added the "Session"-flag?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;- alfred -&lt;/P&gt;</description>
      <pubDate>Mon, 05 Mar 2012 17:35:54 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/creating-dwg-using-net/m-p/3358429#M57028</guid>
      <dc:creator>Alfred.NESWADBA</dc:creator>
      <dc:date>2012-03-05T17:35:54Z</dc:date>
    </item>
    <item>
      <title>Re: Creating DWG using .Net</title>
      <link>https://forums.autodesk.com/t5/net-forum/creating-dwg-using-net/m-p/3359153#M57029</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sorry..I am not understanding what you are saying....can you please elaborate it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;-Raman&lt;/P&gt;</description>
      <pubDate>Tue, 06 Mar 2012 04:37:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/creating-dwg-using-net/m-p/3359153#M57029</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-03-06T04:37:47Z</dc:date>
    </item>
    <item>
      <title>Re: Creating DWG using .Net</title>
      <link>https://forums.autodesk.com/t5/net-forum/creating-dwg-using-net/m-p/3361435#M57030</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;you can define your own commands in your DLL, these commands do work either in document-context or in application-context. If they are working in document-context you can't activate an other document then that and that may be a problem if you try to open and/or to save another document then that where you started the command.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So take care of the attribtutes for your command-definition, one sample including the .Session flag:&lt;/P&gt;&lt;PRE&gt;&amp;lt;Autodesk.AutoCAD.Runtime.CommandMethod("OOCLoad", Autodesk.AutoCAD.Runtime.CommandFlags.Redraw Or Autodesk.AutoCAD.Runtime.CommandFlags.UsePickSet Or Autodesk.AutoCAD.Runtime.CommandFlags.&lt;STRONG&gt;&lt;FONT color="#0000FF"&gt;Session&lt;/FONT&gt;&lt;/STRONG&gt;)&amp;gt; _
Public Shared Sub OOCLoad()
   '....
End Sub&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;HTH, - alfred -&lt;/P&gt;</description>
      <pubDate>Wed, 07 Mar 2012 13:50:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/creating-dwg-using-net/m-p/3361435#M57030</guid>
      <dc:creator>Alfred.NESWADBA</dc:creator>
      <dc:date>2012-03-07T13:50:31Z</dc:date>
    </item>
  </channel>
</rss>

