Author Topic: AutoCAD Map3D Crashing on SetPlotConfigurationName  (Read 2528 times)

0 Members and 1 Guest are viewing this topic.

autogis

  • Guest
AutoCAD Map3D Crashing on SetPlotConfigurationName
« on: November 20, 2013, 11:57:09 AM »
Autocad is blowing up when SetPlotConfigurationName is called from a NETLOADed dll.  The problem is happening on a specific machine.   Also if I import that machines's settings onto my developer machine (using the import/export AutoCAD 2012 settings), I still cannot replicate the problem.  The code works correctly on my machine with the imported settings from the failing machine.  Here is the pertaining code:

string device = "Default Windows System Printer.pc3";
string NewLayoutName = "NewLayout";

LayoutManager layoutMgr = LayoutManager.Current;
layoutMgr.CurrentLayout = "Model";
                // Printer
                ObjectId layoutId_printer = layoutMgr.CreateLayout(NewLayoutName);
                using (Transaction t = db.TransactionManager.StartTransaction())
                {
                    PlotSettings ps = (PlotSettings)t.GetObject(layoutId_printer, OpenMode.ForWrite);
                    PlotSettingsValidator psv = Autodesk.AutoCAD.DatabaseServices.PlotSettingsValidator.Current;
                    psv.RefreshLists(ps);
                    // Set the device
                    psv.SetPlotConfigurationName(ps, device, null);  // <<< THIS LINE IS CRASHING


Attached is the Error.  The exception number can vary, it is not a fixed error number.  Also, the code does have a try/catch but it is not catching this error, AutoCAD is just crashing.

TIA

autogis

  • Guest
Re: AutoCAD Map3D Crashing on SetPlotConfigurationName
« Reply #1 on: November 20, 2013, 02:57:35 PM »
Problem Fixed:

I performed the following on the problem machine and the problem was fixed:

1. Open AutoCAD Map3D 2012
2. Left Click on Layout1 to select it. (Or any other layout)
3. Right Click on Layout1 and choose "Plot..."
4. Under "Printer/Plotter Name", choose "Default Windows System Printer.pc3".  It took about 30-40 seconds to select the printer. (In comparison to selecting the others which was right away)
5. The printer was not selected, it just showed a blank selection.
6. Click on Cancel to close the "Plot..." window
7. Right Click on Layout1 and choose "Plot..." again.
8. Under "Printer/Plotter Name", choose "Default Windows System Printer.pc3" again.  Again it took about 30-40 seconds to select the printer.
9. This time "Default Windows System Printer.pc3" stayed selected.  Click the "Ok" button.
10. Close autocad, open autocad, and now do a netload, run your dll, run your commands etc., as usual...

Problem was gone!  :-o
« Last Edit: November 20, 2013, 03:01:11 PM by autogis »

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: AutoCAD Map3D Crashing on SetPlotConfigurationName
« Reply #2 on: November 20, 2013, 03:00:45 PM »
yeahbutwhyumad?
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

autogis

  • Guest
Re: AutoCAD Map3D Crashing on SetPlotConfigurationName
« Reply #3 on: November 20, 2013, 03:02:33 PM »
Thanks MP for catching that one  :)

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: AutoCAD Map3D Crashing on SetPlotConfigurationName
« Reply #4 on: November 20, 2013, 03:04:26 PM »
:D
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst