-using namespace std;
+#ifdef WNT
+#pragma warning( disable:4786 )
+#endif
-#include "GEOMImpl_IBlocksOperations.hxx"
+#include <Standard_Stream.hxx>
-#include "GEOMImpl_Types.hxx"
+#include <GEOMImpl_IBlocksOperations.hxx>
-#include "GEOMImpl_BlockDriver.hxx"
-#include "GEOMImpl_IBlocks.hxx"
-#include "GEOMImpl_IBlockTrsf.hxx"
-#include "GEOMImpl_CopyDriver.hxx"
-#include "GEOMImpl_Block6Explorer.hxx"
+#include <GEOMImpl_Types.hxx>
-#include "GEOM_Function.hxx"
+#include <GEOMImpl_BlockDriver.hxx>
+#include <GEOMImpl_IBlocks.hxx>
+#include <GEOMImpl_IBlockTrsf.hxx>
+#include <GEOMImpl_CopyDriver.hxx>
+#include <GEOMImpl_Block6Explorer.hxx>
-#include "GEOMAlgo_GlueAnalyser.hxx"
-#include "GEOMAlgo_CoupleOfShapes.hxx"
-#include "GEOMAlgo_ListOfCoupleOfShapes.hxx"
-#include "GEOMAlgo_ListIteratorOfListOfCoupleOfShapes.hxx"
-#include "BlockFix_CheckTool.hxx"
+#include <GEOM_Function.hxx>
+#include <GEOM_PythonDump.hxx>
+
+#include <GEOMAlgo_GlueAnalyser.hxx>
+#include <GEOMAlgo_CoupleOfShapes.hxx>
+#include <GEOMAlgo_ListOfCoupleOfShapes.hxx>
+#include <GEOMAlgo_ListIteratorOfListOfCoupleOfShapes.hxx>
+#include <BlockFix_CheckTool.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(aFace->GetEntry(), anEntry);
- aDescr += anEntry + " = IBlocksOperations.MakeQuad(";
- TDF_Tool::Entry(theEdge1->GetEntry(), anEntry);
- aDescr += anEntry + ", ";
- TDF_Tool::Entry(theEdge2->GetEntry(), anEntry);
- aDescr += anEntry + ", ";
- TDF_Tool::Entry(theEdge3->GetEntry(), anEntry);
- aDescr += anEntry + ", ";
- TDF_Tool::Entry(theEdge4->GetEntry(), anEntry);
- aDescr += anEntry + ")";
-
- aFunction->SetDescription(aDescr);
+ GEOM::TPythonDump(aFunction) << aFace << " = geompy.MakeQuad("
+ << theEdge1 << ", " << theEdge2 << ", " << theEdge3 << ", " << theEdge4 << ")";
SetErrorCode(OK);
return aFace;
}
//Make a Python command
- TCollection_AsciiString anEntry, aDescr;
- TDF_Tool::Entry(aFace->GetEntry(), anEntry);
- aDescr += anEntry + " = IBlocksOperations.MakeQuad2Edges(";
- TDF_Tool::Entry(theEdge1->GetEntry(), anEntry);
- aDescr += anEntry + ", ";
- TDF_Tool::Entry(theEdge2->GetEntry(), anEntry);
- aDescr += anEntry + ")";
-
- aFunction->SetDescription(aDescr);
+ GEOM::TPythonDump(aFunction) << aFace << " = geompy.MakeQuad2Edges("
+ << theEdge1 << ", " << theEdge2 << ")";
SetErrorCode(OK);
return aFace;
}
//Make a Python command
- TCollection_AsciiString anEntry, aDescr;
- TDF_Tool::Entry(aFace->GetEntry(), anEntry);
- aDescr += anEntry + " = IBlocksOperations.MakeQuad4Vertices(";
- TDF_Tool::Entry(thePnt1->GetEntry(), anEntry);
- aDescr += anEntry + ", ";
- TDF_Tool::Entry(thePnt2->GetEntry(), anEntry);
- aDescr += anEntry + ", ";
- TDF_Tool::Entry(thePnt3->GetEntry(), anEntry);
- aDescr += anEntry + ", ";
- TDF_Tool::Entry(thePnt4->GetEntry(), anEntry);
- aDescr += anEntry + ")";
-
- aFunction->SetDescription(aDescr);
+ GEOM::TPythonDump(aFunction) << aFace << " = geompy.MakeQuad4Vertices("
+ << thePnt1 << ", " << thePnt2 << ", " << thePnt3 << ", " << thePnt4 << ")";
SetErrorCode(OK);
return aFace;
}
//Make a Python command
- TCollection_AsciiString anEntry, aDescr;
- TDF_Tool::Entry(aBlock->GetEntry(), anEntry);
- aDescr += anEntry + " = IBlocksOperations.MakeHexa(";
- TDF_Tool::Entry(theFace1->GetEntry(), anEntry);
- aDescr += anEntry + ", ";
- TDF_Tool::Entry(theFace2->GetEntry(), anEntry);
- aDescr += anEntry + ", ";
- TDF_Tool::Entry(theFace3->GetEntry(), anEntry);
- aDescr += anEntry + ", ";
- TDF_Tool::Entry(theFace4->GetEntry(), anEntry);
- aDescr += anEntry + ", ";
- TDF_Tool::Entry(theFace5->GetEntry(), anEntry);
- aDescr += anEntry + ", ";
- TDF_Tool::Entry(theFace6->GetEntry(), anEntry);
- aDescr += anEntry + ")";
-
- aFunction->SetDescription(aDescr);
+ GEOM::TPythonDump(aFunction) << aBlock << " = geompy.MakeHexa("
+ << theFace1 << ", " << theFace2 << ", " << theFace3 << ", "
+ << theFace4 << ", " << theFace5 << ", " << theFace6 << ")";
SetErrorCode(OK);
return aBlock;
}
//Make a Python command
- TCollection_AsciiString anEntry, aDescr;
- TDF_Tool::Entry(aBlock->GetEntry(), anEntry);
- aDescr += anEntry + " = IBlocksOperations.MakeHexa2Faces(";
- TDF_Tool::Entry(theFace1->GetEntry(), anEntry);
- aDescr += anEntry + ", ";
- TDF_Tool::Entry(theFace2->GetEntry(), anEntry);
- aDescr += anEntry + ")";
-
- aFunction->SetDescription(aDescr);
+ GEOM::TPythonDump(aFunction) << aBlock << " = geompy.MakeHexa2Faces("
+ << theFace1 << ", " << theFace2 << ")";
SetErrorCode(OK);
return aBlock;
}
//Make a Python command
- TCollection_AsciiString anEntry, aDescr;
- TDF_Tool::Entry(aBlockComp->GetEntry(), anEntry);
- aDescr += anEntry + " = IBlocksOperations.MakeBlockCompound(";
- TDF_Tool::Entry(theCompound->GetEntry(), anEntry);
- aDescr += anEntry + ")";
-
- aFunction->SetDescription(aDescr);
+ GEOM::TPythonDump(aFunction) << aBlockComp
+ << " = geompy.MakeBlockCompound(" << theCompound << ")";
SetErrorCode(OK);
return aBlockComp;
//=============================================================================
/*!
- * GetEdge
+ * GetPoint
*/
//=============================================================================
Handle(GEOM_Object) GEOMImpl_IBlocksOperations::GetPoint
TopoDS_Shape aBlockOrComp = theShape->GetValue();
if (aBlockOrComp.IsNull()) {
- SetErrorCode("Block or compound is null");
- return NULL;
- }
- if (aBlockOrComp.ShapeType() != TopAbs_SOLID &&
- aBlockOrComp.ShapeType() != TopAbs_COMPOUND &&
- aBlockOrComp.ShapeType() != TopAbs_COMPSOLID) {
- SetErrorCode("Shape is neither a block, nor a compound of blocks");
+ SetErrorCode("Given shape is null");
return NULL;
}
//The GetPoint() doesn't change object so no new function is required.
Handle(GEOM_Function) aFunction = theShape->GetLastFunction();
+ TCollection_AsciiString anOldDescr = aFunction->GetDescription();
//Make a Python command
- TCollection_AsciiString anEntry, aDescr;
- TDF_Tool::Entry(aResult->GetEntry(), anEntry);
- aDescr += anEntry + " = IBlocksOperations.GetPoint(";
- TDF_Tool::Entry(theShape->GetEntry(), anEntry);
- aDescr += anEntry + ", ";
- aDescr += TCollection_AsciiString(theX) + ", ";
- aDescr += TCollection_AsciiString(theY) + ", ";
- aDescr += TCollection_AsciiString(theZ) + ", ";
- aDescr += TCollection_AsciiString(theEpsilon) + ")";
-
- TCollection_AsciiString aNewDescr = aFunction->GetDescription() + "\n";
- aNewDescr += aDescr;
- aFunction->SetDescription(aNewDescr);
+ GEOM::TPythonDump(aFunction) << anOldDescr.ToCString() << "\n\t"
+ << aResult << " = geompy.GetPoint(" << theShape << ", "
+ << theX << ", " << theY << ", " << theZ << ", " << theEpsilon << ")";
SetErrorCode(OK);
return aResult;
TopoDS_Shape aBlockOrComp = theShape->GetValue();
if (aBlockOrComp.IsNull()) {
- SetErrorCode("Block or compound is null");
- return NULL;
- }
- if (aBlockOrComp.ShapeType() != TopAbs_SOLID &&
- aBlockOrComp.ShapeType() != TopAbs_COMPOUND &&
- aBlockOrComp.ShapeType() != TopAbs_COMPSOLID) {
- SetErrorCode("Shape is neither a block, nor a compound of blocks");
+ SetErrorCode("Given shape is null");
return NULL;
}
return NULL;
}
- //The GetEdge() doesn't change object so no new function is required.
- Handle(GEOM_Function) aFunction = theShape->GetLastFunction();
+ Handle(GEOM_Function) aFunction = aResult->GetLastFunction();
//Make a Python command
- TCollection_AsciiString anEntry, aDescr;
- TDF_Tool::Entry(aResult->GetEntry(), anEntry);
- aDescr += anEntry + " = IBlocksOperations.GetEdge(";
- TDF_Tool::Entry(theShape->GetEntry(), anEntry);
- aDescr += anEntry + ", ";
- TDF_Tool::Entry(thePoint1->GetEntry(), anEntry);
- aDescr += anEntry + ", ";
- TDF_Tool::Entry(thePoint2->GetEntry(), anEntry);
- aDescr += anEntry + ")";
-
- TCollection_AsciiString aNewDescr = aFunction->GetDescription() + "\n";
- aNewDescr += aDescr;
- aFunction->SetDescription(aNewDescr);
+ GEOM::TPythonDump(aFunction) << aResult << " = geompy.GetEdge("
+ << theShape << ", " << thePoint1 << ", " << thePoint2 << ")";
SetErrorCode(OK);
return aResult;
TopoDS_Shape aBlockOrComp = theShape->GetValue();
if (aBlockOrComp.IsNull()) {
- SetErrorCode("Block or compound is null");
- return NULL;
- }
- if (aBlockOrComp.ShapeType() != TopAbs_SOLID &&
- aBlockOrComp.ShapeType() != TopAbs_COMPOUND &&
- aBlockOrComp.ShapeType() != TopAbs_COMPSOLID) {
- SetErrorCode("Shape is neither a block, nor a compound of blocks");
+ SetErrorCode("Given shape is null");
return NULL;
}
}
}
+ if (nbEdges == 0) {
+ SetErrorCode("Given shape contains no edges");
+ return NULL;
+ }
+
mapShape.Clear();
Standard_Integer ind = 1;
TopTools_Array1OfShape anEdges (1, nbEdges);
return NULL;
}
- //The GetEdgeNearPoint() doesn't change object so no new function is required.
- Handle(GEOM_Function) aFunction = theShape->GetLastFunction();
+ Handle(GEOM_Function) aFunction = aResult->GetLastFunction();
//Make a Python command
- TCollection_AsciiString anEntry, aDescr;
- TDF_Tool::Entry(aResult->GetEntry(), anEntry);
- aDescr += anEntry + " = IBlocksOperations.GetEdgeNearPoint(";
- TDF_Tool::Entry(theShape->GetEntry(), anEntry);
- aDescr += anEntry + ", ";
- TDF_Tool::Entry(thePoint->GetEntry(), anEntry);
- aDescr += anEntry + ")";
-
- TCollection_AsciiString aNewDescr = aFunction->GetDescription() + "\n";
- aNewDescr += aDescr;
- aFunction->SetDescription(aNewDescr);
+ GEOM::TPythonDump(aFunction) << aResult << " = geompy.GetEdgeNearPoint("
+ << theShape << ", " << thePoint << ")";
SetErrorCode(OK);
return aResult;
SetErrorCode("Block or compound is null");
return NULL;
}
- if (aBlockOrComp.ShapeType() != TopAbs_SOLID &&
- aBlockOrComp.ShapeType() != TopAbs_COMPOUND &&
- aBlockOrComp.ShapeType() != TopAbs_COMPSOLID) {
- SetErrorCode("Shape is neither a block, nor a compound of blocks");
- return NULL;
- }
TopoDS_Shape anArg1 = thePoint1->GetValue();
TopoDS_Shape anArg2 = thePoint2->GetValue();
return NULL;
}
- //The GetFaceByPoints() doesn't change object so no new function is required.
- Handle(GEOM_Function) aFunction = theShape->GetLastFunction();
+ Handle(GEOM_Function) aFunction = aResult->GetLastFunction();
//Make a Python command
- TCollection_AsciiString anEntry, aDescr;
- TDF_Tool::Entry(aResult->GetEntry(), anEntry);
- aDescr += anEntry + " = IBlocksOperations.GetFaceByPoints(";
- TDF_Tool::Entry(theShape->GetEntry(), anEntry);
- aDescr += anEntry + ", ";
- TDF_Tool::Entry(thePoint1->GetEntry(), anEntry);
- aDescr += anEntry + ", ";
- TDF_Tool::Entry(thePoint2->GetEntry(), anEntry);
- aDescr += anEntry + ", ";
- TDF_Tool::Entry(thePoint3->GetEntry(), anEntry);
- aDescr += anEntry + ", ";
- TDF_Tool::Entry(thePoint4->GetEntry(), anEntry);
- aDescr += anEntry + ")";
-
- TCollection_AsciiString aNewDescr = aFunction->GetDescription() + "\n";
- aNewDescr += aDescr;
- aFunction->SetDescription(aNewDescr);
+ GEOM::TPythonDump(aFunction) << aResult << " = geompy.GetFaceByPoints("
+ << theShape << ", " << thePoint1 << ", " << thePoint2
+ << ", " << thePoint3 << ", " << thePoint4 << ")";
SetErrorCode(OK);
return aResult;
return NULL;
}
- //The GetFaceByEdges() doesn't change object so no new function is required.
- Handle(GEOM_Function) aFunction = theShape->GetLastFunction();
+ Handle(GEOM_Function) aFunction = aResult->GetLastFunction();
//Make a Python command
- TCollection_AsciiString anEntry, aDescr;
- TDF_Tool::Entry(aResult->GetEntry(), anEntry);
- aDescr += anEntry + " = IBlocksOperations.GetFaceByEdges(";
- TDF_Tool::Entry(theShape->GetEntry(), anEntry);
- aDescr += anEntry + ", ";
- TDF_Tool::Entry(theEdge1->GetEntry(), anEntry);
- aDescr += anEntry + ", ";
- TDF_Tool::Entry(theEdge2->GetEntry(), anEntry);
- aDescr += anEntry + ")";
-
- TCollection_AsciiString aNewDescr = aFunction->GetDescription() + "\n";
- aNewDescr += aDescr;
- aFunction->SetDescription(aNewDescr);
+ GEOM::TPythonDump(aFunction) << aResult << " = geompy.GetFaceByEdges("
+ << theShape << ", " << theEdge1 << ", " << theEdge2 << ")";
SetErrorCode(OK);
return aResult;
return NULL;
}
- //The GetOppositeFace() doesn't change object so no new function is required.
- Handle(GEOM_Function) aFunction = theShape->GetLastFunction();
+ Handle(GEOM_Function) aFunction = aResult->GetLastFunction();
//Make a Python command
- TCollection_AsciiString anEntry, aDescr;
- TDF_Tool::Entry(aResult->GetEntry(), anEntry);
- aDescr += anEntry + " = IBlocksOperations.GetOppositeFace(";
- TDF_Tool::Entry(theShape->GetEntry(), anEntry);
- aDescr += anEntry + ", ";
- TDF_Tool::Entry(theFace->GetEntry(), anEntry);
- aDescr += anEntry + ")";
-
- TCollection_AsciiString aNewDescr = aFunction->GetDescription() + "\n";
- aNewDescr += aDescr;
- aFunction->SetDescription(aNewDescr);
+ GEOM::TPythonDump(aFunction) << aResult << " = geompy.GetOppositeFace("
+ << theShape << ", " << theFace << ")";
SetErrorCode(OK);
return aResult;
(Handle(GEOM_Object) theShape,
Handle(GEOM_Object) thePoint)
{
-// OSD_Timer timer1, timer2, timer3, timer4, timer5;
-// timer1.Start();
-
SetErrorCode(KO);
//New object
Standard_Real PX, PY, PZ;
aPnt.Coord(PX, PY, PZ);
-// timer1.Stop();
-// timer2.Start();
-
// 1. Classify the point relatively each face
Standard_Integer nearest = 2, nbFound = 0;
TopTools_DataMapOfShapeInteger mapShapeDist;
} // if (!mapShapeDist.IsBound(aFace))
}
-// timer2.Stop();
-// timer3.Start();
-
// 2. Define face, containing the point or having minimum distance to it
if (nbFound > 1) {
if (nearest == 0) {
}
} // if (nbFound > 1)
-// timer3.Stop();
-// timer4.Start();
-
if (nbFound == 0) {
SetErrorCode("There are no faces near the given point");
return NULL;
anArray->SetValue(1, anIndices.FindIndex(aShape));
aResult = GetEngine()->AddSubShape(theShape, anArray);
}
-
-// timer4.Stop();
}
catch (Standard_Failure) {
Handle(Standard_Failure) aFail = Standard_Failure::Caught();
return NULL;
}
-// timer5.Start();
-
- //The GetFaceNearPoint() doesn't change object so no new function is required.
- Handle(GEOM_Function) aFunction = theShape->GetLastFunction();
+ Handle(GEOM_Function) aFunction = aResult->GetLastFunction();
//Make a Python command
- TCollection_AsciiString anEntry, aDescr;
- TDF_Tool::Entry(aResult->GetEntry(), anEntry);
- aDescr += anEntry + " = IBlocksOperations.GetFaceNearPoint(";
- TDF_Tool::Entry(theShape->GetEntry(), anEntry);
- aDescr += anEntry + ", ";
- TDF_Tool::Entry(thePoint->GetEntry(), anEntry);
- aDescr += anEntry + ")";
-
- TCollection_AsciiString aNewDescr = aFunction->GetDescription() + "\n";
- aNewDescr += aDescr;
- aFunction->SetDescription(aNewDescr);
+ GEOM::TPythonDump(aFunction) << aResult << " = geompy.GetFaceNearPoint("
+ << theShape << ", " << thePoint << ")";
SetErrorCode(OK);
-
-// timer5.Stop();
-//
-// cout << "Show current face times:" << endl;
-// timer1.Show();
-// timer2.Show();
-// timer3.Show();
-// timer4.Show();
-// timer5.Show();
-
return aResult;
}
return NULL;
}
- //The GetFaceByNormale() doesn't change object so no new function is required.
- Handle(GEOM_Function) aFunction = theShape->GetLastFunction();
+ Handle(GEOM_Function) aFunction = aResult->GetLastFunction();
//Make a Python command
- TCollection_AsciiString anEntry, aDescr;
- TDF_Tool::Entry(aResult->GetEntry(), anEntry);
- aDescr += anEntry + " = IBlocksOperations.GetFaceByNormale(";
- TDF_Tool::Entry(theShape->GetEntry(), anEntry);
- aDescr += anEntry + ", ";
- TDF_Tool::Entry(theVector->GetEntry(), anEntry);
- aDescr += anEntry + ")";
-
- TCollection_AsciiString aNewDescr = aFunction->GetDescription() + "\n";
- aNewDescr += aDescr;
- aFunction->SetDescription(aNewDescr);
+ GEOM::TPythonDump(aFunction) << aResult << " = geompy.GetFaceByNormale("
+ << theShape << ", " << theVector << ")";
SetErrorCode(OK);
return aResult;
switch (errStruct.error) {
case NOT_BLOCK:
- aDescr += "\nNot a Blocks: ";
+ aDescr += "\n\tNot a Blocks: ";
break;
case EXTRA_EDGE:
- aDescr += "\nHexahedral solids with degenerated and/or seam edges: ";
+ aDescr += "\n\tHexahedral solids with degenerated and/or seam edges: ";
break;
case INVALID_CONNECTION:
- aDescr += "\nInvalid connection between two blocks: ";
+ aDescr += "\n\tInvalid connection between two blocks: ";
break;
case NOT_CONNECTED:
- aDescr += "\nBlocks, not connected with main body: ";
+ aDescr += "\n\tBlocks, not connected with main body: ";
break;
case NOT_GLUED:
- aDescr += "\nNot glued blocks: ";
+ aDescr += "\n\tNot glued blocks: ";
break;
default:
break;
}
//Make a Python command
- TCollection_AsciiString anEntry, aDescr;
- TDF_Tool::Entry(aCopy->GetEntry(), anEntry);
- aDescr += anEntry + " = IBlocksOperations.RemoveExtraEdges(";
- TDF_Tool::Entry(theObject->GetEntry(), anEntry);
- aDescr += anEntry + ")";
-
- aFunction->SetDescription(aDescr);
+ GEOM::TPythonDump(aFunction) << aCopy
+ << " = geompy.RemoveExtraEdges(" << theObject << ")";
SetErrorCode(OK);
return aCopy;
}
//Make a Python command
- TCollection_AsciiString anEntry, aDescr;
- TDF_Tool::Entry(aCopy->GetEntry(), anEntry);
- aDescr += anEntry + " = IBlocksOperations.CheckAndImprove(";
- TDF_Tool::Entry(theObject->GetEntry(), anEntry);
- aDescr += anEntry + ")";
-
- aFunction->SetDescription(aDescr);
+ GEOM::TPythonDump(aFunction) << aCopy
+ << " = geompy.CheckAndImprove(" << theObject << ")";
SetErrorCode(OK);
return aCopy;
Handle(GEOM_Function) aFunction;
TopTools_MapOfShape mapShape;
- TCollection_AsciiString anAsciiList = "[", anEntry;
+ TCollection_AsciiString anAsciiList, anEntry;
// Map shapes
TopTools_IndexedMapOfShape anIndices;
//Make a Python command
TDF_Tool::Entry(anObj->GetEntry(), anEntry);
- anAsciiList += anEntry;
- anAsciiList += ",";
+ anAsciiList += anEntry + ", ";
}
}
}
return aBlocks;
}
- anAsciiList.Trunc(anAsciiList.Length() - 1);
- anAsciiList += "]";
+ anAsciiList.Trunc(anAsciiList.Length() - 2);
//The explode doesn't change object so no new function is required.
aFunction = theCompound->GetLastFunction();
+ TCollection_AsciiString anOldDescr = aFunction->GetDescription();
//Make a Python command
- TCollection_AsciiString aDescr (anAsciiList);
- aDescr += " = IBlocksOperations.ExplodeCompoundOfBlocks(";
- TDF_Tool::Entry(theCompound->GetEntry(), anEntry);
- aDescr += anEntry + ", ";
- aDescr += TCollection_AsciiString(theMinNbFaces) + ", ";
- aDescr += TCollection_AsciiString(theMaxNbFaces) + ")";
-
- TCollection_AsciiString aNewDescr = aFunction->GetDescription() + "\n";
- aNewDescr += aDescr;
- aFunction->SetDescription(aNewDescr);
+ GEOM::TPythonDump(aFunction) << anOldDescr.ToCString() << "\n\t["
+ << anAsciiList.ToCString() << "] = geompy.MakeBlockExplode("
+ << theCompound << ", " << theMinNbFaces << ", " << theMaxNbFaces << ")";
SetErrorCode(OK);
return aBlocks;
return NULL;
}
- //The GetBlockNearPoint() doesn't change object so no new function is required.
- Handle(GEOM_Function) aFunction = theCompound->GetLastFunction();
+ Handle(GEOM_Function) aFunction = aResult->GetLastFunction();
//Make a Python command
- TCollection_AsciiString anEntry, aDescr;
- TDF_Tool::Entry(aResult->GetEntry(), anEntry);
- aDescr += anEntry + " = IBlocksOperations.GetBlockNearPoint(";
- TDF_Tool::Entry(theCompound->GetEntry(), anEntry);
- aDescr += anEntry + ", ";
- TDF_Tool::Entry(thePoint->GetEntry(), anEntry);
- aDescr += anEntry + ")";
-
- TCollection_AsciiString aNewDescr = aFunction->GetDescription() + "\n";
- aNewDescr += aDescr;
- aFunction->SetDescription(aNewDescr);
+ GEOM::TPythonDump(aFunction) << aResult << " = geompy.GetBlockNearPoint("
+ << theCompound << ", " << thePoint << ")";
SetErrorCode(OK);
return aResult;
return NULL;
}
- //The GetBlockByParts() doesn't change object so no new function is required.
- Handle(GEOM_Function) aFunction = theCompound->GetLastFunction();
+ Handle(GEOM_Function) aFunction = aResult->GetLastFunction();
//Make a Python command
- TDF_Tool::Entry(aResult->GetEntry(), anEntry);
- TCollection_AsciiString aDescr (anEntry);
- aDescr += " = IBlocksOperations.GetBlockByParts(";
- TDF_Tool::Entry(theCompound->GetEntry(), anEntry);
- aDescr += anEntry + ", [";
- aDescr += aPartsDescr + "])";
-
- TCollection_AsciiString aNewDescr = aFunction->GetDescription() + "\n";
- aNewDescr += aDescr;
- aFunction->SetDescription(aNewDescr);
+ GEOM::TPythonDump(aFunction) << aResult << " = geompy.GetBlockByParts("
+ << theCompound << ", [" << aPartsDescr.ToCString() << "])";
SetErrorCode(OK);
return aResult;
//Get the parts
Standard_Integer argi, aLen = theParts->Length();
TopTools_Array1OfShape anArgs (1, aLen);
- TCollection_AsciiString anEntry, aPartsDescr, anAsciiList = "[";
+ TCollection_AsciiString anEntry, aPartsDescr, anAsciiList;
+
for (argi = 1; argi <= aLen; argi++) {
Handle(GEOM_Object) anObj = Handle(GEOM_Object)::DownCast(theParts->Value(argi));
Handle(GEOM_Function) aRef = anObj->GetLastFunction();
// For Python command
TDF_Tool::Entry(anObj->GetEntry(), anEntry);
- if (argi > 1) aPartsDescr += ", ";
- aPartsDescr += anEntry;
+ aPartsDescr += anEntry + ", ";
}
//Get the Blocks
anObj = GetEngine()->AddSubShape(theCompound, anArray);
aBlocks->Append(anObj);
- //Make a Python command
+ // For Python command
TDF_Tool::Entry(anObj->GetEntry(), anEntry);
- anAsciiList += anEntry;
- anAsciiList += ",";
+ anAsciiList += anEntry + ", ";
+ if (aFunction.IsNull())
+ aFunction = anObj->GetLastFunction();
}
}
}
return NULL;
}
- anAsciiList.Trunc(anAsciiList.Length() - 1);
- anAsciiList += "]";
-
- //The GetBlocksByParts() doesn't change object so no new function is required.
- aFunction = theCompound->GetLastFunction();
-
//Make a Python command
- TCollection_AsciiString aDescr (anAsciiList);
- aDescr += " = IBlocksOperations.GetBlocksByParts(";
- TDF_Tool::Entry(theCompound->GetEntry(), anEntry);
- aDescr += anEntry + ", [";
- aDescr += aPartsDescr + "])";
+ aPartsDescr.Trunc(aPartsDescr.Length() - 2);
+ anAsciiList.Trunc(anAsciiList.Length() - 2);
- TCollection_AsciiString aNewDescr = aFunction->GetDescription() + "\n";
- aNewDescr += aDescr;
- aFunction->SetDescription(aNewDescr);
+ GEOM::TPythonDump(aFunction) << "[" << anAsciiList.ToCString()
+ << "] = geompy.GetBlocksByParts(" << theCompound
+ << ", [" << aPartsDescr.ToCString() << "])";
SetErrorCode(OK);
return aBlocks;
}
//Make a Python command
- TCollection_AsciiString anEntry, aDescr;
- TDF_Tool::Entry(aCopy->GetEntry(), anEntry);
- aDescr += anEntry + " = IBlocksOperations.MakeMultiTransformation1D(";
- TDF_Tool::Entry(theObject->GetEntry(), anEntry);
- aDescr += anEntry + ", ";
- aDescr += TCollection_AsciiString(theDirFace1) + ", ";
- aDescr += TCollection_AsciiString(theDirFace2) + ", ";
- aDescr += TCollection_AsciiString(theNbTimes) + ") ";
-
- aFunction->SetDescription(aDescr);
+ GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeMultiTransformation1D("
+ << theObject << ", " << theDirFace1 << ", " << theDirFace2 << ", " << theNbTimes << ")";
SetErrorCode(OK);
return aCopy;
}
//Make a Python command
- TCollection_AsciiString anEntry, aDescr;
- TDF_Tool::Entry(aCopy->GetEntry(), anEntry);
- aDescr += anEntry + " = IBlocksOperations.MakeMultiTransformation2D(";
- TDF_Tool::Entry(theObject->GetEntry(), anEntry);
- aDescr += anEntry + ", ";
- aDescr += TCollection_AsciiString(theDirFace1U) + ", ";
- aDescr += TCollection_AsciiString(theDirFace2U) + ", ";
- aDescr += TCollection_AsciiString(theNbTimesU) + ", ";
- aDescr += TCollection_AsciiString(theDirFace1V) + ", ";
- aDescr += TCollection_AsciiString(theDirFace2V) + ", ";
- aDescr += TCollection_AsciiString(theNbTimesV) + ") ";
-
- aFunction->SetDescription(aDescr);
+ GEOM::TPythonDump(aFunction) << aCopy << " = geompy.MakeMultiTransformation2D("
+ << theObject << ", " << theDirFace1U << ", " << theDirFace2U << ", " << theNbTimesU
+ << ", " << theDirFace1V << ", " << theDirFace2V << ", " << theNbTimesV << ")";
SetErrorCode(OK);
return aCopy;
Handle(TColStd_HSequenceOfTransient) aSeq = new TColStd_HSequenceOfTransient;
TopTools_MapOfShape mapAcceptedEdges;
+ TCollection_AsciiString aListRes, anEntry;
for (ie = 1; ie <= nbEdges; ie++) {
TopoDS_Shape curE = MEW.FindKey(ie);
// Add the chain to the result
aSeq->Append(aChain);
+
+ //Make a Python command
+ TDF_Tool::Entry(aChain->GetEntry(), anEntry);
+ aListRes += anEntry + ", ";
}
if (aSeq->IsEmpty()) {
return aSeq;
}
+ aListRes.Trunc(aListRes.Length() - 2);
+
// The Propagation doesn't change object so no new function is required.
Handle(GEOM_Function) aFunction = theShape->GetLastFunction();
+ TCollection_AsciiString anOldDescr = aFunction->GetDescription();
// Make a Python command
- TCollection_AsciiString aDescr
- ("\nlistPropagationChains = IShapesOperations.Propagate(");
- TCollection_AsciiString anEntry;
- TDF_Tool::Entry(theShape->GetEntry(), anEntry);
- aDescr += (anEntry + ")");
-
- TCollection_AsciiString anOldDescr = aFunction->GetDescription();
- anOldDescr = anOldDescr + aDescr;
- aFunction->SetDescription(anOldDescr);
+ GEOM::TPythonDump(aFunction) << anOldDescr.ToCString() << "\n\t["
+ << aListRes.ToCString() << "] = geompy.Propagate(" << theShape << ")";
SetErrorCode(OK);
return aSeq;