Main Logo
Resume
Current Projects
All Projects
Skills

SolidWorks WebApp via Python3

This project is on github: Link

Most of this is documented in more detail in the Github Repo. This writeup is more motivation focused.

SolidWorks is professional software for 3D design. It runs only on Windows and is something that a normal software engineer would never interact with (or probably even know exists). I've done alot of SolidWorks and I quite enjoy it. Something that I always found was that I spent much time doing very few things. As a software engineer, this of course screams for automation.

SolidWorks has a very good API. Furthermore, it is all accessible via the Windows Component Object Model (COM). Practically any button or setting a user can change in SolidWorks, a program can change via the COM. However, there is one drawback: you are locked into the Windows COM. Traditionally, this means C#, (Visual) C++, or Visual Basic. These languages are not known for being popular. As compared to Python, the (free) resources available for C# are abysmal.

Of course, there is a Python library for interacting with the COM. Thus, is it possible to connect to SolidWorks via this library and call the SolidWorks API from Python? Turns out this is very possible.

As a proof of concept, I developed a small webapp which display the currently open files and some simple summary statistics. There is more documentation available in the Github Repo. Regardless, it works, and it works very well. I've proven that you can connect to SolidWorks and populate information from it (via the COM API) into a Django Database. From here the only direction is up. You could setup a CI/CD pipeline which ensures that the model passes all rebuild checks. Likewise, you can setup regression tests: making sure that edits to a commonly used subassembly do not introduce any breaking changes. The world of Python has come to SolidWorks, and the potential is unimaginable.


This was also my first foray into using C#. I like it. It was interesting. Most of what I implemented in Python I tested first in C#. As the libraries are for C#, having (some) compile time checks and proper documentation makes iterating faster than just shooting in the dark in Python.


SolidWorks model and corresponding webapp display.

SolidWorks model and corresponding webapp display.
Prev
Next
LinkedIn Logo
GitHub Logo
GrabCad Logo
Questions? Comments? Contact:
Spencer Gautreaux
Copyright 2022 Spencer Gautreaux. All Rights Reserved.