Introduction
Boolean operations are very useful modeling methods. However, beginners will find that they often encounter strange errors, and it is difficult to find the cause. This document may illustrate this problem.
To understand why a Boolean operation fails, you must first understand how it works. It is not just a few magic commands that organize entities together. Boolean operations are the semi-automated combination of several basic commands. There are about four basic commands: intersection of two entities, and separation of intersection results into two groups, delete unnecessary parts and connect the remaining parts. These steps are all the content of the Boolean operation. You can also perform them all manually.
Therefore, if you want to make the Boolean operation successful, you must ensure that the four commands Intersect, Split, Join, and Delete can be successful manually.
Boolean operation failed
Why does the Boolean operation fail? In fact, the intersection operation is the key to determining whether the Boolean operation is successful or not. If the intersection is correct, other issues are minor issues. In other words, if there is a problem with the intersection, the Boolean operation will certainly fail. So the key to the problem is how to ensure a simple and easy-to-calculate complete crossover. You can modify your model to achieve full crossover, and learn more about the quirks and limits of intersection operations.
Two closed bodies must have at least one closed curve ring (intersection). If there are multiple intersections between the bodies, multiple such rings can be generated. If these rings are closed, no problem occurs. Otherwise, the Boolean operation fails as long as one is not closed. The reason is that the line cannot completely cover the body, and it is impossible to cut the body.
(Note: The objects of Boolean operations may also be non-closed entities, which will be discussed later .)
To sum up, if your Boolean operation fails, you should first consider whether the intersection fails. For example, you can generate a line break to see if it is correct. Disconnected or redundant cables are incorrect. If so, you need to find the reason. If the intersection looks okay, you can also check whether there is a hidden problem such as a coincidence segment.
Intersection problem solving and limit
What causes a split or intersection error in the line? There are many possibilities. For example, the model's own problems, such as floating point errors, etc. For example:
There is a gap between two objects or graphic elements. In this case, try to narrow down the gap.
If there are two faces in total, the intersection of them cannot be calculated. You can try to move one of them slightly.
Almost tangent surface. This problem is similar to the common surface.
The Boolean operation between diseased objects must fail, which must be checked by some detection tools.
Problem Solving
First, check the drawing unit and tolerances. Determine the unit you want. The tolerances are usually set to 0.0001.
Class for setting tolerances: BRepLib ShapeFix_ShapeTolerance BOP_CorrectTolerances.
If the problem persists, you can use the ShapeFix series class to repair the model, such as deleting short edges and Small Faces.
If it doesn't work, you can only manually modify the model so that the model looks like a significant cross, rather than a common plane, a coincidence plane, or a tangent to these critical conditions.