BOM Engine Interfaces

Modified by Rob Evans on Apr 17, 2018

The Altium SDK Bill Of Materials (BOM) Interfaces allow the creation and management of project BOM data and associated parameters.

The BOM 2.0 Engine is available in the Altium SDK 4.0. Its main class is the BOM Manager (IBomManager) , called for a specific document data source type by the IBomManagerFactory ( EDP.Utils.GetBomManagerFactory()).

A BOM 2.0 Engine example project is included with the Altium Developer installation. In the default Altium Developer installation, the C# (CSharp) BOMPanel example location is: C:\ProgramData\Altium\[host Altium software]\Extensions\Altium Developer\SDK4.0\CSharp\Examples\BOMPanel

BOM usage via the Altium SDK


The very entry point for using the BOM (Bill Of Materials) via the Altium SDK is IBomManagerFactory.

To get an instance of the BOM Factory, use  EDP.Utils.GetBomManagerFactory() method.

Get Bill Of Materials

The Bill Of Materials object is represented by an instance of IBomManager/IActiveBomManager:

  • for any document (SCH / PCB / BOMDOC) as a source of components:
  • for SCH / BOMDOC as a source of components with a PCB document as an additional source of PCB parameters:
    IBomManagerFactory.GetManagerForDocumentPcb(srcDoc, pcbDoc)
  • for a whole project:
  • for a whole project with a PCB document as an additional source of PCB parameters:
    IBomManagerFactory.GetManagerForProjectPcb(project, pcbDoc)

IBomManager / IActiveBomManager

Depending on the options above, you will get an instance of EDP.IBomManager or EDP.IActiveBomManager.

To check which one you have, cast the instance to IActiveBomManager:
var activeBomManager = bomManager as IActiveBomManager;
...and check the result for a null.

Retrive the BOM content

Get rows

IBomComponentList components = bomManager.GetSchema().GetComponents()

IBomComponentList is a list of IBomComponent

Get 'original' components of row

First, check if a row (IComponent) is actually a group – that is, it contains more than one component:  row.IsGroup()

Then cast it to a group and get its components: row.AsGroup().GetComponents()

Get row columns (parameter) values

Getting column parameter values for a given IBomComponent row.

Get row parameters dictionary:
IBomParameterDictionary params = row.GetParameters()

...and use the dictionary’s methods like:
bool TryGetParameter(string argName, out IBomParameter argParameter)

GetStrValue(..), GetIntValue(..);

Get column aliases

For an ActiveBOM document, column aliases (custom names) can be specifed.

If you have IActiveBomManager (not just the IBomManager) you are able to access:
string aliases = activeBomManager.GetOptions().GetColumnsAliases()

This string should be parsed – split with a ‘|’ char and then received pairs with ‘=’

Get list of all columns (parameters)

IBomParameterDefinitionList columns = bomManager.GetSchema().GetParameterDefinitions()

Get list of custom columns

For an ActiveBOM document, Custom Columns can be created. They are presented in IBomParameterDefinitionList along with other (auto-generated) columns. If a dedicated list is needed for some reason, it can be obtained with:

Set up the required BOM

The point where you can configure the BOM is:
IBomManagerOptions o = bomManager.GetOptions()

...or for ActiveBOM:
IActiveBomManagerOptions ao = activeBomManager.GetOptions();

Flat view mode





Assume there is a:
IList<Tuple<string, ListSortDirection>> sortOrderParams;

Where the first item is Name of Parameter, and the second is Sort Direction.

...then to apply the following setting to BOM usage:

o.AutoSort = sortOrderParams.Count == 0;

Avoid affecting BOMs in the rest of Altium Designer

It's advisable to save the BOM Manager Options before they are modified:

IBomManagerOptions options
var savedState = options.GetState();

When all the required data have been collected, restore the options:

Using a try-finally clause is recommended.

Modify BOM content

Set line number for row

Setting line numbers is possible for ActiveBOM only:

IActiveBomManager activeBomManager = ... // create BomManager for .BomDoc
IBomComponent component = ... // find component in BOM schema
var catalogId = component.GetParameters().GetStrValue("%CATALOGID%");
var catalog = activeBomManager.GetCatalog();
var catalogItem = catalog.FindItem(catalogId);

To update BOM schema after changing line numbers in catalog items, call bomManager.UpdateSchema (note - this will recreate the whole BOM schema).

Add custom row

To add a custom row in ActiveBOM:

IActiveBomManager activeBomManager = ... // create BomManager for .BomDoc
var catalog = activeBomManager.GetCatalog();
var catalogItem = catalog.AddCustomRow();

To set parameters for a created custom row use catalogItem methods SetComment, SetDescription, SetLineNumber (or GetParameters().SetValue methods to set any parameter).

To update BOM schema after a creating custom row call bomManager.UpdateSchema.

Save ActiveBOM document

After any modification you may wish to save the ActiveBOM document (*.BomDoc), which can be done as follows:

IDocument document = ... // get ActiveBOM document
var serverDocument = document.DM_ServerDocument();
Found an issue with this document? Highlight the area, then use Ctrl+Enter to report it.



You are reporting an issue with the following selected text
and/or image within the active document:
Altium Designer 免费试用
Altium Designer Free Trial
我们开始吧!首先,您或者您的公司已经在使用Altium Designer了吗?

Copyright © 2019 Altium Limited

既然您在使用Altium Designer,为何仍需要试用?

Copyright © 2019 Altium Limited


点击下方按钮下载最新版本的Altium Designer安装包

下载Altium Designer 安装包

Copyright © 2019 Altium Limited

填写下方表格,获取Altium Designer最新报价。





您为何想要试用Altium Designer?

Copyright © 2019 Altium Limited



Great News!

Valid students can get their very own 6-month Altium Designer Student License for FREE! Just fill out the form below to request your Student License today.


好的,您可以下载免费的Altium Designer Viewer查看文档,有效期6个月。






Copyright © 2019 Altium Limited

好的,您可以下载免费的Altium Designer Viewer查看文档,有效期6个月。