Developing Extensions primer

 

Altium Designer provides services which are common to all software extension modules. For example, creating a new document is done in the same way, regardless of the type of document you wish to create. Altium Designer facilitates an open software-architecture, designed to support not only future software extensions, but also those from any developer who wishes to bring their software tool into the Altium Designer environment.

The design environment has been purposely developed as a highly integrated tool set, where the design task is central and the software tools simply provide the services needed to develop the design. This concept can be seen in the Microsoft Office™ products, where the focus has shifted from working within applications, such as Word and Excel, to working with documents, such as a presentation, a workbook or a text document.

Altium Designer's open architecture allows third party developers to integrate their own applications into the environment, with full Application Programming Interface (API) access to the Schematic editor, PCB editor and other editors. Altium Designer extensions are based on the software Client/Server architecture model, which means all the server extensions run in a single fully-customizable user environment. This Client/Server model breaks tasks into interactive 'client' processes and distributive 'server' processes.

Altium Designer's platform allows different server modules to be installed as functional extensions. The PCB Editor and the Schematic Editor are existing servers that provide specialized functionality on the common DXP platform.

You need to be familiar with Object Oriented programming principles, and have Windows API and System Level programming skills. Object Pascal (Delphi) or C++/C# programming skills are recommended before you can embark on building software extensions for Altium Designer.

This document uses the term Extension in reference to server modules (DLLs) that plug in to the DXP platform, although Server is often used in the same context. Both software 'extensions' and 'servers' are equivalent and technically apt in this context, where the focus is centered on the system's client-server architecture. From a functional point of view, server Extensions can be added (plugged in) to Altium Designer.

The Altium Designer Platform

Several major software technologies are used in Altium Designer; the client/server architecture technology, Altium Designer Objects, and finally the object oriented technologies.

The Altium Designer system provides a hybrid interface model, which exposes the functionality of a Dynamic Link Library (DLL) module to both a user and the client executable system. The basic DLL functionality of a software extension is bound to the Altium Designer executable at run-time via an associated installed server file (*.ins). The software extensions are built using the Altium Designer SDK.

Altium Designer: One Client Module (EXE) and multiple extension servers

The Client executable (the DXP platform, in effect) is a standalone executable system that collaborates with loaded DLL extensions within the Altium Designer system. The Client module controls the user interface and delegates tasks (sends commands) to appropriate server extensions. Such extensions (as DLL files) concentrate solely on providing specific functionality based on the commands invoked by the user in Altium Designer. The Altium Designer system maintains a uniform graphical user interface (GUI) through the use of pre-packaged process launchers of loaded server extensions.

Common extension types

There are different types of software extensions (server DLLs) that can be installed in Altium Designer. Typical types of extensions would be a document editor, an importer, exporter, netlister, output generator or an editor enhancement.

As indicated above, the Altium Designer application is based on the DXP technology software platform, which uses DLLs almost exclusively with only one executable in the environment – which is a parallel to the client-server model. Also, the extensions themselves can launch other executables to execute specific tasks and return the results back to them.

Document Editors

A Document Editor allows the user to edit specific document types within Altium Designer. For example, the existing PCB or Schematic Editor is used to create, edit and verify PCB or Schematic documents.

A Document Editor handles the specific type of document you work on in the Altium Designer. For instance, the PCB editor handles PCB documents, and the Schematic editor handles Schematic documents only. A document editor can support more than one document kind.  An editor extension that has its user interface in Altium Designer will have its own GUI resources. This group of resources (the types are; hot keys, menu items and toolbar buttons) is made up of one or more process launchers that launch specific commands to invoke tasks.

Add-ons

An add-on interfaces itself to a main editor using its Application Programming Interface (API) and manipulates the editor's documents within Altium Designer. For example, you can develop an add-on that extends the PCB editor functions by using the editor's PCB API. The Hole Size Editor for the PCB editor is an add-on extension.

Output Generators

An output generator allows the user to generate an output for a project in Altium Designer. Each design project can have a number of Outjob documents that manage different output generators in the following categories: Assembly Outputs, Documentation Outputs, Fabrication Outputs, Netlist Outputs and Report Outputs.

You can develop different types of output generators such as netlisters and Bill of Materials reporters. Altium Designer provides a uniform interface for different output generators which can be dropped in and be used automatically.

Services for Altium Designer

A software extension provides its services in the Altium Designer application. The DXP platform (which is the client module of Altium Designer) interprets the tasks in terms of commands and then delegates these commands to the appropriate server. A command can be thought of as the software executing a sequence of tasks.

Commands as Server Processes acting on Documents

The approach means that Altium Designer's system is a process-centric environment, in that commands invoked by the user through the GUI are dispatched to the appropriate servers automatically. The targeted server responds by activating its required functionality on the currently-focused design document.

For example, when a user clicks on the Schematic menu to place a wire, the system interprets this action as a 'Sch: PlaceWire' command and delegates the command to the Schematic editor. The Schematic editor responds by executing the command (which is a server process string). This is a client-server collaboration, that is, it is fulfilling a set of responsibilities requested by the user

The functionality of an extension server such as a document editor that is installed in the Altium Designer is exposed by that server's processes, and its exposed functions.

Commands, Process Launchers and Processes

