Autocad 2018 plot/publish event handler
I'm fairly new to both the AutoCAD and the VB.net worlds. I've managed to make a DLL file with several event handlers that work. However, I seem unable to write an event handler for plotting and/or publishing. I've tried things like . . .
AddHandler Autodesk.AutoCAD.PlottingServices.BeginPlotEventHandler, AddressOf subBeginPlot
Wondering if anyone knows how this line should be?
Re: Autocad 2018 plot/publish event handler
In other words I'm simply looking for some sample code (in vb.net) of a "BeginPlot" event handler. I'm using AutoCAD 2018 if that matters any.
Re: Autocad 2018 plot/publish event handler
Excerpt from PlotEvents.cs (C#) in Autodesk's free MgdDbg developer tool (which includes source code), where AcPl == Autodesk.AutoCAD.PlottingServices:
Code:
// <snip>
protected override void
EnableEventsImp()
{
Utils.AcadUi.PrintToCmdLine("\nPlot Events Turned On ...\n");
AcPl.PlotReactorManager plot = new AcPl.PlotReactorManager();
plot.BeginDocument += new Autodesk.AutoCAD.PlottingServices.BeginDocumentEventHandler(event_BeginDocument);
plot.BeginPage += new Autodesk.AutoCAD.PlottingServices.BeginPageEventHandler(event_BeginPage);
plot.BeginPlot += new Autodesk.AutoCAD.PlottingServices.BeginPlotEventHandler(event_BeginPlot);
plot.EndDocument += new Autodesk.AutoCAD.PlottingServices.EndDocumentEventHandler(event_EndDocument);
plot.EndPage += new Autodesk.AutoCAD.PlottingServices.EndPageEventHandler(event_EndPage);
plot.EndPlot += new Autodesk.AutoCAD.PlottingServices.EndPlotEventHandler(event_EndPlot);
plot.PageCancelled += new Autodesk.AutoCAD.PlottingServices.PageCancelledEventHandler(event_PageCancelled);
plot.PlotCancelled += new Autodesk.AutoCAD.PlottingServices.PlotCancelledEventHandler(event_PlotCancelled);
}
// <snip>
private void
event_BeginPlot(object sender, Autodesk.AutoCAD.PlottingServices.BeginPlotEventArgs e)
{
// <-- do something useful
}
// <snip>
Re: Autocad 2018 plot/publish event handler
I'm not very good with C#. All of my other code is in VB.
1. Is there a way I could get this code in VB?
2. Do we know how I could add a C# module to my project and compile the .dll?
Re: Autocad 2018 plot/publish event handler
Quote:
Originally Posted by
Christmas050873782348
I'm not very good with C#. All of my other code is in VB.
1. Is there a way I could get this code in VB?
2. Do we know how I could add a C# module to my project and compile the .dll?
That is unfortunate, as there is far more C# sample code available.
First result in a Google search for "convert c# to vb" :
http://converter.telerik.com/
Re: Autocad 2018 plot/publish event handler
Quote:
Originally Posted by
BlackBox
That is unfortunate, as there is far more C# sample code available.
First result in a Google search for "convert c# to vb" :
http://converter.telerik.com/
I used to use SharpDevelop to do conversions.
Re: Autocad 2018 plot/publish event handler
Quote:
Originally Posted by
Ed Jobe
I used to use SharpDevelop to do conversions.
I made the mistake of starting in VB.NET as well :p... Then I taught myself C# reading a 'Pro C#' book and never looked back (thank you, Andrew Troelsen... It was a quick +/- 1800 pages!). :mrgreen: Ehhehehe
[Edit] - I've got the Professional C++ book on my desk now, as it happens. Haha However, with Civil 3D not implementing an ARX API, not sure I'll get around to that anytime soon... Although, I would like to code a RAM 'timings & voltage' app, as I cannot seem to find a Windows 10/DDR4 compatible version of CPU-Tweaker, or any alternative... Because Dell's Spring 2019 BIOS update _still_ doesn't support XMP 2.0, and I'd really like to run my new 2400 MHz RAM in CL12 in lieu of CL17 (for the uninitiated, CAS Latency 12 (1.35v) vs 17 (1.20v) at the same frequency is a +/- 30% boost in effective RAM speed). Grrr
Cheers