Automation for cutting holes in mating bodies based on a sketch?

laukejas
Posts: 198
Joined: Sun Sep 05, 2021 8:27 am
Answers: 0
x 43
x 112

Automation for cutting holes in mating bodies based on a sketch?

Unread post by laukejas »

Hi, I am trying to do something that should be super simple, but I just can't figure it out.

I need to automate the creation of rectangular bi-directional holes on a multibody part that cut through both bodies in equal depth:

Image

Image

Number of holes and positions might change, but their size, depth and orientation is always the same.

Ideal workflow would be:

1. Create a sketch on one of the mating faces with points that represent the centers of the holes;
2. Create these holes on each point with as few clicks as possible.

Normally I would model this by creating one hole, then a point sketch, and a Sketch Driven Pattern. But that's a lot of clicks, and 2 sketches + 2 features for each body pair. I will need to do these cuts in a multibody part with 120 bodies, and around 100 pairs of mating faces, with 4-6 holes per pair... So yeah, quite a lot of work to do manually.

I thought I could create a Library Feature out of this, but apparently you can't add Sketch Driven Pattern to a Library feature.

Hole Wizard could also be ideal for this, but unfortunately it can only cut in one direction, so without an offset plane / second Hole Wizard feature it can't be done (I think).

Fill Pattern with Seed Feature also doesn't cut in multiple directions.

So I'm kind of out of ideas. Yes, this can be done with a macro, but it would still result in a lot of features to maintain. This seems so basic, so surely there must be some way to do this natively in SW? I feel like there must be a way to do this with a Library feature, but it just refuses to let me use the features that could do it. I know this is probably a silly question and I'm missing something super obvious, but I just can't figure it out :roll:
laukejas
Posts: 198
Joined: Sun Sep 05, 2021 8:27 am
Answers: 0
x 43
x 112

Re: Automation for cutting holes in mating bodies based on a sketch?

Unread post by laukejas »

I found kind-of-a workaround, far from ideal, but sharing to show my progress. Basically I created a single sketch and Cut-Extrude feature, and did Link Dimension on both the size of the square and the depth of the cut, with Cut-Extrude set to cut All Bodies. And then copy-paste that feature. Basically like this:

1. Select original Cut-Extrude;
2. Ctrl+c
3. Select the mating face on which I want the next hole (second body does not need to be visible)
4. Ctrl+v, feature and sketch are copied to the point where I selected the face, and dimensions are copied with the link, meaning I can change the size of the square and the depth of the cut for all holes at once.

The downside is that I ended up with 860 features in my model :D Rebuilds surprisingly fast, but if I wanted to change the type of hole (from square to round or whatever), I'd have to delete everything and start from scratch. I thought that if I use a Derived Sketch for the original Cut-Extrude, and then copy that feature, the copies would also have the same Derived Sketch, meaning I could modify the original sketch and propagate the change to all instances. But unfortunately SW un-derives the sketch when doing ctrl+c and ctrl+v. So that doesn't work.

Any better solutions?
User avatar
DanPihlaja
Posts: 849
Joined: Thu Mar 11, 2021 9:33 am
Answers: 25
Location: Traverse City, MI
x 812
x 979

Re: Automation for cutting holes in mating bodies based on a sketch?

Unread post by DanPihlaja »

laukejas wrote: Sun Oct 27, 2024 9:58 am I found kind-of-a workaround, far from ideal, but sharing to show my progress. Basically I created a single sketch and Cut-Extrude feature, and did Link Dimension on both the size of the square and the depth of the cut, with Cut-Extrude set to cut All Bodies. And then copy-paste that feature. Basically like this:

1. Select original Cut-Extrude;
2. Ctrl+c
3. Select the mating face on which I want the next hole (second body does not need to be visible)
4. Ctrl+v, feature and sketch are copied to the point where I selected the face, and dimensions are copied with the link, meaning I can change the size of the square and the depth of the cut for all holes at once.

The downside is that I ended up with 860 features in my model :D Rebuilds surprisingly fast, but if I wanted to change the type of hole (from square to round or whatever), I'd have to delete everything and start from scratch. I thought that if I use a Derived Sketch for the original Cut-Extrude, and then copy that feature, the copies would also have the same Derived Sketch, meaning I could modify the original sketch and propagate the change to all instances. But unfortunately SW un-derives the sketch when doing ctrl+c and ctrl+v. So that doesn't work.

Any better solutions?

I have derived sketch set to the "z" key since I use it a lot.

All I have to do is select a face or plane, select the sketch from the tree and hit the Z key. Derived sketch created. Then just need to constrain it.
image.png
It may not help you in the end, but maybe it will help you speed the process up?
-Dan Pihlaja
Solidworks 2022 SP4

2 Corinthians 13:14
laukejas
Posts: 198
Joined: Sun Sep 05, 2021 8:27 am
Answers: 0
x 43
x 112

Re: Automation for cutting holes in mating bodies based on a sketch?

Unread post by laukejas »

DanPihlaja wrote: Mon Oct 28, 2024 8:22 am I have derived sketch set to the "z" key since I use it a lot.

All I have to do is select a face or plane, select the sketch from the tree and hit the Z key. Derived sketch created. Then just need to constrain it.

image.png

It may not help you in the end, but maybe it will help you speed the process up?
Good idea, didn't know this was possible. But I would still need to create the feature afterwards and do the Link Dimension. Still, all this probably can be automated with a macro. It just feels like there should be a simpler, more canon way to achieve the same end goal :D
Tim Hoover
Posts: 10
Joined: Fri Jul 14, 2023 1:55 pm
Answers: 0
x 5

Re: Automation for cutting holes in mating bodies based on a sketch?

Unread post by Tim Hoover »

You could save the sketch for the hole profile as a library feature. Insert 1x and create your cut-extrude from that, then use a sketch driven pattern to create the other holes.
Post Reply