EPLAN

WPF API-Addins mit Übersetzungen

Einige unserer Produkte sind auch mehrsprachig. Einige API-Addins besitzen eine GUI mit WPF, welche die Übersetzungen aus einer Resource-Datei in einer referenzierten Assembly laden.

 

Leider gibt es beim Öffnen des Windows dann folgenden Fehler:

The file or assembly LocalizationExample.Translations, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null or a dependency of it was not found.
Assembly loader: LocalizationExample.Translations, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null not found
The file or assembly LocalizationExample.Translations, PublicKeyToken=null or a dependency of it was not found.
Assembly loader: LocalizationExample.Translations, PublicKeyToken=null not found
The LocalizationExampleAction action with the /_cmdline:LocalizationExampleAction parameters of the LocalizationExample.EplAddIn.Gui module has failed. Could not load file or assembly 'LocalizationExample.Translations, PublicKeyToken=null' or one of its dependencies. Das System kann die angegebene Datei nicht finden.

 

Ich habe mir mit Fusion++ mal angesehen, was nicht geladen wurde:

LOG: Attempting download of new URL file:///C:/Users/moz/AppData/Roaming/EPLAN/ShadowCopyAssemblies/8980/LocalizationExample.EplAddIn.Gui/bin/en-US/LocalizationExample.EplAddIn.Gui.resources.DLL.
LOG: Attempting download of new URL file:///C:/Users/moz/AppData/Roaming/EPLAN/ShadowCopyAssemblies/8980/LocalizationExample.EplAddIn.Gui/bin/en-US/LocalizationExample.EplAddIn.Gui.resources/LocalizationExample.EplAddIn.Gui.resources.DLL.
LOG: Attempting download of new URL file:///C:/Users/moz/AppData/Roaming/EPLAN/ShadowCopyAssemblies/8980/LocalizationExample.EplAddIn.Gui/bin/en-US/LocalizationExample.EplAddIn.Gui.resources.EXE.
LOG: Attempting download of new URL file:///C:/Users/moz/AppData/Roaming/EPLAN/ShadowCopyAssemblies/8980/LocalizationExample.EplAddIn.Gui/bin/en-US/LocalizationExample.EplAddIn.Gui.resources/LocalizationExample.EplAddIn.Gui.resources.EXE.

 

Der Assembly-Loader sucht nach der falschen Datei… mhh, komisch. Denn der Zugriff außerhalb von WPF, sprich im C# Code, funktioniert ohne Probleme.
Meine Vermutung, dass WPF die Resource-Datei nicht findet hat sich betätigt. Darum greife ich nun BEVOR ich ein WPF-Control erstelle, einmal auf die Assembly zu.

Hab das die Lösung auf GitHub mit einem Beispielprojekt dokumentiert.

Von |2021-09-16T08:38:57+02:002021-09-16|EPLAN, EPLAN-API|

EPLAN 2022: Scripting Neuerungen

2021-06-04

Die Betaversion von EPLAN 2022 ist nun verfügbar. Folgende Änderungen an den Actions habe ich aus den News entnommen.

 

2021-08-05

Die API-Hilfe ist nun auch verfügbar und ich habe die Listen ergänzt.

 

 

Entfernt

Hinzugefügt

Von |2021-08-05T08:08:41+02:002021-08-04|EPLAN, EPLAN-API, EPLAN-Scripts|

EPLAN Ribbon erstellen

Update 2021-12-04:

Ich habe ein neues Beispiel hier erstellt.


Die Beta zu EPLAN 2022 läuft, und ich bekam schon ein paar Anfragen, ob es möglich ist eigene Ribbons zu erstellen: Ja kann man 🥳

Darum hier mal der Beispielcode:

[DeclareRegister]
public void Action()
{
  RibbonBar ribbonBar = new RibbonBar();
  RibbonTab ribbonTab = ribbonBar.AddTab("Suplanus");
  RibbonCommandGroup ribbonCommandGroup = ribbonTab.AddCommandGroup("MyGroup");
  ribbonCommandGroup.AddCommand("MyButton", "MyAction", CommandIcon.Accumulator);
}
Von |2021-12-04T13:23:50+01:002021-07-15|EPLAN, EPLAN-Scripts|

GetProperty

Nach langer Zeit mal wieder was zu EPLAN.
Frank hat hier einen Weg gepostet, um Eigenschaften aus dem GED direkt im Script zu lesen. Anscheinend funktioniert dies nur mit NICHT Read-Only Eigenschaften.

Vielen Dank!

using System.Windows;
using Eplan.EplApi.ApplicationFramework;
using Eplan.EplApi.Scripting;

public class Script
{
  [Start]
  public void XEsGetPropertyAction_Start()
  {
    CommandLineInterpreter cli = new CommandLineInterpreter();
    ActionCallingContext acc = new ActionCallingContext();

    string propertyValue = string.Empty;

    acc.AddParameter("PropertyId", "20100"); //20100 = PartNumber
    acc.AddParameter("PropertyIndex", "1");
    cli.Execute("XEsGetPropertyAction", acc);
    acc.GetParameter("PropertyValue", ref propertyValue);

    MessageBox.Show(propertyValue);
  }
}
Von |2021-03-11T14:05:33+01:002021-03-11|EPLAN, EPLAN-Scripts|
Nach oben