Some issue with accessory parts in EPlan P8

Today I was on site at my customer’s place, and I was having problems when trying to place a certain part on a 2D panel layout page. No matter what settings I was using before placing the part, Eplan would always ask me for the parts dimensions. I double checked all the parts data in Parts Management, and everything was there: dimensions and also the graphical macro to use for 2D layouts. Funny as hell.

After some investigating, I found that the source of the problem was that the part in question had been assigned as an accessory part (an auxiliary contact block) to my main part (a contactor). In itself this should not be causing a problem, but then I noticed that in the parts management dialog, when looking at the accessory list for the contactor part, the “Variant” field was empty beside the auxiliary part number.

After filling in the missing field, things started to work as expected again. Maybe someone deleted the variant field, or maybe the data was messed up some other way we don’t know.

Have a look at this video for a demo of the issue.

Ressigning cables when using PlaceHolders in Eplan P8

I was recently working on a project for a customer when I found an issue with the way Eplan P8 handles cables within PlaceHolder objects.

PlaceHolders are a nice feature of Eplan P8 that allow you to quickly change properties on a group of components in one simple operation. For example, if you want to provide part numbers for the components of a motor starter (ie the motor, the protection device, the cable(s), terminals etc), then using a PlaceHolder will allow you to switch all the parts at once with predetermined sets of values. Here’s an example:

In the above screenshot, we can identify the overload/overcurrent protection device, the cable and the motor. We can also notice the PlaceHolder object which is represented as an anchor symbol.

For regular devices, assigning a new part number through the PlaceHolder will automatically update the connection designations of the component and other peroperties such as technical characteristics. In our motor starter example, the motor leads could be identified with T1, T2, T3 for the 1HP motor, but they could be identified as U, V, W for the 10 HP motor. The assignment of a new part number will take care of renaming your connection designations in your schematics automatically, which saves a lot of typing and prevents errors.

Unfortunately, when it comes to cables, Eplan seems to lack the functionality to reassign the cable’s conductor data back to each individual conductors automatically. This includes wire cross-section and color/number. This can lead to problems down the road, as can be seen on this screen shot of the cables navigator after switching from the 1HP motor to the 2 HP motor and using a different cable part number:

Showing mismatched data on a cable

In the above screenshot, we can see that the data from the part (represented as purple triangles) doesn’t match the data from the cable in the schematic (represented as blue cubes). The reason is simply that after assigning a new value set with the PlaceHolder, a different part number was assigned to the cable, and the conductor properties of the newly assigned cable part were different than the ones already in my schematic. In my case, the conductor cross-section was different, but you’d also get this situation if the color/number scheme of the conductors was different.

I’ve uploaded a short video on Youtube to better demonstrate the issue.

In such a simple case, one can easily remedy this situation by selecting the cable and going to the “Project Data > Cables > Assign Conductors > Reassign All” menu, which will cause the proper data to be transferred from the cable part to the schematic. When only one cable is involved, one could decide to manually update it after assigning a new value set, but one could easily forget this step. Also, if many cables are changed from a single PlaceHolder object, it can quickly become tedious to have to manually reassign the conductor data manually.

As always, I saw an opportunity for a custom Eplan P8 Add-In. In this case, since we have to navigate the data model of our project, we will need to use the API instead of a script.

The source code can be found on my public GitHub repository. Please view the README file for details about the code itself.
Basically, this Add-In will implement an Event Handler that will respond to the “onActionEnd.String.XMPlaceHolderAssignRecordAction” event. This event will be fired after the PlaceHolder completes assignment of all its properties, thus giving us a good hook to call our “reassign all” action automatically.

I’m releasing this API Add-In’s code as Open Source, so feel free to use/copy/modify as you wish. Of course, including my name as the original author would be welcome.

Eplan P8 menu structure

T-Nodes: some help in sight

A good friend of mine who works at the Canadian branch of Eplan sent me this nice document explaining T-Nodes in the context of Eplan P8, and he asked me to “spread the love”, so I’m making it available for all here.

