
PolyMech CAD Tools (pm-cad)
Automate your SolidWorks workflow from the command line. PolyMech CAD Tools (aka pm-cad) is a Windows-first CLI and Node.js toolkit that batch-converts SolidWorks assemblies, parts, and drawings into downstream-friendly formats—STEP, PDF, JPG, interactive HTML webviews, XLSX BOMs, and JSON metadata—without repetitive GUI "Save As" clicks.
If you build products in SolidWorks and need repeatable exports for manufacturing, quoting, documentation, release packages, or CI/CD, pm-cad turns CAD deliverables into a scriptable, auditable pipeline.
What used to take two hours of manual clicking now runs as a 30-second script—consistently, every time.
Why pm-cad?
Engineering teams lose hours to manual export routines: opening models, switching configurations, rebuilding, exporting PDFs, STEP files, and BOMs—then doing it all again after every change. pm-cad replaces that entire burden with one command that can process hundreds of files, consistently.
| Pain point | pm-cad solution |
|---|---|
| Manual "Save As" for every file format | One command converts entire folders (glob patterns) into multiple outputs (e.g., `step |
| No easy way to export BOMs | Generates XLSX bills of materials directly from assemblies |
| HTML previews require eDrawings seats | Batch-exports interactive HTML webviews via the eDrawings API (eDrawings is free) |
| Configuration variants are tedious | Iterates all configurations automatically with ${CONFIGURATION} |
| Hard to integrate into build pipelines | Use it as a CLI, Node.js library, or Grunt task |
What you can do with pm-cad
1) Batch CAD conversion (SolidWorks → STEP/PDF/JPG)
Export manufacturing and documentation deliverables from parts, assemblies, and drawings — one command, done:
- STEP for CAM, CNC, suppliers, and neutral exchange
- PDF for drawings, release packs, and approvals
- JPG for thumbnails, product pages, and catalogs
2) Interactive HTML webviews (via eDrawings)
Create lightweight, shareable HTML previews for assemblies and parts — no SolidWorks license needed to view them:
- internal design reviews
- sales/support handoffs
- web portals and product pages
- vendor communication
3) Excel BOM export (XLSX)
Generate structured Bills of Materials in Excel directly from assemblies, with support for:
- BOM type (Parts Only / Top Level / Indented)
- detail level
- BOM templates
- optional component images
4) Metadata & configuration export (JSON)
Extract rich assembly intelligence for PLM, QA, quoting, and analytics. Feed mass + material data directly into your quoting tool so RFQs build themselves:
- custom properties (global + per-configuration)
- mass properties, materials, bounding boxes
- suppression state, equations, and more
5) Pack & Go (flatten references)
Unlike SolidWorks' built-in Pack & Go, pm-cad's version is scriptable, repeatable, and CI/CD-friendly. Collect an assembly and all referenced files into a clean folder for:
- supplier packages
- archiving
- controlled handoff
- reproducible builds
Quick Start
You're two commands away from never doing a manual Save-As again:
# Install globally
npm i @polymech/cad -g
# Convert an assembly to STEP + PDF
pm-cad sw --src="./cad/Global*.SLDASM" --dst="${SRC_DIR}/${SRC_NAME}.+(step|pdf)"
# See all options
pm-cad --help
Installation
Via npm (recommended)
npm i @polymech/cad -g
Windows Installer
Download and run PolyMechCAD-Setup.exe. The installer auto-detects privileges:
- Double-click → installs per-user to
%LOCALAPPDATA%, no admin required - Right-click → Run as administrator → installs system-wide to
Program Files
Both modes add pm-cad to your PATH automatically.
Automate every export format
Format conversions (glob patterns + multi-output)
Convert between supported formats using glob patterns and multi-extension outputs — no manual file-by-file clicking:
# Assembly → STEP
pm-cad sw --src="./cad/**/*.SLDASM" --dst="${SRC_DIR}/${SRC_NAME}.step"
# Parts + Assemblies → PDF + JPG (recursive)
pm-cad sw --src="./cad/**/*.+(SLDASM|SLDPRT)" --dst="${SRC_DIR}/${SRC_NAME}.+(pdf|jpg)"
# Assembly → Interactive HTML webview (via eDrawings)
pm-cad sw --src="./cad/*.SLDASM" --dst="${SRC_DIR}/${SRC_NAME}.html"
# Draw.io diagrams → PNG
pm-cad sw --src="./docs/**/*.drawio" --dst="${SRC_DIR}/${SRC_NAME}.png"
Bill of Materials (BOM) → Excel (XLSX)
Extract structured BOMs directly from assemblies — no manual table copy-paste from SolidWorks:
pm-cad sw --src="./cad/**/*.SLDASM" --dst="${SRC_DIR}/${SRC_NAME}.xlsx"
Metadata & configuration export (JSON)
Turn SolidWorks models into data you can use in automation, dashboards, and audits:
# Custom properties → JSON
pm-cad sw --src="./cad/*.SLDASM" --dst="${SRC_DIR}/${SRC_NAME}.json"
# All configurations → JSON
pm-cad sw --src="./cad/*.SLDASM" --dst="${SRC_DIR}/${SRC_NAME}-configs.json"
# Per-configuration STEP + HTML export
pm-cad sw --src="./cad/*.SLDASM" --dst="${SRC_DIR}/${SRC_NAME}-${CONFIGURATION}.+(step|html)"
Pack & Go (flatten assembly references)
pm-cad pack --src="./cad/Global*.SLDASM" --dst="./packed"
Deterministic output paths — never rename a file again
Build deterministic output paths using built-in variables. Every output file lands in the right place, with the right name, every time:
| Variable | Description |
|---|---|
${SRC_DIR} |
Directory of the current source file |
${SRC_NAME} |
Base name without extension |
${SRC_FILE_EXT} |
Source file extension |
${CONFIGURATION} |
Current model configuration name |
This makes it easy to keep exports adjacent to sources, mirror folder structures, or produce configuration-specific deliverables.
Glob pattern syntax
| Pattern | Matches |
|---|---|
*.SLDASM |
All assemblies in current directory |
**/*.SLDPRT |
All parts, recursively |
*.+(SLDASM|SLDPRT) |
Assemblies and parts |
*.+(step|pdf|jpg) |
Multiple output formats |
Integration options
File manager integration (Altap Salamander)
Register pm-cad as a custom menu command (F9) for right-click conversions:
Command: pm-cad
Arguments: sw --src="$(FullName)" --dst="&{SRC_DIR}/&{SRC_NAME}.+(step)"
Use
--alt=trueto switch variable prefix from$to&when the host app uses$for its own variables.
Batch droplets (drag & drop)
Create a .bat file and drag-and-drop files onto it:
@echo off
pm-cad sw --src="%~1" --dst="${SRC_DIR}/${SRC_NAME}.+(html)"
For folders:
@echo off
pm-cad sw --src="%~1/**/*.+(SLDASM|SLDPRT)" --dst="${SRC_DIR}/${SRC_NAME}.+(html)"
Node.js library (programmatic automation)
import { convert } from '@polymech/cad/cad/sw-lib';
await convert({
src: './cad/**/*.SLDASM',
dst: '${SRC_DIR}/${SRC_NAME}.+(step|pdf)',
verbose: true,
skip: true
});
Grunt task (build pipeline)
const cad = require('@polymech/cad/cad/sw-lib');
grunt.registerMultiTask('cad-convert', 'Convert SW files', function () {
const done = this.async();
convert(this.data.items, { ...options }, this.data.output)
.then(() => done());
});
// Gruntfile config
'cad-convert': {
step: { items: products, output: '${SRC_DIR}/${SRC_NAME}.+(step)' },
html: { items: products, output: '${SRC_DIR}/../resources/${SRC_NAME}.+(html)' },
bom: { items: products, output: '${SRC_DIR}/../resources/${SRC_NAME}.+(xlsx)' }
}
Supported formats
Input formats
| Format | Extension |
|---|---|
| SolidWorks Assembly | .SLDASM |
| SolidWorks Part | .SLDPRT |
| SolidWorks Drawing | .SLDDRW |
| STEP | .step, .stp |
Output formats
| Format | Extension | Source | Engine |
|---|---|---|---|
| STEP | .step |
Parts, Assemblies | convert.exe |
.pdf |
Parts, Assemblies, Drawings | convert.exe |
|
| JPEG | .jpg |
Parts, Assemblies, Drawings | convert.exe |
| HTML (eDrawings) | .html |
Parts, Assemblies | ExportHTML.exe |
| JSON (metadata) | .json |
Assemblies | model-reader.exe |
| JSON (configs) | -configs.json |
Assemblies | getconfigs.exe |
| Excel BOM | .xlsx |
Assemblies | bom.exe |
Under the hood
pm-cad orchestrates a native toolchain built in C# that talks directly to SolidWorks via COM interop (using xCAD + SolidWorks Interop) and to eDrawings via the eDrawings API.
| Binary | Role |
|---|---|
convert.exe |
Opens models via COM and calls SaveAs for STEP/PDF/JPG. Supports PhotoView 360 ray-trace rendering and Pack & Go. |
model-reader.exe |
Traverses the assembly tree and extracts per-component data to flat JSON + hierarchical .tree.json. |
bom.exe |
Inserts a BOM table via xCAD and exports to XLSX. Supports templates, BOM types, and component images. |
ExportHTML.exe |
Headless eDrawings API export — no SolidWorks license required. |
getconfigs.exe |
Enumerates all configurations and serializes to JSON. |
Extracted data (model-reader)
For each component in the assembly tree, model-reader.exe extracts:
| Category | Fields |
|---|---|
| Custom Properties | All configuration-specific + global custom properties (evaluated values) |
| Mass Properties | Mass, Density, Volume, Surface Area, Center of Mass (X/Y/Z) |
| Materials | Material name + database per part |
| Bounding Box | Min/Max X/Y/Z per component |
| Equations | All equation names and evaluated values |
| Model States | What's Wrong count, error codes, warning flags, affected feature types |
| Suppression | Component suppression state |
CLI options reference
Rendering
| Flag | Default | Description |
|---|---|---|
--renderer |
solidworks |
Render engine (solidworks or photoview) |
--quality |
2 (Good) |
Ray trace quality level |
--width |
1024 |
Output image width in pixels |
--height |
1024 |
Output image height in pixels |
--view |
Render |
Camera view name |
--configuration |
Default |
Model configuration to use |
BOM options
| Flag | Default | Description |
|---|---|---|
--bom-config |
Default |
BOM configuration |
--bom-type |
2 |
BOM type |
--bom-detail |
1 |
Detail level |
--bom-template |
— | Custom BOM table template |
--bom-images |
false |
Include component images |
Workflow
| Flag | Description |
|---|---|
--dry |
Preview operations without executing |
--cache |
Use file hash caching to skip unchanged files |
--save |
Save the model after processing |
--rebuild |
Force model rebuild before export |
--pack |
Pack and go mode |
--light |
Lightweight mode |
--close |
Close SolidWorks after each conversion |
--alt |
Use & instead of $ for variable prefix |
--logLevel |
Minimum log level (debug, info, warn, error) |
Requirements
- Node.js 18+
- SolidWorks 2020–2025 (auto-detected)
- Windows (SolidWorks COM interop)
Who pm-cad is for
- Manufacturing handoffs: Export STEP + drawing PDFs for suppliers in one repeatable step.
- Engineering release: Generate a "release pack" folder with consistent naming and formats.
- Sales/Support enablement: Produce interactive HTML previews that anyone can open in a browser — zero installs required.
- Automation & CI: Create nightly exports (STEP/PDF/BOM) whenever CAD changes — plug into any CI pipeline.
- Data extraction: Pull custom properties and mass/material data into JSON for quoting or audits.
FAQ
Does HTML export require a SolidWorks license?
No. HTML export uses the eDrawings API, which is free. pm-cad runs a headless host — no GUI, no license.
Can I export all configurations automatically?
Yes. Use ${CONFIGURATION} in the destination pattern and pm-cad iterates every configuration.
Can I keep exports next to source files with matching names?
Yes. Use ${SRC_DIR} and ${SRC_NAME} for deterministic output paths.
Is it safe to run on large assemblies?
pm-cad is designed for batch processing and supports workflow controls like caching (--cache), rebuild control (--rebuild), lightweight mode (--light), and closing SolidWorks between jobs (--close) depending on your stability and performance needs.
Get started
PolyMech CAD Tools brings modern automation to SolidWorks deliverables: batch exports, BOM to Excel, interactive HTML previews, metadata extraction, and Pack & Go — all from a scriptable CLI or Node.js API.
Stop clicking Save-As. Start shipping reliable exports.
npm i @polymech/cad -g
pm-cad --help
References
- xCAD.net by Xarial — The .NET framework used by pm-cad's native toolchain for SolidWorks COM interop. Provides strongly-typed access to the SolidWorks API.
- SolidWorks API Help — Official SolidWorks API documentation for COM automation, model traversal, and export methods.
- eDrawings API — API reference for eDrawings automation used by
ExportHTML.exefor headless HTML export. - STEP (ISO 10303-21) — The neutral CAD exchange format used for manufacturing handoffs and CNC programming.
- Node.js Glob Patterns (minimatch) — The glob syntax reference used by pm-cad for file matching.
- npm: @polymech/cad — The npm package page for pm-cad.