Guide
How to Audit SOLIDWORKS Bills of Materials with Codex
Audit SOLIDWORKS BOM exports with Codex and Python. Find missing fields, conflicting revisions, and quantity issues, then verify fixes in the source assembly.

Before a BOM reaches purchasing, someone needs to check whether each row contains the information needed to order the right part. Missing descriptions, conflicting revisions, and quantities that need explanation can turn that review into repeated spreadsheet checks.
You can use Codex CLI to build a Python auditor for a SOLIDWORKS BOM export. Define the rules, preserve the original data, and generate a report that identifies each finding by its source row and the requirement it failed. You then inspect the relevant SOLIDWORKS configuration before making corrections.

Source: SOLIDWORKS Blog
This guide follows an illustrative bench-fixture assembly through export, audit, source review, and a second run. SOLIDWORKS, Codex, and Python will share a Windows workspace on Vagon Cloud Computer, keeping the CAD session and audit execution off your everyday computer while you continue other work.
The result is a repeatable review package: explicit rules, traceable findings, and a fresh export showing what changed. Engineering release decisions remain with the responsible reviewer.
Define Which BOM You Are Auditing
Start by identifying the assembly and the BOM table that will supply the export. For this example, use BenchFixture.SLDASM, its Production configuration, and a conventional table-based assembly BOM. Set the BOM type to Parts only, with quantities representing one completed assembly.
Confirm the configuration referenced by the BOM itself. Record it alongside the saved assembly revision, using your team's revision source, and the export date. These details will become audit_context.json, the context file kept with the audit results.

Source: SOLIDWORKS Blog
Before exporting, establish these settings:
Setting | What to record |
|---|---|
Source | Assembly filename, saved revision, and BOM table name |
Configuration |
|
BOM structure | Parts only, plus subassembly child-display settings |
Configuration grouping | Whether component configurations have separate or combined entries |
Quantity basis | One assembly; identify any rows using measured amounts |
The structure setting needs particular attention. SOLIDWORKS uses child component display settings alongside the BOM type. A subassembly set to Hide can appear as one item in a parts-only BOM instead of exposing its children. Record intentional exceptions before interpreting an absent part as a problem.
For the tutorial, keep distinct component configurations as separate entries. In an existing project, preserve the approved configuration grouping and record how it works. Changing grouping during the audit can alter rows without any underlying design change.
This first audit checks the exported rows for missing required information, conflicting attributes, and quantities that violate declared rules. Confirming that every required component appears needs additional evidence from the assembly or an approved expected-parts list. Keep that distinction in the report so its findings remain tied to what was actually checked.
Give SOLIDWORKS and Codex a Dedicated Audit Workspace
For recurring BOM reviews, choose Vagon Cloud Computer to give the CAD session and audit tools their own Windows machine. Run Codex and Python there alongside SOLIDWORKS, so you can inspect a reported issue in the source assembly without moving the project between environments. Your everyday computer stays available for other work while the cloud computer handles the application session and script execution.
Create a Windows computer, connect to its desktop, and prepare three things:
SOLIDWORKS and the project. Install and activate SOLIDWORKS with your own valid license. Transfer a working copy of
BenchFixture.SLDASMtogether with its referenced parts and subassemblies. OpenProductionand confirm that the expected components resolve before exporting.Codex CLI. Follow the official Windows installation instructions, then sign in using your own OpenAI access. Run the terminal inside the Vagon desktop so Codex works with the files on that computer.
Python. Install Python and confirm that
python --versionworks in the same terminal. The auditor will use standard-library modules for CSV parsing, rules, and reports.
Create a project folder with separate locations for CAD files, preserved exports, generated reports, and scripts:
Keep audit_context.json and the forthcoming audit_rules.json at the project root. Tell Codex to preserve the CAD files and raw exports, place code in scripts, and write results under outputs.
Start with one assembly and one export. The first useful checkpoint is a readable BOM file whose source configuration you can confirm in the open SOLIDWORKS session.
Export the BOM Without Losing Its Meaning
With the Production BOM displayed, check that its values reflect the current saved assembly. Right-click the assembly BOM and use its save/export options to select CSV, one of the documented assembly BOM export formats. Save the first export as inputs/bom_raw.csv and preserve it unchanged.

Source: SOLIDWORKS Blog
Before auditing, inspect the table's column properties. Confirm which columns supply the part number, description, revision, material, quantity, and unit. These are requirements for this example; your template may use different headings or omit some fields. Add necessary columns in the working BOM and export again if the required data is unavailable.

