-using namespace std;
-
-#include "GEOMImpl_ILocalOperations.hxx"
-
-#include "GEOM_Function.hxx"
-#include "GEOMImpl_Types.hxx"
-
-#include "GEOMImpl_FilletDriver.hxx"
-#include "GEOMImpl_ChamferDriver.hxx"
-
-#include "GEOMImpl_IFillet.hxx"
-#include "GEOMImpl_IChamfer.hxx"
-
-#include "GEOMImpl_IArchimede.hxx"
-#include "GEOMImpl_ArchimedeDriver.hxx"
+// Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+#include <Standard_Stream.hxx>
+
+#include <GEOMImpl_ILocalOperations.hxx>
+
+#include <GEOM_Function.hxx>
+#include <GEOM_PythonDump.hxx>
+
+#include <GEOMImpl_Types.hxx>
+
+#include <GEOMImpl_FilletDriver.hxx>
+#include <GEOMImpl_ChamferDriver.hxx>
+
+#include <GEOMImpl_IFillet.hxx>
+#include <GEOMImpl_IChamfer.hxx>
+
+#include <GEOMImpl_IArchimede.hxx>
+#include <GEOMImpl_ArchimedeDriver.hxx>
+
+#include <GEOMImpl_Gen.hxx>
+#include <GEOMImpl_IShapesOperations.hxx>
#include "utilities.h"
-#include "OpUtil.hxx"
-#include "Utils_ExceptHandlers.hxx"
+#include <OpUtil.hxx>
+#include <Utils_ExceptHandlers.hxx>
#include <TFunction_DriverTable.hxx>
#include <TFunction_Driver.hxx>
}
//Make a Python command
- TCollection_AsciiString anEntry, aDescr("");
- TDF_Tool::Entry(aFillet->GetEntry(), anEntry);
- aDescr = anEntry + " = ILocalOperations.MakeFilletAll(";
- TDF_Tool::Entry(theShape->GetEntry(), anEntry);
- aDescr += (anEntry+", ");
- aDescr += (TCollection_AsciiString(theR)+")");
-
- aFunction->SetDescription(aDescr);
+ GEOM::TPythonDump(aFunction) << aFillet << " = geompy.MakeFilletAll("
+ << theShape << ", " << theR << ")";
SetErrorCode(OK);
return aFillet;
}
//Make a Python command
- TCollection_AsciiString anEntry, aDescr("");
- TDF_Tool::Entry(aFillet->GetEntry(), anEntry);
- aDescr = anEntry + " = ILocalOperations.MakeFilletEdges(";
- TDF_Tool::Entry(theShape->GetEntry(), anEntry);
- aDescr += (anEntry+", ");
- aDescr += (TCollection_AsciiString(theR)+", [");
+ GEOM::TPythonDump pd (aFunction);
+ pd << aFillet << " = geompy.MakeFillet(" << theShape
+ << ", " << theR << ", geompy.ShapeType[\"EDGE\"], [";
+
it = theEdges.begin();
- aDescr += (TCollection_AsciiString(*it)+", ");
- it++;
- for (; it != theEdges.end(); it++) {
- aDescr += ", ";
- aDescr += TCollection_AsciiString(*it);
+ pd << (*it++);
+ while (it != theEdges.end()) {
+ pd << ", " << (*it++);
}
- aDescr += "])";
-
- aFunction->SetDescription(aDescr);
+ pd << "])";
SetErrorCode(OK);
return aFillet;
}
//Make a Python command
- TCollection_AsciiString anEntry, aDescr("");
- TDF_Tool::Entry(aFillet->GetEntry(), anEntry);
- aDescr = anEntry + " = ILocalOperations.MakeFilletFaces(";
- TDF_Tool::Entry(theShape->GetEntry(), anEntry);
- aDescr += (anEntry+", ");
- aDescr += (TCollection_AsciiString(theR)+", [");
+ GEOM::TPythonDump pd (aFunction);
+ pd << aFillet << " = geompy.MakeFillet(" << theShape
+ << ", " << theR << ", geompy.ShapeType[\"FACE\"], [";
+
it = theFaces.begin();
- aDescr += (TCollection_AsciiString(*it)+", ");
- it++;
- for (; it != theFaces.end(); it++) {
- aDescr += ", ";
- aDescr += TCollection_AsciiString(*it);
+ pd << (*it++);
+ while (it != theFaces.end()) {
+ pd << ", " << (*it++);
}
- aDescr += "])";
-
- aFunction->SetDescription(aDescr);
+ pd << "])";
SetErrorCode(OK);
return aFillet;
}
//Make a Python command
- TCollection_AsciiString anEntry, aDescr("");
- TDF_Tool::Entry(aChamfer->GetEntry(), anEntry);
- aDescr += anEntry;
- aDescr += " = ILocalOperations.MakeChamferAll(";
- TDF_Tool::Entry(theShape->GetEntry(), anEntry);
- aDescr += (anEntry+", ");
- aDescr += (TCollection_AsciiString(theD)+")");
-
- aFunction->SetDescription(aDescr);
+ GEOM::TPythonDump(aFunction) << aChamfer << " = geompy.MakeChamferAll("
+ << theShape << ", " << theD << ")";
SetErrorCode(OK);
return aChamfer;
}
//Make a Python command
- TCollection_AsciiString anEntry, aDescr("");
- TDF_Tool::Entry(aChamfer->GetEntry(), anEntry);
- aDescr += anEntry;
- aDescr += " = ILocalOperations.MakeChamferEdge(";
- TDF_Tool::Entry(theShape->GetEntry(), anEntry);
- aDescr += (anEntry+", ");
- aDescr += (TCollection_AsciiString(theD1)+", ");
- aDescr += (TCollection_AsciiString(theD2)+", ");
- aDescr += (TCollection_AsciiString(theFace1)+", ");
- aDescr += (TCollection_AsciiString(theFace2)+")");
-
- aFunction->SetDescription(aDescr);
+ GEOM::TPythonDump(aFunction) << aChamfer
+ << " = geompy.MakeChamferEdge(" << theShape << ", " << theD1
+ << ", " << theD2 << ", " << theFace1 << ", " << theFace2 << ")";
SetErrorCode(OK);
return aChamfer;
}
//Make a Python command
- TCollection_AsciiString anEntry, aDescr("");
- TDF_Tool::Entry(aChamfer->GetEntry(), anEntry);
- aDescr += anEntry;
- aDescr += " = ILocalOperations.MakeChamferFaces(";
- TDF_Tool::Entry(theShape->GetEntry(), anEntry);
- aDescr += (anEntry+", ");
- aDescr += (TCollection_AsciiString(theD1)+", ");
- aDescr += (TCollection_AsciiString(theD2)+", [");
+ GEOM::TPythonDump pd (aFunction);
+ pd << aChamfer << " = geompy.MakeChamferFaces(" << theShape
+ << ", " << theD1 << ", " << theD2 << ", [";
+
it = theFaces.begin();
- aDescr += (TCollection_AsciiString(*it)+", ");
- it++;
- for (; it != theFaces.end(); it++) {
- aDescr += ", ";
- aDescr += TCollection_AsciiString(*it);
+ pd << (*it++);
+ while (it != theFaces.end()) {
+ pd << ", " << (*it++);
}
- aDescr += "])";
-
- aFunction->SetDescription(aDescr);
+ pd << "])";
SetErrorCode(OK);
return aChamfer;
}
//Make a Python command
- TCollection_AsciiString anEntry, aDescr("");
- TDF_Tool::Entry(aChamfer->GetEntry(), anEntry);
- aDescr += anEntry;
- aDescr += " = ILocalOperations.MakeArchimede(";
- TDF_Tool::Entry(theShape->GetEntry(), anEntry);
- aDescr += (anEntry+", ");
- aDescr += (TCollection_AsciiString(theWeight)+", ");
- aDescr += (TCollection_AsciiString(theWaterDensity)+", ");
- aDescr += (TCollection_AsciiString(theMeshingDeflection)+")");
-
- aFunction->SetDescription(aDescr);
+ GEOM::TPythonDump(aFunction) << aChamfer
+ << " = geompy.Archimede(" << theShape << ", " << theWeight << ", "
+ << theWaterDensity << ", " << theMeshingDeflection << ")";
SetErrorCode(OK);
return aChamfer;
{
SetErrorCode(KO);
- TopoDS_Shape aShape = theShape->GetValue();
- TopoDS_Shape aSubShape = theSubShape->GetValue();
-
- if (aShape.IsNull() || aSubShape.IsNull()) return -1;
+ Standard_Integer anInd = -1;
+ GEOM_Engine* anEngine = GetEngine();
+ //GEOMImpl_Gen* aGen = dynamic_cast<GEOMImpl_Gen*>(anEngine);
+ GEOMImpl_Gen* aGen = (GEOMImpl_Gen*)anEngine;
- TopTools_IndexedMapOfShape anIndices;
- TopExp::MapShapes(aShape, anIndices);
- if (anIndices.Contains(aSubShape)) {
- SetErrorCode(OK);
- return anIndices.FindIndex(aSubShape);
+ if (aGen) {
+ GEOMImpl_IShapesOperations* anIShapesOperations =
+ aGen->GetIShapesOperations(GetDocID());
+ anInd = anIShapesOperations->GetSubShapeIndex(theShape, theSubShape);
+ SetErrorCode(anIShapesOperations->GetErrorCode());
}
- return -1;
+ return anInd;
}