static int MYDEBUG = 0;
#endif
+// 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 GEOMImpl_IShapesOperations.cxx.
+// ---------------------------------------
+// #define DUMP_SUBSHAPE_IDS
+// ---------------------------------------
+
typedef std::map< TCollection_AsciiString, TCollection_AsciiString > TSting2StringMap;
typedef std::map< TCollection_AsciiString, TObjectData > TSting2ObjDataMap;
typedef std::map< TCollection_AsciiString, TObjectData* > TSting2ObjDataPtrMap;
const TIntToListIntMap &theMapRefs,
std::set< int > &thePublished);
+void Prettify(TCollection_AsciiString& theScript);
+
//================================================================================
/*!
* \brief Fix up the name of python variable
aScript.Insert( posToInsertGlobalVars, globalVars );
}
+ // VSR 29/08/2017: 0023327, 0023428: eliminate unnecessary lines in Python dump
+#ifndef DUMP_SUBSHAPE_IDS
+ Prettify(aScript);
+#endif
+
return aScript;
}
return aResult;
}
+void Prettify(TCollection_AsciiString& theScript)
+{
+ TCollection_AsciiString output;
+ static std::list<TCollection_AsciiString> ToRemove;
+ if (ToRemove.empty()) {
+ ToRemove.push_back("geompy.SubShapeAllIDs");
+ ToRemove.push_back("geompy.SubShapeAllSortedCentresIDs");
+ ToRemove.push_back("geompy.SubShapeAllSortedIDs");
+ ToRemove.push_back("geompy.GetFreeFacesIDs");
+ ToRemove.push_back("geompy.GetShapesOnBoxIDs");
+ ToRemove.push_back("geompy.GetShapesOnShapeIDs");
+ ToRemove.push_back("geompy.GetShapesOnPlaneIDs");
+ ToRemove.push_back("geompy.GetShapesOnPlaneWithLocationIDs");
+ ToRemove.push_back("geompy.GetShapesOnCylinderIDs");
+ ToRemove.push_back("geompy.GetShapesOnCylinderWithLocationIDs");
+ ToRemove.push_back("geompy.GetShapesOnSphereIDs");
+ ToRemove.push_back("geompy.GetShapesOnQuadrangleIDs");
+ ToRemove.push_back("geompy.GetSameIDs");
+ }
+
+ int start = 1;
+ while (start <= theScript.Length()) {
+ int end = theScript.Location("\n", start, theScript.Length());
+ if (end == -1) end = theScript.Length();
+ TCollection_AsciiString line = theScript.SubString(start, end);
+ bool found = false;
+ for (std::list<TCollection_AsciiString>::const_iterator it = ToRemove.begin(); it != ToRemove.end() && !found; ++it)
+ found = line.Search( *it ) != -1;
+ if (!found)
+ output += line;
+ start = end + 1;
+ }
+ theScript = output;
+
+ //OK @@@@@@@@@@@@@@@@@@@@@@@@@@@
+}
+
//================================================================================
/*!
* \brief Constructor
#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)
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;
//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;
// 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;
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);