]> OCCT Git - occt-copy.git/commitdiff
0026245: Unable to write SAT file by default
authorabv <abv@opencascade.com>
Mon, 31 Aug 2015 04:00:57 +0000 (07:00 +0300)
committerabv <abv@opencascade.com>
Wed, 2 Sep 2015 11:39:57 +0000 (14:39 +0300)
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.

src/SHMessage/SHAPE.fr
src/SHMessage/SHAPE.us
src/ShapeProcess/ShapeProcess.cxx
src/XSAlgo/XSAlgo_AlgoContainer.cxx

index 02aa95080d52381c609a8ac8230c996e58c34984..1913c580858e4e701af8dcaa7ed9fa148f80e084 100755 (executable)
 ! ------------------------------------------------------------------------------
 ! 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
 !
 ! ------------------------------------------------------------------------------
index 1c708c6fa19890e17495ca77ef72b3fe178a8009..2eaf53ba6b7c202cccf3a9345a6e93797a5c9504 100755 (executable)
 ! ------------------------------------------------------------------------------
 ! 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
index 9e1e84afaddc34cb89ff89b0244231881769738a..55aaf74da1e3c4c186db9de6c39dac8ce4477889 100644 (file)
@@ -82,6 +82,10 @@ Standard_Boolean ShapeProcess::Perform (const Handle(ShapeProcess_Context)& cont
 #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;
   }
@@ -96,7 +100,7 @@ Standard_Boolean ShapeProcess::Perform (const Handle(ShapeProcess_Context)& cont
   
   // 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 += ",";
@@ -107,11 +111,12 @@ Standard_Boolean ShapeProcess::Perform (const Handle(ShapeProcess_Context)& cont
   }
 
   // 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);
     }
@@ -119,7 +124,7 @@ Standard_Boolean ShapeProcess::Perform (const Handle(ShapeProcess_Context)& cont
     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;
@@ -128,11 +133,11 @@ Standard_Boolean ShapeProcess::Perform (const Handle(ShapeProcess_Context)& cont
     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);
     }
@@ -140,5 +145,5 @@ Standard_Boolean ShapeProcess::Perform (const Handle(ShapeProcess_Context)& cont
   }
   
   context->UnSetScope();
-  return Standard_True;
+  return isDone;
 }
index 2834495ccd6b595de3afdb009fbb65ce2856cb6c..0d3ed9055fc15c0ed6dae87498a1db3af1f3d7be 100644 (file)
@@ -125,7 +125,7 @@ TopoDS_Shape XSAlgo_AlgoContainer::ProcessShape (const TopoDS_Shape& shape,
       time++;
     }
 #endif
-    // if FromSTEP or FromIGES, do default ShapeFix
+    // if reading, do default ShapeFix
     if ( ! strncmp ( pseq, "read.", 5 ) ) {
       try {
         OCC_CATCH_SIGNALS
@@ -153,11 +153,8 @@ TopoDS_Shape XSAlgo_AlgoContainer::ProcessShape (const TopoDS_Shape& shape,
       }  
       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" );
     }
   }
@@ -167,7 +164,7 @@ TopoDS_Shape XSAlgo_AlgoContainer::ProcessShape (const TopoDS_Shape& shape,
   rsc->SetResource ( "Runtime.MaxTolerance", maxTol );
 
   if ( !ShapeProcess::Perform(context, seq) )
-    return TopoDS_Shape(); // Null shape
+    return shape; // return original shape
 
   return context->Result();
 }