Fix boolean operations (#17119)
* add BRepAlgoAPI wrapper files to CMakeList * introduce wrapper for BRepAlgoAPI_BooleanOperation and derivatives, set sensible default Fuzzyness for boolean operations * allow default fuzzyness to be set in settings - including off * backwards compatibility with OCCT 7.3.3 - removed newer paramateres from wrapper * added missing header * reverted src/Mod/Part/App/OpenCascadeAll.h to original state * implement some changes suggested by @wwmayer * removed unneeded destructor definitions * moved getDefaultFuzzyValue into its own helper class * removed unneeded references to base class default constructor * default to SetRunParallel(Standard_True) as suggested by @FlachyJoe * fixed license header as requested * Added new method to autocalculate fuzzyness to BooleanOperation base class and use it for those parts that do not call the obsolete constructor but also do not set precision * implemented static variable solution as suggested by @wwmayer * added helix for test case * Refactoring FCRepAlgoAPI to FCBRepAlgoAPI * Added Test Case (fuse cylinder with helix with different working and non-working Fuzzy values) * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * increased default value of FuzzyBoolean and made tests more robust for compatibility with OCCT 7.3 * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * fixes for FREECAD_USE_PCH - allow testing of FREECAD_USE_PCH on linux with cmake switch (default OFF) * removed surplus line - wasn't needed after all * included precompiled as instructed * set anti-corruption flag in boolean operations, ensures source shape is not damaged in OCCT 7.1 and higher * fix #17085 * disable subtests that were too specific for now * fixed all CLI tests - see comments in Pull Request https://github.com/FreeCAD/FreeCAD/pull/17119#issuecomment-2420772452 * Update src/Mod/PartDesign/PartDesignTests/TestTopologicalNamingProblem.py suggested updated test by CalligaroV Co-authored-by: Vincenzo Calligaro <vincenzo.calligaro@gmail.com> * Update tests/src/Mod/Part/App/TopoShapeExpansion.cpp suggested updated test by CalligaroV Co-authored-by: Vincenzo Calligaro <vincenzo.calligaro@gmail.com> * Update tests/src/Mod/Part/App/TopoShapeExpansion.cpp suggested updated test by CalligaroV Co-authored-by: Vincenzo Calligaro <vincenzo.calligaro@gmail.com> * Update tests/src/Mod/Part/App/TopoShapeExpansion.cpp suggested updated test by CalligaroV Co-authored-by: Vincenzo Calligaro <vincenzo.calligaro@gmail.com> * Update tests/src/Mod/Part/App/TopoShapeExpansion.cpp suggested updated test by CalligaroV Co-authored-by: Vincenzo Calligaro <vincenzo.calligaro@gmail.com> * Update tests/src/Mod/Part/App/TopoShapeExpansion.cpp suggested updated test by CalligaroV Co-authored-by: Vincenzo Calligaro <vincenzo.calligaro@gmail.com> * Update tests/src/Mod/Part/App/TopoShapeExpansion.cpp suggested updated test by CalligaroV Co-authored-by: Vincenzo Calligaro <vincenzo.calligaro@gmail.com> * Update tests/src/Mod/Part/App/TopoShapeExpansion.cpp suggested updated test by CalligaroV Co-authored-by: Vincenzo Calligaro <vincenzo.calligaro@gmail.com> * Update tests/src/Mod/Part/App/TopoShapeExpansion.cpp suggested updated test by CalligaroV Co-authored-by: Vincenzo Calligaro <vincenzo.calligaro@gmail.com> * Update tests/src/Mod/Part/App/TopoShapeExpansion.cpp suggested updated test by CalligaroV Co-authored-by: Vincenzo Calligaro <vincenzo.calligaro@gmail.com> * Update tests/src/Mod/Part/App/TopoShapeExpansion.cpp suggested updated test by CalligaroV Co-authored-by: Vincenzo Calligaro <vincenzo.calligaro@gmail.com> * Update tests/src/Mod/Part/App/TopoShapeExpansion.cpp suggested updated test by CalligaroV Co-authored-by: Vincenzo Calligaro <vincenzo.calligaro@gmail.com> * Update tests/src/Mod/Part/App/TopoShapeExpansion.cpp suggested updated test by CalligaroV Co-authored-by: Vincenzo Calligaro <vincenzo.calligaro@gmail.com> * Update tests/src/Mod/Part/App/TopoShapeExpansion.cpp suggested updated test by CalligaroV Co-authored-by: Vincenzo Calligaro <vincenzo.calligaro@gmail.com> * Update tests/src/Mod/Part/App/TopoShapeExpansion.cpp Co-authored-by: Vincenzo Calligaro <vincenzo.calligaro@gmail.com> * remove surplus tests from github suggestion interface bug * hide the BooleanFuzzy variable - can now be only set by manually editing the config file i in FCParamGroup "Boolean" <FCFloat Name="BooleanFuzzy" Value="10.000000000000"/> * Suggestion by @FlachyJoe - add validity checks to the base and tool shape in any direct boolean op --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Vincenzo Calligaro <vincenzo.calligaro@gmail.com>
This commit is contained in:
@@ -635,7 +635,16 @@ class TestTopologicalNamingProblem(unittest.TestCase):
|
||||
# Assert UpToFace element map is correct
|
||||
self.assertEqual(self.countFacesEdgesVertexes(revolution.Shape.ElementReverseMap),
|
||||
(8, 18, 12))
|
||||
self.assertEqual( revolution.Shape.ElementReverseMap["Face8"].count(";"), 7)
|
||||
# Assertions modified/added while reviewing PR#17119 by CalligaroV
|
||||
# Previously the condition counted the number of ";" (element map operations prefix)
|
||||
# If the number of operations changes then the number of ";" will change accordingly
|
||||
#
|
||||
# However, it is more useful to count the number of times an elemement name is
|
||||
# present in the MappedName of an element (a MappedName is definined also using the
|
||||
# element names - "Vertex*", "Edge*", "Face*" - used by an OCCT operation to generate
|
||||
# output elements)
|
||||
self.assertEqual( revolution.Shape.ElementReverseMap["Face8"].count("Face8"), 3)
|
||||
self.assertEqual( revolution.Shape.ElementReverseMap["Face8"].count("Face10"), 3)
|
||||
|
||||
def testPartDesignElementMapLoft(self):
|
||||
# Arrange
|
||||
@@ -767,10 +776,10 @@ class TestTopologicalNamingProblem(unittest.TestCase):
|
||||
self.Doc.recompute()
|
||||
# Assert
|
||||
self.assertEqual(len(body.Shape.childShapes()), 1)
|
||||
self.assertEqual(body.Shape.childShapes()[0].ElementMapSize, 55)
|
||||
self.assertEqual(body.Shape.childShapes()[0].ElementMapSize, 51)
|
||||
self.assertEqual(body.Shape.ElementMapSize, 51)
|
||||
self.assertEqual(sketch.Shape.ElementMapSize, 12)
|
||||
self.assertEqual(pocket.Shape.ElementMapSize, 55)
|
||||
self.assertEqual(pocket.Shape.ElementMapSize, 51)
|
||||
self.assertNotEqual(
|
||||
pocket.Shape.ElementReverseMap["Vertex1"], "Vertex1"
|
||||
) # NewName, not OldName
|
||||
@@ -1856,7 +1865,7 @@ class TestTopologicalNamingProblem(unittest.TestCase):
|
||||
edges = [name for name in reverseMap.keys() if name.startswith("Edge")]
|
||||
vertexes = [name for name in reverseMap.keys() if name.startswith("Vertex")]
|
||||
self.assertEqual(len(body.Shape.childShapes()), 1)
|
||||
self.assertEqual(body.Shape.childShapes()[0].ElementMapSize, 64)
|
||||
self.assertEqual(body.Shape.childShapes()[0].ElementMapSize, 62)
|
||||
self.assertEqual(len(reverseMap), 62)
|
||||
self.assertEqual(len(faces), 12)
|
||||
self.assertEqual(len(edges), 30)
|
||||
|
||||
Reference in New Issue
Block a user