Fix that face, in which only wire was reordered during shape healing, was not replaced.
Add test case for this fix
Add status for shifted wires in reordering.
Modified test case de/step_1/E3 according to new reference data
case 2: myStatus = ShapeExtend::EncodeStatus (ShapeExtend_DONE2); break;
case -1: myStatus = ShapeExtend::EncodeStatus (ShapeExtend_DONE3); break;
case -2: myStatus = ShapeExtend::EncodeStatus (ShapeExtend_DONE4); break;
+ case 3: myStatus = ShapeExtend::EncodeStatus (ShapeExtend_DONE5); break;//only shifted
case -10: myStatus = ShapeExtend::EncodeStatus (ShapeExtend_FAIL1); break;
}
return LastCheckStatus (ShapeExtend_DONE);
if(stTmp>=0) stTmp = (mainSeq->Value(i) > 0 ? 1 : -1);
myOrd->SetValue(i,mainSeq->Value(i));
}
- myStat = stTmp;
- return;
+ if (stTmp == 0) {
+ myStat = stTmp;
+ return;
+ }
+ else {//check if edges were only shifted in reverse or forward, not reordered
+ Standard_Boolean isShiftReverse = Standard_True, isShiftForward = Standard_True;
+ Standard_Integer tmpFirst = 0, tmpSecond = 0, length = mainSeq->Length();
+ for(i = 1; i <= length - 1; i++) {
+ tmpFirst = mainSeq->Value(i);
+ tmpSecond = mainSeq->Value(i+1);
+ if (!(tmpSecond - tmpFirst == 1 || (tmpFirst == length && tmpSecond == 1)))
+ isShiftForward = Standard_False;
+ if (!(tmpFirst - tmpSecond == 1 || (tmpSecond == length && tmpFirst == 1)))
+ isShiftReverse = Standard_False;
+ }
+ tmpFirst = mainSeq->Value(length);
+ tmpSecond = mainSeq->Value(1);
+ if (!(tmpSecond - tmpFirst == 1 || (tmpFirst == length && tmpSecond == 1)))
+ isShiftForward = Standard_False;
+ if (!(tmpFirst - tmpSecond == 1 || (tmpSecond == length && tmpFirst == 1)))
+ isShiftReverse = Standard_False;
+ if (isShiftForward || isShiftReverse)
+ stTmp = 3;
+ myStat = stTmp;
+ return;
+ }
}
//=======================================================================
}
if ( theAdvFixWire->Perform() ) {
//fixed = Standard_True;
- isfixReorder = (theAdvFixWire->StatusReorder(ShapeExtend_DONE) || isfixReorder);
+ isfixReorder = ((theAdvFixWire->StatusReorder(ShapeExtend_DONE) && !theAdvFixWire->StatusReorder(ShapeExtend_DONE5)) || isfixReorder);
fixed = (theAdvFixWire->StatusSmall(ShapeExtend_DONE) ||
theAdvFixWire->StatusConnected(ShapeExtend_DONE) ||
theAdvFixWire->StatusEdgeCurves(ShapeExtend_DONE) ||
if ( ! Context().IsNull() ) Context()->Replace ( S, tmpFace );
//myFace = tmpFace;
isReplaced = Standard_True;
- myStatus |= ShapeExtend::EncodeStatus ( ShapeExtend_DONE1 );
-
}
- if(fixed || isfixReorder)
+ if(fixed || isfixReorder) {
myFace = tmpFace;
+ myStatus |= ShapeExtend::EncodeStatus ( ShapeExtend_DONE1 );
+ }
}
myResult = myFace;
myStatusReorder |= ShapeExtend::EncodeStatus ( ShapeExtend_DONE2 );
if ( sawo.Status() <0 )
myStatusReorder |= ShapeExtend::EncodeStatus ( ShapeExtend_DONE3 );
+ if ( sawo.Status() == 3)
+ myStatusReorder |= ShapeExtend::EncodeStatus ( ShapeExtend_DONE5 );//only shifted
return Standard_True;
}
--- /dev/null
+puts "================"
+puts "OCC21317"
+puts "================"
+puts ""
+######################################################################################
+# Face cannot be fixed by Shape Healing
+######################################################################################
+
+set BugNumber OCC21317
+
+catch {pload XDE}
+
+restore [locate_data_file bug21317_faulty.brep] a
+fixshape result a
+set info [checkshape result]
+
+# Resume
+puts ""
+if { [regexp {This shape seems to be valid} $info] } {
+ puts "OK ${BugNumber}"
+} else {
+ puts "Faulty ${BugNumber}"
+}
+
+set 2dviewer 0
DATA : Faulties = 0 ( 0 ) Warnings = 0 ( 0 ) Summary = 0 ( 0 )
TPSTAT : Faulties = 0 ( 0 ) Warnings = 21 ( 12 ) Summary = 21 ( 12 )
CHECKSHAPE : Wires = 2 ( 0 ) Faces = 2 ( 0 ) Shells = 0 ( 0 ) Solids = 0 ( 0 )
-NBSHAPES : Solid = 3 ( 4 ) Shell = 4 ( 4 ) Face = 35 ( 35 ) Summary = 292 ( 266 )
-STATSHAPE : Solid = 3 ( 4 ) Shell = 4 ( 4 ) Face = 35 ( 35 ) FreeWire = 0 ( 0 ) FreeEdge = 24 ( 24 ) SharedEdge = 105 ( 103 )
-TOLERANCE : MaxTol = 6.104502198e-06 ( 1e-05 ) AvgTol = 9.694977451e-07 ( 2.91037487e-06 )
+NBSHAPES : Solid = 4 ( 4 ) Shell = 4 ( 4 ) Face = 35 ( 35 ) Summary = 289 ( 266 )
+STATSHAPE : Solid = 4 ( 4 ) Shell = 4 ( 4 ) Face = 35 ( 35 ) FreeWire = 0 ( 0 ) FreeEdge = 24 ( 24 ) SharedEdge = 103 ( 103 )
+TOLERANCE : MaxTol = 6.104502198e-06 ( 1e-05 ) AvgTol = 9.682983037e-07 ( 2.91037487e-06 )
LABELS : N0Labels = 4 ( 4 ) N1Labels = 31 ( 31 ) N2Labels = 0 ( 0 ) TotalLabels = 35 ( 35 ) NameLabels = 7 ( 7 ) ColorLabels = 0 ( 0 ) LayerLabels = 28 ( 28 )
PROPS : Centroid = 0 ( 0 ) Volume = 0 ( 0 ) Area = 0 ( 0 )
NCOLORS : NColors = 0 ( 0 )