Hallo Zusammen,
ich habe mehrere alte Projekte, die ich als DWG Import in 2.3/2.7 mir reinhole. Leider fehlt die Seitenbeschreibung. Jetzt wollte ich mir ein Skript erstellen, indem ich eine Datei einlese (z.B. txt), wo die Seitennamen hinterlegt sind und dann alle markierten Seiten nacheinander bezeichne. (Es sind sehr viele gleiche Projekte).
Leider klappt das nicht, bzw. hat jemand Ahnung, wie ich es schaffe, dass es die Seiten nicht immer gleich bzeichnet, wie jetzt im Skript.
Schleife???
Hier das Skript:
______
using System;
using System.Diagnostics;
using System.Threading;
using System.Windows.Forms;
using Eplan.EplApi.ApplicationFramework;
using Eplan.EplApi.Base;
using Eplan.EplApi.Scripting;
class Program
{
[Start]
public void Action()
{
// Get selected pages
var pages = GetPages();
// Setup progressbar
Progress progress = new Progress("EnhancedProgress");
progress.SetTitle("Do Something with pages");
progress.SetAllowCancel(true);
progress.ShowImmediately();
progress.SetNeededSteps(pages.Length + 1);
try
{
// Do something with pages
foreach (var page in pages)
{
progress.SetActionText(page);
progress.Step(1);
SelectPage(page);
}
}
catch (Exception exception)
{
MessageBox.Show(exception.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
finally
{
progress.EndPart(true);
}
}
private static string[] GetPages()
{
ActionCallingContext actionCallingContext = new ActionCallingContext();
string pagesString = string.Empty;
actionCallingContext.AddParameter("TYPE", "PAGES");
new CommandLineInterpreter().Execute("selectionset", actionCallingContext);
actionCallingContext.GetParameter("PAGES", ref pagesString);
string[] pages = pagesString.Split(';');
return pages;
}
private void SelectPage(string page)
{
CommandLineInterpreter oCLI = new CommandLineInterpreter();
ActionCallingContext acc = new ActionCallingContext();
acc.AddParameter("PropertyId", "11011"); //PropertyIdentName (benutzerdefinierte Eigenschaften)
acc.AddParameter("PropertyIndex", "0");
acc.AddParameter("PropertyValue", "1");
oCLI.Execute("XEsSetPagePropertyAction", acc);
}
}
________
Im Moment werden alle markierten Seiten gleich bezeichnet... Bitte um Hilfe oder Ideen
[Diese Nachricht wurde von DespoOne am 11. Dez. 2019 editiert.]
Eine Antwort auf diesen Beitrag verfassen (mit Zitat/Zitat des Beitrags) IP