Difference function - removing compared solids


#1

 

Hi All,

I just started using Dynamo and I’m still trying to figure out how things work. As an experiment, I wanted to cut a sphere out of a cube. I first created two solids and then used Solid.Difference to ‘cut’ the sphere out of the cube. The function seems to work properly (I translated the result to show you what I’m after), but I can not seem to remove the original two solids. I am able to hide them (right click -> uncheck preview), but then they still show up when I export to STL. Is there a way to remove the two original solids from the model after using the difference function? Thanks in advance!


#2

use the export to sat node -or use mesh toolkit package, then you can feed the resulting geometry into the node so you can export exactly what you want.


#3

Thanks for that reply. The Mesh Toolkit package did the job perfectly.


#4

I just tried the same, but with a series of spheres (see screenshot). When I use the difference function (and hide the spheres), the result is a solid cube. It seems that the function doesn’t work when used this way. Any advice?


#5

You’ll need to use recursive code to achieve that. Here’s a quick example:


#6

Flatten the list of spheres


#7

Nice one, Vikram. I forgot about “Solid.DifferenceAll”.

Another unofficial trick, that I don’t really recommend, is to union all the spheres into a single disjoined solid :


#8

Excellent! This is very helpful. Thanks.