<?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: dwg open and close in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/dwg-open-and-close/m-p/7239787#M30596</link>
    <description>&lt;P&gt;Sorry, I gave you a bad link.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The page where you can convert VB.NET to C# is&amp;nbsp;&lt;A href="http://converter.telerik.com/" target="_blank"&gt;http://converter.telerik.com/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you're not able to convert that relatively-simple VB.NET code to C#, what else are you expecting to be able to do with the open Database ?&lt;/P&gt;</description>
    <pubDate>Wed, 19 Jul 2017 18:59:12 GMT</pubDate>
    <dc:creator>ActivistInvestor</dc:creator>
    <dc:date>2017-07-19T18:59:12Z</dc:date>
    <item>
      <title>dwg open and close</title>
      <link>https://forums.autodesk.com/t5/net-forum/dwg-open-and-close/m-p/7234848#M30586</link>
      <description>&lt;P&gt;I use AutoCAD plant3d 2016.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to open a new dwg during modeling work with .NET code&lt;/P&gt;&lt;P&gt;and after work (modeling etc), I want to close dwg that I opened with code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there any good way? only .NET code.&lt;/P&gt;</description>
      <pubDate>Tue, 18 Jul 2017 09:22:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/dwg-open-and-close/m-p/7234848#M30586</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-07-18T09:22:17Z</dc:date>
    </item>
    <item>
      <title>Re: dwg open and close</title>
      <link>https://forums.autodesk.com/t5/net-forum/dwg-open-and-close/m-p/7234913#M30587</link>
      <description>&lt;P&gt;You want to do this task as window application or run inside autocad using netload&lt;/P&gt;</description>
      <pubDate>Tue, 18 Jul 2017 09:58:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/dwg-open-and-close/m-p/7234913#M30587</guid>
      <dc:creator>amitnkukanur</dc:creator>
      <dc:date>2017-07-18T09:58:24Z</dc:date>
    </item>
    <item>
      <title>Re: dwg open and close</title>
      <link>https://forums.autodesk.com/t5/net-forum/dwg-open-and-close/m-p/7236417#M30588</link>
      <description>&lt;P&gt;Here is an example;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Public Sub dosomethingtodwg(mainDrawingFile As String)&lt;BR /&gt;Dim db As New Database(False, True)&lt;BR /&gt;db.ReadDwgFile(mainDrawingFile, System.IO.FileShare.ReadWrite, True, "")&lt;BR /&gt;Using db&lt;BR /&gt;Dim saveRequired As Boolean = False&lt;BR /&gt;db.dosomethingtodwg(True, False)&lt;BR /&gt;Using tr As Transaction = db.TransactionManager.StartTransaction()&lt;BR /&gt;dosomething.......&lt;BR /&gt;Next&lt;BR /&gt;tr.Commit()&lt;BR /&gt;tr.Dispose()&lt;BR /&gt;End Using&lt;BR /&gt;If saveRequired Then&lt;BR /&gt;db.SaveAs(mainDrawingFile, DwgVersion.Current)&lt;BR /&gt;End If&lt;BR /&gt;End Using&lt;/P&gt;</description>
      <pubDate>Tue, 18 Jul 2017 18:20:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/dwg-open-and-close/m-p/7236417#M30588</guid>
      <dc:creator>Littlerubarb</dc:creator>
      <dc:date>2017-07-18T18:20:22Z</dc:date>
    </item>
    <item>
      <title>Re: dwg open and close</title>
      <link>https://forums.autodesk.com/t5/net-forum/dwg-open-and-close/m-p/7236513#M30589</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/29298"&gt;@Littlerubarb&lt;/a&gt; wrote:&lt;BR /&gt;&lt;P&gt;Here is an example;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Public Sub dosomethingtodwg(mainDrawingFile As String)&lt;BR /&gt;Dim db As New Database(False, True)&lt;BR /&gt;db.ReadDwgFile(mainDrawingFile, System.IO.FileShare.ReadWrite, True, "")&lt;BR /&gt;Using db&lt;BR /&gt;Dim saveRequired As Boolean = False&lt;BR /&gt;db.dosomethingtodwg(True, False)&lt;BR /&gt;Using tr As Transaction = db.TransactionManager.StartTransaction()&lt;BR /&gt;dosomething.......&lt;BR /&gt;Next&lt;BR /&gt;tr.Commit()&lt;BR /&gt;tr.Dispose()&lt;BR /&gt;End Using&lt;BR /&gt;If saveRequired Then&lt;BR /&gt;db.SaveAs(mainDrawingFile, DwgVersion.Current)&lt;BR /&gt;End If&lt;BR /&gt;End Using &amp;nbsp;&lt;FONT color="#FF0000"&gt;&amp;lt;-- closes mainDrawingFile&lt;/FONT&gt;&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;When you call Dispose() on a Database that was accessed via ReadDwgFile(), that closes the file and releases the lock on it, so that it can be accessed by other users.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Was that the question?&lt;/P&gt;</description>
      <pubDate>Tue, 18 Jul 2017 18:59:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/dwg-open-and-close/m-p/7236513#M30589</guid>
      <dc:creator>ActivistInvestor</dc:creator>
      <dc:date>2017-07-18T18:59:14Z</dc:date>
    </item>
    <item>
      <title>Re: dwg open and close</title>
      <link>https://forums.autodesk.com/t5/net-forum/dwg-open-and-close/m-p/7236530#M30590</link>
      <description>&lt;P&gt;Yes it does close the drawing! In an automated process you would want to close the file. If you have a better idea please post it!&lt;/P&gt;</description>
      <pubDate>Tue, 18 Jul 2017 19:04:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/dwg-open-and-close/m-p/7236530#M30590</guid>
      <dc:creator>Littlerubarb</dc:creator>
      <dc:date>2017-07-18T19:04:22Z</dc:date>
    </item>
    <item>
      <title>Re: dwg open and close</title>
      <link>https://forums.autodesk.com/t5/net-forum/dwg-open-and-close/m-p/7236826#M30591</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/29298"&gt;@Littlerubarb&lt;/a&gt; wrote:&lt;BR /&gt;&lt;P&gt;Yes it does close the drawing! In an automated process you would want to close the file. If you have a better idea please post it!&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;There is no better idea. The example code you show is closing the DWG file when it reaches the last End Using statement. &amp;nbsp;There's nothing else that needs to be done.&lt;/P&gt;</description>
      <pubDate>Tue, 18 Jul 2017 20:57:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/dwg-open-and-close/m-p/7236826#M30591</guid>
      <dc:creator>ActivistInvestor</dc:creator>
      <dc:date>2017-07-18T20:57:38Z</dc:date>
    </item>
    <item>
      <title>Re: dwg open and close</title>
      <link>https://forums.autodesk.com/t5/net-forum/dwg-open-and-close/m-p/7237321#M30592</link>
      <description>&lt;P&gt;Thank you. reply my question.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sorry, can you change this example to c #?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The question is wrong. I should have done it with C# instead of vb.NET&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm sorry. I don't know vb.NET code. &amp;nbsp;T_T&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jul 2017 03:27:20 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/dwg-open-and-close/m-p/7237321#M30592</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-07-19T03:27:20Z</dc:date>
    </item>
    <item>
      <title>Re: dwg open and close</title>
      <link>https://forums.autodesk.com/t5/net-forum/dwg-open-and-close/m-p/7237327#M30593</link>
      <description>&lt;P&gt;The question is wrong. I should have done it with C# instead of vb.NET&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm sorry. I don't know vb.NET code. &amp;nbsp;T_T&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please. c# code instead of vb.net&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jul 2017 03:30:07 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/dwg-open-and-close/m-p/7237327#M30593</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-07-19T03:30:07Z</dc:date>
    </item>
    <item>
      <title>Re: dwg open and close</title>
      <link>https://forums.autodesk.com/t5/net-forum/dwg-open-and-close/m-p/7239203#M30594</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;@Anonymous wrote:&lt;BR /&gt;&lt;P&gt;The question is wrong. I should have done it with C# instead of vb.NET&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm sorry. I don't know vb.NET code. &amp;nbsp;T_T&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please. c# code instead of vb.net&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;visit &lt;A href="http://www.telerick.com" target="_blank"&gt;www.telerick.com&lt;/A&gt; and use their translator to translate VB.NET to C# and back.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jul 2017 16:07:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/dwg-open-and-close/m-p/7239203#M30594</guid>
      <dc:creator>ActivistInvestor</dc:creator>
      <dc:date>2017-07-19T16:07:56Z</dc:date>
    </item>
    <item>
      <title>Re: dwg open and close</title>
      <link>https://forums.autodesk.com/t5/net-forum/dwg-open-and-close/m-p/7239211#M30595</link>
      <description>&lt;P&gt;The C# will be much the same.&amp;nbsp; I recommend you try to rewrite it yourself first. &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://forums.autodesk.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;By the way, this could be opening a can of worms since Plant3D is "project based" with a host of other considerations.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jul 2017 16:09:32 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/dwg-open-and-close/m-p/7239211#M30595</guid>
      <dc:creator>dgorsman</dc:creator>
      <dc:date>2017-07-19T16:09:32Z</dc:date>
    </item>
    <item>
      <title>Re: dwg open and close</title>
      <link>https://forums.autodesk.com/t5/net-forum/dwg-open-and-close/m-p/7239787#M30596</link>
      <description>&lt;P&gt;Sorry, I gave you a bad link.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The page where you can convert VB.NET to C# is&amp;nbsp;&lt;A href="http://converter.telerik.com/" target="_blank"&gt;http://converter.telerik.com/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you're not able to convert that relatively-simple VB.NET code to C#, what else are you expecting to be able to do with the open Database ?&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jul 2017 18:59:12 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/dwg-open-and-close/m-p/7239787#M30596</guid>
      <dc:creator>ActivistInvestor</dc:creator>
      <dc:date>2017-07-19T18:59:12Z</dc:date>
    </item>
    <item>
      <title>Re: dwg open and close</title>
      <link>https://forums.autodesk.com/t5/net-forum/dwg-open-and-close/m-p/7240631#M30597</link>
      <description>&lt;P&gt;Sorry. I've never used vb.net.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have used only c++ and c# on visual studio. I've never used anything else.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So I can convert c++ to c#, or c# to c++. a little.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Thu, 20 Jul 2017 01:24:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/dwg-open-and-close/m-p/7240631#M30597</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-07-20T01:24:22Z</dc:date>
    </item>
    <item>
      <title>Re: dwg open and close</title>
      <link>https://forums.autodesk.com/t5/net-forum/dwg-open-and-close/m-p/7244426#M30598</link>
      <description>&lt;P&gt;I convert .net to C# that this code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Dim db As New Database(False, True)
