XSAlgo_AlgoContainer is corrected to return original shape if Shape Processing fails.
Handling of situation of absence of defined operator sequence is corrected to apply DirectFaces operator by default on writing, regardless of target format.
ShapeProcess is corrected to output warning if operator sequence is not defined in resource file, and to continue if one operator in sequence has failed.
Message names are made more meaningful.
! ------------------------------------------------------------------------------
! Messages for sequence of operators
!
-.Sequence.MSG0
+.SP.Sequence.Info.Seq
Sequence d'operateurs: %s
!
-.Sequence.MSG5
+.SP.Sequence.Info.Operator
Operateur %d/%d: %s
!
-.Sequence.MSG1
+.SP.Sequence.Error.NoOp
Error: Operator %s is not found
!
-.Sequence.MSG2
+.SP.Sequence.Error.Except
Error: Operator %s failed with exception %s
!
-.Sequence.MSG3
+.SP.Sequence.Warn.NoSeq
Warning: Shape Processing: sequence not defined for %s
!
! ------------------------------------------------------------------------------
! ------------------------------------------------------------------------------
! Messages for sequence of operators
!
-.Sequence.MSG0
-Info: Sequence of operators: %s
+.SP.Sequence.Info.Seq
+Info: Shape Processing: Sequence of operators: %s
!
-.Sequence.MSG5
-Error: Operator %d/%d: %s
+.SP.Sequence.Info.Operator
+Info: Shape Processing: Operator %d/%d: %s
!
-.Sequence.MSG1
-Error: Operator %s is not found
+.SP.Sequence.Error.NoOp
+Error: Shape Processing: Operator %s is not found
!
-.Sequence.MSG2
-Error: Operator %s failed with exception %s
+.SP.Sequence.Error.Except
+Error: Shape Processing: Operator %s failed with exception %s
!
-.Sequence.MSG3
-Warning: Shape Processing: sequence not defined for %s
+.SP.Sequence.Warn.NoSeq
+Warning: Shape Processing: Sequence not defined for %s, nothing to do
!
! ------------------------------------------------------------------------------
! Messages for printing results of shape processing
#ifdef OCCT_DEBUG
cout << "Error: ShapeProcess_Performer::Perform: sequence not defined for " << seq << endl;
#endif
+ if ( context->TraceLevel() >0 ) {
+ Message_Msg SMSG3 ("SP.Sequence.Warn.NoSeq"); // Sequence %s not found
+ context->Messenger()->Send (SMSG3 << seq, Message_Warning);
+ }
context->UnSetScope();
return Standard_False;
}
// put a message
if ( context->TraceLevel() >=2 ) {
- Message_Msg SMSG0 ("Sequence.MSG0"); //Sequence of operators: %s
+ Message_Msg SMSG0 ("SP.Sequence.Info.Seq"); //Sequence of operators: %s
TCollection_AsciiString Seq;
for ( Standard_Integer i1=1; i1 <= sequenceOfOperators.Length(); i1++ ) {
if (i1 > 1) Seq += ",";
}
// iterate on operators in the sequence
+ Standard_Boolean isDone = Standard_False;
for (i=1; i<=sequenceOfOperators.Length(); i++) {
oper = sequenceOfOperators.Value(i);
if ( context->TraceLevel() >=2 ) {
- Message_Msg SMSG5 ("Sequence.MSG5"); //Operator %d/%d: %s
+ Message_Msg SMSG5 ("SP.Sequence.Info.Operator"); //Operator %d/%d: %s
SMSG5 << i << sequenceOfOperators.Length() << oper.ToCString();
context->Messenger()->Send (SMSG5, Message_Alarm);
}
Handle(ShapeProcess_Operator) op;
if ( ! ShapeProcess::FindOperator ( oper.ToCString(), op ) ) {
if ( context->TraceLevel() >0 ) {
- Message_Msg SMSG1 ("Sequence.MSG1"); //Operator %s not found
+ Message_Msg SMSG1 ("SP.Sequence.Error.NoOp"); //Operator %s not found
context->Messenger()->Send (SMSG1 << oper, Message_Alarm);
}
continue;
context->SetScope ( oper.ToCString() );
try {
OCC_CATCH_SIGNALS
- if ( !op->Perform(context) )
- return Standard_False;
+ if ( op->Perform(context) )
+ isDone = Standard_True;
}
catch (Standard_Failure) {
- Message_Msg SMSG2 ("Sequence.MSG2"); //Operator %s failed with exception %s
+ Message_Msg SMSG2 ("SP.Sequence.Error.Except"); //Operator %s failed with exception %s
SMSG2 << oper << Standard_Failure::Caught()->GetMessageString();
context->Messenger()->Send (SMSG2, Message_Alarm);
}
}
context->UnSetScope();
- return Standard_True;
+ return isDone;
}
time++;
}
#endif
- // if FromSTEP or FromIGES, do default ShapeFix
+ // if reading, do default ShapeFix
if ( ! strncmp ( pseq, "read.", 5 ) ) {
try {
OCC_CATCH_SIGNALS
}
return context->Result();
}
- // if ToSTEP or ToIGES, define sequence of DirectFaces
- else if ( ! strcmp ( pseq, "write.step.sequence" ) ) {
- rsc->SetResource ( str.ToCString(), "DirectFaces" );
- }
- else if ( ! strcmp ( pseq, "write.iges.sequence" ) ) {
+ // for writing, define default sequence of DirectFaces
+ else if ( ! strncmp ( pseq, "write.", 6 ) ) {
rsc->SetResource ( str.ToCString(), "DirectFaces" );
}
}
rsc->SetResource ( "Runtime.MaxTolerance", maxTol );
if ( !ShapeProcess::Perform(context, seq) )
- return TopoDS_Shape(); // Null shape
+ return shape; // return original shape
return context->Result();
}