TheSwamp

Code Red => .NET => Topic started by: T.Willey on April 11, 2007, 01:51:29 PM

Title: Getting a PlotConfig by name
Post by: T.Willey on April 11, 2007, 01:51:29 PM
How can I get a PlotConfig without setting it current?  When looking at the constructions for the PlotConfig class in the reflector, it is only asking for no arguements, or (IntPtr, Boolean).  I'm not sure what the 'IntPtr' is supposed to be.  I read that it is an integer that is system specific, so I tried this
Code: [Select]
IntPtr tempIntPtr = new IntPtr(5);
PlotConfig pc = new PlotConfig (tempIntPtr, false);
and got this as an error
Quote
c:\MyCustom\CSharp\AcadClass\Test\MyPlotv03.cs(651,20): error CS0122: 'Autodesk.AutoCAD.PlottingServices.PlotConfig.PlotConfig(System.IntPtr, bool)' is inaccessible due to its protection level
and when I tried it with no arguements, I got this error
Quote
c:\MyCustom\CSharp\AcadClass\Test\MyPlotv03.cs(650,20): error CS1501: No overload for method 'PlotConfig' takes '0' arguments

Is there anyway to get the PlotConfig without setting it current?  I'm going this route because I can't seem to get my batch plot routine to work, so I figured I would plot to file (since this worked), then send the file to the right plotter/printer, but I need the port of the plotter/printer, and the only way I see to get it is by the PlotConfig.

Any/all help/ideas/comments welcomed.  Thanks in advance.
Title: Re: Getting a PlotConfig by name
Post by: Chuck Gabriel on April 11, 2007, 09:13:45 PM
I can't see a way to do it without setting the PlotConfig current at least temporarily, something like this:

Code: [Select]
PlotConfig pcTmp = PlotConfigManager.CurrentConfig;
PlotConfig pc = PlotConfigManager.SetCurrentConfig("YourConfigName");
PlotConfigManager.SetCurrentConfig(pcTmp.DeviceName);
Title: Re: Getting a PlotConfig by name
Post by: T.Willey on April 12, 2007, 11:29:06 AM
I can't see a way to do it without setting the PlotConfig current at least temporarily, something like this:

Code: [Select]
PlotConfig pcTmp = PlotConfigManager.CurrentConfig;
PlotConfig pc = PlotConfigManager.SetCurrentConfig("YourConfigName");
PlotConfigManager.SetCurrentConfig(pcTmp.DeviceName);

Thanks Chuck.  That is what I was afraid of.