.NET

Reply
Mentor
Amremad
Posts: 217
Registered: ‎08-24-2010
Message 1 of 12 (1,030 Views)
Accepted Solution

Plotting Device Information with events

1030 Views, 11 Replies
04-23-2013 04:40 AM

hi

 

how can i catch the plotting information (paper size and scale ... ) using plotting device??

I was on vacation for a while. So, this reply might be a late. But here it goes anyway.

 

Have you looked at Autodesk.AutoCAD.PlottingServices.PlotReactorManager class?

 

It raises events when AutoCAD plots: Begin/EndPlot, Begin/EndDocument, BeginEndPage... I am not sure what "Plot" event Balaji was referring to, but PlotReactorManager class provides all information you need to know (copies of plot, paper size, plot device name...via BeginPlot/Document/PageEventArgs.

 

So, simply get an instance of PlotReactorManager and handle the events raised by it, you'll get all the information whan AutoCAD plots. Specifically, if you need to know paper size, you need to handle BeginPage, and the BeginPageEventArgs has a property "PlotInfo", which intern has a property "ValidatedSettings" (type of PlotSettings), from which you can get the information of paper size, scale...

 

I posted an article a couple of years ago that might be of help to you:

 

http://drive-cad-with-code.blogspot.ca/2011_02_01_archive.html

 

 

Mentor
khoa.ho
Posts: 219
Registered: ‎09-15-2011
Message 2 of 12 (1,011 Views)

Re: Plotting Device Information with events

04-23-2013 08:22 AM in reply to: Amremad

Hi,

 

Try to use PlotSettings, PlotSettingsValidator. AutoCAD DevBlog will give you a hint at this link.

 

-Khoa

www.netscriptcad.com

 

Mentor
Amremad
Posts: 217
Registered: ‎08-24-2010
Message 3 of 12 (976 Views)

Re: Plotting Device Information with events

04-28-2013 12:40 AM in reply to: khoa.ho

no no no

 

i need to know when user plote

 

whate the device and paper size and other plotting information

ADN Support Specialist
Balaji_Ram
Posts: 715
Registered: ‎03-21-2011
Message 4 of 12 (942 Views)

Re: Plotting Device Information with events

05-02-2013 05:29 AM in reply to: Amremad

The Plot event does not provide such information.

It is limited to what the "BeginPlotEventArgs" class provides. 



Balaji
Developer Technical Services
Autodesk Developer Network

*Expert Elite*
norman.yuan
Posts: 1,019
Registered: ‎04-27-2009
Message 5 of 12 (920 Views)

Re: Plotting Device Information with events

05-06-2013 03:07 AM in reply to: Amremad

I was on vacation for a while. So, this reply might be a late. But here it goes anyway.

 

Have you looked at Autodesk.AutoCAD.PlottingServices.PlotReactorManager class?

 

It raises events when AutoCAD plots: Begin/EndPlot, Begin/EndDocument, BeginEndPage... I am not sure what "Plot" event Balaji was referring to, but PlotReactorManager class provides all information you need to know (copies of plot, paper size, plot device name...via BeginPlot/Document/PageEventArgs.

 

So, simply get an instance of PlotReactorManager and handle the events raised by it, you'll get all the information whan AutoCAD plots. Specifically, if you need to know paper size, you need to handle BeginPage, and the BeginPageEventArgs has a property "PlotInfo", which intern has a property "ValidatedSettings" (type of PlotSettings), from which you can get the information of paper size, scale...

 

I posted an article a couple of years ago that might be of help to you:

 

http://drive-cad-with-code.blogspot.ca/2011_02_01_archive.html

 

 

ADN Support Specialist
Balaji_Ram
Posts: 715
Registered: ‎03-21-2011
Message 6 of 12 (914 Views)

Re: Plotting Device Information with events

05-06-2013 04:37 AM in reply to: Amremad

Sorry, I did not pay attention to the "BeginPageEventArgs" class.

 

Thanks to Norman for correcting me and the link to his nice blog post.



Balaji
Developer Technical Services
Autodesk Developer Network

Mentor
Amremad
Posts: 217
Registered: ‎08-24-2010
Message 7 of 12 (891 Views)

Re: Plotting Device Information with events

05-07-2013 01:37 AM in reply to: norman.yuan
Imports Autodesk.AutoCAD.PlottingServices
Public Class AMRLISP
    Dim WithEvents PlotManager As PlotReactorManager
    Private Sub PlotManager_BeginPlot(sender As Object, e As BeginPlotEventArgs) Handles PlotManager.BeginPlot
        MsgBox("BeginPlot")
    End Sub
End Class

 thankyou Mr. norman.yuan

 

can help me with above code?? plz

the message doesn't appear  ... Why ??

 

 

ADN Support Specialist
Balaji_Ram
Posts: 715
Registered: ‎03-21-2011
Message 8 of 12 (886 Views)

Re: Plotting Device Information with events

05-07-2013 01:51 AM in reply to: Amremad

Can you try this ?

 

    Public Sub InitializePlotEvents()

        mPlotReactorManager = New PlotReactorManager()

        AddHandler mPlotReactorManager.BeginPlot, AddressOf BeginPlot
        AddHandler mPlotReactorManager.EndPlot, AddressOf EndPlot

    End Sub

    Private Sub BeginPlot(ByVal sender As Object, ByVal e As Autodesk.AutoCAD.PlottingServices.BeginPlotEventArgs)

        WriteMessage("BeginPlot")

    End Sub

    Private Sub EndPlot(ByVal sender As Object, ByVal e As Autodesk.AutoCAD.PlottingServices.EndPlotEventArgs)

        WriteMessage("EndPlot")

    End Sub

 Edit :

 

Also remember to set the "BACKGROUNDPLOT” system variable to 0.



Balaji
Developer Technical Services
Autodesk Developer Network

Mentor
Amremad
Posts: 217
Registered: ‎08-24-2010
Message 9 of 12 (882 Views)

Re: Plotting Device Information with events

05-07-2013 01:58 AM in reply to: Balaji_Ram

i need to use events not delegates

 

i know this way but i need to use the events , but i don't know what can i write in Initialize Method to run my events

Mentor
Amremad
Posts: 217
Registered: ‎08-24-2010
Message 10 of 12 (880 Views)

Re: Plotting Device Information with events

05-07-2013 02:01 AM in reply to: Amremad

i solve it

 

i wort  in Initialize Method

 

PlotManager = New  PlotReactorManager

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Need installation help?

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