Work / eplanbridge
eplanbridge: EPLAN Pro Panel automation through the EPLAN API in C#
Drive EPLAN Pro Panel 2022.0.3 from outside the application — and build a 6-axis robot-arm control schematic with it.
What is it made of?
csharp · eplan · eplan-pro-panel · industrial-automation · mcp
Source on GitHub ↗ · Need one like it? →
How does it work?
Drive EPLAN Pro Panel 2022.0.3 from outside the application — and build a 6-axis robot-arm control schematic with it.
A programmable control surface for EPLAN Pro Panel, shaped like the existing gxbridge MCP server, plus the project it was built to produce: RoboArm_6DOF_FX5U, a 20-page schematic for an FX5U-controlled 6-axis arm — 273 symbols and 129 connections, all placed by script.
Read these first
- FINDINGS.md: The construction spec: pin geometry, the place → generate → close sequence, what is unresolved and why
- ATTEMPTS.md: The dead ends, so they are not repeated
- docs/eplan-automation-surface.md: How the remoting bridge was established at all
Each records what was measured and what is still a guess. Read the relevant one before changing anything.
Why
EPLAN has no supported way to build a schematic in bulk from outside the GUI. Drawing 273 symbols and wiring them by hand is slow and unrepeatable; doing it from a script makes the drawing a build artefact that can be rebuilt, diffed, and corrected. This project works out what that takes and records the parts that are not obvious — chiefly that placement alone connects nothing.
Why it is built this way
EPLAN's remoting channel exposes exactly one useful verb: ExecuteAction. The interesting API — DataModel, DataModel.E3D, HEServices — is in-process only. The bridge between them is EPLAN's ExecuteScript action.
But EPLAN's script compiler carries no reference to Eplan.EplApi.DataModelu.dll. Any compile-time mention of that namespace fails the whole script, and a failed compile is reported as Succeed=False with an empty message — no error text anywhere. That single fact dictates the design.
PowerShell / MCP server (out of process, net48)
| EplanRemoteClient.ExecuteAction
v
ExecuteScript /ScriptFile:EplanBridgeStub.cs
| (the ONLY reflection in the system)
v
EplanBridge.Core.dll (in process, typed C#, full API access)EplanBridgeStub.cs names no EPLAN API type, so it always compiles. It loads EplanBridge.Core.dll and calls Bridge.Invoke(command, argument). Everything below that boundary is ordinary typed C# — which means the compiler checks the API usage instead of mistakes surfacing at runtime.
The stub loads the DLL from a byte array, not Assembly.LoadFrom. That leaves the file unlocked, so EplanBridge.Core can be rebuilt without restarting EPLAN. Verified working.
Layout
- src/EplanBridge.Core/: net48 class library, typed EPLAN API access
- bin/EplanBridge.Core.dll: Build output, loaded into EPLAN
- scripts/EplanBridgeStub.cs: Reflection stub run by ExecuteScript
- tools/Invoke-EplanBridge.ps1: Call one bridge command from PowerShell
- tools/Invoke-EplanAction.ps1: Dispatch EPLAN's own actions (generate, renumber, reports)
- tools/Build-RoboArmSchematic.ps1: Build every schematic page — idempotent, clears each page first
- tools/Get-ProjectAudit.ps1: The finish check: functions, connections, and untagged count per page
- tools/Set-RoboArmParts.ps1: Allocate a part to every function representing a real device — idempotent
- tools/Get-SymbolGeometry.ps1: Measure a symbol's connection-point offsets before designing with it
- tools/Build-PanelSpace.ps1: Create the Pro Panel 3D space and mounting plate — not idempotent
- tools/Build-PanelLayout.ps1: Draw the cabinet arrangement on the panel-layout page — idempotent
- tools/New-RoboArmPages.ps1: Create the page shells (already run)
- tools/Restore-PageNumbering.ps1: Shift a page block's counters — does not work, kept as evidence
- docs/parts-catalog.json: All 654 parts in the local database, dumped via parts.search
Build
cd src\EplanBridge.Core
dotnet build -c Release -o ..\..\binTargets net48 because the EPLAN API is .NET Framework. The only SDK installed is .NET 10, which cannot load Framework assemblies in-process — but it builds net48 fine, since the targeting pack is present. EPLAN references use false so its DLLs are never copied; the process already has them loaded.
Use
.\tools\Invoke-EplanBridge.ps1 -Command ping
.\tools\Invoke-EplanBridge.ps1 -Command project.info `
-Argument 'C:\Users\Kishor\Tovex-Work\eplan-propanel-bridge\projects\RoboArm_6DOF_FX5U.elk'-Port defaults to 57315 (the dedicated instance). Start a dedicated instance with an explicit port rather than an ephemeral one:
Eplan.exe /Variant:"Pro Panel" EplanServer /EPLANSERVERPORT:<port>Verify
With a dedicated EPLAN instance running on port 57315:
.\tools\Get-ProjectAudit.ps1Success is the last three lines reading exactly:
total functions = 273
total connections = 129
untagged (=+) = 273and every page =RA1+CAB/2 through /17 reporting a non-zero function count. The audit reopens the project from disk, so a passing run is also the persistence proof — there is no Save in this API, only Project.Close().
untagged = 273 is the expected value, not a failure to investigate: device numbering does not work yet (FINDINGS §3). It will drop to 0 when it does.
Parts allocation
.\tools\Invoke-EplanBridge.ps1 -Command project.parts `
-Argument 'C:\Users\Kishor\Tovex-Work\eplan-propanel-bridge\projects\RoboArm_6DOF_FX5U.elk'Success is withoutPart reading 0:
{"totalFunctions":169,"withPart":144,"withoutPart":0,
"cannotCarryArticle":25,"distinctParts":9}totalFunctions is 169 here and 273 in the audit above, and both are correct. The audit sums 16 page-filtered queries; this is one project-wide query, and GetFunctions(null) does not return the 104 PLC connection points. Do not "fix" either number to match the other.
Rebuild from scratch and re-verify
.\tools\Build-RoboArmSchematic.ps1
.\tools\Invoke-EplanAction.ps1 -Actions 'generate /TYPE:CONNECTIONS /PROJECTNAME:"C:\Users\Kishor\Tovex-Work\eplan-propanel-bridge\projects\RoboArm_6DOF_FX5U.elk" /REBUILDALLCONNECTIONS:1'
.\tools\Invoke-EplanBridge.ps1 -Command project.close -Argument 'C:\Users\Kishor\Tovex-Work\eplan-propanel-bridge\projects\RoboArm_6DOF_FX5U.elk'
.\tools\Get-ProjectAudit.ps1Commands
- ping. Argument: —. Returns: Bridge version, CLR, bitness
- project.info. Argument: .elk path. Returns: Name, paths, page count, page list
- project.close. Argument: .elk path. Returns: Confirmation — this is what flushes writes to disk
- project.connections. Argument: .elk path. Returns: Project-wide connection count by representation type
- project.parts. Argument: .elk path. Returns: The parts finish check: functions with/without a part, grouped by part number
- page.create. Argument: project=…;plant=…;location=…;counter=N;type=…;description=…. Returns: Created page name and type
- page.contents. Argument: project=…;page=…. Returns: Functions, with function definition and identifier letter
- page.placements. Argument: project=…;page=…. Returns: Every placement by type — use this, not page.contents, to tell whether a report page is populated
- page.pins. Argument: project=…;page=…. Returns: Each symbol's connection points in absolute coordinates
- page.connections. Argument: project=…;page=…. Returns: Connections EPLAN derived on the page
- page.clear. Argument: project=…;page=…. Returns: Count removed — destructive, no undo
- page.clearall. Argument: project=…;page=…. Returns: Removes every placement including graphics — destructive
- page.setcounter. Argument: project=…;page=…;counter=N. Returns: Renames a page — fails; PAGE_COUNTER is read-only after creation
- symbol.list. Argument: library=;filter=…;limit=N. Returns: Symbol name, id, and FUNC_DESC
Page types accepted by page.create: Circuit, TitlePage, TableOfContents, PLCDiagram, PLCCardOverview, TerminalDiagram, PanelLayout, Overview, and the rest of DocumentTypeManager.DocumentType.
Rules for adding a command
- One command, one verb, one effect. Never "create or update".
- Return JSON always. Never throw across the boundary; never show a dialog — a modal dialog blocks every later remote call, since EPLAN only services remote calls when idle.
- Data-model writes must be wrapped in a LockingStep, or EPLAN throws NoLockingStepException (S063110).
- A project already open cannot be re-opened. Use GetProject first (returns null when not open), then OpenProject.
- State in the command's docs what it cannot do.
API gotchas found the hard way
There is no Save. The only persistence trigger is Project.Close(). Verified: after creating 19 pages, Page.eod was still 1,134 bytes at its original timestamp; after project.close it became 22,680 bytes, and reopening from disk (wasAlreadyOpen:false) returned all 20 pages. Never report a write as done before closing — an in-memory read-back proves nothing.
Placing symbols does not connect them. EPLAN auto-connects connection points that share an X coordinate and face each other, but only when generate /TYPE:CONNECTIONS /REBUILDALLCONNECTIONS:1 is run. Place → generate → close. Skip the middle step and you get a drawing that looks right and is electrically empty.
Place symbols with SymbolVariant.Create(page), never Function.Create. Function.Create only builds generic Functions. For a symbol backed by a specialised class (terminals, cables, PLC boxes) it creates the object and then throws NotImplementedException — leaving a half-initialised object on the page while reporting failure. Observed exactly: four terminals reported FAIL yet all appeared in page.contents. SymbolVariant.Create returns the correct subclass; set SymbolReference.Location afterwards.
Device tags cannot be set as a property. FUNC_DEVICETAG_FULL throws NotImplementedException; NameParts has no FUNC_DEVICETAG_MAINNAME; there are no IDENTLETTER/COUNTER name-part properties on FunctionBasePropertyList. EPLAN assigns device tags with its own renumber action — place first, number after.
The page description property is PAGE_NOMINATIOMN — EPLAN's own misspelling, documented as "Page description # 11011". There is no PAGE_DESCRIPTION. PAGE_SUPPLEMENTARYFIELD is a different, indexed property (11901) and is the wrong choice.
Read the full README on GitHub →
What do people ask about it?
Can EPLAN Pro Panel be automated from outside the application?
Yes, with one catch: EPLAN's remoting channel exposes a single useful verb, ExecuteAction, and the real API — DataModel, DataModel.E3D, HEServices — is in-process only. eplanbridge crosses that gap through EPLAN scripting, the ExecuteScript action: an out-of-process PowerShell or MCP server on .NET Framework 4.8 sends the action, a stub script runs inside EPLAN, and the stub loads EplanBridge.Core.dll, typed C# with full access to the API.
Which EPLAN version does it target?
EPLAN Pro Panel 2022.0.3. The API behaviour that cost time to find — a failed script compile reported as Succeed=False with an empty message, the missing reference to Eplan.EplApi.DataModelu.dll — is recorded in FINDINGS.md, and the dead ends in ATTEMPTS.md, so neither is repeated.
What did it actually build?
RoboArm_6DOF_FX5U: a 20-page control schematic for a 6-axis robot arm on a Mitsubishi FX5U — 273 symbols and 129 connections, all placed by script, so the drawing is a build artefact that can be rebuilt from scratch, diffed and re-verified.
Why does placing symbols by script connect nothing?
Because placement alone connects nothing in EPLAN: a placed symbol has no connections until the generate step runs, so the sequence is place, generate, close, and the pin geometry has to be right first. That is the main finding the project records.
Is it an MCP server like GXBridge?
It is shaped like the GXBridge MCP server — a programmable control surface for an engineering tool — with a PowerShell front as well, so an AI agent or a plain script can drive EPLAN the same way.
What else did I build?
GXBridge-MCP
Control Mitsubishi GX Works3 and your PLC with AI — an MCP server for any agent GX Works3 · Industrial Automation
TIA-Portal-MCP
TIA Portal MCP server: control Siemens TIA Portal, STEP 7 and S7-1200/S7-1500 PLCs with AI (Claude, Cursor, any MCP client). Write LAD/SCL PLC code, configure hardware and WinCC HMI, compile, test in PLCSIM and download. AI Agents · Claude
picw-overview
Replacing a Mitsubishi PLC with a Raspberry Pi 4B as master of a dynamic checkweigher (Thames Side T16 / XT1-SO)