Source: SOLIDWORKS Blog
A column labeled Material might contain a custom property. Record its source so a populated cell is not mistaken for confirmation of the part's physical material assignment. Likewise, map the quantity column specifically to Production if the table contains several configuration quantities.
For illustration, a small export could contain:
This teaching sample includes a blank description, a description containing a comma, and a measured quantity. Keep 00127 as text. Inspect the raw file in a text editor first; if you use a spreadsheet, import identifier columns explicitly as text and leave the original export untouched.
Add the export filename and exact header mapping to audit_context.json, together with:
The confirmed character encoding, delimiter, and quote character.
The decimal separator and any permitted thousands-separator convention.
The quantity unit and whether each relevant item uses a count or a measured amount.
Use Python's CSV parser to read quoted fields correctly. Have Codex preview the headers, parsed record count, and several records before building the checks. Compare that preview against the BOM, including identifiers and quantities. Unexpected columns or broken descriptions mean the input needs attention before any audit result is useful.
Turn BOM Requirements into Explicit Audit Rules
Give Codex a written definition of a finding before asking it to inspect the export. For this fixture, require a part number, description, revision, material, quantity, and unit on each data record. A missing column prevents the audit from running; a blank cell produces a finding against that record.
Save the policy as audit_rules.json. Using the exact headers from the sample export, start with:
The unit mapping expresses the approved convention for this example. Confirm the quantity basis in SOLIDWORKS before adopting it for another project. SOLIDWORKS can calculate BOM quantities from a custom property, so an integer-only check would incorrectly reject legitimate measured amounts.

Source: SOLIDWORKS Blog
Use three named checks:
Rule | Condition to report | Expected behavior in the example |
|---|---|---|
| A required value is empty or contains only whitespace | Flag the blank description for |
| Records sharing an exact part number contain different nonblank values for an invariant field | Report conflicting values together; retain every source record |
| Quantity is nonnumeric, nonfinite, nonpositive, fractional for a count, or paired with an unrecognized unit | Accept |
Here, Part Number is the team's chosen identity within this export. Compare it as text, preserving leading zeros and case. Repeated numbers with matching attributes pass the conflict check. A blank identity receives a missing-field finding and stays out of identity grouping.
Keep comparisons exact for this first version; use whitespace checks only to identify empty values. Any later normalization needs an explicit policy while retaining the original text. Quantity parsing must follow the decimal and separator settings recorded with the export.
Revision or material allowlists require an additional check and acceptance tests using team-approved values. The supplied auditor does not implement allowlist validation and rejects unsupported rule keys instead of silently ignoring them. Codex should not invent approved revisions, substitute materials, or fill missing descriptions. Corrections follow inspection of the source.
Have Codex Build and Test the BOM Auditor
Open Codex in C:\BOMAudit and give it the preserved export, context, and rules. Ask it to inspect those inputs first and identify any missing configuration before generating code. The implementation should read files, evaluate the declared checks, and write review artifacts.
Use a bounded request:
Have Codex save the complete implementation under scripts and the acceptance tests under tests. Use verified project values in the context file when auditing your own export. The rule keys reference exact CSV headers. The context mapping documents their meaning without renaming them; its optional item_no entry also selects the source column used for item numbers in findings. Omit that entry if the export has no item-number column.
Review the generated code before running it. Quantity conversion should use Decimal constructed from text, with the declared decimal and grouping separators. Check that nonfinite values are rejected and that an unknown unit produces a review finding. Missing headers, duplicate headers, malformed records, or an empty dataset must stop the audit with an input error.
Test both failures and legitimate data. The sample should produce exactly one R-MISSING finding for the description of 00127. It should preserve 00128 and parse "Clamp, fixed" as one field, while accepting 0.25 kg. Additional fixtures should distinguish identical repeated records from conflicting revisions and confirm that a fractional count is flagged.
Run the tests, then the first audit from the project root:
Use a fresh output directory each time; the reference project includes run-01 as a recorded example. Exit code 0 means the declared checks are clear, 1 means findings require review, and 2 means an input or execution error. Check the exit code before opening a report.
The reference auditor passed eleven acceptance tests on synthetic data, including repeated-run consistency, preservation of input files, rejection of unsupported rule keys, and alternate item-number headers. This verifies the file-processing behavior on the authoring host. Inspection of a real SOLIDWORKS export and its source assembly remains the next checkpoint.
Review Missing Fields, Identity Conflicts, and Quantity Warnings
Open report.md in the new run directory, then check manifest.json for the source filename, configuration, and record count. The recorded teaching run contains three data records, one finding, and the status review_required. If your run stops with an input error, resolve that error before interpreting any earlier report.
The corresponding entry in findings.json includes:
This identifies the blank description from the sample. The full entry also supplies a review action. Use exceptions.csv to work through findings in a spreadsheet, or inspect findings.json when you need to confirm exact strings such as 00127.
Here, record: 1 means the first data record after the header. A quoted description can span several physical lines, so the record number is not necessarily a text-editor line number. Keep the export filename, record ordinal, item number, and part number together when locating the source row. After a new export, rows may move; match findings using the declared part identity and field.
When another export produces R-CONFLICT, review the related records as a group. Two flagged records can represent one disagreement, such as two revisions attached to the same part number. The report preserves both values; it does not decide which revision is authoritative. The three-record teaching sample contains no such conflict.

