using System; using System.IO; using System.Windows.Forms; using Eplan.EplApi.ApplicationFramework; using Eplan.EplApi.Base; using Eplan.EplApi.Scripting; public class IoCheckList { static string PathLocalEplanTempFolder { get { return Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); } } [Start] public void Export() { string strFolderEinzeldateien = PathLocalEplanTempFolder + @"\EplanTemp\IO_Checkliste\Einzeldateien\"; string strFolder = PathLocalEplanTempFolder + @"\EplanTemp\IO_Checkliste\"; string strStrukturkennzeichen = strFolder + @"Strukturkennzeichen.txt"; //MessageBox.Show(strStrukturkennzeichen); string[] lines = System.IO.File.ReadAllLines(strStrukturkennzeichen); int NumberOfSteps = lines.Length; int count = 0; Progress progress = new Progress("Simple Progress"); progress.SetAllowCancel(false); progress.SetNeededSteps(NumberOfSteps); progress.SetTitle("IO Checkliste exportieren."); progress.ShowImmediately(); foreach (string line in lines) { count++; ////MessageBox.Show(line); progress.Step(count); string strFilterScheme = line.Replace("+", ""); FilterSchemaAnpassen(strFilterScheme, strFolderEinzeldateien); } progress.EndPart(true); } //Hier wird das Filterschema für den Einbauort angepasst public static void FilterSchemaAnpassen(string FilterScheme, string DestinationFile) { Eplan.EplApi.Base.Settings oSettings = new Eplan.EplApi.Base.Settings(); string sSchemeName = "EA-Liste"; //Name des Schemas Fertigungsdaten Export string sLocation = FilterScheme; //Wert der bei Einbauort eingetragen wird SchemeSetting oSchemeSetting = new SchemeSetting(); oSchemeSetting.Init("USER.Labelling.Config"); //Einstellungspfad zum Schema if (oSchemeSetting.CheckIfSchemeExists(sSchemeName)) { oSchemeSetting.SetScheme(sSchemeName); string sValue = "0|1|0|1220;0|0|" + sLocation + "|0|1|1|0|0|0;0|"; //Wert des Sortierschemas oSchemeSetting.SetStringSetting("SortFilter.FilterSchemeData", sValue, 0); //Wert einstellen } BeschriftungenAusgeben(DestinationFile + @"+" + FilterScheme + @"_EA Liste.xlsx"); //return; } //Beschriftungen ausgeben public static void BeschriftungenAusgeben(string Destinationfile) { ActionCallingContext LabellingContext = new ActionCallingContext(); LabellingContext.AddParameter("CONFIGSCHEME", "EA-Liste"); LabellingContext.AddParameter("DESTINATIONFILE", Destinationfile); LabellingContext.AddParameter("FILTERSCHEME", ""); LabellingContext.AddParameter("SUBFILTERSCHEME", "Nur EAs"); LabellingContext.AddParameter("SORTSCHEME", ""); LabellingContext.AddParameter("SUBSORTSCHEME", "SPS-Adresse"); LabellingContext.AddParameter("TASKREPEAT", ""); LabellingContext.AddParameter("LANGUAGE", "de_DE"); new CommandLineInterpreter().Execute("label", LabellingContext); } }