ds-blue-logo
Preview  |  SOLIDWORKS USER FORUM
Use your SOLIDWORKS ID or 3DEXPERIENCE ID to log in.
JRJustinas Rubinovas07/08/2020

Hi,

I have an advanced API question. Imagine there is a SOLIDWORKS assembly with multiple parts - some single body parts, some multibody parts, some might be touching, some might have gaps in between. I need to write a macro that would analyse the geometry of the whole assembly, find all enclosed volumes, and generate an array of Temporary Bodies that fill these enclosed volumes. Enclosed volumes might be:

1. Filled volumes of existing Solid Bodies - this would be as simple as making a copy of each body;

2. Empty volumes inside Solid Bodies in Parts - for example, a simple Boss-Extrude that has a Shell feature applied to it with no faces selected, resulting in a hollow volume inside;

3. Empty volumes between several Bodies in a multi-body part: for example, the same Boss-Extrude with Shell, but also a Split feature that splits that Body into two Bodies, yet both of them are still touching and leaving no gap, therefore forming an eclosed volume;

4. Empty volumes between multiple Bodies of different Parts in an Assembly: for example, a Bottle part and a Cap part that are mated in the Assembly in such a way that the Cap is in top of the Bottle, and creates an enclosed space inside (making the bottle leak-proof).

Furthermore, it would be great if there was an option to specify allowable gap between the different Bodies, so that microscopic gaps (either due to floating-point errors or deliberate user design decision) would be overlooked.

Think of this as the Knit Surface feature with Create Solid function enabled. I need something similar, only for all the cases I described, and without having the user specify the geometry that makes up these enclosed volumes. It should be automatic.

And of course, these computations have to be reasonably fast with several hundred Bodies in an assembly spread over a similar number of single-body or multi-body parts

Another way to understand the goal of this problem: imagine if the whole assembly were submerged in water. I need to get all the volumes where the water couldn't get to. Not just volumes of Solid Bodies, but also these enclosed spaces in between them that have no gaps or openings.

I imagine this is pretty darn complicated, so I would like to ask, is this at all possible with SOLIDWORKS API? How would you approach such a problem?