.NET

Reply
Contributor
17 Posts
0 Kudos
Registered: ‎11-29-2005
Post 1 of 1

Visual Basic .NET Plotting

85 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
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post