You can get a list of PlotDevices with:
PlotConfigManager.RefreshList(RefreshCode.RefreshDevicesList);
string plotDevNames=null;
using (PlotConfigInfoCollection plotDevices= PlotConfigManager.Devices)
{
if (plotDevices != null && plotDevices.Count > 0)
{
plotDevNames = plotDevices.Cast<PlotConfigInfo>()
.Select(n => n.DeviceName).ToList();
}
}
And based on the (pc3)Name of the device you can decide to set the Units, Scale etc.
var lm = LayoutManager.Current;
var psv = PlotSettingsValidator.Current;
using (var tr = db.TransactionManager.StartTransaction())
{
var layoutName = lm.CurrentLayout;
var layoutId = lm.GetLayoutId(layoutName);
var layout = (Layout)tr.GetObject(layoutId, OpenMode.ForRead);
using (var ps = new PlotSettings(layout.ModelType))
{
ps.CopyFrom(layout);
//Set or Change the PlotDevice
//psv.SetPlotConfigurationName(ps, pc3Name, null);
//psv.RefreshLists(ps);
//or Get the PlotDevice and set Units accordingly
var pc3Name=ps.PlotConfigurationName;
var psUnits=(pc3Name.Contains("PDF",StringComparison.OrdinalIgnoreCase) ? PlotPaperUnit.Millimeters : PlotPaperUnit.Pixels;
psv.SetPlotPaperUnits(ps, psUnits);
layout.CopyFrom(ps);
}
tr.Commit();
}
PS: you might need this String Extension for the Case Insensitive Compare
public static class StringExtension
{
public static bool Contains(this string source, string toCheck, StringComparison compType)
{
return source != null && toCheck != null && source.IndexOf(toCheck, compType) >= 0;
}
}