SolidWorks-CLI vs writing C# against the SOLIDWORKS COM API
Automating SOLIDWORKS directly means writing C# against version-specific COM interop DLLs
for every task, while the alternative is repeating clicks in the viewport. SolidWorks-CLI implements the
COM plumbing once via late binding: 92 verbs with plain flags, JSON output, persistent face/edge handles
and dry-run safety until --apply.
92 verbs · Single late-bound COM binary · 10 tasks compared below
| Task | SOLIDWORKS GUI, by hand | Raw C# COM API | SolidWorks-CLI |
|---|---|---|---|
| Inspect a part's feature tree and dimensions | Open the part and expand every FeatureManager folder by hand | Attach via ROT, traverse IFeature.GetFirstFeature / GetNextFeature and IDisplayDimension in COM | solid tree, solid features, solid part-dims as JSON |
| Target a face or edge reliably after edits | Rotate the model and click the face in the viewport again | Call GetPersistReference3 / GetObjectByPersistReference3, serialize byte arrays and check stale refs | solid refs-list / solid refs-of with persistent @fN handles |
| Create a dimensioned 2D sketch and extrude or cut | Pick a plane, draw segments, add relations and dims, run Extrude/Cut | Coordinate InsertSketch2, CreateLine, SketchAddConstraints and 23-argument FeatureExtrusion3 | solid sketch, solid extrude, solid cut |
| Add fillets, chamfers, shells or patterns | Select edges or faces manually and fill each PropertyManager | Select objects with exact marks, manage IFeatureData, AccessSelections and ReleaseSelectionAccess | solid fillet, solid chamfer, solid shell, solid linear-pattern |
| Insert assembly components and create mates | Insert each part, drag near position, pick faces in the Mate dialog | Call AddComponent5, compute transform matrices, invoke AddMate5 with exact alignment enums | solid insert-component, solid mate, solid move-component |
| Audit an assembly for interference, mass and BOM | Run Interference Detection, Mass Properties and BOM tables separately | Drive IInterferenceDetectionMgr, walk leaf components and aggregate mass/material data | solid review, solid interference, solid mass-props, solid bom |
| Create a 3-view drawing and export STEP / PDF / DXF | Open template, place views, add dimensions and Save As per format | Handle drawing templates, Create3rdAngleViews2, IExportPdfData and Extension.SaveAs | solid new-drawing, solid drawing-view, solid drawing-dim, solid export |
| Preview edits before touching production CAD | No dry run: edits alter the open model immediately | Only if you build your own sandbox copy and rollback harness | Every write verb is a dry run until --apply, guarded by solid sandbox and policy.json |
| Run across SOLIDWORKS versions without licensed DLLs | Operate each local installation manually | Reference local SolidWorks.Interop.*.dll assemblies and recompile per version | Single x64 late-bound COM binary, zero SOLIDWORKS DLLs redistributed, ROT attach (--pid) |
| Keep concurrent callers from corrupting a session | One engineer per window | Build your own cross-process lock: SOLIDWORKS COM is single-threaded and synchronous | Machine-wide Ring-1 mutex refuses concurrent writes cleanly, plus solid batch for one-attach runs |
The repetitive cost in raw C# is the plumbing: ROT session discovery, late-bound dispatch, persistent reference serialization, rebuild verification and cross-process locking. Paying that once in one CLI gives every script and AI agent a uniform JSON surface.
Common questions
Do I need to write C# to automate SOLIDWORKS?
Not with a command-line layer in front of the COM API. SolidWorks-CLI wraps the ROT attach, persistent geometry references, dry-run guards and rebuild checks once, exposing 92 JSON verbs usable from PowerShell, Python, CI scripts or AI agents.
Does SolidWorks-CLI replace a SOLIDWORKS license?
No. It automates the licensed SOLIDWORKS installation already on your Windows workstation through its public COM API. What it replaces is manual clicking and repetitive per-task C# boilerplate.
Run these verbs on your own SOLIDWORKS models
Run read-only inspection on any part or assembly before changing a single millimetre. SolidWorks-CLI is local and on-premise: zero UAC elevation, zero SOLIDWORKS interop DLLs
redistributed, and every write is a dry run until you pass --apply. Fourteen-day free trial
with corporate e-mail, no card.
Verb families
- Open, create, save and sandbox SOLIDWORKS files from the command line13 verbs
- Inspect SOLIDWORKS feature trees, dimensions, mass, holes and configurations15 verbs
- Create, read, constrain and edit 2D SOLIDWORKS sketches by command10 verbs
- Build and edit 3D SOLIDWORKS part features, datums and materials17 verbs
- Automate SOLIDWORKS assemblies, mates, BOM and interference checks10 verbs
- Generate SOLIDWORKS drawings, section views, hole callouts and CAD exports7 verbs
- Validate, inspect and transactionally build SOLIDWORKS specs from JSON5 verbs
- Address SOLIDWORKS faces and edges by persistent reference and inspect COM APIs7 verbs
- Check SOLIDWORKS installations, ROT sessions, health, paths and batch runs8 verbs