}
else {
const TopoDS_Edge& Edge2 = TopoDS::Edge(seqSections(i));
- //gka
seqSectionsNew.Append(Edge2);
seqCandidatesNew.Append(i);
- /*TopoDS_Shape bnd = Edge2;
- if (mySectionBound.IsBound(bnd)) bnd = mySectionBound(bnd);
- //gka
- if (myBoundFaces.Contains(bnd)) {
- Standard_Boolean isOK = Standard_True;
- TopTools_ListIteratorOfListOfShape itf2(myBoundFaces.FindFromKey(bnd));
- for (; itf2.More() && isOK; itf2.Next()) {
- const TopoDS_Face& Face2 = TopoDS::Face(itf2.Value());
- // Check whether condition is satisfied
- isOK = !Faces1.Contains(Face2);
- if (!isOK) isOK = IsMergedClosed(Edge1,Edge2,Face2);
- }
- if (isOK) {
- seqSectionsNew.Append(Edge2);
- seqCandidatesNew.Append(i);
- }
- }*/
}
}
Standard_Integer nbSectionsNew = seqSectionsNew.Length();
if (nbSectionsNew > 1) {
-
+
// Evaluate distances between reference and other sections
TColStd_Array1OfBoolean arrForward(1,nbSectionsNew);
TColStd_Array1OfReal arrDistance(1,nbSectionsNew);
TColStd_Array1OfReal arrLen(1,nbSectionsNew);
TColStd_Array1OfReal arrMinDist(1,nbSectionsNew);
EvaluateDistances(seqSectionsNew,arrForward,arrDistance,arrLen,arrMinDist,1);
-
+
// Fill sequence of candidate indices sorted by distance
for (i = 2; i <= nbSectionsNew; i++) {
- if (arrDistance(i) >= 0.0 && arrLen(i) > myMinTolerance) {
+ Standard_Real aMaxDist = arrDistance(i);
+ if (aMaxDist >= 0.0 && aMaxDist <= myTolerance && arrLen(i) > myMinTolerance) {
+
// Reference section is connected to section #i
Standard_Boolean isInserted = Standard_False;
Standard_Integer j, ori = (arrForward(i)? 1 : 0);
for (j = 1; (j <= seqCandidates.Length()) && !isInserted; j++) {
Standard_Real aDelta = arrDistance(i) - arrDistance(seqCandidates.Value(j));
- //if (arrDistance(i) <= arrDistance(seqCandidates.Value(j))) {
+
if( aDelta < Precision::Confusion()) {
if(fabs(aDelta) > RealSmall() ||
}
}
}
-
- // Replace candidate indices
+
nbCandidates = seqCandidates.Length();
+ if (!nbCandidates)
+ return Standard_False; // Section has no candidates to merge
+
+ // Replace candidate indices
+
for (i = 1; i <= nbCandidates; i++)
seqCandidates(i) = seqCandidatesNew(seqCandidates(i));
+
}
- //}
-
+
if (!nbCandidates) return Standard_False; // Section has no candidates to merge
if (myNonmanifold && nbCandidates >1) {
--- /dev/null
+puts "========================"
+puts "OCC24036"
+puts "========================"
+puts ""
+#######################################################################
+# Regression: sewing is not correct
+# (OCC 6.6.0 regression) BRepBuilderAPI_Sewing returns wrong result
+#######################################################################
+
+pload XSDRAW
+
+restore [locate_data_file bug24036_data.brep] v
+explode v
+sewing result 0.00001 v_1 v_2
+
+checkshape result
+
+set tolmaxres [tolmax result]
+regexp {max tol = ([-0-9.+eE]+)} $tolmaxres full MaxTolerance
+set CMP_TOL 1.e-4
+if { ${MaxTolerance} > ${CMP_TOL} } {
+ puts "Error: invalid tolerance"
+}
+
+freebounds $result 0
+set s [explode result_c e]
+
+set index [ llength $s ]
+puts "Number of free edges is $index"
+if { $index != 2 } {
+ puts "Error : Number of free edges is $index"
+}
+
+set 2dviewer 1