One of the request that I get a lot when doing Eplan P8 on-site consulting is for the possibility to set more than one property from a toolbar button.

Those of you who have customized toolbar buttons in Eplan P8 will already know that it’s only possible to call a single action from a button.

For example, setting the color for selected wires to “BU” using XEsSetPropertyAction would look like this:

XEsSetPropertyAction /PropertyId:31004 /PropertyIndex:0 /PropertyValue:"BU"

But what if you also wanted to set the wire gauge at the same time ? It’s unfortunately not possible at this time in P8. Maybe this will eventually be added, but for now it’s no go.

I decided to tackle this by creating a small script that allows for setting both properties from a single button, and with some modifications this script can be adapted to set an arbitrary number of properties.

SetWireProperties.cs:

public class SetWireProperties
{
 
  [DeclareAction("SetWirePropertiesAction")]
   public void SetWirePropertiesAction(string color, string gauge)
   {
 
    //Use a Command Line Interpreter to call the Action
    CommandLineInterpreter CLI = new CommandLineInterpreter();
 
    //First property to change: wire color
    ActionCallingContext ctx1 = new ActionCallingContext();
    ctx1.AddParameter("propertyID","31004");
    ctx1.AddParameter("propertyIndex","0");
    ctx1.AddParameter("propertyValue", color);
    CLI.Execute("XEsSetPropertyAction", ctx1);
 
    //Second property to change: wire gauge
    ActionCallingContext ctx2 = new ActionCallingContext();
    ctx2.AddParameter("propertyID","31002");
    ctx2.AddParameter("propertyIndex","0");
    ctx2.AddParameter("propertyValue", gauge);
    CLI.Execute("XEsSetPropertyAction", ctx2);
 
    return;
 
   }
 
}

This script declares a new custom Action named SetWirePropertiesAction, which takes two parameters. The first one is the color to be assigned to the conductor and the second one is the wire gauge.

In order to set this up on your station, simply create a new text file named SetWireProperties.cs, and copy/paste the above script to it. Save it somewhere convenient. From Eplan P8, go to the “Utilities/Scrips/Load..” menu, and open the previously created file.

Once the script is loaded, the SetWireProperties Action can be called from a toolbar button. Simply put the following text in the Command Line property of a custom button:

SetWirePropertiesAction /color:"BU" /gauge:"18"

This will set both the color and gauge to BU and 18 respectively.

Enjoy