Author Topic: AutoCAD2007 Plotting from standalaone VB Application  (Read 3206 times)

0 Members and 1 Guest are viewing this topic.

freeman3k

  • Guest
AutoCAD2007 Plotting from standalaone VB Application
« on: July 23, 2007, 11:49:14 AM »
Hello,
I've this simple function:

Code: [Select]
Dim acad As AcadApplication
Dim doc As AcadDocument
acad = Nothing
doc = Nothing



Try
acad = CreateObject("AutoCAD.Application")

acad.Visible = True
doc = acad.Documents.Open("c:\prova2_123.dwg", True, Nothing)


Dim docActive As AcadDocument = acad.ActiveDocument

'MsgBox(docActive.Name)




docActive.PaperSpace.Layout.PlotType = AcPlotType.acExtents
docActive.PaperSpace.Layout.StandardScale = AcPlotScale.acScaleToFit
docActive.PaperSpace.Layout.CenterPlot = True
docActive.PaperSpace.Layout.ConfigName = "DWG To PDF.pc3"
docActive.Plot.NumberOfCopies = 1

docActive.Plot.PlotToFile("c:\out.pdf")

Catch e As Exception
Console.WriteLine(e.Message)
Console.WriteLine(e.StackTrace)
End Try

But docActive.Plot.PlotToFile return False. I don't know why :'(

Inside AutoCAD I got this message:

Quote
Job: - Canceled

Job ID: 1
Sheet set name:
Date and time started: 22/07/2007 22.14.33
Date and time completed: 22/07/2007 22.14.33
UserID: user
Profile ID: <>
Total sheets: 0
Sheets plotted: 0
Number of errors: 0
Number of warnings: 0

No runtime error was generated, just not plot.

Sorry maybe is a stupid error, but I'm new to AutoCAD Programming and .NET Programming :'(

I hope you can help me.

Thank you.

Alfredo

Guest

  • Guest
Re: AutoCAD2007 Plotting from standalaone VB Application
« Reply #1 on: July 23, 2007, 12:01:16 PM »
The only thing that comes to mind would be trying this:

Code: [Select]
docActive.Plot.PlotToDevice
P.S. Welcome to the Swamp!



One other thing... The DWG to PDF.pc3 is a steaming pile of &*%^.  Use something else if you can.

mohnston

  • Bull Frog
  • Posts: 305
  • CAD Programmer
Re: AutoCAD2007 Plotting from standalaone VB Application
« Reply #2 on: July 26, 2007, 02:02:38 PM »
The only thing that comes to mind would be trying this:

Code: [Select]
docActive.Plot.PlotToDevice
P.S. Welcome to the Swamp!



One other thing... The DWG to PDF.pc3 is a steaming pile of &*%^.  Use something else if you can.

I use PDFCreator and like it.
Then you can just use PlotToDevice.
It's amazing what you can do when you don't know what you can't do.
CAD Programming Solutions