So go ahead, download it and enjoy !

Eplan P8 script to show extended property information

“When doing script or API development in Eplan P8, it is important to determine the internal name of the different settings that can be set by script or API. Unfortunately, out of the box those settings names are not visible to the user.

In order to obtain the name, or path, of settings, we must set a “hidden” boolean setting to true. Once we do that, we can then right click (almost) any setting in the Settings dialog, copy the path to the clipboard, and paste it in our code.

Please see this video for a demonstration.

The script is available for download here.

In a later post and video, I’ll show how to actually put that script to good use to develop our own scripts.

Script to open the current project’s folder

I keep needing to open the folder containing the Eplan Project I’m currently working on, so I decided to modify a script initially created by Sean P. Mulherin.


//Luc Morin, 2012, based on work By Sean Patrick Mulherin
//Small script to open the folder containing the currently selected project in Windows Explorer
//It adds a new Action to Eplan: OpenProjectFolderInExplorerAction
//This action can be called either from a menu, a toolbar button, or from a script
//Simply "load" the script in Eplan (don't "run" it).
public class RegisterScriptMenu
    public void MenuFunction()
		//Add a new menu point for our Action. it will be placed in the "Utilities" menu.
		//This menu point will call our Action when selected by the user
        Eplan.EplApi.Gui.Menu oMenu = new Eplan.EplApi.Gui.Menu();
        oMenu.AddMenuItem("Open Project Folder",
        				"Opens the current Project Document folder in Windows Explorer",
						System.UInt32.Parse("35032"), 	// ID of the prvious menu
						System.Int32.Parse("0"), 	// ID of the next menu. (0 no special)
	//Our Action declaration
	public void Action()
		//Execute a "selectionset" action to obtain the currently selected project's full name (including folder)
		Eplan.EplApi.ApplicationFramework.ActionManager oMngr = new Eplan.EplApi.ApplicationFramework.ActionManager();
		Eplan.EplApi.ApplicationFramework.Action oSelSetAction = oMngr.FindAction("selectionset");
		string sProjectFolder = string.Empty;
		if (oSelSetAction != null)
			Eplan.EplApi.ApplicationFramework.ActionCallingContext ctx = new Eplan.EplApi.ApplicationFramework.ActionCallingContext();
			ctx.AddParameter("TYPE", "PROJECT");
			bool bRet = oSelSetAction.Execute(ctx);
			if (bRet)
				string selectedProject = string.Empty;
				ctx.GetParameter("PROJECT", ref selectedProject);
				//Obtain the project folder. Must add the trailing backslah or else Windows Explorer won't cooperate
				sProjectFolder =  System.IO.Path.GetDirectoryName(selectedProject) + "\";
				System.Windows.Forms.MessageBox.Show("Action could not be executed!");
		System.Windows.Forms.MessageBox.Show("Action Selection could not be executed");
		//Launch Windows Explorer with our Project Path
		System.Diagnostics.Process.Start("explorer.exe", sProjectFolder);


Eplan P8 multi-level terminals sorting made easy

Although Eplan P8 handles multi-level terminals pretty well, one still has to manually sort the terminal strip in order for the multi-level handling to “click” in.

Indeed, for Eplan P8 to consider terminals as being part of a single multi-level terminal (MLT), they have to be sorted by level, and this sorting has to be done manually in most cases.

For example, take the following scenario where sensors need to be connected to multi-level terminals:

Multi-level terminals 1

In this image, terminals 1,2 & 9 must be treated as a single MLT, so do terminals 3, 4 & 10 and so on.

Unfortunately, after inserting those terminals, we get the default following ordering (Project Data/Terminal Strips/Edit…):

Multi-level terminals 2

We would normally use the arrow keys (Red rectangle) to reorder the terminals to get the levels as per this image:

Multi-level terminals 3

We can see that the levels are ordered in a 1,2,3 fashion, and this is how Eplan P8 recognizes MLTs.

Using the up/down arrows can become tedious, especially if you have dozens of terminals on a single terminal strip. Here’s where this little script will come in handy.

See this video for a demonstration.


//Created by Luc Morin, November 2011
public class MultiLevelSortCode
	public void SetSortCodeAction()
		//Use a Command Line Interpreter to call the Action
		CommandLineInterpreter CLI = new CommandLineInterpreter();
		Eplan.EplApi.Base.Settings set = new Eplan.EplApi.Base.Settings();
			bool bOk = set.AddNumericSetting("USER.SCRIPTS.SORTCODE",  new int[] { 0 },
				new Range[] { new Range { FromValue = 0, ToValue = 32768}}, "Sort code setting", new int[] { 0 },
		int index = set.GetNumericSetting("USER.SCRIPTS.SORTCODE", 0);
		ActionCallingContext ctx1 = new ActionCallingContext();
		ctx1.AddParameter("propertyID","20809"); //Sort code
		ctx1.AddParameter("propertyValue", index.ToString());
		CLI.Execute("XEsSetPropertyAction", ctx1);
		set.SetNumericSetting("USER.SCRIPTS.SORTCODE", ++index, 0);
	public void SetSortCodeMenuFunction()
		Eplan.EplApi.Gui.Menu oMenu = new Eplan.EplApi.Gui.Menu();
		oMenu.AddMenuItem("Set sort code", "SetSortCodeAction");
	public void ResetSortCodeAction()
		//Use a Command Line Interpreter to call the Action
		CommandLineInterpreter CLI = new CommandLineInterpreter();
		Eplan.EplApi.Base.Settings set = new Eplan.EplApi.Base.Settings();
			bool bOk = set.AddNumericSetting("USER.SCRIPTS.SORTCODE",  new int[] { 0 },
				new Range[] { new Range { FromValue = 0, ToValue = 32768}}, "Sort code setting", new int[] { 0 },
		set.SetNumericSetting("USER.SCRIPTS.SORTCODE", 0, 0);
	public void ResetSortCodeMenuFunction()
		Eplan.EplApi.Gui.Menu oMenu = new Eplan.EplApi.Gui.Menu();
		oMenu.AddMenuItem("Reset sort code", "ResetSortCodeAction");

This script is divided in four sections, but they work in pairs. Basically, we declare two Actions and then two Menus (one per Action).

The first Action is the SetSortCodeAction, and it is used to assign the sort code to selected terminals. In order to keep track of the sort code, we create a new USER setting under USER.SETTINGS.SORTCODE. Eplan P8 allows us to define any number of such user settings, but they must be uniquely named. So, the SetSortCodeAction assign the current sort code to selected terminals, increments it, then stores it for the next call.

The ResetSortCodeAction, as its name implies, resets the current sort code to zero when we need to operate on another terminal strip. Though this is not absolutely necessary, it is a good idea to reset the sort code to zero. As far as Eplan is concerned, it doesn’t matter if the sort code starts at zero, as long as they are in numerical order.

These two Actions have associated menu points, which allows us to call them from the Utilities menu in Eplan. One can also assign these actions to shortcut keys for a more convenient way of calling them (I have assigned them to ALT-S and CTRL-S respectively).

This script makes it easier to manage the sorting of MLTs, but it still involves a certain level of manual intervention. In my next post, I’ll detail a better way to accomplish this through the API instead of a Script. This will provide a fully automated way of sorting MLTs.

As I explained in a previous post, there are limitations to what can be achieved in Scripts, and one such limitation is the fact that we can’t iterate over selected items. In a Script, we can only act over selected items as a group, so when we assign the sort code, we assign the same sort code to all selected terminals. In API, it is possible to iterate over selected terminals such that we can assign a different sort code to each. It is then possible to select the whole terminal strip, and launch the process of assigning a unique sort code to each individual terminal. This is unfortunately not possible in Scripts, so we have to manually select each group of terminals to assign the same sort code to the group.

I hope you enjoy this scripted solution. You are free to use it and redistribute it as you wish. I’ll appreciate if you would give me credit for it though.

Eplan P8: API vs. Scripts

People ask me what the difference is between API and Scripts in Eplan P8.

At the core, both offer you a way to customize your Eplan environment by adding your own “Actions”.

Actions are the building block of most functions in Eplan P8. Even built-in commands, such as wire numbering, are really Actions that get called by a menu or a Toolbar. Having the possibility to create your own Action is thus a great way to automate some of the repetitive tasks in your electrical design workflow.

So, if both API and Scripts can be used to create custom Actions, what is then the difference between the two ?

Both are based on the .NET Framework, so you can actually use any .NET compatible language for their development. I use C# and my language of choice.

Scripts don’t require a special license to be used. You can edit those scripts in a text editor, and load them in Eplan P8. What you can do with them is limited because you can only access classes from the following .NET assemblies:

  • System
  • System.XML
  • System.Drawing
  • System.Windows.Forms
  • Eplan.EplApi.Base
  • Eplan.EplApi.Gui
  • Eplan.EplApi.ApplicationFramework


Scripts are compiled on the fly by Eplan P8 when you load them, so the available assemblies are fixed and, according to the documentation, There is no way to reference additional assemblies (.Net framework, EPLAN or other providers)! Scripts allow you to set properties to selected objects, or to automate a series of repetitive steps. What you can do from the Graphical Editor (GED), you can do from a script. They could be assimilated to macros in other software.

On the other hand, API (Application Programming Interface), are full fledged .NET assemblies that you compile using your choice editor/IDE (I use Visual Studio 2010). While this allows you to access any Assembly in either the .NET Framework or Eplan’s own API Assemblies, it does require an additional license (please contact your local Eplan office for details).

API is really the way to go if you need to manipulate the Eplan Data Model. For example, you could iterate over all the parts in a project, filter them, process them in any way you want and finally write them to a third party MRP/ERP system through a database connection. Or you might want to add parts automatically to every terminal strip in your project. The possibilities are virtually endless.

(Shameless plug following)
As a freelance Eplan consultant and API programmer, I can help my customers by developing custom Actions to help them automating their design workflow.

Please see my contacts page for details

Setting more than one property from a toolbar button in Eplan P8

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.


public class SetWireProperties
   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("propertyValue", color);
    CLI.Execute("XEsSetPropertyAction", ctx1);
    //Second property to change: wire gauge
    ActionCallingContext ctx2 = new ActionCallingContext();
    ctx2.AddParameter("propertyValue", gauge);
    CLI.Execute("XEsSetPropertyAction", ctx2);

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.


Expanding my services offering

For 5 years now I’ve been offering services in the field of industrial automation. Services such as design, commissioning, troubleshooting and programming have been my bread and butter.

All along I was seeing some small machining and welding jobs that I’ve had to let go for lack of proper tools. Reparing a small broken shaft, welding a new bracket on a machine, making slots in a bracket etc.

I finally decided to byte the bullet, and I bought the following equipment:

  • A lathe:

  • A mill:

  • A TIG/Stick welding machine:

  • A bandsaw:

All these new tools are relatively small, but they will allow me to offer more services to my customers instead of having to sub-contract them.

I’m currently taking a refresher training in stick/TIG welding, and in february I’ll be taking the machining classes.

Last summer I also widened my design services offering by purchasing Autodesk Inventor so that I could design small custom metal parts. Now I’ll also be able to make them myself!

With Eplan P8 version 2.0 and Inventor 2011, plus all the new equipment, I have reached a level of horizontal integration that will eventually allow me to take small custom machines contracts and drive them from A to Z.


Electrical schematics appearance is not (so) important

In my dealings with users of EPLAN Electric P8, whether they are new users or [...]