Code:
using System.Diagnostics;public class Script
{
[Start]
//[DeclareAction("EbeneAusschalten")]
public void EbeneAusFuerPDF() // Funktion*
{
// Ebene_2 ausschalten (Unsichtbar machen)
ActionCallingContext EbeneAus = new ActionCallingContext();
EbeneAus.AddParameter("Layerstate", "Santex_2| |n|n|;Santex_3| |n|n|"); // "<EBENE>|<Textgröße>|<Sichtbar>|<Drucken>|<Farbe>"
new CommandLineInterpreter().Execute("ToggleLayers", EbeneAus);
//Projekt; Projektname ermitteln und Endung abschneiden.
string sProjectName = PathMap.SubstitutePath("$(PROJECTNAME)");
string Projectpath = PathMap.SubstitutePath("$(PROJECTPATH)");
Projectpath = Projectpath.Substring(0, Projectpath.LastIndexOf("\\")) + @"\";
ActionCallingContext exportContext = new ActionCallingContext ();
exportContext.AddParameter("TYPE","PDFPROJECT");
exportContext.AddParameter("exportfile",@"T:\"+ sProjectName +"_Bedienpanels.pdf");
exportContext.AddParameter("blackwhite","1"); //0 = PDF wird farbig
exportContext.AddParameter("useprintmargins","0"); // 1= Seiten werden mit Druckrändern ausgegeben
exportContext.AddParameter("usezoom","0"); // 1 = Zoomfaktor für die Anzeige
exportContext.AddParameter("zoomlevel","100");
exportContext.AddParameter("usesimplelink","0"); //1 = einfache Sprungfunktion
exportContext.AddParameter("readonlyexport","1"); //1 = PDF wird schreibgeschützt
exportContext.AddParameter("exportscheme","Santex Bedienseiten +BED"); // Filter für +BED
exportContext.AddParameter("fastwebview","1"); //1 = schnelle Web-Anzeige
exportContext.AddParameter("exportmodel","0");
//exportContext.AddParameter("ProjectName",strProjectName);
// PDF: Action
Progress ProgressPDF = new Progress("ProgressPDF");
ProgressPDF.BeginPart(100, "");
ProgressPDF.SetAllowCancel(true);
new CommandLineInterpreter().Execute("export",exportContext);
ProgressPDF.EndPart(true);
// PDF: Öffnen
//Process pPDF = new Process();
// System.Diagnostics.Process.Start(Projectpath + sProjectName + ".pdf");
// Ebene Santex_2 wieder einschalten
ActionCallingContext EbeneEin = new ActionCallingContext();
EbeneEin.AddParameter("Layerstate", "Santex_2| |y|y|;Santex_3| |y|y|"); // "<EBENE>|<Textgröße>|<Sichtbar>|<Drucken>|<Farbe>"
new CommandLineInterpreter().Execute("ToggleLayers", EbeneEin);
}
}