In the simplest sense, an extension server is supported by its set of processes, and these processes act as a link between Altium Designer and the server. Each has its own particular list of processes and these, along with their parameters, are packed as process launchers that are linked to commands in the Altium Designer's Graphical User Interface. To see it from a different perspective, when you select a menu item, press a hot key or click on a toolbar button, the Altium Designer system launches the command (its packaged process launcher) by passing the process identifier and its parameters (if any) to the appropriate extension server, which then executes the action on the active document.

Commands

A command can be thought of as the software executing a sequence of tasks. This task can be as simple as redrawing the screen on the monitor, or it may be more complex like generating a Bill of Materials report. Commands are the basic units of Altium Designer's GUI.

A command is a packaged process launcher with tool tip and bitmap image information. Each time you execute a command in Altium Designer, the command string is sent to the server, and then the specific server's command table is consulted to execute the actions for this command.

Process Launchers

A process launcher provokes an action in Altium Designer. It has a name:process string and each process launcher is tied to a user interface element in Altium Designer such as a hot key, menu item or a toolbar button.

Processes

Processes are internal commands provided by an extension server which are used as the elements for process launchers that link to menus, toolbars and short cut keys in Altium Designer. That is, behind each menu item, toolbar button and hotkey is a process launcher, which itself is a wrapper around a process, a set of parameters, and display information such as a caption string.

As a result, the server's processes, called commands, are implemented as process launchers which are linked to menu items, toolbar buttons and shortcut keys in Altium Designer. Note that a server has its own unique name, so that different ones can have same process names but different commands in Altium Designer, for example PCB:Zoom and SCH:Zoom commands.

An extension as a DLL

Generally speaking, an software extension as a DLL is a collection of routines, data structures and interfaces that can be called by the Altium Designer. Like the SDK source units, the DLLs contain shareable code or resources.

Altium Designer's software architecture allows additional extension servers to be added in at any time to extend the available services. That is, all extensions use the same Altium SDK and implement the same interfaces and routines. It is also possible to expose the functionality of an extension server, such as a document editor, so other servers can have access. To further enhance the interaction and integration between different extension servers, the Schematic and PCB editors have an Application Programming Interface (API).

An API allows PCB and Schematic processes and database objects to be used directly from other servers. For example, a Router extension would not need a document editor, as it could route a design that was open in the PCB editor through API calls. With the APIs, all the power and functionality of Schematic and PCB editors is directly available for you as a developer, to use to build a software extension to further enhance Schematic or PCB editors.

Building an extension server

To build an extension server, you need a suitable programming toolkit (Embarcadero Delphi or Microsoft Visual Studio for C++/C#), the Altium Designer SDK and its API source units, and obviously, Altium Designer. A range of software extensions can be developed for Altium Designer, but in the general sense these can be categorized as:

  • Add-ons
  • Document editors
  • Output Generators

Add-on: Add-ons are relatively simple extension servers that do not manage their own documents but harness the services of main servers, such as PCB or Schematic servers, via their APIs.

Document editors: A document editor is a complete extension that can provide and manage its own documents. A set of shell files is provided which can be used when developing a server.

Output Generators: An Output generator is a self-contained software extension that produces output documents for an Altium Designer project, such as BOM or Netlist Outputs.

Once the Altium SDK and programming IDE have been installed, the process of developing a software extension is best explored by working through, or building up, an example project. This involves setting up Delphi/C++/C# and your project files, accessing or developing the project configuration files and source code, compiling and debugging the application, implementing the resulting extension package in Altium Designer, and more.

For more information on building an add-on extension server, see:

Deploying an extension server in Altium Designer

An extension server, once developed and compiled as a DLL, also needs a set of configuration files to specify the way it interfaces to Altium Designer.

A document editor extension has a set of commands, as you would expect. These command identifiers are stored in an installation file (*.INS), and the process launchers that link to specific user interface elements (also called resources) along with the layout of user interface elements are defined in the resources file (*.RCS). The locations of panels and toolbars for a server are defined in a toolbars layout file (*.TLT).

After building a software extension it can be installed via the Altium DXP Developer, which registers the new extension in Altium Designer. Its processes are then ready to use. Typically, the extension files would be the DLL, its installation file (.INS), its resources file (.RCS), and optionally, a toolbars layout file (.TLT). Buttons and Icon files can also be included.

An installable extension server is physically composed of at least four files – the DLL file representing the functionality of the server itself, the resources file which contains the process launchers and the structure of the server's user interface, the installation file with server settings and process names, and the TLT file representing the locations of panels and toolbars for this extension.

In essence, an extension server's configuration files allow Altium Designer to determine the system capabilities and configurations of the extension when Altium Designer starts.

Mapping to Altium Designer's Preferences dialog

Plug-in extension servers can have their control resources mapped onto a local page in Altium Designer's Preferences dialog (DXP » Preferences).

To apply the mapping, you need to register the notification handler and the option pages from your server module, define a global preferences container that contains the states of your controls, and define the notification handlers which refresh the states of the controls.

When mapping is established from your extension server, if a checkbox control on the server's panel is disabled by the user for example, the same control on the Preferences dialog is turned off automatically. Internally, when you click on a control on a panel, a notification is broadcast within Altium Designer which is then intercepted by the server and the related controls are refreshed.

If you find an issue, select the text/image and pressCtrl + Enterto send us your feedback.
Content