Fast rebuilding of the face is now avoided if its edges have been unified during the intersection.
Full rebuilding of the face is required in this case (using BuilderFace algorithm).
// possibility of split.
TopTools_DataMapOfShapeListOfShape aVerticesCounter;
+ // Check that the edges of the initial face have not been unified during intersection.
+ // Otherwise, it will be necessary to check validity of the new wires.
+ TopTools_MapOfShape aMEdges;
+
// Update wires of the original face and add them to draft face
TopoDS_Iterator aItW(theFace.Oriented(TopAbs_FORWARD));
for (; aItW.More(); aItW.Next())
// Check if the original edge is degenerated
Standard_Boolean bIsDegenerated = BRep_Tool::Degenerated(aE);
+ // Check if the original edge is closed on the face
+ Standard_Boolean bIsClosed = BRep_Tool::IsClosed(aE, theFace);
// Check for the splits of the edge
const TopTools_ListOfShape* pLEIm = theImages.Seek(aE);
if (!bIsDegenerated && HasMultiConnected(aE, aVerticesCounter))
return TopoDS_Face();
+ // Check edges unification
+ if (!bIsClosed && !aMEdges.Add(aE))
+ return TopoDS_Face();
+
aBB.Add(aNewWire, aE);
continue;
}
- // Check if the original edge is closed on the face
- Standard_Boolean bIsClosed = BRep_Tool::IsClosed(aE, theFace);
-
TopTools_ListIteratorOfListOfShape aItLEIm(*pLEIm);
for (; aItLEIm.More(); aItLEIm.Next())
{
if (!bIsDegenerated && HasMultiConnected(aSp, aVerticesCounter))
return TopoDS_Face();
+ // Check edges unification
+ if (!bIsClosed && !aMEdges.Add(aSp))
+ return TopoDS_Face();
+
aSp.Orientation(anOriE);
if (bIsDegenerated)
{
--- /dev/null
+puts "======="
+puts "OCC28113: BOPAlgo_Builder produces invalid shape"
+puts "======="
+puts ""
+
+
+restore [locate_data_file bug28113_shapes.brep] s
+explode s
+
+# fix the first shape in compound
+# 1. exclude s_1_3 from compsolid
+eval compound [lrange [explode s_1 so] 0 1] [lrange [explode s_1 so] 3 end] comp
+# fix SI in compound
+eval mkvolume v [explode comp f]
+checkshape v
+checknbshapes v -solid 18 -shell 18
+if {![regexp "OK" [bopcheck v]]} {
+ puts "Error: unable to rebuild the shape"
+}
+
+# create Compsolid
+shape s1 CS
+foreach s [explode v so] { add $s s1}
+
+# perform the operation
+bclearobjects
+bcleartools
+baddobjects s1
+baddtools s_2 s_3 s_4 s_5
+bfillds
+bbuild gf
+bsplit result
+
+foreach r {gf result} {
+ checkshape $r
+ if {![regexp "OK" [bopcheck $r]]} {
+ puts "Error: result is a self-interfering shape"
+ }
+}
+
+checknbshapes gf -wire 417 -face 417 -shell 91 -solid 90
+checkprops gf -s 259559 -v 690192
+
+checknbshapes result -wire 417 -face 417 -shell 90 -solid 90
+checkprops result -s 226564 -v 669028
+
+checkview -display result -2d -path ${imagedir}/${test_image}.png
--- /dev/null
+puts "======="
+puts "OCC28113: BOPAlgo_Builder produces invalid shape"
+puts "======="
+puts ""
+
+
+restore [locate_data_file bug28113_shapes_2.brep] s
+explode s
+bclearobjects
+bcleartools
+baddobjects s_1
+baddtools s_2
+bfillds
+bsplit result
+
+checkshape result
+checknbshapes result -wire 34 -face 34 -shell 3 -solid 3
+checkprops result -s 26451 -v 107642
+
+checkview -display result -2d -path ${imagedir}/${test_image}.png
}
checknbshapes r0 -wire 6 -face 6 -shell 1 -solid 1
-checkprops r0 -s 5.2 -v 0.42
+checkprops r0 -s 4.8 -v 0.405134
checknbshapes r1 -wire 25 -face 25 -shell 1 -solid 1
checkprops r1 -s 45921.2 -v 6839.09
checknbshapes r3 -wire 10 -face 10 -shell 2 -solid 2
checkprops r3 -s 142.969 -v 39.5572
-checkprops r4 -l 14.2568
+checkprops r4 -l 14.8225
checkview -display r2 -2d -path ${imagedir}/${test_image}.png