]> 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)
committerbugmaster <bugmaster@opencascade.com>
Thu, 10 Sep 2015 14:31:33 +0000 (17:31 +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 2e7830b34fa41a6b962d3b76298e2365e8242144..5eba8fa0313d59853522249e457b6f2341f0afa7 100644 (file)
@@ -81,6 +81,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;
   }
@@ -95,7 +99,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 += ",";
@@ -106,11 +110,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);
     }
@@ -118,7 +123,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;
@@ -127,11 +132,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);
     }
@@ -139,5 +144,5 @@ Standard_Boolean ShapeProcess::Perform (const Handle(ShapeProcess_Context)& cont
   }
   
   context->UnSetScope();
-  return Standard_True;
+  return isDone;
 }
index 1e00efe53a9e79399638779ae8951e4f19a0c8a4..3ee0d3acb40d8d74c22d488068ca60b391e4d9b1 100644 (file)
@@ -129,7 +129,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
@@ -157,11 +157,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" );
     }
   }
@@ -171,7 +168,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();
 }