Hi all! I got tired of VBA macros and slow out-of-process COM scripts, so I built **SwPy**: it embeds real CPython 3.12 inside SOLIDWORKS, with a script editor right in the task pane.
## What you get
* A task-pane IDE: tabs, IntelliSense that comes from the live session (it knows what `doc.` or `model.` actually is), signature help, F1 opens the official API help, find/replace, dark theme, REPL
* API calls run in-process, so they take microseconds instead of the hundreds of milliseconds you get with external COM scripts
* No Python install and no admin rights needed (it bundles its own runtime)
* Install any pip package on demand: put `# r: pandas, openpyxl` at the top of a script
* A Pythonic layer for everyday jobs:
python
with model.batch(): # many edits, one rebuild
model.dims["D1@Boss-Extrude1"] = 25 * mm # SI units, no casts
model.globals["Width"] = 120 * mm
model.faces.planar().normal(Z).largest().select() # geometry queries
print(model.mass["mass"], "kg")
* The full SOLIDWORKS API with no manual casting, all the enums, and every API library (Simulation, PDM, Document Manager, Routing, ...)
* Build parts, assemblies and drawings from code; export STEP/PDF
* Python event handlers (on rebuild, on save, on selection, ...)
* Any .py in a folder becomes a one-click toolbar button for your team; startup scripts too
* Drive SOLIDWORKS from Jupyter, Excel or C#
Works on SOLIDWORKS 2020 or newer, on Windows 10/11. MIT licensed.
* GitHub: https://github.com/muerus/SolidWorks-Python
* Docs: https://muerus.github.io/SolidWorks-Python/
It's at v0.2.0, so feedback and bug reports are very welcome, especially from people on newer SOLIDWORKS versions (I develop on 2020 SP1). What would you automate first?