Source: SOLIDWORKS Blog
For R-QTY, inspect the reported field first. A finding against UNIT asks you to establish the quantity policy. A finding against QTY. directs attention to the numeric value or format. Neither establishes the correct replacement quantity by itself.

Source: SOLIDWORKS Blog
The manifest records SHA-256 hashes of the export, context, rules, and script, allowing you to identify the exact files behind a result. It also marks assembly completeness as not_checked. Treat the report as a queue of specific review tasks, with each resolution supported by the source assembly or the team's approved data.
Trace Each Finding Back to SOLIDWORKS
Return to the working copy of BenchFixture.SLDASM and confirm that the BOM still references Production. Locate the row for 00127, identify its associated component, and inspect the column supplying Description. A displayed part number may differ from the component filename, so establish that connection in SOLIDWORKS before opening or editing a part.
For the sample's missing description, follow the value from the table to its source. Check the mapped property in the referenced component configuration. If the BOM uses a configuration description, inspect that setting too: the Use in bill of materials option can give the configuration description precedence over custom-property text. Correcting a different property would leave the exported value unchanged.

Source: SOLIDWORKS Blog
Check for a table-specific override when a BOM value disagrees with the model. The SOLIDWORKS 2025 override documentation distinguishes Keep Link, which passes an edit to the model, from Break Link, which overrides the table value. Confirm the behavior in your installed release before editing a linked cell. Changing the displayed text can affect a different scope than intended.
Route other questions to the relevant source:
Conflicting revisions: identify the documents and configurations behind each row, then compare them with the approved revision record. Do not select whichever value occurs most often.
Unexpected quantities: inspect the referenced configuration, quantity-driving property, and unit. Compare the contributing component instances with the declared quantity basis.
A component expected by the reviewer is absent: inspect its Exclude from bill of materials setting, suppression state, and parent subassembly's child-display settings. This investigation starts from independent knowledge of the component, not a discovery made by the CSV auditor.

Source: SOLIDWORKS Blog
Record each decision in a separate disposition log: finding, source document and configuration, cause, approved action, reviewer, and status. Leave unresolved cases open. Apply approved corrections to the working CAD files or intended BOM settings, then save the affected documents. The next export will show whether the change reached the data being audited.
Re-Export and Keep a Reviewable BOM Audit Package
After saving the approved corrections, export the same BOM as inputs/bom_reviewed.csv. Preserve the first export. Copy the context into audit_context_reviewed.json and update its export_file, saved revision, and export date as appropriate. Retain the same configuration, grouping, column definitions, and quantity basis so the results remain comparable.
Run the reviewed export with the original rules and script:
For the teaching example, supplying the approved description for 00127 should remove its R-MISSING finding. Confirm that the part still appears and that the other records retain their intended values. A finding disappearing because its row was omitted does not establish that the source problem was corrected.
Compare the two runs by part identity, rule, and field, using the disposition log to explain resolved and outstanding cases. The companion produces each run's findings; cross-run comparison is a separate review step. If the rules or script changed, document why and rerun the original export under that version before comparing results.
Keep both exports, their context files, the rules and script, both output directories, and the disposition log together. This package lets another reviewer trace each reported issue through its source check, approved action, and subsequent export without reconstructing the audit from a chat history.
FAQs
Do I need MCP to audit a SOLIDWORKS BOM with Codex?
No. This workflow gives Codex access to an exported CSV and uses Python for the checks. Direct inspection or modification of native CAD documents would require a separate, verified application integration. The companion script does neither.
Can I use an Excel or PDM BOM instead?
The companion reads CSV, so convert an Excel workbook to CSV while preserving identifiers and field values. SOLIDWORKS PDM also supports BOM export to CSV. Establish that export's BOM type, file version, configuration, headers, and quantity meaning before adapting the context and rules.
Can the auditor find parts missing from the export?
It cannot identify a completely absent part from the CSV alone. That requires assembly evidence or comparison with an authoritative expected-parts list. The supplied companion checks exported records; it does not implement an assembly traversal or expected-list comparison.
Does a clean report make the BOM ready for release?
A clean report means the supplied records passed the configured checks. It does not verify that a populated description is correct, a revision is approved, or a material is suitable. Release still requires the team's source-data review and engineering approval.
Filed under

Written by
Mert Boz
Mert is a philosophy student with a strong interest in economics, motorsports, and basketball. He enjoys thinking about how the world works, both in theory and in real life. In his free time, you can often find him watching a race, following a basketball game, or reading about economic ideas.
More posts by this writer →
Related
More on Engineering & CAD
All posts →






