How to create your own plugin from this template

This folder contains a working example plugin for PCAutomation / Smap3D P&ID, built as a native Delphi DLL. Use it as a starting point for your own plugin by following the steps below in order.

What you need

Overview of the steps

  1. Try the template as-is first, before changing anything.
  2. Build the project.
  3. Place the DLL and its MIF file in PC Automation's install directory.
  4. Edit the MIF file so it points to your DLL, with the text you want.
  5. Install the plugin inside PC Automation.

Step 3 is something you only do once per plugin. Step 4 also only needs doing once, unless you later move the DLL to a different folder. Steps 1 and 2 you'll repeat every time you rebuild, since there's no automatic build step that copies the DLL for you.


Step 0 — Try the template as-is first

Before you change anything, it's worth going through Steps 1, 2 and 4 once with the template exactly as you received it (it's a working test plugin on its own — it just shows a small test window). That way, if something doesn't work later while you're building your own plugin, you already know your machine, Delphi, and PC Automation setup are all fine, and the problem is something in your own changes rather than the environment.

So: skip ahead to Step 1 (Build), then Step 2 (Place), then Step 4 (Install), and confirm the demo plugin shows up under Tools and opens its test window when clicked. Once that works, come back here and continue with Step 3 to turn it into your own plugin.


Step 1 — Build the project

Open TestDLL.dpr in Delphi and build it (Project → Build). This produces TestDLL.dll.


Step 2 — Place the DLL and MIF file

When PC Automation starts, it looks for plugins in its own install directory - the same folder that PCsELcad.exe is in. Place both your built DLL and a .MIF file there.

You'll need to copy the DLL there by hand every time you rebuild.


Step 3 — Edit the MIF file

The .MIF file (TestDLL.MIF) is a small text file that tells PC Automation about your plugin: what it's called, which menu it should appear in, and which DLL to run.

[Modul]
Title=Test DLL

[PLUGIN]
Menu1=Tools
Name1=Test DLL
Cmd1=TestDLL.dll,0,0,0
Index1=40
Section Field What it does
[Modul] Title The text shown in File → Modules.
[PLUGIN] MenuX Which menu the plugin appears under, e.g. Menu1=Tools puts it in the Tools menu.
NameX The caption shown in that menu.
CmdX The DLL filename to run, e.g. TestDLL.dll,0,0,0.
IndexX Sort order within that menu - lower numbers appear first.

Do not change the section headers [Modul] and [PLUGIN] - PC Automation looks for those exact names.

The three numbers after the DLL filename in CmdX (e.g. the 0,0,0 in TestDLL.dll,0,0,0) control advanced options for when the plugin is allowed to start - for example, automatically when a project is opened. That's beyond the scope of this guide - leave them as 0,0,0.


Step 4 — Install the plugin inside PC Automation

  1. Open PC Automation.
  2. Go to File → Modules.
  3. Find your plugin in the list (it will show the Title you set in the .MIF file).
  4. Select it and click Install.

Your plugin will now show up in the Tools menu. Click it to try it out.


Troubleshooting

Problem Likely cause
Plugin doesn't appear in File → Modules at all The .MIF file wasn't copied to PC Automation's install folder alongside the DLL. Re-check Step 2.
Plugin installed, but doesn't show up in the Tools menu Make sure you clicked Install in File → Modules (not just selected it), then restart PC Automation.
Nothing happens when you click the plugin, or your changes don't seem to take effect Double-check the DLL was actually rebuilt and copied to the install folder after your last change - there's no automatic copy step, so it's easy to accidentally test against a stale DLL.