how to guess the fuzzy value for boolean operations?

Hello,

I have to perform boolean operations on shapes that may contain some inaccuracies. As these inaccuracies cause troubles to boolean operations I was suggested to use the fuzzy boolean operations to overcome such issues.

As I have a CAD model that should be aligned on 1mm preccission I thought that I will set the fuzzy value to 1e-4 as there should not be any distance less than 1mm in the model. Is this a good approach to use global fuzzy value for all shapes in processed model? Or should I set the fuzzy value individually per operation/shape depending on some analysis of the boolean operation arguments? Has anyone any experience with this?

The reason I am asking such questions is that I encountered a case in my 1mm precise model in which a fuse with fuzzy value 1e-4 produces an invalid shape but a fuse with no fuzzy value of exactly the same arguments produces valid result. Can anyone explain such behavior? See the following DRAW script:

Draw[159]> bfuzzyvalue 0
Draw[160]> restore 024-merge.in1-Port-AZS.brep i1
i1
Draw[161]> checkshape i1
This shape seems to be valid
Draw[162]> bopcheck i1
 This shape seems to be OK.
 
Draw[163]> restore 024-merge.in2-Port-AZS.brep i2
i2
Draw[164]> checkshape i2
This shape seems to be valid
Draw[165]> bopcheck i2
 This shape seems to be OK.
 
Draw[166]> bopargcheck i1 i2 -F #F
Shape(s) seem(s) to be valid for BOP.
 
Draw[168]> bop i1 i2
Draw[169]> bopfuse r
Draw[170]> checkshape r
This shape seems to be valid
Draw[171]> bopcheck r
 This shape seems to be OK.

Draw[193]> nbshapes r
Number of shapes in r
 VERTEX    : 113
 EDGE      : 197
 WIRE      : 94
 FACE      : 94
 SHELL     : 6
 SOLID     : 6
 COMPSOLID : 0
 COMPOUND  : 1
 SHAPE     : 511

 
Draw[172]> bfuzzyvalue 1e-4
Draw[173]> restore 024-merge.in1-Port-AZS.brep i1
i1
Draw[174]> checkshape i1
This shape seems to be valid
Draw[175]> bopcheck i1
 This shape seems to be OK.
 
Draw[176]> restore 024-merge.in2-Port-AZS.brep i2
i2
Draw[177]> checkshape i2
This shape seems to be valid
Draw[178]> bopcheck i2
 This shape seems to be OK.
 
Draw[179]> bopargcheck i1 i2 -F #F
Shape(s) seem(s) to be valid for BOP.
 
Draw[180]> bop i1 i2
Draw[181]> bopfuse r
Draw[182]> checkshape r
On Shape faulty_1 :
BRepCheck_BadOrientationOfSubshape
 
Faulty shapes in variables faulty_1 to faulty_1
 
Draw[183]> bopcheck r
E/E: x17 x111
V/Z: x6 x134
V/Z: x9 x134
V/Z: x23 x134
E/Z: x5 x134
E/Z: x8 x134
E/Z: x12 x134
E/Z: x15 x134
E/Z: x22 x134
E/Z: x24 x134
E/Z: x26 x134
E/Z: x36 x134
E/Z: x41 x134
F/Z: x3 x134
F/Z: x20 x134
F/Z: x47 x134
F/Z: x52 x134

Draw[185]> nbshapes r
Number of shapes in r
 VERTEX    : 112
 EDGE      : 197
 WIRE      : 96
 FACE      : 96
 SHELL     : 8
 SOLID     : 8
 COMPSOLID : 0
 COMPOUND  : 1
 SHAPE     : 518

I understand that the result of the non-zero fuzzy value fuse contains less vertices as some pair of misaligned vertices was merged into one. What surprises me is that even in such situation the result of the fuzzy operation contains more solids. But maybe this is caused by the error in the shape?

Please share your ideas! Best regards, Petr

Qr Qr's picture

From my experience, it is not easy to choose a good fuzzy value. For related discussion see https://www.opencascade.com/content/cut-operation-usage