12

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:

enter image description here

Steps 3 + 4 also work as expected:

enter image description here

And so does step 5:

enter image description here

And even step 6 for the 1st cylinder:

enter image description here

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

enter image description here

enter image description here

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):

enter image description here

Drux
  • 263
  • 1
  • 2
  • 8
  • 1
    I suggest you upload the typical .blend file via http://www.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
  • @LeonCheung Can you please point to a few past questions (here or on meta) that indicate that this is indeed common practice. A binary blend file contains information (such as the name of my employer due to pathname conventions) that seem of no direct concern here, and the sequence of screenshots should make things pretty clear in this simple case. Yes, I could post the blend file if this is indeed required, but I don't want to upload stuff to yet-another-service without good cause. – Drux Nov 27 '13 at 11:30
  • 1
    What happen if you make all spheres ONE object (press CTRL J), and all cylinders another, then use only 2 boolean modifiers ? – Polosson Nov 27 '13 at 12:05
  • 2
    @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
  • 1
    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
  • Do you have any unapplied modifiers in the stack? – Neil Nov 27 '13 at 17:28
  • @Polosson That did not seem to make any difference. The two joined objects are now marked with the same error in the list of the cube's modifiers (see update to question). – Drux Nov 27 '13 at 18:08
  • @LeonCheung Thx for your understanding and additional effort. Placing the cylinder booleans before the sphere booleans did not seem to make a difference (although I did not try all permutations). – Drux Nov 27 '13 at 18:10
  • @Neil None of the modifiers are currently applied. If memory serves the problem was the same when I tried to apply them all. – Drux Nov 27 '13 at 18:10
  • @Drux There are some good reasons for uploading a file, here are some: 1. It's possible (though not likely) this behavior is caused by something unexpected, e.g. like here. 2. It will be easily reproducible. 3. More people will look at your problem because they don't have to take the time to follow your instructions. If you are concerned about privacy issues, you could append the relevant objects into a new file without any external paths and upload it to a .blend specific site, e.g. pasteall. – gandalf3 Nov 28 '13 at 01:03
  • 2
    @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 01:06
  • @gandalf3 Thx for this and for posting your answer. I'll accept it once I can confirm your recipe. – Drux Nov 28 '13 at 02:06

3 Answers3

14

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:

enter image description here

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

enter image description here

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

enter image description here

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:

    enter image description here

  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:

    enter image description here

  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:

    enter image description here

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

  7. Select the vertices as shown:

    enter image description here

  8. Extrude along the X axis (EX):

    enter image description here

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

    enter image description here

  10. Do the same for the other side:

    enter image description here

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

    enter image description here

  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:

      enter image description here

    2. After:

      enter image description here

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

    enter image description here

You can then use this for the boolean operations:

enter image description here

Here is the blendfile.

gandalf3
  • 157,169
  • 58
  • 601
  • 1,133
  • +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 http://www.pasteall.org/blend/25436 – Drux Nov 28 '13 at 03: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 06: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 07:14
  • In the file used above the cylinders did not intersect. (I'm on a different machine now, but I'll upload the file when I get a chance) Perhaps you could use some conventional modeling to avoid some of the boolean operations? – gandalf3 Nov 28 '13 at 07:22
  • I see. How could I model such a ring (the entire geometry) conventionally (i.e. without boolean operations but if possible also without bulged corners as they are visible in your current solution)? I'm fairly new to Blender ... – Drux Nov 28 '13 at 07:50
  • @Drux I'm not sure.. I thought perhaps using a combination of the knife project tool and the extrude tool, however I found a bug which seems to make this impossible. Here is the .blend in my answer. – gandalf3 Nov 28 '13 at 23:46
  • 1
    @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 04:31
  • @Drux Never mind, I came up with a solution that does not use the Knife tool. See my (rather long, sorry) edits. – gandalf3 Nov 29 '13 at 05:27
  • @gandalf3, In your step 7, I don't think snap can successfully detect the intersection of two crossed edges, unless you break them by a real vertex. If I'm wrong about this, would you help to explain more with a GIF or something? Thanks! – Leon Cheung Nov 29 '13 at 17:16
  • Thanks for this great effort! For this humble beginner this will take a while to digest :) While struggling with the details of step 5 ("select these elements") I'm also wondering if the method specifically benefits from/depends on the radius of the initial sphere being smaller than the cylinders' ... – Drux Nov 29 '13 at 17:50
  • @LeonCheung If you are in the center of the world with default scaled primitives that point happens to be on the grid, so snap to increment works. – gandalf3 Nov 29 '13 at 18:23
  • @Drux The easiest way to select that is 1 select allA 2 deselect the small quarter with box select B. To deselect with box you need to middle click, or hold Shift when you press Enter or Esc. See this post. However, I realized that step 5 is unnecessary with some adjustments, I will update my answer. – gandalf3 Nov 29 '13 at 18:37
  • @gandalf3, ah, right, increment snap, which make sense then. :) – Leon Cheung Nov 29 '13 at 18:41
  • Re-thx & re further update to answer: if you could make the circle's and cylinders' radii match, that would be optimal. Ultimately I want to use the model in a physics simulation, so these little things/bulged corners count (to some degree). – Drux Nov 29 '13 at 20:59
  • @Drux They are the same radius, what made you think the aren't? – gandalf3 Nov 30 '13 at 03:13
  • The top view in step 2 and the scaling in step 7 make me think so. (The sphere's segment retained in the final geometry still seems to have the smaller/unscaled radius.) Still digesting, though ... – Drux Nov 30 '13 at 08:37
  • 1
    @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 09:32
  • Again, excellent. However, in the final blendfile I see the cube minus the central spheres plus the cylinder and an error "Cannot execute boolean operation" on the Cube (with target Sphere.001). Could you perhaps upload a version that results in the final view (image after step 13) upon opening. Eventually I'll also get there by managing to repeat those steps ... :) – Drux Nov 30 '13 at 10:23
  • @Drux Very odd.. That file is the one in that screenshot, yet you are right, on opening it it says operation failed. However, by transforming the sphere.001 object and canceling (G, Esc) it works again. Reported yet another bug here. – gandalf3 Nov 30 '13 at 20:11
  • Confirmed: select Sphere.001 + (G, Esc) + select Cube + apply modifier that is marked as erroneous + hide Sphere.001 leads to the final result. BTW, concerning this core bug report it may be worthwhile to add a link to the corresponding ticket for carve: So far I haven't found any, although blender states that carve is/was looking into it. – Drux Dec 01 '13 at 05:50
  • @gandalf3 +1 for "objects that are not water-tight will fail", solved my problem. Many thanks. – Tom Pace Aug 05 '14 at 15:52
0

(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"

Huygir
  • 1
0

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.