db.ReadDwgFile(mainDrawingFile, System.IO.FileShare.ReadWrite, True, "")&lt;/PRE&gt;&lt;P&gt;In this code, An error occurs in ReadDwgFile method. so I changed bool value.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;false, true -&amp;gt; error,&lt;/P&gt;&lt;P&gt;true, false -&amp;gt; error,&lt;/P&gt;&lt;P&gt;false, false -&amp;gt; error,&lt;/P&gt;&lt;P&gt;true, true -&amp;gt; no error.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;so I used below code&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Database db = new Database(true, true);&lt;BR /&gt;//If dwg file doesn't exist, It occurs error. so I used SaveAs method&lt;BR /&gt;db.SaveAs(newDwgName, DwgVersion.Current);
db.ReadDwgFile(newDwgName, System.IO.FileShare.ReadWrite, true, "");&lt;BR /&gt;&lt;BR /&gt;Document openDoc = Application.DocumentManager.Open(newDwgName,false);&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;By the way, I have a problem.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In new dwg, drawing pipe is not work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Always pop up alert dialog that dwg insert to current project.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Help me~~~.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Jul 2017 10:29:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/dwg-open-and-close/m-p/7244426#M30598</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-07-21T10:29:34Z</dc:date>
    </item>
    <item>
      <title>Re: dwg open and close</title>
      <link>https://forums.autodesk.com/t5/net-forum/dwg-open-and-close/m-p/7244939#M30599</link>
      <description>&lt;P&gt;You question is quite vague to get a useful respond/answer. The code suggested in earlier reply may or may not suit to your need. You'd better describe the process of your need in more details:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What does "open" and "close" mean? drawing file can be opened/closed as Document&amp;nbsp;in/from AutoCAD editor, or can be "opened/closed" as side Database without being visible in AutoCAD. When opening in AutoCAD editor as Document, it can be opened in Document context (so, it would not become MdiActiveDocument), or opened in Application context (it becomes MdiDocument upon opening)...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Without knowing the situation of your business requirement, it is difficult to provide useful code/suggestion, but you DO NOT need to create an empty data base, save it to file, then open it as Document. In most cases, you can use DocumentCollectionExtension.Add()/Open() to OPEN a drawing in AutoCAD editor.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, since you use AutoCAD vertical product (Acad Plant), opening drawing as side Database may not allow you to reach the vertical product's specific data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Jul 2017 13:29:54 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/dwg-open-and-close/m-p/7244939#M30599</guid>
      <dc:creator>norman.yuan</dc:creator>
      <dc:date>2017-07-21T13:29:54Z</dc:date>
    </item>
    <item>
      <title>Re: dwg open and close</title>
      <link>https://forums.autodesk.com/t5/net-forum/dwg-open-and-close/m-p/7248125#M30600</link>
      <description>&lt;P&gt;Thank you for&amp;nbsp;your reply.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to create and open new dwg file in current AutoCAD project with C# code.&lt;/P&gt;&lt;P&gt;then, modeling this dwg file that I created.&lt;/P&gt;&lt;P&gt;And modeling is done, close dwg file.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I don't know what should I do.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You said DocumentcollectionExtension's Add, Open method,&lt;/P&gt;&lt;P&gt;are these method useful in this topic?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 24 Jul 2017 00:39:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/dwg-open-and-close/m-p/7248125#M30600</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-07-24T00:39:03Z</dc:date>
    </item>
  </channel>
</rss>

