Results 1 to 7 of 7

Thread: Autocad 2018 plot/publish event handler

  1. #1
    Login to Give a bone
    0

    Default 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?

  2. #2
    Login to Give a bone
    0

    Default 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.

  3. #3
    Administrator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    5,714
    Login to Give a bone
    0

    Default 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>
    "How we think determines what we do, and what we do determines what we get."

    Sincpac C3D ~ Autodesk Exchange Apps

    Computer Specs:
    Dell Precision 3660, Core i9-12900K 5.2GHz, 64GB DDR5 RAM, PCIe 4.0 M.2 SSD (RAID 0), 16GB NVIDIA RTX A4000

  4. #4
    Login to Give a bone
    0

    Default 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?

  5. #5
    Administrator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    5,714
    Login to Give a bone
    0

    Default Re: Autocad 2018 plot/publish event handler

    Quote Originally Posted by Christmas050873782348 View Post
    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/
    "How we think determines what we do, and what we do determines what we get."

    Sincpac C3D ~ Autodesk Exchange Apps

    Computer Specs:
    Dell Precision 3660, Core i9-12900K 5.2GHz, 64GB DDR5 RAM, PCIe 4.0 M.2 SSD (RAID 0), 16GB NVIDIA RTX A4000

  6. #6
    Administrator Ed Jobe's Avatar
    Join Date
    2000-11
    Location
    Turlock, CA
    Posts
    6,397
    Login to Give a bone
    0

    Default Re: Autocad 2018 plot/publish event handler

    Quote Originally Posted by BlackBox View Post
    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.
    C:> ED WORKING....

  7. #7
    Administrator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    5,714
    Login to Give a bone
    0

    Default Re: Autocad 2018 plot/publish event handler

    Quote Originally Posted by Ed Jobe View Post
    I used to use SharpDevelop to do conversions.
    I made the mistake of starting in VB.NET as well ... Then I taught myself C# reading a 'Pro C#' book and never looked back (thank you, Andrew Troelsen... It was a quick +/- 1800 pages!). 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
    Last edited by BlackBox; 2019-06-13 at 10:33 PM.
    "How we think determines what we do, and what we do determines what we get."

    Sincpac C3D ~ Autodesk Exchange Apps

    Computer Specs:
    Dell Precision 3660, Core i9-12900K 5.2GHz, 64GB DDR5 RAM, PCIe 4.0 M.2 SSD (RAID 0), 16GB NVIDIA RTX A4000

Similar Threads

  1. Next event June 6th, 2018 - webster groves
    By Wanderer in forum St. Louis Revit Users Group - STLRUG
    Replies: 0
    Last Post: 2018-05-24, 02:06 PM
  2. Quadro M1200 for Autocad 2018 and Revit 2018
    By fredrik.schlau in forum Hardware
    Replies: 8
    Last Post: 2018-03-19, 09:09 PM
  3. Replies: 9
    Last Post: 2014-07-07, 02:40 AM
  4. Handler AutoCAD Window Moved
    By jason907238 in forum Dot Net API
    Replies: 3
    Last Post: 2011-11-17, 10:37 PM
  5. Event Handler to toggle LTScale between MS/PS
    By RobertB in forum VBA/COM Interop
    Replies: 0
    Last Post: 2004-06-05, 03:49 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •