Mit diesem Script kann man beliebige Seiten im Projekt löschen. Es können mehrere Seiten mit Pipe |
getrennt angegeben werden. Beispiel-Aufruf:
DeletePages /Pages:"=TEST/11|=TEST/12"
Ist eine angegebene Seite im Projekt nicht vorhanden, wird eine Systemmeldung ausgegeben.
using Eplan.EplApi.ApplicationFramework; using Eplan.EplApi.Base; using Eplan.EplApi.Scripting; public class DeletePages { [DeclareAction("DeletePages")] public void Action(ActionCallingContext acc) { string pagesString = null; acc.GetParameter("Pages", ref pagesString); if (string.IsNullOrEmpty(pagesString)) { new Decider().Decide(EnumDecisionType.eOkDecision, "Parameter 'Pages' missing.", "DeletePages", EnumDecisionReturn.eOK, EnumDecisionReturn.eOK, null, false, EnumDecisionIcon.eFATALERROR); return; } var pages = pagesString.Split('|'); foreach (var page in pages) { DeletePage(page); } } private void DeletePage(string page) { ActionCallingContext accPage = new ActionCallingContext(); accPage.AddParameter("PAGENAME", page); var isPageValid = new CommandLineInterpreter().Execute("edit", accPage); if (isPageValid) { using (new QuietModeStep(QuietModes.ShowNoDialogs)) { new CommandLineInterpreter().Execute("XGedSelectPageAction"); new CommandLineInterpreter().Execute("GfDlgMgrActionIGfWindDelete"); } } else { new BaseException("Page not found: " + page, MessageLevel.Error).FixMessage(); } } }
Hallo,
an welchem Punkt muss ich die Namen der zu löschenden Seiten eintragen?
Stehehier irgendwie auf dem Schlauch.
Das Script laden und im Aufruf (Befehl oder dein Script) der Action dann im Parameter /Pages der Action, siehe Beschreibung im Beitrag.
Danke für die schnelle Antwort,
jetzt bin ich wieder im Thema.
Hat sehr gut geplappt
Excellent! Where did you find the function GfDlgMgrActionIGfWindDelete? I can’t find it in the official eplan documentation.
Its an internal action.
Via CTRL+^ on german layout keyboard you can show the EPALN diagnostics dialog. There you find the last called action.
Amazing work, Johann Weiher!
This opens up a lot of new possibilities for me. Thank you so much for sharing your knowledge with us!
I have an additional question:
I’m a beginner and still figuring out the best way to do things. I’ve created several scripts to insert macros, but these scripts run directly through the user interface. They work, but inserting all the macros takes a long time, and the user can’t use the computer while the script is running.
I don’t have an API license for EPLAN. Without this license, is there any way to insert macros in the background using a script?
You can start EPLAN in Quite-Mode and do the long task.
Also Remoting could work with async mode: https://eplan-scripting.suplanus.de/v4/de/examples/#remoteclient