Table of Contents

bom

Free

Description

The bom command allows you to extract a bill of materials from a SOLIDWORKS file inside the PDM vault and export it to a CSV file.
This command supports configuration evaluation using $configuration, allows specifying configNames, and supports selecting a layout from all available BOM layouts.

Syntax

bom -filePath -name -directory -search -recursive -configNames -layout -csv

Use -id as an alternative to -filePath for the same operand. A required target still needs one selector, even though each alternative is optional individually. See File IDs and paths for selection rules and command-specific exceptions.

Parameters

Parameter Alias Required Description
-filePath No File to create the Bill Of Materials for
-name No Pattern of the destination filename. This supports placeholders.
-directory -dir No Where to export the Bill Of Materials
-search No Searches for files in the current directory and runs the bom command on. You ignore -filePath if you use this parameter.
-recursive No Use only in combination with -search
-configNames No Configuration names to export, separated by semicolons.
-layout No Bill Of Materials layout name
-csv No Search only: save an operation-results report, separate from the exported BOM files.
-id No Positive PDM file ID instead of -filePath, identifying the same file that -filePath describes (including a macro, input CSV or existing output file). Requires a connected vault. Shared files with multiple locations require an exact -filePath. Resolving the ID itself does not download, check out or check in the file; the requested command still performs its normal operation.

More about parameters

  • filePath
    Path to the SOLIDWORKS file whose BOM you want to export.

  • name
    The base name for the exported CSV file.
    Supports evaluation (e.g., $configuration).
    More information here.

  • directory
    Target folder where the CSV will be saved.

  • search
    Search query used to find files in the current directory and run the bom command on each result.

  • recursive
    When used with search, includes files in subfolders.

  • configNames
    Comma-separated list of configurations to extract the BOM from. If unspecified, all configurations are processed. Example: @,Default,Manufacturing.

  • layout
    A comma-separated list of BOM layout names to export.
    Example: Engineering,Manufacturing.
    PDMShell validates layout names against PDM before exporting.

Report search results

Use -csv with -search to save the outcome of each BOM export:

bom -search "Name=%.sldasm" -recursive -layout BOM -configNames Default -name "$fileNameWithoutExtension-$configuration" -directory "C:\Exports" -csv "C:\Reports\bom-results.csv"

The report columns are ID, ParentFolderID, Name, Output, Status, Error, Exception, HRESULT, Configuration, and Layout. Output is the export destination; Status tells you whether it succeeded. Errors include the exception details. Each attempted configuration/layout export has its own row; file-level errors have a row with those fields empty.

Failed exports do not stop later files. Any failure marks the command as failed. An empty search produces a report containing only the column headers.

-csv cannot be used with -filePath or -id. Relative report paths use the current vault folder. The report folder must already exist, and the report must have a different path from the BOM exports. New reports inside the vault are added to PDM; existing vault reports must be checked out by you in that folder on this computer and remain checked out. External reports are replaced.