<?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: Using COM and 2010 to batch plot drawings in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/using-com-and-2010-to-batch-plot-drawings/m-p/2654681#M66256</link>
    <description>I have dealt with C#, but not VB with AutoCAD.  As a thought, see what acadApp.Documents.Open(CStr(DrawingList.Items.Item(i)), True) returns.  It should return an AcadDocument...&lt;BR /&gt;
&lt;BR /&gt;
So... my suggestiong would be to try this:&lt;BR /&gt;
&lt;BR /&gt;
ThisDrawing  = acadApp.Documents.Open(CStr(DrawingList.Items.Item(i)), True) 'open drawing as Read Only = True&lt;BR /&gt;
&lt;BR /&gt;
And removing the other ThisDrawing assignment.</description>
    <pubDate>Fri, 26 Mar 2010 14:41:05 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2010-03-26T14:41:05Z</dc:date>
    <item>
      <title>Using COM and 2010 to batch plot drawings</title>
      <link>https://forums.autodesk.com/t5/net-forum/using-com-and-2010-to-batch-plot-drawings/m-p/2654680#M66255</link>
      <description>I have a programme I used for batch plotting using COM which works with 2006 and 2008, but now I have switched to 64 bit 2010 and it just won't work. I can get autocad to open up but not to open a drawing.  The code to open is:&lt;BR /&gt;
 Public Function CDOpen() As Boolean 'return value&lt;BR /&gt;
        Dim ThisDrawing As Autodesk.AutoCAD.Interop.AcadDocument&lt;BR /&gt;
        Dim acadApp As Autodesk.AutoCAD.Interop.AcadApplication&lt;BR /&gt;
&lt;BR /&gt;
        Try&lt;BR /&gt;
            'WriteLogFile(ControlChars.CrLf &amp;amp; "Start Autocad")&lt;BR /&gt;
            'start a new autocad session, does not check to see if&lt;BR /&gt;
            'there is any other sessions already&lt;BR /&gt;
&lt;BR /&gt;
            acadApp = New Autodesk.AutoCAD.Interop.AcadApplication 'start a new autocad session&lt;BR /&gt;
            acadApp.Visible = True 'show it&lt;BR /&gt;
&lt;BR /&gt;
            ThisDrawing = acadApp.ActiveDocument   'make the current drawing as active&lt;BR /&gt;
            SDIVariable = CInt(ThisDrawing.GetVariable("sdi"))&lt;BR /&gt;
            ThisDrawing.SetVariable("sdi", 0) 'set MDI mode (set SDI off) to enable drawing to be opened as readonly&lt;BR /&gt;
            ThisDrawing.SetVariable("backgroundplot", 0)&lt;BR /&gt;
            ThisDrawing.Close(False) 'close current drawing and don't save changes (False)&lt;BR /&gt;
&lt;BR /&gt;
            Dim i As Integer&lt;BR /&gt;
&lt;BR /&gt;
            For i = 0 To DrawingList.Items.Count - 1&lt;BR /&gt;
&lt;BR /&gt;
                BorderSize = ""&lt;BR /&gt;
&lt;BR /&gt;
                DrawingPathName = Path.GetDirectoryName(DrawingList.Items.Item(i))&lt;BR /&gt;
                DrawingFileName = Path.GetFileNameWithoutExtension(DrawingList.Items.Item(i))&lt;BR /&gt;
&lt;BR /&gt;
                acadApp.Documents.Open(CStr(DrawingList.Items.Item(i)), True) 'open drawing as Read Only = True&lt;BR /&gt;
                ThisDrawing = acadApp.ActiveDocument 'make this drawing current&lt;BR /&gt;
                ThisDrawing.ActiveSpace = Autodesk.AutoCAD.Interop.Common.AcActiveSpace.acPaperSpace&lt;BR /&gt;
&lt;BR /&gt;
I drag and drop the drawings onto a list box.&lt;BR /&gt;
&lt;BR /&gt;
I believe I have everything set up for 64 bit but cannot get a drawing to open.&lt;BR /&gt;
&lt;BR /&gt;
Am I missing something obvious?&lt;BR /&gt;
&lt;BR /&gt;
I have also noticed that COM is not the way to go, so what is the right way using .net, Transactions? NETLOAD? SensCommand?&lt;BR /&gt;
&lt;BR /&gt;
I would really like to get my COM version running again before I take the time to re-write it the new/better way&lt;BR /&gt;
&lt;BR /&gt;
Thanks for any help&lt;BR /&gt;
&lt;BR /&gt;
Colin

Edited by: colin.dodds on Mar 25, 2010 12:22 PM</description>
      <pubDate>Thu, 25 Mar 2010 12:18:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/using-com-and-2010-to-batch-plot-drawings/m-p/2654680#M66255</guid>
      <dc:creator>Colin_Dodds</dc:creator>
      <dc:date>2010-03-25T12:18:21Z</dc:date>
    </item>
    <item>
      <title>Re: Using COM and 2010 to batch plot drawings</title>
      <link>https://forums.autodesk.com/t5/net-forum/using-com-and-2010-to-batch-plot-drawings/m-p/2654681#M66256</link>
      <description>I have dealt with C#, but not VB with AutoCAD.  As a thought, see what acadApp.Documents.Open(CStr(DrawingList.Items.Item(i)), True) returns.  It should return an AcadDocument...&lt;BR /&gt;
&lt;BR /&gt;
So... my suggestiong would be to try this:&lt;BR /&gt;
&lt;BR /&gt;
ThisDrawing  = acadApp.Documents.Open(CStr(DrawingList.Items.Item(i)), True) 'open drawing as Read Only = True&lt;BR /&gt;
&lt;BR /&gt;
And removing the other ThisDrawing assignment.</description>
      <pubDate>Fri, 26 Mar 2010 14:41:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/using-com-and-2010-to-batch-plot-drawings/m-p/2654681#M66256</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2010-03-26T14:41:05Z</dc:date>
    </item>
    <item>
      <title>Re: Using COM and 2010 to batch plot drawings</title>
      <link>https://forums.autodesk.com/t5/net-forum/using-com-and-2010-to-batch-plot-drawings/m-p/2654682#M66257</link>
      <description>Thanks for the suggestion, cut the whole thing down to open a drawing, nothing else.&lt;BR /&gt;
It never gets to the open part and seems to think once autocad is open that's it.&lt;BR /&gt;
&lt;BR /&gt;
Try&lt;BR /&gt;
'WriteLogFile(ControlChars.CrLf &amp;amp; "Start Autocad")&lt;BR /&gt;
'start a new autocad session, does not check to see if&lt;BR /&gt;
'there is any other sessions already&lt;BR /&gt;
&lt;BR /&gt;
acadApp = New Autodesk.AutoCAD.Interop.AcadApplication 'start a new autocad session&lt;BR /&gt;
acadApp.Visible = True 'show it&lt;BR /&gt;
&lt;BR /&gt;
ThisDrawing = acadApp.ActiveDocument 'make the current drawing as active&lt;BR /&gt;
&lt;BR /&gt;
acadApp.Documents.Open("c:\test\drawing1.dwg, True) 'open drawing as Read Only = True</description>
      <pubDate>Mon, 29 Mar 2010 07:53:12 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/using-com-and-2010-to-batch-plot-drawings/m-p/2654682#M66257</guid>
      <dc:creator>Colin_Dodds</dc:creator>
      <dc:date>2010-03-29T07:53:12Z</dc:date>
    </item>
  </channel>
</rss>

