// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
#include <TopoDS.hxx>
#include <TopoDS_Face.hxx>
+#include <Standard_Failure.hxx>
+#include <Standard_ErrorHandler.hxx>
+
#include <sstream>
#include <set>
CORBA::Boolean SMESH_Pattern_i::LoadFromFile(const char* theFileContents)
{
+ // remove some gabage from the end
+ TCollection_AsciiString patternDescription = (char*) theFileContents;
+ int pos = patternDescription.Length();
+ while (! isdigit( patternDescription.Value( pos )))
+ pos--;
+ if ( pos != patternDescription.Length() ) {
+ patternDescription.Trunc( pos );
+ }
+
// Update Python script
- TPythonDump() << "isDone = pattern.LoadFromFile(" << theFileContents << ")";
+ TPythonDump() << "isDone = pattern.LoadFromFile("
+ << TPythonDump::LongStringStart("Pattern")
+ << patternDescription
+ << TPythonDump::LongStringEnd()
+ << ")";
addErrorCode( "LoadFromFile" );
return myPattern.Load( theFileContents );
if ( elem && elem->GetType() == SMDSAbs_Face )
fset.insert( static_cast<const SMDS_MeshFace *>( elem ));
}
- if (myPattern.Apply( fset, theNodeIndexOnKeyPoint1, theReverse ) &&
- myPattern.GetMappedPoints( xyzList ))
+ bool ok = false;
+ try {
+#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
+ OCC_CATCH_SIGNALS;
+#endif
+ ok = myPattern.Apply( aMesh, fset, theNodeIndexOnKeyPoint1, theReverse );
+ }
+ catch (Standard_Failure& exc) {
+ MESSAGE("OCCT Exception in SMESH_Pattern: " << exc.GetMessageString());
+ }
+ catch ( std::exception& exc ) {
+ MESSAGE("STD Exception in SMESH_Pattern: << exc.what()");
+ }
+ catch ( ... ) {
+ MESSAGE("Unknown Exception in SMESH_Pattern");
+ }
+
+ if ( ok && myPattern.GetMappedPoints( xyzList ))
{
points->length( xyzList.size() );
list<const gp_XYZ *>::iterator xyzIt = xyzList.begin();
RETCASE( ERR_LOAD_EMPTY_SUBMESH );
RETCASE( ERR_LOADF_NARROW_FACE );
RETCASE( ERR_LOADF_CLOSED_FACE );
+ RETCASE( ERR_LOADF_CANT_PROJECT );
RETCASE( ERR_LOADV_BAD_SHAPE );
RETCASE( ERR_LOADV_COMPUTE_PARAMS );
RETCASE( ERR_APPL_NOT_LOADED );