SOLIDWORKS Manage provides greater flexibility than we’ve known with just PDM in terms of exporting data. We’ve previously covered exporting record item data, so now we’ll extend that by including BOM data.
What can we export?
When exporting BOM information, we’re limited to a number of fields for the child along with all properties from the parent. Additionally, we are given fields related to the child and its configuration in the BOM, such as quantity and item number.
Configuring the Export
Configuring the XML export for exporting BOM data starts as described in a previous article and then adds a few extra steps. First, we’ll specify the format for the BOM information itself.
To do this, open the object’s administration dialog and go to the BOM configuration page.
We’ll select a BOM format that we’ve already defined to edit and use for export.
On the Other Options tab in the BOM properties dialog, find the Export data templates button.
Export file settings are specific to the BOM configuration. If multiple formats are necessary, more BOM configurations will need to be created to suit.
In the File Body area, we define our structure as we did in the Main Text area of the object’s export template.
This structure does not need to be a full XML structure, as it will be repeated per BOM item inside the main template once fully configured.
I’ve created this example as a sub-item structure for how I want my BOM to look as a multi-tiered output.
Input values work the same as defined in the article for exporting record data to XML; the key difference is the options of fields.
Many of the fields are only able to be pulled from the parent and not the BOM item itself. There are also options for Quantity and Item number, which can only exist in a BOM.
We define these one at a time by clicking the + icon. From here, we specify a keyword.
There are no special requirements for keywords, but the idea is to make them unique enough that they won’t be in the body of the XML structure.
In the image below, we have the description from the record being injected into the output file from the keyword ‘$Qty’.
We added an extra character to ensure that the tag of ‘Quantity’ isn’t getting replaced with the values from the record.
Repeat this process for every variable you’d like to see in the XML output, and include the keyword in the file body text.
Once the BOM export template is configured, it can be added to the object’s export template that we’ve previously defined.
To make the template a BOM template, check the box for Export BOM.
This enables the keyword for the BOM field. This can be specified as something custom if necessary, but is BomKeyword by default.
Add this to the main text as shown above.
This will be replaced repeatedly for each item on the BOM. If we toggle the option to export BOM items in Tree style, then BOM items will come with their sub-components noted as a sub-item level with a #.# item number format.
Using the Output children from all BOM levels option, you get this same effect, but item numbers for sub-items start at one for each new sub-assembly.
Exporting Record Data
Running an export that is configured for BOM data is the same as it is for records. To export, right-click a record and go to Tools > Create XML file for ERP.
A dialog will pop up to select which XML template to use. Clicking Generate will process the export and create the file in your site’s output folder.