.NET

Reply
Contributor
cctbailey
Posts: 17
Registered: ‎11-29-2005
Message 1 of 1 (80 Views)

Visual Basic .NET Plotting

80 Views, 0 Replies
12-09-2005 09:12 AM
Hi! I found some code elsewhere on this board that I am trying to implement in my program. I need to open a drawing and create a plt file of it. The code I'm trying to copy is:

objAutoCADDocs.Open(filelocation)

objAutoCADDoc = objAutoCADApp.ActiveDocument

objAutoCADDoc.PaperSpace.Layout.PlotType = AcPlotType.acExtents
objAutoCADDoc.PaperSpace.Layout.StandardScale = AcPlotScale.acScaleToFit
objAutoCADDoc.PaperSpace.Layout.CenterPlot = True
objAutoCADDoc.PaperSpace.Layout.ConfigName = "DWF6 ePlot.pc3"
objAutoCADDoc.Plot.PlotToFile(plotname)

objAutoCADDoc.Close()


This person did not post their Imports statements, but here is what I have:

Imports System
Imports System.Runtime.InteropServices
Imports Autodesk.AutoCAD.Runtime
Imports Autodesk.AutoCAD.ApplicationServices
Imports acadApp = Autodesk.AutoCAD.ApplicationServices.Application
Imports AcadDocument = Autodesk.AutoCAD.ApplicationServices.Document

Public Sub pltFileCreate()
acadApp.MainWindow.Visible = True
acadApp.MainWindow.WindowState = FormWindowState.Normal
Dim origSDI As Boolean = acadApp.Preferences.System.SingleDocumentMode
acadApp.Preferences.System.SingleDocumentMode = False
Dim objAutoCADDocs = acadApp.DocumentManager

Dim objAutoCADDoc As AcadDocument
objAutoCADDoc = objAutoCADDocs.Open("C:\Sample30x42Drawing.dwg")

End Sub

This all works great, but it dies when I try to copy the line above:

objAutoCADDoc = objAutoCADApp.ActiveDocument

When I try to set objAutoCADDoc equal to my acadApp.ActiveDocument, I get "'ActiveDocument' is not a memeber of 'Autodesk.AutoCAD.ApplicationServices.Application'." How can I set my objAutoCADDoc equal to the document that I open so I can access the plotting commands as in the example?

Any help would be greatly appreciated.

Christy
Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.