r/SolidWorks • u/genzdesigner • 8h ago
3rd Party Software Built a custom SOLIDWORKS VBA macro (with LLM assistance) to batch-rename multibody solid bodies based on version names — cuts 30+ mins of tree cleanup down to seconds
Working with complex multibody sheet metal and enclosure parts means feature-tree management quickly becomes a bottleneck. Manually renaming solid bodies to match version names and keeping cut-lists organized easily eats up 30–45 minutes per assembly—and leaves room for manual errors.
I teamed up with an LLM to write and debug a native SOLIDWORKS VBA macro to automate this. Here is a before-and-after look at the FeatureManager tree and a breakdown of the setup:
Why an LLM-coded VBA macro instead of MCP? MCP and agentic AI workflows are great for conversational CAD queries and dynamic exploration, whereas production documentation needs deterministic, zero-latency execution. Using an LLM to generate native COM-based VBA gives me fast AI-assisted development while keeping the actual execution 100% offline, repeatable, and free of token overhead.
Under the hood: The macro accesses the active
IModelDoc2andIPartDocinterfaces, traverses theIBody2solid body collection, parses the version naming convention, and programmatically updates the body names and cut-list properties in a single pass.Time saved: Turns a 30+ minute manual cleanup routine into a 5-second execution—saving roughly 3 to 4 hours a week across design revisions.
As SOLIDWORKS CEO Manish Kumar mentioned in the Design in the Age of AI webinar, AI isn't replacing engineers—it acts as a multiplier on your existing CAD fundamentals. Even if debugging a custom macro takes a few tries, the long-term ROI on your workflow is huge.
Happy to share API tips if anyone else is getting started with SOLIDWORKS VBA automation!
#solidworkschampions #solidworks #AI #solidworksmacro #llm




