Old Content - visit altium.com/documentation

Parent page: Altium Designer API Reference

This section of the Altium Designer API documentation provides a detailed reference of the Workspace Manager API interfaces.

The Altium Designer scripting system implements a subset of the complete Altium Designer API and its Object Interfaces. The Altium DXP Developer, used for developing Altium Designer server Extensions, has access to the full Altium Designer API via a set of API SDK source units.

The WorkSpace Manager (WSM) Application Programming Interface reference covers the Workspace manager object interfaces from the Workspace Manager Object Model.

The workspace manager interfaces exist as long there are associated existing objects in memory, thus when writing a script or server code, you have the responsibility of checking whether the interface you wish to query exists or not before you proceed to invoke the interface's methods.

You will have to ensure that the design project is compiled first otherwise the workspace manager interfaces are in an invalid state and will be returning nil values.

The workspace manager provides a bridge between source documents (such as Schematic documents) and its corresponding primary implementation documents (such as PCB documents). This workspace manager provides you information on how a project is structured, and information on nets and its associated net aware objects of source and implementation documents.

The IWorkSpace interface deals with projects, documents and objects on the open documents. To use workspace interfaces, the project needs to be compiled first refreshing all the linkages and nets up to date.

Main WSM interfaces

  • The IDMObject interface is a generic interface used for all other WorkSpace interfaces.
  • The IWorkSpace interface is the top level interface and contains many interfaces within. For example the IWorkSpace interface has a DM_OpenProject function which returns a currently open or currently focused IProject interface.
  • The IProject interface represents the current project in Altium Designer.
  • The IDocument interface represents a document in Altium Designer.

Logical and Physical Documents

An important note, there are logical and physical documents; these terms are used to differentiate the documents in multi-channel projects. A multi channel design means that a single sheet is referenced repeatedly for a channel design. This sheet is called a logical document. A physical document (usually a PCB document) has components with unique names within a room which is mapped to a channel on a Schematic sheet. So a multi channel design translates to multiple rooms with components with unique physical designators on a PCB.

A physical designator of a PCB component is calculated to have the hierarchy path of a schematic project as well as the logical designator of the associated Schematic component to ensure that this designator for the PCB component is unique.

Example
Obtaining the project path from the current IProject interface.

 // Get WSM interface (the shell of the WorkSpace Manager interface). WSM := GetWorkSpace; If WSM = Nil Then Exit; Document := WSM.DM_Document; If Document = Nil The Exit; Project := Document.DM_Project;

Script Examples
There are script examples in the \Examples\Scripts\WSM folder

References for the WSM API

Separate references for other Altium Designer APIs

WSM Object Model

To have access to the workspace interface object which represents the workspace manager in Altium Designer, you need to invoke the GetWorkspace function first. This function returns you the IWorkspace interface object. An object interface is just a means of access to an object in memory.

The workspace manager provides a bridge between source documents (such as Schematic documents) and its corresponding primary implementation documents (such as PCB documents). This workspace manager provides you the ability to manipulate the contents of a design project in Altium Designer.

WSM Interfaces

A sample of the workspace manager interfaces:

  • The IDMObject interface is a generic interface used for all other WorkSpace interfaces.
  • The IWorkSpace interface is the top level interface and contains many interfaces within. For example the IWorkSpace interface has a DM_OpenProject function which returns a currently open or currently focused IProject interface.
  • The IProject interface represents a design project in Altium Designer.
  • The IPart interface represents a part of a multi-part component. This component is represented by the IComponent interface.
  • The IDocument interface represents a document in Altium Designer.
  • The IECO interface is used for the Engineering Change Order system in PCB and Schematic servers.
  • The INet interface is a container storing Net aware objects (which are INetItem interfaces) that have the same net property. So there are INet interfaces representing nets on a document.
  • The INetItem interface is the ancestor interface for the Cross, Pin, Port, Netlabel, Sheet entry and Power Object interfaces. These interface objects have a net property and thus these objects can be part of a net.

 

You are reporting an issue with the following selected text and/or image within the active document: