Using the Integrated Library API
Parent page: Using the Altium Designer API
Using the Integrated Library Interfaces
There are different types of libraries in Altium Designer - normal standalone libraries like PCB Libraries and Schematic Libraries, other library types called integrated libraries which contain different libraries bundled together and database libraries. A library can contain components and its models.
A schematic design is a collection of components which have been connected logically. To test or implement the design it needs to be transferred to another modelling domain, such as simulation, PCB layout, Signal Integrity analysis and so on.
.
The PCB model dialog represents the PCB Library Model Editor which provides the capability to change the links of PCB footprints to a schematic component.
Each domain needs some information about each component and a way to map that information to the pins of the schematic component. Some of the domain information resides in model files, the format of which is typically pre-defined. Examples of these include IBIS, MDL and CKT files. Some of the information does not reside in the model files, for example, the spice pin mapping and netlist data.
Models linked to a Component
Each schematic component can have models from one or more domains. A schematic component can also have multiple models per domain, one of which will be the current model for that domain.
A model represents all the information needed for a component in a given domain, while a datafile entity (or link) is the only information which is in an external file. See the diagram below for a relationship between a Schematic component and its models.
A model can be represented by external data sources called data file links. For example, pins of a component can have links to different data files, as for signal integrity models. We will consider each model type in respect to the data file links for the main editor servers supported in Altium Designer.
PCB Footprints (Models)
For the PCB footprints, the model name and the data file names are both the same.
Simulation Models
Schematic symbols can have simulation models to capture real life electronic data. Altium Designer has its own built in simulation models for many schematic symbols. For example, you can have a simulation model which represents a 4ohm resistor. An external file is not needed for this simulation model as the resistor model is built from a spice modelling language in Altium Designer.
Signal Integrity Models
A signal integrity model represents the I/O electrical characteristics for each pin of a schematic symbol. Normally these models are modelled with Altium Designer's SI model database.
We have the option of using external IBIS datafiles then each signal integrity model would have multiple data files. That is, each data file for each type of pin of a schematic symbol.
Note that a model can also be called an implementation. For each implementation there are parameters and data file links.
Using Integrated Library Interfaces
The IntegratedLibrary API provides a number of interfaces which can be used to access features of an integrated library open in Altium Designer.
- The IModelEditor interface represents the Model Editor hosted by a server which normally has a dialog that displays data about the model properties in Altium Designer.
- The IModelDatafile interface represents the data file that is associated with a model. Each model can have multiple data files (different representations of the same model type). This interface is used within the IServerModel interface.
- The IServerModel interface represents the model set up by the server to be used by the integrated library server.
- The IModelType interface represents the model domain. Each model domain has at least one data file type or entity type.
- The IModelDatafileType interface represents the data file as one of the models for that model type.
- The IModelTypeManager interface is like a repository of available model types in Altium Designer. The IMP files are collected and processed by this manager. This manager uses IModelType and IModelDataType interfaces.
- The IIntegratedLibraryManager interface is the integrated library manager that can retrieve or set many parameters associated with schematic components and its models. This interface is implemented in the Integrated Library server and the functionality can be used to extract the information you require.
The Integrated Library server manages IModelType, IModelDataFileType, IModelTypeManager
and IIntegratedLibraryManager
interfaces for you. You can use them to find out the current state of these interfaces used within Altium Designer. The IModelEditor, IModelDataFiles
and IServerModel
interfaces are needed to build a server that hosts a model editor that adds new model types in Altium Designer.
To have access to the Integrated Library manager, invoke the IntegratedLibraryManager
function. To have access to the interfaces of the Model Type Manager, invoke the ModelTypeManager
function.
Building a Model Editor in a Server project
There is a provision for Server Developers to build their own model editors for their document editor servers to extend the range of models the schematic components can support. To build your own Model Editor, you would need to define the source code implementations for the IModelEditor
and its associated IModelDatafile
and IServerModel
interfaces.
The IServerModel
interface and the implementation configuration file (with an *.IMP
file extension) are taken in by the Integrated Library server when you plug in the server that implements the IModelEditor
interface.
A model implementation configuration file is needed that outlines the model type (particular model domain such as PCB, Simulation, 3D models etc), and the model libraries/files for that model domain.
The Description
clause within the [ImplementationEditor
] section in this implementation file gets listed in the Add New Model dialog (accessed when you click the Add button from the Component Properties dialog.
The model implementation configuration files for PCB editor and Simulation editor are as follows:
PCB Footprint implementation file (advpcb.imp)
[ImplementationEditor] ModelType = PCBLIB Module = AdvPCB.dll Description = Footprint ServerName = PCB Process = PCB_RunSchModelEditor [Datafiles] Count = 1 DatafileKind0 = PCBLib DatafileDescription0 = Footprint Library DatafileEntityType0 = Footprint DatafileExtensionFilter0 =*.PCBLIB
Simulation Model implementation file (advsim.imp)
[ImplementationEditor] ModelType = SIM Module = AdvSim.dll Description = Simulation Process = SimAPI_RunImplEditor ServerName = Sim [Datafiles] Count = 2 DatafileKind0 = MDL DatafileDescription0 = Sim Model File DatafileEntityType0 = Sim Model DatafileExtensionFilter0 =*.MDL DatafileKind1 = CKT DatafileDescription1 = Sim Subcircuit File DatafileEntityType1 = Sim Subcircuit DatafileExtensionFilter1 =*.CKT