From: abv Date: Mon, 31 Aug 2015 04:00:57 +0000 (+0300) Subject: 0026245: Unable to write SAT file by default X-Git-Tag: V7_0_0_beta~283 X-Git-Url: http://git.dev.opencascade.org/gitweb/?p=occt.git;a=commitdiff_plain;h=881536e20e310b89ebc745366a6a2e77f3e2f11d 0026245: Unable to write SAT file by default 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. --- diff --git a/src/SHMessage/SHAPE.fr b/src/SHMessage/SHAPE.fr index 02aa95080d..1913c58085 100755 --- a/src/SHMessage/SHAPE.fr +++ b/src/SHMessage/SHAPE.fr @@ -25,19 +25,19 @@ ! ------------------------------------------------------------------------------ ! 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 ! ! ------------------------------------------------------------------------------ diff --git a/src/SHMessage/SHAPE.us b/src/SHMessage/SHAPE.us index 1c708c6fa1..2eaf53ba6b 100755 --- a/src/SHMessage/SHAPE.us +++ b/src/SHMessage/SHAPE.us @@ -26,20 +26,20 @@ ! ------------------------------------------------------------------------------ ! 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 diff --git a/src/ShapeProcess/ShapeProcess.cxx b/src/ShapeProcess/ShapeProcess.cxx index 2e7830b34f..5eba8fa031 100644 --- a/src/ShapeProcess/ShapeProcess.cxx +++ b/src/ShapeProcess/ShapeProcess.cxx @@ -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; } diff --git a/src/XSAlgo/XSAlgo_AlgoContainer.cxx b/src/XSAlgo/XSAlgo_AlgoContainer.cxx index 1e00efe53a..3ee0d3acb4 100644 --- a/src/XSAlgo/XSAlgo_AlgoContainer.cxx +++ b/src/XSAlgo/XSAlgo_AlgoContainer.cxx @@ -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(); }