views:

16

answers:

0

In AutoCAD, I use the PlotSettingsValidator.GetPlotDeviceList method to get all the possible plotters. The user then selects one of those plotters. When I go to plot the document, the PlotEngine.BeginDocument method expects one parameter that tells AutoCAD whether or not it should plot to file and another parameter with the file name. How can I figure out whether or not the device only plots to file (ex. "DWF6 ePlot.pc3")? I currently have code that solves this but it uses exception handling and I'd rather have a cleaner solution. The solution should also assume that I do not know which plotters are available until runtime. Any ideas?

try
{
  plotEngine.BeginDocument(plotInfo, document.Name, null, 1, false, String.Empty);
}
catch (Autodesk.AutoCAD.Runtime.Exception exception)
{
  if (exception.ErrorStatus == ErrorStatus.MustPlotToFile)
    plotEngine.BeginDocument(plotInfo, document.Name, null, 1, true, drawingFullPath);
  else
    throw;
}