# “Cannot execute boolean operation” when subtracting several spheres and cylinders from cube

This is a follow-on question as suggested by a commenter. What I'd like to do is to create a geometry with the following properties:

A cube with several spherical indentations carved out on top. 16 indentations are half-spheres. The 17th indentation has the shape of four half-cylinders that form a ring (with slightly rounded corners corresponding to the radius of the cylinders).

My plan of attack is as follows:

1. create and scale the cube
2. create 16 spheres clustered around the center of the cube's top face
3. create 4 cylinders, scale and rotate them to form the basic ring
4. create 4 more spheres at the corners to complete the ring
5. add 16 DIFFERENCE boolean modifiers to the cube with the 16 spheres from step 2 as targets; hide each sphere after adding the corresponding modifier
6. add 4 DIFFERENCE boolean modifiers to the cube with the 4 cylinders from step 3 as targets; hide each cylinder after adding the corresponding modifier
7. add 4 DIFFERENCE boolean modifiers to the cube with the 4 spheres from step 4 as targets; hide each sphere after adding the corresponding modifier

Steps 1 + 2 work as expected:

Steps 3 + 4 also work as expected:

And so does step 5:

And even step 6 for the 1st cylinder:

However when I try to subtract the 2nd cylinder the visual result is unexpected and the error message appears:

What is going on here and how can I obtain the desired geometry?

Could the problem be caused by the fact that the two cylinders I wish to subtract from the cube are themselves overlapping? (The Blender documentation mentions "concurrent Boolean operations for the same modified mesh, which in most cases is impossible to execute depending on the chosen target" but does not elaborate further.)

UPDATE Here's the (still expected) result when joining the 4 cylinders and last 4 spheres before subtracting the from the cube (see @Polosson's comment):

• I suggest you upload the typical .blend file via pasteall.org/blend, and paste the link here, which can be helpful for others to make quick help, too. – Leon Cheung Nov 27 '13 at 11:19
• What happen if you make all spheres ONE object (press <kbd>CTRL</kbd> <kbd>J</kbd>), and all cylinders another, then use only 2 boolean modifiers ? – Polosson Nov 27 '13 at 12:05
• @Drux, I've pointed it out, actually -- for quicker help in answer your quesion.:) Alright, I've followed your steps, it indeed happened, I have to admit that. If you want to make a final result, I suggest you take Polosson's way. But it seems that you want to know what or why on earch caused such issue. Me too. – Leon Cheung Nov 27 '13 at 12:35
• Btw, according to my experience on multiple Boolean modifiers, the combined result sometimes depends much on the their orders in the Modifier stack. So, you may try to move up the cylinder boolean(s) up above one or more sphere booleans, and see whether it would make any difference to the final result. – Leon Cheung Nov 27 '13 at 12:39
• @Drux Continued.. It is of course your choice, I just wanted to point out some reasons why you may want to. Here are some meta posts: policy for linking to blendfiles and sites to upload images and blendfiles – gandalf3 Nov 28 '13 at 1:06

# Cases where boolean operations can fail:

• Overlapping geometry between objects:
Multiple vertices in the same location will often cause the boolean modifier to act up. From this bug report:

this is a known bug in Carve upstream (a library we're using for boolean operations)

• Self intersecting objects:
Boolean operations with non-manifold objects or objects that are not water-tight will fail when non-manifold parts interact in the boolean operation.

# Some things you can try:

Add supporting geometry. The boolean operation creates a lot of tris, so this might make subsequent operations difficult.

For example:

The spheres boolean causes this mess of tris where the cylinders will go:

However, if you add some loop cuts around the spheres:

The tris are contained in the center, keeping the topology clean where the cylinders intersect:

# With modeling tools

You can get the result with conventional modeling too:

1. Add a sphere and two cylinders (the cylinders are just guides)

2. Rotate and move then into position using increment snapping (Ctrl) to keep everything precisely aligned:

3. Snap the 3D cursor to the sphere object by selecting (in object mode) it and pressing ShiftS> Cursor to Selected

4. Press . (period) to set the pivot to the 3D cursor

5. Enter edit mode with the sphere active and delete these elements with X or Delete> Vertices:

6. Scale the 45 degree edgeloop along the X and Y by pressing S and then ShiftZ, then holding Ctrl to snap until the edgeloop at 45 degrees touches the intersection at the two cylinders:

The cylinders are no longer useful after this step, so you can delete them.

7. Select the vertices as shown:

8. Extrude along the X axis (EX):

9. Set the pivot to Bounding box center (,) and scale the selection to 0 along the X by pressing SXO (zero):

10. Do the same for the other side:

11. Add a mirror modifier and enable X and Y:

12. With the sphere active, enter edit mode and select all (A), then move it so the object origin is not in the middle of the sphere:

1. Before:

2. After:

13. Enable Clipping in the mirror modifier and move each edge so it merges with the mirrored geometry:

You can then use this for the boolean operations:

Here is the blendfile.

• +1 also for loop cuts. Hmm ... when I try that I still get the same error when forming the union. I must be doing something wrong here. I've now uploaded the blend file on PasteAll (as @LeonCheung has suggested), the URL is pasteall.org/blend/25436 – Drux Nov 28 '13 at 3:39
• @Drux It appears that it is because the cylinders object has self intersections (each cylinder in the object is intersecting the cylinder next to it). I haven't found a workaround yet.. – gandalf3 Nov 28 '13 at 6:52
• Yes, that has become my impression too, and it would be somewhat consistent with what the documentation says (as cited above). But how did it not happen in your solution? (Could you perhaps also post the blender file?) BTW, whether one uses UV or ISO spheres does not seem to make a difference either. – Drux Nov 28 '13 at 7:14
• @Drux I also noticed the boolean operation seems to fail when verts overlap. Reported a bug here. BTW the previous bug is now fixed in git, as soon as I get my hands on an up to date version I'll test my idea. – gandalf3 Nov 29 '13 at 4:31
• @Drux The cylinders aren't used, and the scaling is so that the extruded bit is circular. The radius should be the same (Check the blendfile). Updated answer. – gandalf3 Nov 30 '13 at 9:32

(work around, and probably obvious) - often if you perform the same modifications in a different order that results in the same final object you can avoid the dreaded "cannot boolean"

Well, purists say that we have to model everything, but boolean operations are far easier. Simple suggestion: export the mesh into .stl. Open with meshmixer (free app from autodesk). 1 - try edit - separate shells. Delete all shells that are not visible. 2 - export to stl. It should work now in blender.

if there are no separate shells: use edit - make solid. Try using accurate or sharp edges and move the triangle and face counts to the middle. look at the shape to see if the details are all there and re-export to stl. It shall work now with boolean operations in blender.