public void PrintLayout(PlotSettings plot_settings, ObjectId layout_id, string layout_name, string filename = "") {
var bg_plot = Application.GetSystemVariable("BACKGROUNDPLOT");
try {
Application.SetSystemVariable("BACKGROUNDPLOT", 0);
if (PlotFactory.ProcessPlotState != ProcessPlotState.NotPlotting) throw new Exception("Плоттер в данный момент занят");
using (var plot_info = new PlotInfo {Layout = layout_id}) {
plot_info.OverrideSettings = plot_settings;
Print(layout_name, plot_info, filename);
}
} finally {
Application.SetSystemVariable("BACKGROUNDPLOT", bg_plot);
}
}