Auto-intersection corrigee
!
.FixAdvWire.FixIntersection.MSG5
-L'arete %d etait auto-intersectante, corrigee
+L'arete etait auto-intersectante, corrigee
!
.FixAdvWire.FixIntersection.MSG10
-Les aretes n0 %d et %d s'intersectaient, corrigees
+Les aretes s'intersectent, corrigees
!
.FixAdvWire.FixLacking.MSG0
Insertion d'arete(s) manquante(s)
.FixAdvFace.FixOrientation.MSG5
Contour sur face inverse
!
-.FixAdvFace.FixOrientation.MSG10
-Le Contour n0 %d parmi %d de la face a ete inverse
-!
.FixAdvFace.FixOrientation.MSG11
-Impossible d'orienter les contour n0 %d parmi %d
+Impossible d'orienter le contour
!
.FixAdvShell.FixOrientation.MSG20
Impossible d'orienter les faces dans le shell, creation de plusieurs shells
Self-intersection corrected
!
.FixAdvWire.FixIntersection.MSG5
-Edge %d was self-intersecting, corrected
+Edge was self-intersecting, corrected
!
.FixAdvWire.FixIntersection.MSG10
-Edges %d and %d were intersecting, corrected
+Edges were intersecting, corrected
!
.FixAdvWire.FixLacking.MSG0
Lacking edge(s) inserted
.FixAdvFace.FixOrientation.MSG5
Wire on face was reversed
!
-.FixAdvFace.FixOrientation.MSG10
-Wire %d of %d on face was reversed
-!
.FixAdvFace.FixOrientation.MSG11
-Cannot orient wire %d of %d
+Cannot orient wire
!
.FixAdvShell.FixOrientation.MSG20
Impossible to orient faces in shell, several shells created
Improperly connected solid split into several parts
!
.FixAdvFace.FixLoopWire.MSG0
-Wire was splitted on %d wires
+Wire was splitted on several wires
!
.FixAdvFace..MSG5
!
#include <TopoDS_Iterator.hxx>
#include <TopExp_Explorer.hxx>
#include <BRep_Tool.hxx>
+#include <BRep_Builder.hxx>
#include <BRepBuilderAPI.hxx>
#include <BRepTopAdaptor_FClass2d.hxx>
#include <Message_ListIteratorOfListOfMsg.hxx>
#include <Message_Msg.hxx>
#include <TCollection_AsciiString.hxx>
+#include <TColStd_DataMapIteratorOfDataMapOfAsciiStringInteger.hxx>
+#include <TColStd_DataMapOfAsciiStringInteger.hxx>
#include <TopTools_MapOfShape.hxx>
#include <TopTools_DataMapOfShapeListOfShape.hxx>
#include <TopAbs_State.hxx>
if ( argv[i][0] == '-' || argv[i][0] == '+' || argv[i][0] == '*' ) {
Standard_Integer val = ( argv[i][0] == '-' ? 0 : argv[i][0] == '+' ? 1 : -1 );
switch ( argv[i][1] ) {
- case 'l': sfs->FixWireTool()->FixLackingMode() = val;
- case 'o': sfs->FixFaceTool()->FixOrientationMode() = val;
- case 'h': sfs->FixWireTool()->FixShiftedMode() = val;
- case 'm': sfs->FixFaceTool()->FixMissingSeamMode() = val;
- case 'd': sfs->FixWireTool()->FixDegeneratedMode() = val;
- case 's': sfs->FixWireTool()->FixSmallMode() = val;
- case 'i': sfs->FixWireTool()->FixSelfIntersectionMode() = val;
- case 'n': sfs->FixWireTool()->FixNotchedEdgesMode() = val;
- case '?': mess = val;
+ case 'l': sfs->FixWireTool()->FixLackingMode() = val; break;
+ case 'o': sfs->FixFaceTool()->FixOrientationMode() = val; break;
+ case 'h': sfs->FixWireTool()->FixShiftedMode() = val; break;
+ case 'm': sfs->FixFaceTool()->FixMissingSeamMode() = val; break;
+ case 'd': sfs->FixWireTool()->FixDegeneratedMode() = val; break;
+ case 's': sfs->FixWireTool()->FixSmallMode() = val; break;
+ case 'i': sfs->FixWireTool()->FixSelfIntersectionMode() = val; break;
+ case 'n': sfs->FixWireTool()->FixNotchedEdgesMode() = val; break;
+ case '?': mess = val; break;
}
continue;
}
sfs->Perform (aProgress);
DBRep::Set (res,sfs->Shape());
- if ( mess ) {
- Standard_Integer num = 0;
+ if ( mess )
+ {
+ TColStd_DataMapOfAsciiStringInteger aMapOfNumberOfFixes;
+ Standard_SStream aSStream;
+ TopoDS_Compound aCompound;
+ BRep_Builder aBuilder;
+ aBuilder.MakeCompound (aCompound);
const ShapeExtend_DataMapOfShapeListOfMsg &map = msg->MapShape();
- for ( ShapeExtend_DataMapIteratorOfDataMapOfShapeListOfMsg it(map); it.More(); it.Next() ) {
- //cout << it.Key().TShape()->DynamicType()->Name() << " " << *(void**)&it.Key().TShape();
- Standard_SStream aSStream;
- aSStream << it.Key().TShape()->DynamicType()->Name() << " " << *(void**)&it.Key().TShape();
- di << aSStream;
-
- if ( mess <0 ) {
- char buff[256];
- sprintf ( buff, "%s_%d", res, ++num );
- di << " (saved in DRAW shape " << buff << ")";
- DBRep::Set (buff,it.Key());
+ // Counting the number of each type of fixes. If the switch '*?' store all modified shapes in compound.
+ for ( ShapeExtend_DataMapIteratorOfDataMapOfShapeListOfMsg it ( map ); it.More(); it.Next() )
+ {
+ for ( Message_ListIteratorOfListOfMsg iter ( it.Value() ); iter.More(); iter.Next() )
+ {
+ if ( aMapOfNumberOfFixes.IsBound ( iter.Value().Value() ) )
+ {
+ aMapOfNumberOfFixes ( iter.Value().Value() )++;
+ }
+ else
+ {
+ aMapOfNumberOfFixes.Bind ( iter.Value().Value(), 1 );
+ }
}
- di << ":" << "\n";
- for (Message_ListIteratorOfListOfMsg iter (it.Value()); iter.More(); iter.Next())
- di << " " << TCollection_AsciiString(iter.Value().Value()).ToCString() << "\n";
+ if ( mess < 0 )
+ {
+ aBuilder.Add ( aCompound, it.Key() );
+ }
+ }
+
+ aSStream << " Fix" << setw (58) << "Count\n";
+ aSStream << " ------------------------------------------------------------\n";
+ for ( TColStd_DataMapIteratorOfDataMapOfAsciiStringInteger anIter ( aMapOfNumberOfFixes ); anIter.More(); anIter.Next() )
+ {
+ aSStream << " " << anIter.Key() << setw ( 60 - anIter.Key().Length() ) << anIter.Value() << "\n";
+ }
+ aSStream << " ------------------------------------------------------------\n";
+ di << aSStream;
+
+ if ( mess < 0 )
+ {
+ char buff[256];
+ sprintf ( buff, "%s_%s", res, "m" );
+ di << " Modified shapes saved in compound: " << buff;
+ DBRep::Set (buff, aCompound);
}
}
//fix for loop of wire
TopTools_SequenceOfShape aLoopWires;
if(NeedFix ( myFixLoopWiresMode) && FixLoopWire(aLoopWires)) {
-
+ if (aLoopWires.Length() > 1)
+ SendWarning ( wire, Message_Msg ( "FixAdvFace.FixLoopWire.MSG0" ) );// Wire was splitted on several wires
myStatus |= ShapeExtend::EncodeStatus ( ShapeExtend_DONE7 );
fixed = Standard_True;
Standard_Integer k=1;
}
// B.UpdateFace (myFace,myPrecision);
- SendWarning (Message_Msg ("FixAdvFace.FixOrientation.MSG0"));//Face created with natural bounds
+ SendWarning ( myFace, Message_Msg ( "FixAdvFace.FixOrientation.MSG0" ) );// Face created with natural bounds
BRepTools::Update(myFace);
return Standard_True;
}
#ifdef DEBUG
cout<<"Natural bound on sphere or torus with holes added"<<endl; // mise au point !
#endif
- SendWarning (Message_Msg ("FixAdvFace.FixOrientation.MSG0"));//Face created with natural bounds
+ SendWarning ( myFace, Message_Msg ( "FixAdvFace.FixOrientation.MSG0" ) );// Face created with natural bounds
return Standard_True;
}
new ShapeExtend_WireData (TopoDS::Wire(ws.Value(1)));
sbdw->Reverse ( myFace );
ws.SetValue ( 1, sbdw->Wire() );
- SendWarning (Message_Msg ("FixAdvFace.FixOrientation.MSG5"));//Wire on face was reversed
+ SendWarning ( sbdw->Wire(), Message_Msg ( "FixAdvFace.FixOrientation.MSG5" ) );// Wire on face was reversed
done = Standard_True;
#ifdef DEBUG
cout<<"Wire reversed"<<endl; // mise au point !
}
if (sta == TopAbs_UNKNOWN) { // ERREUR
- Message_Msg MSG ("FixAdvFace.FixOrientation.MSG11"); //Cannot orient wire %d of %d
- MSG.Arg (i);
- MSG.Arg (nb);
- SendWarning (MSG);
+ SendWarning ( aw, Message_Msg ( "FixAdvFace.FixOrientation.MSG11" ) );// Cannot orient wire
}
else {
MW.Bind(aw,IntWires);
ShapeExtend_WireData sewd (aw);
sewd.Reverse(myFace);
ws.SetValue (i,sewd.Wire());
+ SendWarning ( sewd.Wire(), Message_Msg ( "FixAdvFace.FixOrientation.MSG5" ) );// Wire on face was reversed
aSeqReversed.Append(i);
done = Standard_True;
SI.Bind(ws.Value(i),1);
ShapeExtend_WireData sewd (aw);
sewd.Reverse(myFace);
ws.SetValue (i,sewd.Wire());
+ SendWarning ( sewd.Wire(), Message_Msg ( "FixAdvFace.FixOrientation.MSG5" ) );// Wire on face was reversed
aSeqReversed.Append(i);
done = Standard_True;
MapWires.Bind(ws.Value(i),IW);
ShapeExtend_WireData sewd (aw);
sewd.Reverse(myFace);
ws.SetValue (i,sewd.Wire());
+ SendWarning ( sewd.Wire(), Message_Msg ( "FixAdvFace.FixOrientation.MSG5" ) );// Wire on face was reversed
aSeqReversed.Append(i);
done = Standard_True;
}
myFace = TopoDS::Face ( S );
BRepTools::Update(myFace);
Standard_Integer k =1;
- for( ; k <= aSeqReversed.Length();k++) {
- Message_Msg MSG ("FixAdvFace.FixOrientation.MSG10"); //Wire %d of %d on face was reversed
- MSG.Arg (aSeqReversed.Value(k));
- MSG.Arg (nb);
- SendWarning (MSG);
+ for( ; k <= aSeqReversed.Length(); k++ )
+ {
#ifdef DEBUG
- cout<<"Wire no "<<aSeqReversed.Value(k)<<" of "<<nb<<" reversed"<<endl; // mise au point !
+ cout<<"Wire no "<<aSeqReversed.Value(k)<<" of "<<nb<<" reversed"<<endl; // mise au point !
#endif
}
BRepTools::Update(myFace); //:p4
}
- SendWarning (Message_Msg ("FixAdvFace.FixMissingSeam.MSG0"));//Missing seam-edge added
+ SendWarning ( Message_Msg ( "FixAdvFace.FixMissingSeam.MSG0" ) );// Missing seam-edge added
return Standard_True;
}
continue;
TopoDS_Wire wire = TopoDS::Wire ( wi.Value() );
Handle(ShapeAnalysis_Wire) saw = new ShapeAnalysis_Wire(wire,myFace,prec);
- if ( saw->CheckSmallArea(prec) ) nbRemoved++;
- else {
+ if ( saw->CheckSmallArea(prec) )
+ {
+ SendWarning ( wire, Message_Msg ("FixAdvFace.FixSmallAreaWire.MSG0") );// Null area wire detected, wire skipped
+ nbRemoved++;
+ }
+ else
+ {
B.Add(face,wire);
nbWires++;
}
#endif
if ( ! Context().IsNull() ) Context()->Replace ( myFace, face );
myFace = face;
- SendWarning (Message_Msg ("FixAdvFace.FixSmallAreaWire.MSG0"));//Null area wire detected, wire skipped
return Standard_True;
}
//=======================================================================
}
Standard_Boolean isDone =(aResWires.Length() && isClosed);
- if(isDone && aResWires.Length() >1) {
-
- Message_Msg MSG ("FixAdvFace.FixLoopWire.MSG0"); //Wire was splitted on %d wires
- MSG.Arg (aResWires.Length());
+ if(isDone && aResWires.Length() >1)
+ {
#ifdef DEBUG
- cout<<"Wire was splitted on "<<aResWires.Length()<<" wires"<< endl;
+ cout<<"Wire was splitted on "<<aResWires.Length()<<" wires"<< endl;
#endif
}
done = Standard_True;
myStatus = ShapeExtend::EncodeStatus (ShapeExtend_FAIL);
- SendWarning (Message_Msg ("FixAdvShell.FixOrientation.MSG20"));//Faces were incorrectly oriented in the shell, a few shells were created;
+ SendWarning ( Message_Msg ( "FixAdvShell.FixOrientation.MSG20" ) );// Impossible to orient faces in shell, several shells created
return Standard_True;
}
if(aNumMultShell >1) {
myStatus = ShapeExtend::EncodeStatus (ShapeExtend_DONE2);
if(!Context().IsNull())
Context()->Replace(shell, myShape);
- if( myNbShells == 1)
- SendWarning (Message_Msg ("FixAdvShell.FixOrientation.MSG0"));//Faces were incorrectly oriented in the shell, corrected
+ if ( myNbShells == 1 )
+ SendWarning ( Message_Msg ( "FixAdvShell.FixOrientation.MSG0" ) );// Faces were incorrectly oriented in the shell, corrected
else
- SendWarning (Message_Msg ("FixAdvShell.FixOrientation.MSG30"));//Bad connected shell ,a few shells were created.
+ SendWarning ( Message_Msg ( "FixAdvShell.FixOrientation.MSG30" ) );// Improperly connected shell split into parts
return Standard_True;
}
else return Standard_False;
FixSmall ( i, lockvtx, precsmall );
myStatusSmall |= myLastFixStatus;
}
-
- if ( StatusSmall ( ShapeExtend_DONE ) && ! myShape.IsNull() ) {
- SendWarning (Message_Msg ("FixAdvWire.FixSmall.MSG0"));//Small edge(s) removed
- }
+
return StatusSmall ( ShapeExtend_DONE );
}
TopLoc_Location L;
Standard_Real first, last;
BRep_Tool::CurveOnSurface ( sbwd->Edge(i), C, S, L, first, last );
- if ( C.IsNull() ) {
+ if ( C.IsNull() )
+ {
+ SendWarning ( sbwd->Edge ( i ), Message_Msg ( "FixWire.FixCurve3d.Removed" ) );// Incomplete edge (with no pcurves or 3d curve) removed
sbwd->Remove ( i-- );
nb--;
myStatusEdgeCurves |= ShapeExtend::EncodeStatus ( ShapeExtend_DONE5 );
- if ( ! myShape.IsNull() )
- SendWarning (Message_Msg ("FixWire.FixCurve3d.Removed")); // Incomplete edge (with no pcurves or 3d curve) removed
}
myStatusEdgeCurves |= ShapeExtend::EncodeStatus ( ShapeExtend_FAIL5 );
}
}
else prevcoded = coded;
}
-
- if ( StatusDegenerated ( ShapeExtend_DONE ) && ! myShape.IsNull() ) {
- SendWarning (Message_Msg ("FixWire.FixDegenerated.MSG0")); //Degenerated edge(s) detected
- }
return StatusDegenerated ( ShapeExtend_DONE );
}
*/
}
- if ( StatusSelfIntersection ( ShapeExtend_DONE ) && ! myShape.IsNull() ) {
- SendWarning (Message_Msg ("FixAdvWire.FixIntersection.MSG0")); // Self-intersection corrected
- }
return StatusSelfIntersection ( ShapeExtend_DONE );
}
else myLastFixStatus |= ShapeExtend::EncodeStatus ( ShapeExtend_DONE1 );
// action: remove edge
- if ( ! Context().IsNull() ) Context()->Remove(WireData()->Edge(n));
+ if ( ! Context().IsNull() )
+ Context()->Remove(WireData()->Edge(n));
+ SendWarning ( WireData()->Edge ( n ), Message_Msg ( "FixAdvWire.FixSmall.MSG0" ) ); //Small edge(s) removed
WireData()->Remove ( n );
// call FixConnected in the case if vertices of the small edge were not the same
savLastFixStatus |= ShapeExtend::EncodeStatus ( ShapeExtend_FAIL3 );
myLastFixStatus = savLastFixStatus;
}
-
- if ( ! myShape.IsNull() ) {
- Message_Msg MSG ("FixAdvWire.FixSmall.MSG0"); //Small edge %d removed
- MSG.Arg (n);
- SendWarning (MSG);
- }
+
return Standard_True;
}
sbwd->Set ( degEdge, n2 );
myLastFixStatus |= ShapeExtend::EncodeStatus ( ShapeExtend_DONE2 );
}
-//: abv 28.08.01 - commented to avoid extra messages
-// Message_Msg MSG ("FixWire.FixDegenerated.MSG5"); //Degenerated edge %d detected
-// MSG.Arg (n2);
-// SendWarning (MSG);
+
+// commented to avoid extra messages
+// SendWarning ( degEdge, Message_Msg ( "FixWire.FixDegenerated.MSG0" ) );// Degenerated edge(s) detected
+
return Standard_True;
}
}
if ( LastFixStatus ( ShapeExtend_DONE ) && ! myShape.IsNull() ) {
- Message_Msg MSG ("FixAdvWire.FixIntersection.MSG5"); //Edge %d was self-intersecting, corrected
- MSG.Arg (num);
- SendWarning (MSG);
+ SendWarning ( E, Message_Msg ( "FixAdvWire.FixIntersection.MSG5" ) );// Edge was self-intersecting, corrected
}
return LastFixStatus ( ShapeExtend_DONE );
myLastFixStatus |= ShapeExtend::EncodeStatus ( ShapeExtend_DONE7 );
}
if ( ! myShape.IsNull() ) {
- Message_Msg MSG ("FixAdvWire.FixIntersection.MSG10"); //Edges %d and %d were intersecting, corrected
- MSG.Arg (n1);
- MSG.Arg (n2);
- SendWarning (MSG);
+ SendWarning ( Message_Msg ( "FixAdvWire.FixIntersection.MSG10" ) );// Edges were intersecting, corrected
}
return Standard_True;
}
if(newTolers(i)>0) B.UpdateVertex(TopoDS::Vertex(vertices(i)),newTolers(i));
if ( ! myShape.IsNull() ) {
- Message_Msg MSG ("FixAdvWire.FixIntersection.MSG10"); //Edges %d and %d were intersecting, corrected
- MSG.Arg (n1);
- MSG.Arg (n2);
- SendWarning (MSG);
+ SendWarning ( Message_Msg ( "FixAdvWire.FixIntersection.MSG10" ) );// Edges were intersecting, corrected
}
return Standard_True;
}