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:
Public Function CDOpen() As Boolean 'return value
Dim ThisDrawing As Autodesk.AutoCAD.Interop.AcadDocument
Dim acadApp As Autodesk.AutoCAD.Interop.AcadApplication
Try
'WriteLogFile(ControlChars.CrLf & "Start Autocad")
'start a new autocad session, does not check to see if
'there is any other sessions already
acadApp = New Autodesk.AutoCAD.Interop.AcadApplication 'start a new autocad session
acadApp.Visible = True 'show it
ThisDrawing = acadApp.ActiveDocument 'make the current drawing as active
SDIVariable = CInt(ThisDrawing.GetVariable("sdi"))
ThisDrawing.SetVariable("sdi", 0) 'set MDI mode (set SDI off) to enable drawing to be opened as readonly
ThisDrawing.SetVariable("backgroundplot", 0)
ThisDrawing.Close(False) 'close current drawing and don't save changes (False)
Dim i As Integer
For i = 0 To DrawingList.Items.Count - 1
BorderSize = ""
DrawingPathName = Path.GetDirectoryName(DrawingList.Items.Item(i))
DrawingFileName = Path.GetFileNameWithoutExtension(DrawingList.Items.Item(i))
acadApp.Documents.Open(CStr(DrawingList.Items.Item(i)), True) 'open drawing as Read Only = True
ThisDrawing = acadApp.ActiveDocument 'make this drawing current
ThisDrawing.ActiveSpace = Autodesk.AutoCAD.Interop.Common.AcActiveSpace.acPaperSpace
I drag and drop the drawings onto a list box.
I believe I have everything set up for 64 bit but cannot get a drawing to open.
Am I missing something obvious?
I have also noticed that COM is not the way to go, so what is the right way using .net, Transactions? NETLOAD? SensCommand?
I would really like to get my COM version running again before I take the time to re-write it the new/better way
Thanks for any help
Colin
Edited by: colin.dodds on Mar 25, 2010 12:22 PM