#include <Standard_Failure.hxx>
#include <Standard_ErrorHandler.hxx> // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC
+// VSR 29/08/2017: 0023327, 0023428: eliminate unnecessary lines in Python dump
+// Next macro, when defined, causes appearing of SubShapeAllIDs(), SubShapeAllSortedIDs(), GetSameIDs()
+// and other such commands in Python dump.
+// See also GEOM_Engine.cxx.
+// ---------------------------------------
+// #define DUMP_SUBSHAPE_IDS
+// ---------------------------------------
+
namespace {
void AddFlatSubShapes(const TopoDS_Shape& S, TopTools_ListOfShape& L, TopTools_MapOfShape& M)
return NULL;
}
}
- catch (Standard_Failure) {
- Handle(Standard_Failure) aFail = Standard_Failure::Caught();
- SetErrorCode(aFail->GetMessageString());
+ catch (Standard_Failure& aFail) {
+ SetErrorCode(aFail.GetMessageString());
return NULL;
}
return NULL;
}
}
- catch (Standard_Failure) {
- Handle(Standard_Failure) aFail = Standard_Failure::Caught();
- SetErrorCode(aFail->GetMessageString());
+ catch (Standard_Failure& aFail) {
+ SetErrorCode(aFail.GetMessageString());
return NULL;
}
return NULL;
}
}
- catch (Standard_Failure) {
- Handle(Standard_Failure) aFail = Standard_Failure::Caught();
- SetErrorCode(aFail->GetMessageString());
+ catch (Standard_Failure& aFail) {
+ SetErrorCode(aFail.GetMessageString());
return NULL;
}
return NULL;
}
}
- catch (Standard_Failure) {
- Handle(Standard_Failure) aFail = Standard_Failure::Caught();
- SetErrorCode(aFail->GetMessageString());
+ catch (Standard_Failure& aFail) {
+ SetErrorCode(aFail.GetMessageString());
return NULL;
}
return NULL;
}
}
- catch (Standard_Failure) {
- Handle(Standard_Failure) aFail = Standard_Failure::Caught();
- SetErrorCode(aFail->GetMessageString());
+ catch (Standard_Failure& aFail) {
+ SetErrorCode(aFail.GetMessageString());
// to provide warning
if (!aFunction->GetValue().IsNull()) {
isWarning = Standard_True;
return NULL;
}
}
- catch (Standard_Failure) {
- Handle(Standard_Failure) aFail = Standard_Failure::Caught();
- SetErrorCode(aFail->GetMessageString());
+ catch (Standard_Failure& aFail) {
+ SetErrorCode(aFail.GetMessageString());
// to provide warning
if (!aFunction->GetValue().IsNull()) {
isWarning = Standard_True;
return NULL;
}
}
- catch (Standard_Failure) {
- Handle(Standard_Failure) aFail = Standard_Failure::Caught();
- SetErrorCode(aFail->GetMessageString());
+ catch (Standard_Failure& aFail) {
+ SetErrorCode(aFail.GetMessageString());
return NULL;
}
return NULL;
}
}
- catch (Standard_Failure) {
- Handle(Standard_Failure) aFail = Standard_Failure::Caught();
- SetErrorCode(aFail->GetMessageString());
+ catch (Standard_Failure& aFail) {
+ SetErrorCode(aFail.GetMessageString());
// to provide warning
if (!aFunction->GetValue().IsNull()) {
isWarning = Standard_True;
return NULL;
}
}
- catch (Standard_Failure) {
- Handle(Standard_Failure) aFail = Standard_Failure::Caught();
- SetErrorCode(aFail->GetMessageString());
+ catch (Standard_Failure& aFail) {
+ SetErrorCode(aFail.GetMessageString());
return NULL;
}
return NULL;
}
}
- catch (Standard_Failure) {
- Handle(Standard_Failure) aFail = Standard_Failure::Caught();
- SetErrorCode(aFail->GetMessageString());
+ catch (Standard_Failure& aFail) {
+ SetErrorCode(aFail.GetMessageString());
return NULL;
}
return NULL;
}
}
- catch (Standard_Failure) {
- Handle(Standard_Failure) aFail = Standard_Failure::Caught();
- SetErrorCode(aFail->GetMessageString());
+ catch (Standard_Failure& aFail) {
+ SetErrorCode(aFail.GetMessageString());
// to provide warning
if (!aFunction->GetValue().IsNull()) {
isWarning = Standard_True;
return NULL;
}
}
- catch (Standard_Failure) {
- Handle(Standard_Failure) aFail = Standard_Failure::Caught();
- SetErrorCode(aFail->GetMessageString());
+ catch (Standard_Failure& aFail) {
+ SetErrorCode(aFail.GetMessageString());
// to provide warning
if (!aFunction->GetValue().IsNull()) {
isWarning = Standard_True;
return NULL;
}
}
- catch (Standard_Failure) {
- Handle(Standard_Failure) aFail = Standard_Failure::Caught();
- SetErrorCode(aFail->GetMessageString());
+ catch (Standard_Failure& aFail) {
+ SetErrorCode(aFail.GetMessageString());
// to provide warning
if (!aFunction->GetValue().IsNull()) {
isWarning = Standard_True;
TopoDS_Shape aShape;
TopTools_SequenceOfShape shapes;
std::list< Handle(GEOM_Object) >::iterator s = theShapes.begin();
- Handle(GEOM_Object) lastCreatedGO;
+ Handle(GEOM_BaseObject) lastCreatedGO;
for ( ; s != theShapes.end(); ++s )
{
Handle(GEOM_Object) go = *s;
return NULL;
}
}
- catch (Standard_Failure) {
- Handle(Standard_Failure) aFail = Standard_Failure::Caught();
- SetErrorCode(aFail->GetMessageString());
+ catch (Standard_Failure& aFail) {
+ SetErrorCode(aFail.GetMessageString());
// to provide warning
if (!aFunction->GetValue().IsNull()) {
isWarning = Standard_True;
Standard_Integer types = theGroupsOnly ? Groups : Groups|SubShapes;
Handle(TColStd_HSequenceOfTransient) results = GetExistingSubObjects(theShape, types);
+ Handle(GEOM_BaseObject) lastCreatedGO = GEOM::GetCreatedLast(results);
+ lastCreatedGO = GEOM::GetCreatedLast(lastCreatedGO, theShape);
+
if (results->Length() > 0) {
- //Make a Python command
- TCollection_AsciiString anAsciiList;
- for (int i = 1; i <= results->Length(); i++)
+ // Make a Python command
+ GEOM::TPythonDump pd (lastCreatedGO->GetLastFunction(), /*append=*/true);
+ pd << "[";
+ Standard_Integer i, aLen = results->Length();
+ for (i = 1; i <= aLen; i++)
{
- Handle(GEOM_BaseObject) obj = Handle(GEOM_BaseObject)::DownCast( results->Value(i));
- obj->GetEntryString();
- if ( i < results->Length() )
- anAsciiList += ",";
+ Handle(GEOM_BaseObject) obj = Handle(GEOM_BaseObject)::DownCast(results->Value(i));
+ pd << obj << ((i < aLen) ? ", " : "");
}
-
- GEOM::TPythonDump pd (theShape->GetLastFunction(), /*append=*/true);
- pd << "[" << anAsciiList.ToCString();
pd << "] = geompy.GetExistingSubObjects(";
pd << theShape << ", " << (bool)theGroupsOnly << ")";
}
-
+
return results;
}
Handle(GEOM_Function) aFunction = theShape->GetLastFunction();
+ // VSR 29/08/2017: 0023327, 0023428: eliminate unnecessary lines in Python dump
+#ifdef DUMP_SUBSHAPE_IDS
//Make a Python command
GEOM::TPythonDump pd (aFunction, /*append=*/true);
pd << "listSubShapeIDs = geompy.SubShapeAll";
break;
default: ;
}
+#endif // DUMP_SUBSHAPE_IDS
SetErrorCode(OK);
return aSeq;
nbShapes = nbTypes[theShapeType];
}
}
- catch (Standard_Failure) {
- Handle(Standard_Failure) aFail = Standard_Failure::Caught();
- SetErrorCode(aFail->GetMessageString());
+ catch (Standard_Failure& aFail) {
+ SetErrorCode(aFail.GetMessageString());
return -1;
}
return NULL;
}
}
- catch (Standard_Failure) {
- Handle(Standard_Failure) aFail = Standard_Failure::Caught();
- SetErrorCode(aFail->GetMessageString());
+ catch (Standard_Failure& aFail) {
+ SetErrorCode(aFail.GetMessageString());
return NULL;
}
//The explode doesn't change object so no new function is required.
Handle(GEOM_Function) aFunction = theShape->GetLastFunction();
+ // VSR 29/08/2017: 0023327, 0023428: eliminate unnecessary lines in Python dump
+#ifdef DUMP_SUBSHAPE_IDS
//Make a Python command
GEOM::TPythonDump(aFunction, /*append=*/true)
<< "listFreeFacesIDs = geompy.GetFreeFacesIDs(" << theShape << ")";
+#endif // DUMP_SUBSHAPE_IDS
SetErrorCode(OK);
return aSeq;
// The GetShapesOnBox() doesn't change object so no new function is required.
Handle(GEOM_Function) aFunction = GEOM::GetCreatedLast(theShape,theBox)->GetLastFunction();
+ // VSR 29/08/2017: 0023327, 0023428: eliminate unnecessary lines in Python dump
+#ifdef DUMP_SUBSHAPE_IDS
// Make a Python command
GEOM::TPythonDump(aFunction, /*append=*/true)
<< "listShapesOnBoxIDs = geompy.GetShapesOnBoxIDs("
<< theShape << ", "
<< TopAbs_ShapeEnum(theShapeType) << ", "
<< theState << ")";
+#endif // DUMP_SUBSHAPE_IDS
SetErrorCode(OK);
return aSeqOfIDs;
Handle(GEOM_Function) aFunction =
GEOM::GetCreatedLast(theShape,theCheckShape)->GetLastFunction();
+ // VSR 29/08/2017: 0023327, 0023428: eliminate unnecessary lines in Python dump
+#ifdef DUMP_SUBSHAPE_IDS
// Make a Python command
GEOM::TPythonDump(aFunction, /*append=*/true)
- << "listShapesOnBoxIDs = geompy.GetShapesOnShapeIDs("
+ << "listShapesOnShapeIDs = geompy.GetShapesOnShapeIDs("
<< theCheckShape << ", "
<< theShape << ", "
<< TopAbs_ShapeEnum(theShapeType) << ", "
<< theState << ")";
+#endif // DUMP_SUBSHAPE_IDS
SetErrorCode(OK);
return aSeqOfIDs;
return NULL;
}
}
- catch (Standard_Failure) {
- Handle(Standard_Failure) aFail = Standard_Failure::Caught();
- SetErrorCode(aFail->GetMessageString());
+ catch (Standard_Failure& aFail) {
+ SetErrorCode(aFail.GetMessageString());
return NULL;
}
VertMax = T;
}
}
- catch (Standard_Failure) {
- Handle(Standard_Failure) aFail = Standard_Failure::Caught();
- SetErrorCode(aFail->GetMessageString());
+ catch (Standard_Failure& aFail) {
+ SetErrorCode(aFail.GetMessageString());
return aSeqOfIDs;
}
// END: Mantis issue 0020961
// The GetShapesOnPlaneIDs() doesn't change object so no new function is required.
Handle(GEOM_Function) aFunction = GEOM::GetCreatedLast(theShape,theAx1)->GetLastFunction();
+ // VSR 29/08/2017: 0023327, 0023428: eliminate unnecessary lines in Python dump
+#ifdef DUMP_SUBSHAPE_IDS
// Make a Python command
GEOM::TPythonDump(aFunction, /*append=*/true)
<< "listShapesOnPlane = geompy.GetShapesOnPlaneIDs"
<< "(" << theShape << "," << aShapeType << "," << theAx1 << "," << theState << ")";
+#endif // DUMP_SUBSHAPE_IDS
SetErrorCode(OK);
return aSeq;
// The GetShapesOnPlaneIDs() doesn't change object so no new function is required.
Handle(GEOM_Function) aFunction = GEOM::GetCreatedLast(theShape,theAx1)->GetLastFunction();
+ // VSR 29/08/2017: 0023327, 0023428: eliminate unnecessary lines in Python dump
+#ifdef DUMP_SUBSHAPE_IDS
// Make a Python command
GEOM::TPythonDump(aFunction, /*append=*/true)
<< "listShapesOnPlane = geompy.GetShapesOnPlaneWithLocationIDs"
<< "(" << theShape << ", " << aShapeType << ", " << theAx1 << ", "<< thePnt << ", " << theState << ")";
+#endif // DUMP_SUBSHAPE_IDS
SetErrorCode(OK);
return aSeq;
// The GetShapesOnCylinder() doesn't change object so no new function is required.
Handle(GEOM_Function) aFunction = GEOM::GetCreatedLast(theShape,theAxis)->GetLastFunction();
+ // VSR 29/08/2017: 0023327, 0023428: eliminate unnecessary lines in Python dump
+#ifdef DUMP_SUBSHAPE_IDS
// Make a Python command
GEOM::TPythonDump(aFunction, /*append=*/true)
<< "listShapesOnCylinder = geompy.GetShapesOnCylinderIDs"
<< "(" << theShape << ", " << aShapeType << ", " << theAxis << ", "
<< theRadius << ", " << theState << ")";
+#endif // DUMP_SUBSHAPE_IDS
SetErrorCode(OK);
return aSeq;
Handle(GEOM_Function) aFunction =
GEOM::GetCreatedLast(theShape, GEOM::GetCreatedLast(thePnt,theAxis))->GetLastFunction();
+ // VSR 29/08/2017: 0023327, 0023428: eliminate unnecessary lines in Python dump
+#ifdef DUMP_SUBSHAPE_IDS
// Make a Python command
GEOM::TPythonDump(aFunction, /*append=*/true)
<< "listShapesOnCylinder = geompy.GetShapesOnCylinderWithLocationIDs"
<< "(" << theShape << ", " << aShapeType << ", " << theAxis << ", "
<< thePnt << ", " << theRadius << ", " << theState << ")";
+#endif // DUMP_SUBSHAPE_IDS
SetErrorCode(OK);
return aSeq;
// The GetShapesOnSphere() doesn't change object so no new function is required.
Handle(GEOM_Function) aFunction = GEOM::GetCreatedLast(theShape,theCenter)->GetLastFunction();
+ // VSR 29/08/2017: 0023327, 0023428: eliminate unnecessary lines in Python dump
+#ifdef DUMP_SUBSHAPE_IDS
// Make a Python command
GEOM::TPythonDump(aFunction, /*append=*/true)
- << "listShapesOnCylinder = geompy.GetShapesOnSphereIDs"
+ << "listShapesOnSphere = geompy.GetShapesOnSphereIDs"
<< "(" << theShape << ", " << aShapeType << ", " << theCenter << ", "
<< theRadius << ", " << theState << ")";
+#endif // DUMP_SUBSHAPE_IDS
SetErrorCode(OK);
return aSeq;
// Make a Python command
// The GetShapesOnCylinder() doesn't change object so no new function is required.
- Handle(GEOM_Object) lastObj = GEOM::GetCreatedLast(theShape,theTopLeftPoint);
+ Handle(GEOM_BaseObject) lastObj = GEOM::GetCreatedLast(theShape,theTopLeftPoint);
lastObj = GEOM::GetCreatedLast(lastObj,theTopRigthPoint);
lastObj = GEOM::GetCreatedLast(lastObj,theBottomRigthPoint);
lastObj = GEOM::GetCreatedLast(lastObj,theBottomLeftPoint);
Handle(GEOM_Function) aFunction = lastObj->GetLastFunction();
+ // VSR 29/08/2017: 0023327, 0023428: eliminate unnecessary lines in Python dump
+#ifdef DUMP_SUBSHAPE_IDS
GEOM::TPythonDump(aFunction, /*append=*/true)
<< "listShapesOnQuadrangle = geompy.GetShapesOnQuadrangleIDs("
<< theShape << ", "
<< theBottomLeftPoint << ", "
<< theBottomRigthPoint << ", "
<< theState << ")";
+#endif // DUMP_SUBSHAPE_IDS
SetErrorCode(OK);
return aSeqOfIDs;
// The GetSameIDs() doesn't change object so no new function is required.
Handle(GEOM_Function) aFunction = GEOM::GetCreatedLast(theShapeWhere,theShapeWhat)->GetLastFunction();
+ // VSR 29/08/2017: 0023327, 0023428: eliminate unnecessary lines in Python dump
+#ifdef DUMP_SUBSHAPE_IDS
// Make a Python command
GEOM::TPythonDump(aFunction, /*append=*/true)
<< "listSameIDs = geompy.GetSameIDs("
<< theShapeWhere << ", "
<< theShapeWhat << ")";
+#endif // DUMP_SUBSHAPE_IDS
return aSeq;
} else {
SetErrorCode(NOT_FOUND_ANY);
return NULL;
}
}
- catch (Standard_Failure) {
- Handle(Standard_Failure) aFail = Standard_Failure::Caught();
- SetErrorCode(aFail->GetMessageString());
+ catch (Standard_Failure& aFail) {
+ SetErrorCode(aFail.GetMessageString());
return NULL;
}
return NULL;
}
}
- catch (Standard_Failure) {
- Handle(Standard_Failure) aFail = Standard_Failure::Caught();
- SetErrorCode(aFail->GetMessageString());
+ catch (Standard_Failure& aFail) {
+ SetErrorCode(aFail.GetMessageString());
return NULL;
}
return NULL;
}
}
- catch (Standard_Failure) {
- Handle(Standard_Failure) aFail = Standard_Failure::Caught();
- SetErrorCode(aFail->GetMessageString());
+ catch (Standard_Failure& aFail) {
+ SetErrorCode(aFail.GetMessageString());
return NULL;
}