Feasibility Check: Custom SolidWorks Macro/Plug-in for Fastener Hole Generation via Excel Database

Hello everyone,

I am looking to validate a concept for a SolidWorks macro/plug-in.

The Problem Statement:

Designers frequently need to place fastener holes to join multiple sheet metal parts. While they know what screw size they want to use, looking up standard binding or clearance hole diameters takes up manual design time.

The Proposed Solution:

I want to build a SolidWorks Macro that does the following:

1. The user selects a flat face on a sheet metal part or assembly.

2. They launch the macro, which brings up a simple UserForm pop-up.

3. The pop-up queries an external company Excel spreadsheet containing standard fastener sizes and their respective binding/clearance hole diameters.

4. The user selects the screw size (e.g., M4) and the fit type (Clearance vs. Binding) from a dropdown.

5. The macro automatically sketches the circle, detects the sheet metal thickness, and applies a Cut-Extrude (set to Through All).

My Questions for the Community:

1. Is this fully achievable via the SolidWorks API (specifically handling the face selection coordinates)?

2. Are there any known API roadblocks i should watch out?

3. Has anyone built something similar, or is there an open-source framework i should look at before writing this from scratch?

Appreciate any insights, advice, or API tips you can share!

Why not use the built in tool wizard, and create your own standard for sheet metal screws?

Thanks for sharing your thoughts!

The main reason we are avoiding the built-in Hole Wizard/Toolbox approach comes down to long-term data management and future automation goals for the client:

  1. Dynamic Centralized Updates: The client wants the engineering data to live completely outside of SolidWorks configuration files. Right now, it’s an Excel sheet on a shared drive, which will eventually move to SharePoint or a PLM system. If an engineering manager adds, removes, or modifies a hole size online, they want that change to immediately replicate across the entire organization’s systems without having to push out updated Toolbox databases or .sldreg files to every user’s local machine.

  2. Phase 2 Automation: The dropdowns in the UserForm are just the first step. The ultimate goal for this tool is to not only cut the hole but to automatically fetch, orient, and insert the corresponding hardware/screw into the model based on that exact same Excel data.

Yes. However, I assume you don’t want users just selecting some random spot to place the holes. Are they going to constrain them after the fact, or will they actually be selecting a sketch point or some other entity to position it?

Not really. This is all straightforward stuff from a SOLIDWORKS API standpoint. One thing to think about is how to handle edits of the Excel file. You can’t have multiple people making changes to it simultaneously. If it is a fairly static document, this won’t be an issue.

There are a few SOLIDWORKS API frameworks out there. They may be a bit much for this type of thing though. This isn’t terribly complicated.

I would recommend not using a user form and instead using a property manager page. It will make the user experience much better and will make it look like it is part of SOLIDWORKS and not something that was bolted on.

It sounds like you’re going to be doing a lot of wheel reinventing. Pretty sure both of these are already available with toolbox. Using admin tools, users can be forced to use a certain toolbox database, which is just a SQLite database, that resides in a common location or PLM, just like an Excel sheet can.

I don’t actually use it myself, but I’m pretty sure Toolbox can automatically fetch, orient, and insert fasteners based on the hole standard selected in the Hole Wizard feature. Of course, there are some challenges with putting a toolbox fastener database on a shared or PLM location… But guess what - You’ll have the same issues trying to rebuild the exact same functionality from scratch.

Are you asking if it’s feasible to pay someone who is already a programming/API expert to do this for you, or asking if it’s feasible to figure it out yourself?

I think you’d be better off creating Library Features to create the holes:

Then my add-in Lightning to add the fasteners:

The fast fastener filter - Lightning - CAD Booster

Usually, when Excel gets involved in automation, there is a better way available.