#include <TDF_Tool.hxx>
#include <TDF_Data.hxx>
+#include <TDF_LabelSequence.hxx>
#include <TDataStd_Integer.hxx>
#include <TDataStd_ChildNodeIterator.hxx>
#include <TFunction_Driver.hxx>
#include <TCollection_AsciiString.hxx>
#include <TCollection_ExtendedString.hxx>
#include <TColStd_SequenceOfAsciiString.hxx>
+#include <TColStd_SequenceOfTransient.hxx>
+#include <TColStd_HSequenceOfTransient.hxx>
+#include <TColStd_ListOfTransient.hxx>
+#include <TColStd_MapOfTransient.hxx>
+#include <TColStd_HSequenceOfInteger.hxx>
#include <Standard_ErrorHandler.hxx> // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC
return aDocID.IntegerValue();
}
+void ProcessFunction(Handle(GEOM_Function)& theFunction,
+ TCollection_AsciiString& theScript,
+ TColStd_MapOfTransient& theProcessed);
+
+Handle(TColStd_HSequenceOfInteger) FindEntries(TCollection_AsciiString& theString);
+
//=============================================================================
/*!
* GetEngine
* AddSubShape
*/
//=============================================================================
-Handle(GEOM_Object) GEOM_Engine::AddSubShape(Handle(GEOM_Object) theMainShape, Handle(TColStd_HArray1OfInteger) theIndices)
+Handle(GEOM_Object) GEOM_Engine::AddSubShape(Handle(GEOM_Object) theMainShape,
+ Handle(TColStd_HArray1OfInteger) theIndices,
+ bool isStandaloneOperation)
{
if(theMainShape.IsNull() || theIndices.IsNull()) return NULL;
if(_objects.IsBound(anID)) _objects.UnBind(anID);
_objects.Bind(anID, anObject);
- TCollection_AsciiString anEntry, aDescr("");
- TDF_Tool::Entry(anObject->GetEntry(), anEntry);
- aDescr += anEntry;
- aDescr += " = geom.AddSubShape(";
- TDF_Tool::Entry(theMainShape->GetEntry(), anEntry);
- aDescr += (anEntry+", ");
- aDescr += (", [");
- for(Standard_Integer i=theIndices->Lower(); i<=theIndices->Upper(); i++) {
- aDescr += (TCollection_AsciiString(theIndices->Value(i))+", ");
+ TCollection_AsciiString aDescr("");
+
+ if(isStandaloneOperation) {
+ TCollection_AsciiString anEntry;
+ TDF_Tool::Entry(anObject->GetEntry(), anEntry);
+ aDescr += anEntry;
+ aDescr += " = geom.AddSubShape(";
+ TDF_Tool::Entry(theMainShape->GetEntry(), anEntry);
+ aDescr += (anEntry+", ");
+ aDescr += (", [");
+ for(Standard_Integer i=theIndices->Lower(); i<=theIndices->Upper(); i++) {
+ aDescr += (TCollection_AsciiString(theIndices->Value(i))+", ");
+ }
+ aDescr.Trunc(aDescr.Length()-1);
+ aDescr += "])";
}
- aDescr.Trunc(aDescr.Length()-1);
- aDescr += "])";
+ else
+ TCollection_AsciiString aDescr("None");
+
aFunction->SetDescription(aDescr);
return anObject;
TCollection_AsciiString anID = BuildIDFromObject(theObject);
if(_objects.IsBound(anID)) _objects.UnBind(anID);
+ int nb = theObject->GetNbFunctions();
+ Handle(TDataStd_TreeNode) aNode;
+ for(int i = 1; i<=nb; i++) {
+ Handle(GEOM_Function) aFunction = theObject->GetFunction(i);
+ if(aFunction->GetEntry().FindAttribute(GEOM_Function::GetFunctionTreeID(), aNode))
+ aNode->Remove();
+ }
+
TDF_Label aLabel = theObject->GetEntry();
aLabel.ForgetAllAttributes(Standard_True);
bool GEOM_Engine::Load(int theDocID, char* theFileName)
{
Handle(TDocStd_Document) aDoc;
- if(_OCAFApp->Open(theFileName, aDoc) != CDF_RS_OK) return false;
+ if(_OCAFApp->Open(theFileName, aDoc) != CDF_RS_OK) {
+ return false;
+ }
aDoc->SetUndoLimit(_UndoLimit);
TDataStd_Integer::Set(aDoc->Main(), theDocID);
+ _OCAFApp->SaveAs(aDoc, "/dn05/salome/srn/Test.sdg");
+
return true;
}
aDoc.Nullify();
}
}
+
+//=============================================================================
+/*!
+ * DumpPython
+ */
+//=============================================================================
+TCollection_AsciiString GEOM_Engine::DumpPython(int theDocID,
+ Resource_DataMapOfAsciiStringAsciiString& theObjectNames,
+ bool isPublished,
+ bool& aValidScript)
+{
+ TCollection_AsciiString aScript;
+ Handle(TDocStd_Document) aDoc = GetDocument(theDocID);
+
+ if(aDoc.IsNull()) return TCollection_AsciiString("def RebuildData(theStudy): pass\n");
+
+ aScript = "import geompy\n\n";
+ aScript += "def RebuildData(theStudy):";
+
+ Handle(TDataStd_TreeNode) aNode, aRoot;
+ Handle(GEOM_Function) aFunction;
+ TColStd_MapOfTransient aMap;
+
+ if(aDoc->Main().FindAttribute(GEOM_Function::GetFunctionTreeID(), aRoot)) {
+ TDataStd_ChildNodeIterator Itr(aRoot);
+ for(; Itr.More(); Itr.Next()) {
+ aNode = Itr.Value();
+ aFunction = GEOM_Function::GetFunction(aNode->Label());
+ if(aFunction.IsNull()) {
+ cout << "Null function !!!!" << endl;
+ continue;
+ }
+ ProcessFunction(aFunction, aScript, aMap);
+ }
+ }
+
+ aScript += "\n\tpass\n";
+ aValidScript = true;
+
+
+ Handle(TColStd_HSequenceOfInteger) aSeq = FindEntries(aScript);
+ Standard_Integer aLen = aSeq->Length(), objectCounter = 0, aStart = 1, aScriptLength = aScript.Length();
+ Resource_DataMapOfAsciiStringAsciiString aNames;
+
+ //Replace entries by the names
+ TCollection_AsciiString anUpdatedScript, anEntry, aName, aBaseName("geomObj_");
+ if(aLen == 0) anUpdatedScript = aScript;
+
+ for(Standard_Integer i = 1; i <= aLen; i+=2) {
+ anUpdatedScript += aScript.SubString(aStart, aSeq->Value(i)-1);
+ anEntry = aScript.SubString(aSeq->Value(i), aSeq->Value(i+1));
+ if(theObjectNames.IsBound(anEntry)) {
+ aName = theObjectNames.Find(anEntry);
+ }
+ else {
+ aName = aBaseName + TCollection_AsciiString(++objectCounter);
+ while(theObjectNames.IsBound(aName)) aName = aBaseName + TCollection_AsciiString(++objectCounter);
+ }
+
+ anUpdatedScript += aName;
+ aNames.Bind(aName, "1");
+ aStart = aSeq->Value(i+1) + 1;
+ }
+
+ //Add final part of the script
+ if(aSeq->Value(aLen) < aScriptLength) anUpdatedScript += aScript.SubString(aSeq->Value(aLen)+1, aScriptLength);
+
+ return anUpdatedScript;
+}
+
+
+//===========================================================================
+// Internal functions
+//===========================================================================
+void ProcessFunction(Handle(GEOM_Function)& theFunction,
+ TCollection_AsciiString& theScript,
+ TColStd_MapOfTransient& theProcessed)
+{
+ if(theFunction.IsNull() || theProcessed.Contains(theFunction)) return;
+
+/*
+ TDF_LabelSequence aSeq;
+ theFunction->GetDependency(aSeq);
+ Standard_Integer aLen = aSeq.Length();
+ for(Standard_Integer i = 1; i<= aLen; i++) {
+ Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(aSeq.Value(i));
+ if(aFunction.IsNull()) continue;
+ ProcessFunction(aFunction, theScript, theProcessed);
+ }
+*/
+
+ TCollection_AsciiString aDescr = theFunction->GetDescription();
+ if(aDescr.Length() == 0) {
+ //cout << "Warning: the function has no description" << endl;
+ return;
+ }
+ //Check if its internal function which doesn't requires dumping
+ if(aDescr == "None") return;
+
+ theScript += "\n\t";
+ theScript += aDescr;
+
+ theProcessed.Add(theFunction);
+ return;
+}
+
+//=============================================================================
+/*!
+ * FindEntries: Returns a sequence of start/end positions of entries in the string
+ */
+//=============================================================================
+Handle(TColStd_HSequenceOfInteger) FindEntries(TCollection_AsciiString& theString)
+{
+ Handle(TColStd_HSequenceOfInteger) aSeq = new TColStd_HSequenceOfInteger;
+ Standard_Integer aLen = theString.Length();
+ Standard_Boolean isFound = Standard_False;
+
+ char* arr = theString.ToCString();
+ Standard_Integer i = 0, j;
+
+ while(i < aLen) {
+ int c = (int)arr[i];
+ j = i+1;
+ if(c >= 48 && c <= 57) { //Is digit?
+
+ isFound = Standard_False;
+ while((j < aLen) && ((c >= 48 && c <= 57) || c == 58) ) { //Check if it is an entry
+ c = (int)arr[j++];
+ if(c == 58) isFound = Standard_True;
+ }
+
+ if(isFound) {
+ aSeq->Append(i+1); // +1 because AsciiString starts from 1
+ aSeq->Append(j-1);
+ }
+ }
+
+ i = j;
+ }
+
+ return aSeq;
+}
#include "GEOM_Application.hxx"
#include <Interface_DataMapOfIntegerTransient.hxx>
+#include <Resource_DataMapOfAsciiStringAsciiString.hxx>
#include <TDF_Label.hxx>
#include <TDocStd_Document.hxx>
#include "GEOM_Object.hxx"
#include <TColStd_HArray1OfInteger.hxx>
+#include <TColStd_HSequenceOfAsciiString.hxx>
#include <TopAbs.hxx>
#include "GEOM_DataMapOfAsciiStringTransient.hxx"
void Redo(int theDocID);
//Adds a new sub shape object of the MainShape object
- Handle(GEOM_Object) AddSubShape(Handle(GEOM_Object) theMainShape, Handle(TColStd_HArray1OfInteger) theIndices);
-
+ Handle(GEOM_Object) AddSubShape(Handle(GEOM_Object) theMainShape,
+ Handle(TColStd_HArray1OfInteger) theIndices,
+ bool isStandaloneOperation = false);
+
+ TCollection_AsciiString DumpPython(int theDocID,
+ Resource_DataMapOfAsciiStringAsciiString& theObjectNames,
+ bool isPublished,
+ bool& aValidScript);
+
protected:
static void SetEngine(GEOM_Engine* theEngine);
TCollection_AsciiString anEntry, aDescr("");
TDF_Tool::Entry(aBox->GetEntry(), anEntry);
aDescr += anEntry;
- aDescr += " = I3DPrimOperations.MakeBoxDXDYDZ(";
+ aDescr += " = geompy.MakeBoxDXDYDZ(";
aDescr += (TCollection_AsciiString(theDX)+", ");
aDescr += (TCollection_AsciiString(theDY)+", ");
aDescr += (TCollection_AsciiString(theDZ)+")");
TCollection_AsciiString anEntry, aDescr("");
TDF_Tool::Entry(aBox->GetEntry(), anEntry);
aDescr += anEntry;
- aDescr += " = I3DPrimOperations.MakeBoxTwoPnt(";
+ aDescr += " = geompy.MakeBoxTwoPnt(";
TDF_Tool::Entry(thePnt1->GetEntry(), anEntry);
aDescr += (anEntry+", ");
TDF_Tool::Entry(thePnt2->GetEntry(), anEntry);
TCollection_AsciiString anEntry, aDescr("");
TDF_Tool::Entry(aCylinder->GetEntry(), anEntry);
aDescr += anEntry;
- aDescr += " = I3DPrimOperations.MakeCylinderRH(";
+ aDescr += " = geompy.MakeCylinderRH(";
aDescr += (TCollection_AsciiString(theR)+", ");
aDescr += (TCollection_AsciiString(theH)+")");
TCollection_AsciiString anEntry, aDescr("");
TDF_Tool::Entry(aCylinder->GetEntry(), anEntry);
aDescr += anEntry;
- aDescr += " = I3DPrimOperations.MakeCylinderPntVecRH(";
+ aDescr += " = geompy.MakeCylinder(";
TDF_Tool::Entry(thePnt->GetEntry(), anEntry);
aDescr += (anEntry+", ");
TDF_Tool::Entry(theVec->GetEntry(), anEntry);
TCollection_AsciiString anEntry, aDescr("");
TDF_Tool::Entry(aCone->GetEntry(), anEntry);
aDescr += anEntry;
- aDescr += " = I3DPrimOperations.MakeConeR1R2H(";
+ aDescr += " = geompy.MakeConeR1R2H(";
aDescr += (TCollection_AsciiString(theR1)+", ");
aDescr += (TCollection_AsciiString(theR2)+", ");
aDescr += (TCollection_AsciiString(theH)+")");
TCollection_AsciiString anEntry, aDescr("");
TDF_Tool::Entry(aCone->GetEntry(), anEntry);
aDescr += anEntry;
- aDescr += " = I3DPrimOperations.MakeConePntVecR1R2H(";
+ aDescr += " = geompy.MakeCone(";
TDF_Tool::Entry(thePnt->GetEntry(), anEntry);
aDescr += (anEntry+", ");
TDF_Tool::Entry(theVec->GetEntry(), anEntry);
TCollection_AsciiString anEntry, aDescr("");
TDF_Tool::Entry(aSphere->GetEntry(), anEntry);
aDescr += anEntry;
- aDescr += " = I3DPrimOperations.MakeSphereR(";
+ aDescr += " = geompy.MakeSphereR(";
aDescr += (TCollection_AsciiString(theR)+")");
aFunction->SetDescription(aDescr);
TCollection_AsciiString anEntry, aDescr("");
TDF_Tool::Entry(aSphere->GetEntry(), anEntry);
aDescr += anEntry;
- aDescr += " = I3DPrimOperations.MakeSpherePntR(";
+ aDescr += " = geompy.MakeSpherePntR(";
TDF_Tool::Entry(thePnt->GetEntry(), anEntry);
aDescr += (anEntry+", ");
aDescr += (TCollection_AsciiString(theR)+")");
TCollection_AsciiString anEntry, aDescr("");
TDF_Tool::Entry(anEll->GetEntry(), anEntry);
aDescr += anEntry;
- aDescr += " = ICurvesOperations.MakeTorusRR(";
+ aDescr += " = geompy.MakeTorusRR(";
aDescr += (TCollection_AsciiString(theRMajor)+", ");
aDescr += (TCollection_AsciiString(theRMinor)+")");
TCollection_AsciiString anEntry, aDescr("");
TDF_Tool::Entry(anEll->GetEntry(), anEntry);
aDescr += anEntry;
- aDescr += " = ICurvesOperations.MakeTorusPntVecRR(";
+ aDescr += " = geompy.MakeTorus(";
TDF_Tool::Entry(thePnt->GetEntry(), anEntry);
aDescr += (anEntry+", ");
TDF_Tool::Entry(theVec->GetEntry(), anEntry);
TCollection_AsciiString anEntry, aDescr("");
TDF_Tool::Entry(aPrism->GetEntry(), anEntry);
aDescr += anEntry;
- aDescr += " = I3DPrimOperations.MakePrismVecH(";
+ aDescr += " = geompy.MakePrismVecH(";
TDF_Tool::Entry(theBase->GetEntry(), anEntry);
aDescr += (anEntry+", ");
TDF_Tool::Entry(theVec->GetEntry(), anEntry);
TCollection_AsciiString anEntry, aDescr("");
TDF_Tool::Entry(aPrism->GetEntry(), anEntry);
aDescr += anEntry;
- aDescr += " = I3DPrimOperations.MakePrismVecH(";
+ aDescr += " = geompy.MakePrism(";
TDF_Tool::Entry(theBase->GetEntry(), anEntry);
aDescr += (anEntry+", ");
TDF_Tool::Entry(thePoint1->GetEntry(), anEntry);
//Make a Python command
TCollection_AsciiString anEntry, aDescr;
TDF_Tool::Entry(aPipe->GetEntry(), anEntry);
- aDescr += (anEntry + " = I3DPrimOperations.MakePipe(");
+ aDescr += (anEntry + " = geompy.MakePipe(");
TDF_Tool::Entry(theBase->GetEntry(), anEntry);
aDescr += (anEntry + ", ");
TDF_Tool::Entry(thePath->GetEntry(), anEntry);
TCollection_AsciiString anEntry, aDescr("");
TDF_Tool::Entry(aRevolution->GetEntry(), anEntry);
aDescr += anEntry;
- aDescr += " = I3DPrimOperations.MakeRevolutionAxisAngle(";
+ aDescr += " = geompy.MakeRevolution(";
TDF_Tool::Entry(theBase->GetEntry(), anEntry);
aDescr += (anEntry+", ");
TDF_Tool::Entry(theAxis->GetEntry(), anEntry);
TCollection_AsciiString anEntry, aDescr("");
TDF_Tool::Entry(aSolid->GetEntry(), anEntry);
aDescr += anEntry;
- aDescr += " = I3DPrimOperations.MakeSolidShell(";
+ aDescr += " = geompy.MakeSolid(";
TDF_Tool::Entry(theShell->GetEntry(), anEntry);
aDescr += (anEntry+")");
TCollection_AsciiString anEntry, aDescr("");
TDF_Tool::Entry(aFilling->GetEntry(), anEntry);
aDescr += anEntry;
- aDescr += " = ICurvesOperations.MakeFilling(";
+ aDescr += " = geompy.MakeFilling(";
TDF_Tool::Entry(theShape->GetEntry(), anEntry);
aDescr += (anEntry+", ");
aDescr += (TCollection_AsciiString(theMinDeg)+", ");
//Make a Python command
TCollection_AsciiString anEntry, aDescr;
TDF_Tool::Entry(aPoint->GetEntry(), anEntry);
- aDescr += (anEntry+" = IBasicOperations.MakePointXYZ(");
+ aDescr += (anEntry+" = geompy.MakeVertex(");
aDescr += (TCollection_AsciiString(theX)+", ");
aDescr += (TCollection_AsciiString(theY)+", ");
aDescr += (TCollection_AsciiString(theZ)+")");
//Make a Python command
TCollection_AsciiString anEntry, aDescr;
TDF_Tool::Entry(aPoint->GetEntry(), anEntry);
- aDescr += (anEntry+" = IBasicOperations.MakePointReference(");
+ aDescr += (anEntry+" = geompy.MakeVertexWithRef(");
TDF_Tool::Entry(theReference->GetEntry(), anEntry);
aDescr += (anEntry+", ");
aDescr += (TCollection_AsciiString(theX)+", ");
//Make a Python command
TCollection_AsciiString anEntry, aDescr;
TDF_Tool::Entry(aPoint->GetEntry(), anEntry);
- aDescr += (anEntry+" = IBasicOperations.MakePointReference(");
+ aDescr += (anEntry+" = geompy.MakeVertexOnCurve(");
TDF_Tool::Entry(theCurve->GetEntry(), anEntry);
aDescr += (anEntry+", ");
aDescr += (TCollection_AsciiString(theParameter)+")");
//Make a Python command
TCollection_AsciiString anEntry, aDescr;
TDF_Tool::Entry(aVector->GetEntry(), anEntry);
- aDescr += (anEntry+" = IBasicOperations.MakeVectorDXDYDZ(");
+ aDescr += (anEntry+" = geompy.MakeVectorDXDYDZ(");
aDescr += (TCollection_AsciiString(theDX)+", ");
aDescr += (TCollection_AsciiString(theDY)+", ");
aDescr += (TCollection_AsciiString(theDZ)+")");
//Make a Python command
TCollection_AsciiString anEntry, aDescr;
TDF_Tool::Entry(aVector->GetEntry(), anEntry);
- aDescr += (anEntry+" = IBasicOperations.MakeVectorTwoPnt(");
+ aDescr += (anEntry+" = geompy.MakeVector(");
TDF_Tool::Entry(thePnt1->GetEntry(), anEntry);
aDescr += (anEntry+", ");
TDF_Tool::Entry(thePnt2->GetEntry(), anEntry);
//Make a Python command
TCollection_AsciiString anEntry, aDescr;
TDF_Tool::Entry(aLine->GetEntry(), anEntry);
- aDescr += (anEntry+" = IBasicOperations.MakeLine(");
+ aDescr += (anEntry+" = geompy.MakeLine(");
TDF_Tool::Entry(thePnt->GetEntry(), anEntry);
aDescr += (anEntry+", ");
TDF_Tool::Entry(theDir->GetEntry(), anEntry);
//Make a Python command
TCollection_AsciiString anEntry, aDescr;
TDF_Tool::Entry(aLine->GetEntry(), anEntry);
- aDescr += (anEntry+" = IBasicOperations.MakeLineTwoPnt(");
+ aDescr += (anEntry+" = geompy.MakeLineTwoPnt(");
TDF_Tool::Entry(thePnt1->GetEntry(), anEntry);
aDescr += (anEntry+", ");
TDF_Tool::Entry(thePnt2->GetEntry(), anEntry);
//Make a Python command
TCollection_AsciiString anEntry, aDescr;
TDF_Tool::Entry(aPlane->GetEntry(), anEntry);
- aDescr += (anEntry+" = IBasicOperations.MakePlaneThreePnt(");
+ aDescr += (anEntry+" = geompy.MakePlaneThreePnt(");
TDF_Tool::Entry(thePnt1->GetEntry(), anEntry);
aDescr += (anEntry+", ");
TDF_Tool::Entry(thePnt2->GetEntry(), anEntry);
//Make a Python command
TCollection_AsciiString anEntry, aDescr;
TDF_Tool::Entry(aPlane->GetEntry(), anEntry);
- aDescr += (anEntry+" = IBasicOperations.MakePlanePntVec(");
+ aDescr += (anEntry+" = geompy.MakePlane(");
TDF_Tool::Entry(thePnt->GetEntry(), anEntry);
aDescr += (anEntry+", ");
TDF_Tool::Entry(theVec->GetEntry(), anEntry);
//Make a Python command
TCollection_AsciiString anEntry, aDescr;
TDF_Tool::Entry(aPlane->GetEntry(), anEntry);
- aDescr += (anEntry+" = IBasicOperations.MakePlaneFace(");
+ aDescr += (anEntry+" = geompy.MakePlaneFace(");
TDF_Tool::Entry(theFace->GetEntry(), anEntry);
aDescr += (anEntry+", ");
aDescr += TCollection_AsciiString(theSize) + ")";
//Make a Python command
TCollection_AsciiString anEntry, aDescr;
TDF_Tool::Entry(aMarker->GetEntry(), anEntry);
- aDescr += anEntry + " = IBasicOperations.MakeMarker(";
+ aDescr += anEntry + " = geompy.MakeMarker(";
aDescr += TCollection_AsciiString(theOX) + ", ";
aDescr += TCollection_AsciiString(theOY) + ", ";
aDescr += TCollection_AsciiString(theOZ) + ", ";
//Make a Python command
TCollection_AsciiString anEntry, aDescr;
TDF_Tool::Entry(aFace->GetEntry(), anEntry);
- aDescr += anEntry + " = IBlocksOperations.MakeQuad(";
+ aDescr += anEntry + " = geompy.MakeQuad(";
TDF_Tool::Entry(theEdge1->GetEntry(), anEntry);
aDescr += anEntry + ", ";
TDF_Tool::Entry(theEdge2->GetEntry(), anEntry);
//Make a Python command
TCollection_AsciiString anEntry, aDescr;
TDF_Tool::Entry(aFace->GetEntry(), anEntry);
- aDescr += anEntry + " = IBlocksOperations.MakeQuad2Edges(";
+ aDescr += anEntry + " = geompy.MakeQuad2Edges(";
TDF_Tool::Entry(theEdge1->GetEntry(), anEntry);
aDescr += anEntry + ", ";
TDF_Tool::Entry(theEdge2->GetEntry(), anEntry);
//Make a Python command
TCollection_AsciiString anEntry, aDescr;
TDF_Tool::Entry(aFace->GetEntry(), anEntry);
- aDescr += anEntry + " = IBlocksOperations.MakeQuad4Vertices(";
+ aDescr += anEntry + " = geompy.MakeQuad4Vertices(";
TDF_Tool::Entry(thePnt1->GetEntry(), anEntry);
aDescr += anEntry + ", ";
TDF_Tool::Entry(thePnt2->GetEntry(), anEntry);
//Make a Python command
TCollection_AsciiString anEntry, aDescr;
TDF_Tool::Entry(aBlock->GetEntry(), anEntry);
- aDescr += anEntry + " = IBlocksOperations.MakeHexa(";
+ aDescr += anEntry + " = geompy.MakeHexa(";
TDF_Tool::Entry(theFace1->GetEntry(), anEntry);
aDescr += anEntry + ", ";
TDF_Tool::Entry(theFace2->GetEntry(), anEntry);
//Make a Python command
TCollection_AsciiString anEntry, aDescr;
TDF_Tool::Entry(aBlock->GetEntry(), anEntry);
- aDescr += anEntry + " = IBlocksOperations.MakeHexa2Faces(";
+ aDescr += anEntry + " = geompy.MakeHexa2Faces(";
TDF_Tool::Entry(theFace1->GetEntry(), anEntry);
aDescr += anEntry + ", ";
TDF_Tool::Entry(theFace2->GetEntry(), anEntry);
//Make a Python command
TCollection_AsciiString anEntry, aDescr;
TDF_Tool::Entry(aBlockComp->GetEntry(), anEntry);
- aDescr += anEntry + " = IBlocksOperations.MakeBlockCompound(";
+ aDescr += anEntry + " = geompy.BlocksOp.MakeBlockCompound(";
TDF_Tool::Entry(theCompound->GetEntry(), anEntry);
aDescr += anEntry + ")";
//Make a Python command
TCollection_AsciiString anEntry, aDescr;
TDF_Tool::Entry(aResult->GetEntry(), anEntry);
- aDescr += anEntry + " = IBlocksOperations.GetPoint(";
+ aDescr += anEntry + " = geompy.GetPoint(";
TDF_Tool::Entry(theShape->GetEntry(), anEntry);
aDescr += anEntry + ", ";
aDescr += TCollection_AsciiString(theX) + ", ";
aDescr += TCollection_AsciiString(theZ) + ", ";
aDescr += TCollection_AsciiString(theEpsilon) + ")";
- TCollection_AsciiString aNewDescr = aFunction->GetDescription() + "\n";
+ TCollection_AsciiString aNewDescr = aFunction->GetDescription() + "\n\t";
aNewDescr += aDescr;
aFunction->SetDescription(aNewDescr);
//Make a Python command
TCollection_AsciiString anEntry, aDescr;
TDF_Tool::Entry(aResult->GetEntry(), anEntry);
- aDescr += anEntry + " = IBlocksOperations.GetEdge(";
+ aDescr += anEntry + " = geompy.GetEdge(";
TDF_Tool::Entry(theShape->GetEntry(), anEntry);
aDescr += anEntry + ", ";
TDF_Tool::Entry(thePoint1->GetEntry(), anEntry);
TDF_Tool::Entry(thePoint2->GetEntry(), anEntry);
aDescr += anEntry + ")";
- TCollection_AsciiString aNewDescr = aFunction->GetDescription() + "\n";
+ TCollection_AsciiString aNewDescr = aFunction->GetDescription() + "\n\t";
aNewDescr += aDescr;
aFunction->SetDescription(aNewDescr);
//Make a Python command
TCollection_AsciiString anEntry, aDescr;
TDF_Tool::Entry(aResult->GetEntry(), anEntry);
- aDescr += anEntry + " = IBlocksOperations.GetEdgeNearPoint(";
+ aDescr += anEntry + " = geompy.GetEdgeNearPoint(";
TDF_Tool::Entry(theShape->GetEntry(), anEntry);
aDescr += anEntry + ", ";
TDF_Tool::Entry(thePoint->GetEntry(), anEntry);
aDescr += anEntry + ")";
- TCollection_AsciiString aNewDescr = aFunction->GetDescription() + "\n";
+ TCollection_AsciiString aNewDescr = aFunction->GetDescription() + "\n\t";
aNewDescr += aDescr;
aFunction->SetDescription(aNewDescr);
//Make a Python command
TCollection_AsciiString anEntry, aDescr;
TDF_Tool::Entry(aResult->GetEntry(), anEntry);
- aDescr += anEntry + " = IBlocksOperations.GetFaceByPoints(";
+ aDescr += anEntry + " = geompy.GetFaceByPoints(";
TDF_Tool::Entry(theShape->GetEntry(), anEntry);
aDescr += anEntry + ", ";
TDF_Tool::Entry(thePoint1->GetEntry(), anEntry);
TDF_Tool::Entry(thePoint4->GetEntry(), anEntry);
aDescr += anEntry + ")";
- TCollection_AsciiString aNewDescr = aFunction->GetDescription() + "\n";
+ TCollection_AsciiString aNewDescr = aFunction->GetDescription() + "\n\t";
aNewDescr += aDescr;
aFunction->SetDescription(aNewDescr);
//Make a Python command
TCollection_AsciiString anEntry, aDescr;
TDF_Tool::Entry(aResult->GetEntry(), anEntry);
- aDescr += anEntry + " = IBlocksOperations.GetFaceByEdges(";
+ aDescr += anEntry + " = geompy.GetFaceByEdges(";
TDF_Tool::Entry(theShape->GetEntry(), anEntry);
aDescr += anEntry + ", ";
TDF_Tool::Entry(theEdge1->GetEntry(), anEntry);
TDF_Tool::Entry(theEdge2->GetEntry(), anEntry);
aDescr += anEntry + ")";
- TCollection_AsciiString aNewDescr = aFunction->GetDescription() + "\n";
+ TCollection_AsciiString aNewDescr = aFunction->GetDescription() + "\n\t";
aNewDescr += aDescr;
aFunction->SetDescription(aNewDescr);
//Make a Python command
TCollection_AsciiString anEntry, aDescr;
TDF_Tool::Entry(aResult->GetEntry(), anEntry);
- aDescr += anEntry + " = IBlocksOperations.GetOppositeFace(";
+ aDescr += anEntry + " = geompy.GetOppositeFace(";
TDF_Tool::Entry(theShape->GetEntry(), anEntry);
aDescr += anEntry + ", ";
TDF_Tool::Entry(theFace->GetEntry(), anEntry);
aDescr += anEntry + ")";
- TCollection_AsciiString aNewDescr = aFunction->GetDescription() + "\n";
+ TCollection_AsciiString aNewDescr = aFunction->GetDescription() + "\n\t";
aNewDescr += aDescr;
aFunction->SetDescription(aNewDescr);
//Make a Python command
TCollection_AsciiString anEntry, aDescr;
TDF_Tool::Entry(aResult->GetEntry(), anEntry);
- aDescr += anEntry + " = IBlocksOperations.GetFaceNearPoint(";
+ aDescr += anEntry + " = geompy.GetFaceNearPoint(";
TDF_Tool::Entry(theShape->GetEntry(), anEntry);
aDescr += anEntry + ", ";
TDF_Tool::Entry(thePoint->GetEntry(), anEntry);
aDescr += anEntry + ")";
- TCollection_AsciiString aNewDescr = aFunction->GetDescription() + "\n";
+ TCollection_AsciiString aNewDescr = aFunction->GetDescription() + "\n\t";
aNewDescr += aDescr;
aFunction->SetDescription(aNewDescr);
//Make a Python command
TCollection_AsciiString anEntry, aDescr;
TDF_Tool::Entry(aResult->GetEntry(), anEntry);
- aDescr += anEntry + " = IBlocksOperations.GetFaceByNormale(";
+ aDescr += anEntry + " = geompy.GetFaceByNormale(";
TDF_Tool::Entry(theShape->GetEntry(), anEntry);
aDescr += anEntry + ", ";
TDF_Tool::Entry(theVector->GetEntry(), anEntry);
aDescr += anEntry + ")";
- TCollection_AsciiString aNewDescr = aFunction->GetDescription() + "\n";
+ TCollection_AsciiString aNewDescr = aFunction->GetDescription() + "\n\t";
aNewDescr += aDescr;
aFunction->SetDescription(aNewDescr);
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(";
+ aDescr += anEntry + " = geompy.RemoveExtraEdges(";
TDF_Tool::Entry(theObject->GetEntry(), anEntry);
aDescr += anEntry + ")";
//Make a Python command
TCollection_AsciiString anEntry, aDescr;
TDF_Tool::Entry(aCopy->GetEntry(), anEntry);
- aDescr += anEntry + " = IBlocksOperations.CheckAndImprove(";
+ aDescr += anEntry + " = geompy.CheckAndImprove(";
TDF_Tool::Entry(theObject->GetEntry(), anEntry);
aDescr += anEntry + ")";
//Make a Python command
TCollection_AsciiString aDescr (anAsciiList);
- aDescr += " = IBlocksOperations.ExplodeCompoundOfBlocks(";
+ aDescr += " = geompy.MakeBlockExplode(";
TDF_Tool::Entry(theCompound->GetEntry(), anEntry);
aDescr += anEntry + ", ";
aDescr += TCollection_AsciiString(theMinNbFaces) + ", ";
aDescr += TCollection_AsciiString(theMaxNbFaces) + ")";
- TCollection_AsciiString aNewDescr = aFunction->GetDescription() + "\n";
+ TCollection_AsciiString aNewDescr = aFunction->GetDescription() + "\n\t";
aNewDescr += aDescr;
aFunction->SetDescription(aNewDescr);
//Make a Python command
TCollection_AsciiString anEntry, aDescr;
TDF_Tool::Entry(aResult->GetEntry(), anEntry);
- aDescr += anEntry + " = IBlocksOperations.GetBlockNearPoint(";
+ aDescr += anEntry + " = geompy.GetBlockNearPoint(";
TDF_Tool::Entry(theCompound->GetEntry(), anEntry);
aDescr += anEntry + ", ";
TDF_Tool::Entry(thePoint->GetEntry(), anEntry);
aDescr += anEntry + ")";
- TCollection_AsciiString aNewDescr = aFunction->GetDescription() + "\n";
+ TCollection_AsciiString aNewDescr = aFunction->GetDescription() + "\n\t";
aNewDescr += aDescr;
aFunction->SetDescription(aNewDescr);
//Make a Python command
TDF_Tool::Entry(aResult->GetEntry(), anEntry);
TCollection_AsciiString aDescr (anEntry);
- aDescr += " = IBlocksOperations.GetBlockByParts(";
+ aDescr += " = geompy.GetBlockByParts(";
TDF_Tool::Entry(theCompound->GetEntry(), anEntry);
aDescr += anEntry + ", [";
aDescr += aPartsDescr + "])";
- TCollection_AsciiString aNewDescr = aFunction->GetDescription() + "\n";
+ TCollection_AsciiString aNewDescr = aFunction->GetDescription() + "\n\t";
aNewDescr += aDescr;
aFunction->SetDescription(aNewDescr);
//Make a Python command
TCollection_AsciiString aDescr (anAsciiList);
- aDescr += " = IBlocksOperations.GetBlocksByParts(";
+ aDescr += " = geompy.GetBlocksByParts(";
TDF_Tool::Entry(theCompound->GetEntry(), anEntry);
aDescr += anEntry + ", [";
aDescr += aPartsDescr + "])";
- TCollection_AsciiString aNewDescr = aFunction->GetDescription() + "\n";
+ TCollection_AsciiString aNewDescr = aFunction->GetDescription() + "\n\t";
aNewDescr += aDescr;
aFunction->SetDescription(aNewDescr);
//Make a Python command
TCollection_AsciiString anEntry, aDescr;
TDF_Tool::Entry(aCopy->GetEntry(), anEntry);
- aDescr += anEntry + " = IBlocksOperations.MakeMultiTransformation1D(";
+ aDescr += anEntry + " = geompy.MakeMultiTransformation1D(";
TDF_Tool::Entry(theObject->GetEntry(), anEntry);
aDescr += anEntry + ", ";
aDescr += TCollection_AsciiString(theDirFace1) + ", ";
//Make a Python command
TCollection_AsciiString anEntry, aDescr;
TDF_Tool::Entry(aCopy->GetEntry(), anEntry);
- aDescr += anEntry + " = IBlocksOperations.MakeMultiTransformation2D(";
+ aDescr += anEntry + " = geompy.MakeMultiTransformation2D(";
TDF_Tool::Entry(theObject->GetEntry(), anEntry);
aDescr += anEntry + ", ";
aDescr += TCollection_AsciiString(theDirFace1U) + ", ";
// Make a Python command
TCollection_AsciiString aDescr
- ("\nlistPropagationChains = IShapesOperations.Propagate(");
+ ("\n\tlistPropagationChains = IShapesOperations.Propagate(");
TCollection_AsciiString anEntry;
TDF_Tool::Entry(theShape->GetEntry(), anEntry);
aDescr += (anEntry + ")");
TCollection_AsciiString anEntry, aDescr("");
TDF_Tool::Entry(aBool->GetEntry(), anEntry);
aDescr += anEntry;
- aDescr += " = IBooleanOperations.MakeBoolean(";
+ aDescr += " = geompy.MakeBoolean(";
TDF_Tool::Entry(theShape1->GetEntry(), anEntry);
aDescr += (anEntry+", ");
TDF_Tool::Entry(theShape2->GetEntry(), anEntry);
TCollection_AsciiString aDescr;
TDF_Tool::Entry(aPartition->GetEntry(), anEntry);
aDescr += anEntry;
- aDescr += " = IBooleanOperations.MakePartition([";
+ aDescr += " = geompy.MakePartition([";
// Shapes
aDescr += aShapesDescr + "], [";
// Tools
TCollection_AsciiString anEntry, aDescr;
TDF_Tool::Entry(aPart->GetEntry(), anEntry);
aDescr += anEntry;
- aDescr += " = IBooleanOperations.MakePartition(";
+ aDescr += " = geompy.MakeHalfPartition(";
TDF_Tool::Entry(theShape->GetEntry(), anEntry);
aDescr += (anEntry+", ");
TDF_Tool::Entry(thePlane->GetEntry(), anEntry);
TCollection_AsciiString anEntry, aDescr("");
TDF_Tool::Entry(aPolyline->GetEntry(), anEntry);
aDescr += anEntry;
- aDescr += " = ICurvesOperations.MakePolyline([";
+ aDescr += " = geompy.MakePolyline([";
it = thePoints.begin();
TDF_Tool::Entry((*it)->GetEntry(), anEntry);
+ aDescr += anEntry;
it++;
- aDescr += (anEntry+", ");
for (; it != thePoints.end(); it++) {
aDescr += ", ";
TDF_Tool::Entry((*it)->GetEntry(), anEntry);
TCollection_AsciiString anEntry, aDescr("");
TDF_Tool::Entry(aCircle->GetEntry(), anEntry);
aDescr += anEntry;
- aDescr += " = ICurvesOperations.MakeCircleThreePnt(";
+ aDescr += " = geompy.MakeCircleThreePnt(";
TDF_Tool::Entry(thePnt1->GetEntry(), anEntry);
aDescr += (anEntry+", ");
TDF_Tool::Entry(thePnt2->GetEntry(), anEntry);
TCollection_AsciiString anEntry, aDescr("");
TDF_Tool::Entry(aCircle->GetEntry(), anEntry);
aDescr += anEntry;
- aDescr += " = ICurvesOperations.MakeCirclePntVecR(";
+ aDescr += " = geompy.MakeCircle(";
TDF_Tool::Entry(thePnt->GetEntry(), anEntry);
aDescr += (anEntry+", ");
TDF_Tool::Entry(theVec->GetEntry(), anEntry);
TCollection_AsciiString anEntry, aDescr("");
TDF_Tool::Entry(anEll->GetEntry(), anEntry);
aDescr += anEntry;
- aDescr += " = ICurvesOperations.MakeEllipse(";
+ aDescr += " = geompy.MakeEllipse(";
TDF_Tool::Entry(thePnt->GetEntry(), anEntry);
aDescr += (anEntry+", ");
TDF_Tool::Entry(theVec->GetEntry(), anEntry);
TCollection_AsciiString anEntry, aDescr("");
TDF_Tool::Entry(anArc->GetEntry(), anEntry);
aDescr += anEntry;
- aDescr += " = ICurvesOperations.MakeArc(";
+ aDescr += " = geompy.MakeArc(";
TDF_Tool::Entry(thePnt1->GetEntry(), anEntry);
aDescr += (anEntry+", ");
TDF_Tool::Entry(thePnt2->GetEntry(), anEntry);
TCollection_AsciiString anEntry, aDescr("");
TDF_Tool::Entry(aSpline->GetEntry(), anEntry);
aDescr += anEntry;
- aDescr += " = ICurvesOperations.MakeSplineBezier([";
+ aDescr += " = geompy.MakeBezier([";
it = thePoints.begin();
TDF_Tool::Entry((*it)->GetEntry(), anEntry);
+ aDescr += anEntry;
it++;
- aDescr += (anEntry+", ");
for (; it != thePoints.end(); it++) {
aDescr += ", ";
TDF_Tool::Entry((*it)->GetEntry(), anEntry);
TCollection_AsciiString anEntry, aDescr("");
TDF_Tool::Entry(aSpline->GetEntry(), anEntry);
aDescr += anEntry;
- aDescr += " = ICurvesOperations.MakeSplineInterpolation([";
+ aDescr += " = geompy.MakeInterpol([";
it = thePoints.begin();
TDF_Tool::Entry((*it)->GetEntry(), anEntry);
+ aDescr += anEntry;
it++;
- aDescr += (anEntry+", ");
for (; it != thePoints.end(); it++) {
aDescr += ", ";
TDF_Tool::Entry((*it)->GetEntry(), anEntry);
TCollection_AsciiString anEntry, aDescr;
TDF_Tool::Entry(aSketcher->GetEntry(), anEntry);
aDescr += anEntry;
- aDescr += " = ICurvesOperations.MakeSketcher(";
- aDescr += aCommand+", [";
+ aDescr += " = geompy.MakeSketcher( \"";
+ aDescr += aCommand+"\", [";
it = theWorkingPlane.begin();
aDescr += TCollection_AsciiString(*it);
//Make a Python command
TCollection_AsciiString anEntry, aDescr("");
TDF_Tool::Entry(aGroup->GetEntry(), anEntry);
- aDescr = anEntry + " = IGroupOperations.CreateGroup(";
+ aDescr = anEntry + " = geompy.CreateGroup(";
TDF_Tool::Entry(theMainShape->GetEntry(), anEntry);
aDescr += (anEntry+", ");
aDescr += (TCollection_AsciiString((int)theShapeType)+")");
aSSI.SetIndices(aNewSeq);
}
+ //Make a Python command
+ TCollection_AsciiString anEntry, aDescr("geompy.AddObject( ");
+ TDF_Tool::Entry(theGroup->GetEntry(), anEntry);
+ aDescr += (anEntry+", ");
+ aDescr += (TCollection_AsciiString(theSubShapeID)+" )");
+
+ aFunction->SetDescription(aDescr);
+
SetErrorCode(OK);
return;
}
aSSI.SetIndices(aNewSeq);
}
+ //Make a Python command
+ TCollection_AsciiString anEntry, aDescr("geompy.RemoveObject( ");
+ TDF_Tool::Entry(theGroup->GetEntry(), anEntry);
+ aDescr += (anEntry+", ");
+ aDescr += (TCollection_AsciiString(theSubShapeID)+" )");
+
+ aFunction->SetDescription(aDescr);
+
SetErrorCode(OK);
return;
}
}
aSSI.SetIndices(aNewSeq);
+
+ //Make a Python command
+ TCollection_AsciiString anEntry, aDescr("geompy.UnionList( ");
+ TDF_Tool::Entry(theGroup->GetEntry(), anEntry);
+ aDescr += (anEntry+", [ ");
+ for (i = 1; i <= aLen; i++) {
+ Handle(GEOM_Object) anObj_i = Handle(GEOM_Object)::DownCast(theSubShapes->Value(i));
+ TDF_Tool::Entry(anObj_i->GetEntry(), anEntry);
+ aDescr += anEntry + (char*)(( i < aLen ) ? ", " : " ])");
+ }
+
+ aFunction->SetDescription(aDescr);
}
SetErrorCode(OK);
}
aSSI.SetIndices(aNewSeq);
+
+
+ //Make a Python command
+ TCollection_AsciiString anEntry, aDescr("geompy.DifferenceList( ");
+ TDF_Tool::Entry(theGroup->GetEntry(), anEntry);
+ aDescr += (anEntry+", [ ");
+ for (i = 1; i <= aLen; i++) {
+ Handle(GEOM_Object) anObj_i = Handle(GEOM_Object)::DownCast(theSubShapes->Value(i));
+ TDF_Tool::Entry(anObj_i->GetEntry(), anEntry);
+ aDescr += anEntry + (char*)(( i < aLen ) ? ", " : " ])");;
+ }
+
+ aFunction->SetDescription(aDescr);
}
SetErrorCode(OK);
Handle(GEOM_Object) aMainShape = GEOM_Object::GetObject(aLabel);
if(aMainShape.IsNull()) return NULL;
+ //Make a Python command
+ TCollection_AsciiString anEntry, aDescr;
+ TDF_Tool::Entry(aMainShape->GetEntry(), aDescr);
+ TDF_Tool::Entry(theGroup->GetEntry(), anEntry);
+ aDescr += " = geompy.GetMainShape( ";
+ aDescr += (anEntry+" )");
+
+ theGroup->GetFunction(1)->SetDescription(aDescr);
+
SetErrorCode(OK);
return aMainShape;
}
#include <TColStd_HSequenceOfTransient.hxx>
#include <TCollection_AsciiString.hxx>
+#include <TDF_Tool.hxx>
+
#include <Standard_ErrorHandler.hxx> // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC
return NULL;
}
- //Make a Python command
- // ...
- // ... missing ...
+ //Make a Python command
+ TCollection_AsciiString anEntry, aDescr;
+ TDF_Tool::Entry(aNewObject->GetEntry(), aDescr);
+ aDescr += " = geompy.ProcessShape( ";
+ TDF_Tool::Entry(theObject->GetEntry(), anEntry);
+ aDescr += (anEntry+", [ ");
+ // list of operators
+ int i = theOperators->Lower(), nb = theOperators->Upper();
+ for ( ; i <= nb; i++) {
+ aDescr += "\"";
+ aDescr += theOperators->Value( i );
+ aDescr += "\"";
+ aDescr += (char*)(( i < nb ) ? ", " : " ], [ ");
+ }
+ // list of parameters
+ i = theParams->Lower(); nb = theParams->Upper();
+ for ( ; i <= nb; i++) {
+ aDescr += "\"";
+ aDescr += TCollection_AsciiString(theParams->Value( i ));
+ aDescr += "\"";
+ aDescr += (char*)(( i < nb ) ? ", " : " ], [ ");
+ }
+ // list of values
+ i = theValues->Lower(); nb = theValues->Upper();
+ for ( ; i <= nb; i++)
+ aDescr += TCollection_AsciiString(theValues->Value( i ))
+ + (char*)(( i < nb ) ? ", " : " ])");
+
+ aFunction->SetDescription(aDescr);
SetErrorCode(OK);
return aNewObject;
}
//Make a Python command
- // ...
- // ... missing ...
+ TCollection_AsciiString anEntry, aDescr;
+ TDF_Tool::Entry(aNewObject->GetEntry(), aDescr);
+ aDescr += " = geompy.SuppressFaces( ";
+ TDF_Tool::Entry(theObject->GetEntry(), anEntry);
+ aDescr += (anEntry+", [ ");
+ // list of face ids
+ int i = theFaces->Lower(), nb = theFaces->Upper();
+ for ( ; i <= nb; i++)
+ aDescr +=
+ TCollection_AsciiString(theFaces->Value( i ))
+ + (char*)(( i < nb ) ? ", " : " ])");
+
+ aFunction->SetDescription(aDescr);
SetErrorCode(OK);
return aNewObject;
}
//Make a Python command
- // ...
- // ... missing ...
+ TCollection_AsciiString anEntry, aDescr;
+ TDF_Tool::Entry(aNewObject->GetEntry(), aDescr);
+ aDescr += " = geompy.CloseContour( ";
+ TDF_Tool::Entry(theObject->GetEntry(), anEntry);
+ aDescr += (anEntry+", [ ");
+ // list of wire ids
+ int i = theWires->Lower(), nb = theWires->Upper();
+ for ( ; i <= nb; i++)
+ aDescr += TCollection_AsciiString(theWires->Value( i ))
+ + (char*)(( i < nb ) ? ", " : " ], ");
+ aDescr += (char*)( isCommonVertex ? "1 )" : "0 )" );
+
+ aFunction->SetDescription(aDescr);
SetErrorCode(OK);
return aNewObject;
}
//Make a Python command
- // ...
- // ... missing ...
+ TCollection_AsciiString anEntry, aDescr;
+ TDF_Tool::Entry(aNewObject->GetEntry(), aDescr);
+ aDescr += " = geompy.SuppressInternalWires( ";
+ TDF_Tool::Entry(theObject->GetEntry(), anEntry);
+ aDescr += (anEntry+", [ ");
+ // list of wire ids
+ int i = theWires->Lower(), nb = theWires->Upper();
+ for ( ; i <= nb; i++)
+ aDescr += TCollection_AsciiString(theWires->Value( i ))
+ + (char*)(( i < nb ) ? ", " : " ])");
+
+ aFunction->SetDescription(aDescr);
SetErrorCode(OK);
return aNewObject;
}
//Make a Python command
- // ...
- // ... missing ...
+ TCollection_AsciiString anEntry, aDescr;
+ TDF_Tool::Entry(aNewObject->GetEntry(), aDescr);
+ aDescr += " = geompy.SuppressHoles( ";
+ TDF_Tool::Entry(theObject->GetEntry(), anEntry);
+ aDescr += (anEntry+", [ ");
+ // list of wire ids
+ int i = theWires->Lower(), nb = theWires->Upper();
+ for ( ; i <= nb; i++)
+ aDescr += TCollection_AsciiString(theWires->Value( i ))
+ + (char*)(( i < nb ) ? ", " : " ])");
+
+ aFunction->SetDescription(aDescr);
SetErrorCode(OK);
return aNewObject;
}
//Make a Python command
- // ...
- // ... missing ...
+ TCollection_AsciiString anEntry, aDescr;
+ TDF_Tool::Entry(aNewObject->GetEntry(), aDescr);
+ aDescr += " = geompy.Sew( ";
+ TDF_Tool::Entry(theObject->GetEntry(), anEntry);
+ aDescr += anEntry+", " + theTolerance + " )";
+
+ aFunction->SetDescription(aDescr);
SetErrorCode(OK);
return aNewObject;
}
//Make a Python command
- // ...
- // ... missing ...
+ TCollection_AsciiString anEntry, aDescr;
+ TDF_Tool::Entry(aNewObject->GetEntry(), aDescr);
+ aDescr += " = geompy.DivideEdge( ";
+ TDF_Tool::Entry(theObject->GetEntry(), anEntry);
+ aDescr += anEntry + ", " + theIndex + ", " + theValue + ", ";
+ aDescr += (char*)( isByParameter ? "1 )" : "0 )" );
SetErrorCode(OK);
return aNewObject;
//Make a Python command
TCollection_AsciiString anEntry, aDescr;
TDF_Tool::Entry(aCopy->GetEntry(), anEntry);
- aDescr += (anEntry+" = IInsertOperations.MakeCopy(");
+ aDescr += (anEntry+" = geompy.MakeCopy(");
TDF_Tool::Entry(theOriginal->GetEntry(), anEntry);
aDescr += (anEntry+")");
//Make a Python command
TCollection_AsciiString anEntry, aDescr;
- aDescr = "IInsertOperations.Export(";
+ aDescr = "geompy.Export(";
TDF_Tool::Entry(theOriginal->GetEntry(), anEntry);
- aDescr += (anEntry + ", ");
- aDescr += (TCollection_AsciiString(aFileName) + ", ");
- aDescr += (TCollection_AsciiString(aFormatName) + ")");
+ aDescr += (anEntry + ", \"");
+ aDescr += (TCollection_AsciiString(aFileName) + "\", \"");
+ aDescr += (TCollection_AsciiString(aFormatName) + "\")");
aFunction->SetDescription(aDescr);
//Make a Python command
TCollection_AsciiString anEntry, aDescr;
TDF_Tool::Entry(result->GetEntry(), anEntry);
- aDescr += (anEntry + " = IInsertOperations.Import(");
- aDescr += (TCollection_AsciiString(aFileName) + ", ");
- aDescr += (TCollection_AsciiString(aFormatName) + ")");
+ aDescr += (anEntry + " = geompy.Import(\"");
+ aDescr += (TCollection_AsciiString(aFileName) + "\", \"");
+ aDescr += (TCollection_AsciiString(aFormatName) + "\")");
aFunction->SetDescription(aDescr);
//Make a Python command
TCollection_AsciiString anEntry, aDescr("");
TDF_Tool::Entry(aFillet->GetEntry(), anEntry);
- aDescr = anEntry + " = ILocalOperations.MakeFilletAll(";
+ aDescr = anEntry + " = geompy.MakeFilletAll(";
TDF_Tool::Entry(theShape->GetEntry(), anEntry);
aDescr += (anEntry+", ");
aDescr += (TCollection_AsciiString(theR)+")");
//Make a Python command
TCollection_AsciiString anEntry, aDescr("");
TDF_Tool::Entry(aFillet->GetEntry(), anEntry);
- aDescr = anEntry + " = ILocalOperations.MakeFilletEdges(";
+ aDescr = anEntry + " = geompy.MakeFillet(";
TDF_Tool::Entry(theShape->GetEntry(), anEntry);
aDescr += (anEntry+", ");
- aDescr += (TCollection_AsciiString(theR)+", [");
+ aDescr += (TCollection_AsciiString(theR)+", geompy.ShapeType[\"EDGE\"], [");
it = theEdges.begin();
- aDescr += (TCollection_AsciiString(*it)+", ");
+ aDescr += TCollection_AsciiString(*it);
it++;
for (; it != theEdges.end(); it++) {
aDescr += ", ";
//Make a Python command
TCollection_AsciiString anEntry, aDescr("");
TDF_Tool::Entry(aFillet->GetEntry(), anEntry);
- aDescr = anEntry + " = ILocalOperations.MakeFilletFaces(";
+ aDescr = anEntry + " = geompy.MakeFillet(";
TDF_Tool::Entry(theShape->GetEntry(), anEntry);
aDescr += (anEntry+", ");
- aDescr += (TCollection_AsciiString(theR)+", [");
+ aDescr += (TCollection_AsciiString(theR)+", geompy.ShapeType[\"FACE\"], [");
it = theFaces.begin();
- aDescr += (TCollection_AsciiString(*it)+", ");
+ aDescr += TCollection_AsciiString(*it);
it++;
for (; it != theFaces.end(); it++) {
aDescr += ", ";
TCollection_AsciiString anEntry, aDescr("");
TDF_Tool::Entry(aChamfer->GetEntry(), anEntry);
aDescr += anEntry;
- aDescr += " = ILocalOperations.MakeChamferAll(";
+ aDescr += " = geompy.MakeChamferAll(";
TDF_Tool::Entry(theShape->GetEntry(), anEntry);
aDescr += (anEntry+", ");
aDescr += (TCollection_AsciiString(theD)+")");
TCollection_AsciiString anEntry, aDescr("");
TDF_Tool::Entry(aChamfer->GetEntry(), anEntry);
aDescr += anEntry;
- aDescr += " = ILocalOperations.MakeChamferEdge(";
+ aDescr += " = geompy.MakeChamferEdge(";
TDF_Tool::Entry(theShape->GetEntry(), anEntry);
aDescr += (anEntry+", ");
aDescr += (TCollection_AsciiString(theD1)+", ");
TCollection_AsciiString anEntry, aDescr("");
TDF_Tool::Entry(aChamfer->GetEntry(), anEntry);
aDescr += anEntry;
- aDescr += " = ILocalOperations.MakeChamferFaces(";
+ aDescr += " = geompy.MakeChamferFaces(";
TDF_Tool::Entry(theShape->GetEntry(), anEntry);
aDescr += (anEntry+", ");
aDescr += (TCollection_AsciiString(theD1)+", ");
aDescr += (TCollection_AsciiString(theD2)+", [");
it = theFaces.begin();
- aDescr += (TCollection_AsciiString(*it)+", ");
+ aDescr += TCollection_AsciiString(*it);
it++;
for (; it != theFaces.end(); it++) {
aDescr += ", ";
TCollection_AsciiString anEntry, aDescr("");
TDF_Tool::Entry(aChamfer->GetEntry(), anEntry);
aDescr += anEntry;
- aDescr += " = ILocalOperations.MakeArchimede(";
+ aDescr += " = geompy.Archimede(";
TDF_Tool::Entry(theShape->GetEntry(), anEntry);
aDescr += (anEntry+", ");
aDescr += (TCollection_AsciiString(theWeight)+", ");
//Make a Python command
TCollection_AsciiString anEntry, aDescr;
TDF_Tool::Entry(aCDG->GetEntry(), anEntry);
- aDescr += anEntry + " = IMeasureOperations.MakeCentreOfMass(";
+ aDescr += anEntry + " = geompy.MakeCDG(";
TDF_Tool::Entry(theShape->GetEntry(), anEntry);
aDescr += anEntry + ")";
//Make a Python command
TCollection_AsciiString anEntry, aDescr;
TDF_Tool::Entry(anEdge->GetEntry(), anEntry);
- aDescr += (anEntry+" = IShapesOperations.MakeEdge(");
+ aDescr += (anEntry+" = geompy.MakeEdge(");
TDF_Tool::Entry(thePnt1->GetEntry(), anEntry);
aDescr += (anEntry+", ");
TDF_Tool::Entry(thePnt2->GetEntry(), anEntry);
TCollection_AsciiString anEntry, aDescr;
TDF_Tool::Entry(aFace->GetEntry(), anEntry);
aDescr += anEntry;
- aDescr += " = IShapesOperations.MakeFace(";
+ aDescr += " = geompy.MakeFace(";
TDF_Tool::Entry(theWire->GetEntry(), anEntry);
aDescr += anEntry;
if (isPlanarWanted)
aDescr += ", 1)";
-
else
aDescr += ", 0)";
//Make a Python command
TCollection_AsciiString anEntry, aDescr;
TDF_Tool::Entry(aShape->GetEntry(), anEntry);
- aDescr += (anEntry + " = IShapesOperations.MakeFaceWires([");
+ aDescr += (anEntry + " = geompy.MakeFaceWires([");
// Shapes
it = theShapes.begin();
if (it != theShapes.end()) {
TDF_Tool::Entry((*it)->GetEntry(), anEntry);
+ aDescr += anEntry;
it++;
- aDescr += (anEntry+", ");
for (; it != theShapes.end(); it++) {
aDescr += ", ";
TDF_Tool::Entry((*it)->GetEntry(), anEntry);
Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeSolidShells
(list<Handle(GEOM_Object)> theShapes)
{
- return MakeShape(theShapes, GEOM_SOLID, SOLID_SHELLS, "MakeSolidShells");
+ return MakeShape(theShapes, GEOM_SOLID, SOLID_SHELLS, "MakeSolid");
}
//=============================================================================
TCollection_AsciiString anEntry, aDescr("");
TDF_Tool::Entry(aSolid->GetEntry(), anEntry);
aDescr += anEntry;
- aDescr += " = IShapesOperations.MakeSolidShell(";
+ aDescr += " = geompy.MakeSolid(";
TDF_Tool::Entry(theShell->GetEntry(), anEntry);
aDescr += (anEntry+")");
//Make a Python command
TCollection_AsciiString anEntry, aDescr("");
TDF_Tool::Entry(aShape->GetEntry(), anEntry);
- aDescr += (anEntry + " = IShapesOperations.");
+ aDescr += (anEntry + " = geompy.");
aDescr += (theMethodName + "([");
// Shapes
it = theShapes.begin();
if (it != theShapes.end()) {
TDF_Tool::Entry((*it)->GetEntry(), anEntry);
+ aDescr += anEntry;
it++;
- aDescr += (anEntry+", ");
for (; it != theShapes.end(); it++) {
aDescr += ", ";
TDF_Tool::Entry((*it)->GetEntry(), anEntry);
TCollection_AsciiString anEntry, aDescr;
TDF_Tool::Entry(aGlued->GetEntry(), anEntry);
aDescr += anEntry;
- aDescr += " = IShapesOperations.MakeGlueFaces(";
+ aDescr += " = geompy.MakeGlueFaces(";
TDF_Tool::Entry(theShape->GetEntry(), anEntry);
aDescr += anEntry + ", ";
aDescr += TCollection_AsciiString(theTolerance) + ")";
anAsciiList.Trunc(anAsciiList.Length() - 1);
anAsciiList += "]";
- anAsciiList = TCollection_AsciiString("\n") + anAsciiList;
+ anAsciiList = TCollection_AsciiString("\n\t") + anAsciiList;
//The explode doesn't change object so no new function is requiered.
aFunction = theShape->GetLastFunction();
//Make a Python command
TCollection_AsciiString aDescr(anAsciiList);
TDF_Tool::Entry(theShape->GetEntry(), anEntry);
- aDescr += " = IShapesOperations.MakeExplode(";
- aDescr += (anEntry + ",");
if (isSorted)
- aDescr += (TCollection_AsciiString(theShapeType) + ", 1)");
+ aDescr += " = geompy.SubShapeAllSorted( ";
else
- aDescr += (TCollection_AsciiString(theShapeType) + ", 0)");
+ aDescr += " = geompy.SubShapeAll( ";
+ aDescr += (anEntry + ", ");
+ aDescr += theShapeType;
+ aDescr += " )";
TCollection_AsciiString anOldDescr = aFunction->GetDescription();
anOldDescr = anOldDescr + aDescr;
//Make a Python command
TCollection_AsciiString aDescr
- ("\nlistSubShapeAllIDs = IShapesOperations.SubShapeAllIDs(");
+ ("\n\tlistSubShapeAllIDs = geompy.SubShapeAllIDs(");
TCollection_AsciiString anEntry;
TDF_Tool::Entry(theShape->GetEntry(), anEntry);
aDescr += (anEntry + ",");
Handle(TColStd_HArray1OfInteger) anArray = new TColStd_HArray1OfInteger(1,1);
anArray->SetValue(1, theID);
- Handle(GEOM_Object) anObj = GetEngine()->AddSubShape(theMainShape, anArray);
+ Handle(GEOM_Object) anObj = GetEngine()->AddSubShape(theMainShape, anArray,true);
if (anObj.IsNull()) {
SetErrorCode("Can not get a sub-shape with the given ID");
return NULL;
Handle(GEOM_Function) aFunction = theMainShape->GetLastFunction();
//Make a Python command
- TCollection_AsciiString aDescr ("\n");
+ TCollection_AsciiString aDescr ("\n\t");
TCollection_AsciiString anEntry;
TDF_Tool::Entry(anObj->GetEntry(), anEntry);
- aDescr += anEntry + " = IShapesOperations.GetSubShape(";
+ aDescr += anEntry + " = geompy.GetSubShape(";
TDF_Tool::Entry(theMainShape->GetEntry(), anEntry);
- aDescr += anEntry + ", ";
- aDescr += TCollection_AsciiString(theID) + ")";
+ aDescr += anEntry + ", [" + theID + "])";
TCollection_AsciiString anOldDescr = aFunction->GetDescription();
anOldDescr = anOldDescr + aDescr;
TCollection_AsciiString anEntry, aDescr;
TDF_Tool::Entry(aReversed->GetEntry(), anEntry);
aDescr += anEntry;
- aDescr += " = IShapesOperations.ReverseShape(";
+ aDescr += " = geompy.ChangeOrientation(";
TDF_Tool::Entry(theShape->GetEntry(), anEntry);
aDescr += anEntry + ")";
Handle(GEOM_Function) aFunction = theShape->GetLastFunction();
//Make a Python command
- TCollection_AsciiString aDescr ("\nlistFreeFacesIDs = IShapesOperations.GetFreeFacesIDs(");
+ TCollection_AsciiString aDescr ("\n\tlistFreeFacesIDs = geompy.GetFreeFacesIDs(");
TCollection_AsciiString anEntry;
TDF_Tool::Entry(theShape->GetEntry(), anEntry);
aDescr += (anEntry + ")");
//Make a Python command
TCollection_AsciiString aDescr
- ("\nlistSharedShapes = IShapesOperations.GetSharedShapes(");
+ ("\n\tlistSharedShapes = geompy.GetSharedShapes(");
TCollection_AsciiString anEntry;
TDF_Tool::Entry(theShape1->GetEntry(), anEntry);
aDescr += (anEntry + ",");
// Make a Python command
TCollection_AsciiString anEntry, aDescr
- ("\nlistShapesOnPlane = IShapesOperations.GetShapesOnPlane(");
+ ("\n\tlistShapesOnPlane = geompy.GetShapesOnPlane(");
TDF_Tool::Entry(theShape->GetEntry(), anEntry);
aDescr += anEntry + TCollection_AsciiString(theShapeType) + ",";
TDF_Tool::Entry(theAx1->GetEntry(), anEntry);
// Make a Python command
TCollection_AsciiString anEntry, aDescr
- ("\nlistShapesOnCylinder = IShapesOperations.GetShapesOnCylinder(");
+ ("\n\tlistShapesOnCylinder = geompy.GetShapesOnCylinder(");
TDF_Tool::Entry(theShape->GetEntry(), anEntry);
aDescr += anEntry + TCollection_AsciiString(theShapeType) + ",";
TDF_Tool::Entry(theAxis->GetEntry(), anEntry);
// Make a Python command
TCollection_AsciiString anEntry, aDescr
- ("\nlistShapesOnSphere = IShapesOperations.GetShapesOnSphere(");
+ ("\n\tlistShapesOnSphere = geompy.GetShapesOnSphere(");
TDF_Tool::Entry(theShape->GetEntry(), anEntry);
aDescr += anEntry + TCollection_AsciiString(theShapeType) + ",";
TDF_Tool::Entry(theCenter->GetEntry(), anEntry);
TCollection_AsciiString anEntry, aDescr;
TDF_Tool::Entry(aResult->GetEntry(), anEntry);
aDescr += anEntry;
- aDescr += " = IShapesOperations.GetInPlace(";
+ aDescr += " = geompy.GetInPlace(";
TDF_Tool::Entry(theShapeWhere->GetEntry(), anEntry);
aDescr += anEntry + ",";
TDF_Tool::Entry(theShapeWhat->GetEntry(), anEntry);
//Make a Python command
TCollection_AsciiString anEntry, aDescr;
TDF_Tool::Entry(theObject->GetEntry(), anEntry);
- aDescr += (anEntry+" = ITransformOperations.TranslateTwoPoints(");
+ aDescr += (anEntry+" = geompy.TrsfOp.TranslateTwoPoints(");
aDescr += (anEntry+", ");
TDF_Tool::Entry(thePoint1->GetEntry(), anEntry);
aDescr += (anEntry+", ");
//Make a Python command
TCollection_AsciiString anEntry, aDescr;
TDF_Tool::Entry(theObject->GetEntry(), anEntry);
- aDescr += (anEntry+" = ITransformOperations.TranslateDXDXYDZ(");
+ aDescr += (anEntry+" = geompy.TrsfOp.TranslateDXDYDZ(");
aDescr += (anEntry+", ");
aDescr += (TCollection_AsciiString(theX)+", ");
aDescr += (TCollection_AsciiString(theY)+", ");
//Make a Python command
TCollection_AsciiString anEntry, aDescr;
TDF_Tool::Entry(aCopy->GetEntry(), anEntry);
- aDescr += (anEntry+" = ITransformOperations.TranslateTwoPointsCopy(");
+ aDescr += (anEntry+" = geompy.MakeTranslationTwoPoints(");
TDF_Tool::Entry(theObject->GetEntry(), anEntry);
aDescr += (anEntry+", ");
TDF_Tool::Entry(thePoint1->GetEntry(), anEntry);
//Make a Python command
TCollection_AsciiString anEntry, aDescr;
TDF_Tool::Entry(aCopy->GetEntry(), anEntry);
- aDescr += (anEntry+" = ITransformOperations.TranslateDXDXYDZCopy(");
+ aDescr += (anEntry+" = geompy.MakeTranslation(");
TDF_Tool::Entry(theObject->GetEntry(), anEntry);
aDescr += (anEntry+", ");
aDescr += (TCollection_AsciiString(theX)+", ");
//Make a Python command
TCollection_AsciiString anEntry, aDescr;
TDF_Tool::Entry(theObject->GetEntry(), anEntry);
- aDescr += (anEntry+" = ITransformOperations.TranslateVector(");
+ aDescr += (anEntry+" = geompy.TrsfOp.TranslateVector(");
aDescr += (anEntry+", ");
TDF_Tool::Entry(theVector->GetEntry(), anEntry);
aDescr += (anEntry+") ");
//Make a Python command
TCollection_AsciiString anEntry, aDescr;
TDF_Tool::Entry(aCopy->GetEntry(), anEntry);
- aDescr += (anEntry+" = ITransformOperations.TranslateVectorCopy(");
+ aDescr += (anEntry+" = geompy.MakeTranslationVector(");
TDF_Tool::Entry(theObject->GetEntry(), anEntry);
aDescr += (anEntry+", ");
TDF_Tool::Entry(theVector->GetEntry(), anEntry);
//Make a Python command
TCollection_AsciiString anEntry, aDescr;
TDF_Tool::Entry(aCopy->GetEntry(), anEntry);
- aDescr += (anEntry+" = ITransformOperations.Translate1D(");
+ aDescr += (anEntry+" = geompy.MakeMultiTranslation1D(");
TDF_Tool::Entry(theObject->GetEntry(), anEntry);
aDescr += (anEntry+", ");
TDF_Tool::Entry(theVector->GetEntry(), anEntry);
//Make a Python command
TCollection_AsciiString anEntry, aDescr;
TDF_Tool::Entry(aCopy->GetEntry(), anEntry);
- aDescr += (anEntry+" = ITransformOperations.Translate2D(");
+ aDescr += (anEntry+" = geompy.MakeMultiTranslation2D(");
TDF_Tool::Entry(theObject->GetEntry(), anEntry);
aDescr += (anEntry+", ");
TDF_Tool::Entry(theVector->GetEntry(), anEntry);
//Make a Python command
TCollection_AsciiString anEntry, aDescr;
TDF_Tool::Entry(theObject->GetEntry(), anEntry);
- aDescr += (anEntry + " = ITransformOperations.MirrorPlane(");
+ aDescr += (anEntry + " = geompy.TrsfOp.MirrorPlane(");
aDescr += (anEntry + ", ");
TDF_Tool::Entry(thePlane->GetEntry(), anEntry);
aDescr += (anEntry + ") ");
//Make a Python command
TCollection_AsciiString anEntry, aDescr;
TDF_Tool::Entry(aCopy->GetEntry(), anEntry);
- aDescr += (anEntry + " = ITransformOperations.MirrorPlaneCopy(");
+ aDescr += (anEntry + " = geompy.MakeMirrorByPlane(");
TDF_Tool::Entry(theObject->GetEntry(), anEntry);
aDescr += (anEntry + ", ");
TDF_Tool::Entry(thePlane->GetEntry(), anEntry);
//Make a Python command
TCollection_AsciiString anEntry, aDescr;
TDF_Tool::Entry(theObject->GetEntry(), anEntry);
- aDescr += (anEntry + " = ITransformOperations.MirrorPoint(");
+ aDescr += (anEntry + " = geompy.TrsfOp.MirrorPoint(");
aDescr += (anEntry + ", ");
TDF_Tool::Entry(thePoint->GetEntry(), anEntry);
aDescr += (anEntry + ") ");
//Make a Python command
TCollection_AsciiString anEntry, aDescr;
TDF_Tool::Entry(aCopy->GetEntry(), anEntry);
- aDescr += (anEntry + " = ITransformOperations.MirrorPointCopy(");
+ aDescr += (anEntry + " = geompy.MakeMirrorByPoint(");
TDF_Tool::Entry(theObject->GetEntry(), anEntry);
aDescr += (anEntry + ", ");
TDF_Tool::Entry(thePoint->GetEntry(), anEntry);
//Make a Python command
TCollection_AsciiString anEntry, aDescr;
TDF_Tool::Entry(theObject->GetEntry(), anEntry);
- aDescr += (anEntry + " = ITransformOperations.MirrorAxis(");
+ aDescr += (anEntry + " = geompy.TrsfOp.MirrorAxis(");
aDescr += (anEntry + ", ");
TDF_Tool::Entry(theAxis->GetEntry(), anEntry);
aDescr += (anEntry + ") ");
//Make a Python command
TCollection_AsciiString anEntry, aDescr;
TDF_Tool::Entry(aCopy->GetEntry(), anEntry);
- aDescr += (anEntry + " = ITransformOperations.MirrorAxisCopy(");
+ aDescr += (anEntry + " = geompy.MakeMirrorByAxis(");
TDF_Tool::Entry(theObject->GetEntry(), anEntry);
aDescr += (anEntry + ", ");
TDF_Tool::Entry(theAxis->GetEntry(), anEntry);
//Make a Python command
TCollection_AsciiString anEntry, aDescr;
TDF_Tool::Entry(theObject->GetEntry(), anEntry);
- aDescr += (anEntry+" = ITransformOperations.OffsetShape(");
+ aDescr += (anEntry+" = geompy.TrsfOp.OffsetShape(");
aDescr += (anEntry+", ");
aDescr += TCollection_AsciiString(theOffset)+")";
aFunction->SetDescription(aDescr);
//Make a Python command
TCollection_AsciiString anEntry, aDescr;
TDF_Tool::Entry(aCopy->GetEntry(), anEntry);
- aDescr += (anEntry+" = ITransformOperations.OffsetShapeCopy(");
+ aDescr += (anEntry+" = geompy.MakeOffset(");
TDF_Tool::Entry(theObject->GetEntry(), anEntry);
aDescr += (anEntry+", ");
aDescr += TCollection_AsciiString(theOffset)+")";
//Make a Python command
TCollection_AsciiString anEntry, aDescr;
TDF_Tool::Entry(theObject->GetEntry(), anEntry);
- aDescr += (anEntry+" = ITransformOperations.ScaleShape(");
+ aDescr += (anEntry+" = geompy.TrsfOp.ScaleShape(");
aDescr += (anEntry+", ");
TDF_Tool::Entry(thePoint->GetEntry(), anEntry);
aDescr += (anEntry+", ");
//Make a Python command
TCollection_AsciiString anEntry, aDescr;
TDF_Tool::Entry(aCopy->GetEntry(), anEntry);
- aDescr += (anEntry+" = ITransformOperations.ScaleShapeCopy(");
+ aDescr += (anEntry+" = geompy.MakeScaleTransform(");
TDF_Tool::Entry(theObject->GetEntry(), anEntry);
aDescr += (anEntry+", ");
TDF_Tool::Entry(thePoint->GetEntry(), anEntry);
//Make a Python command
TCollection_AsciiString anEntry, aDescr;
TDF_Tool::Entry(theObject->GetEntry(), anEntry);
- aDescr += (anEntry+" = ITransformOperations.PositionShape(");
+ aDescr += (anEntry+" = geompy.TrsfOp.PositionShape(");
aDescr += (anEntry+", ");
TDF_Tool::Entry(theStartLCS->GetEntry(), anEntry);
aDescr += (anEntry+", ");
//Make a Python command
TCollection_AsciiString anEntry, aDescr;
TDF_Tool::Entry(aCopy->GetEntry(), anEntry);
- aDescr += (anEntry+" = ITransformOperations.PositionShapeCopy(");
+ aDescr += (anEntry+" = geompy.MakePosition(");
TDF_Tool::Entry(theObject->GetEntry(), anEntry);
aDescr += (anEntry+", ");
TDF_Tool::Entry(theStartLCS->GetEntry(), anEntry);
//Make a Python command
TCollection_AsciiString anEntry, aDescr;
TDF_Tool::Entry(theObject->GetEntry(), anEntry);
- aDescr += (anEntry+" = ITransformOperations.Rotate(");
+ aDescr += (anEntry+" = geompy.TrsfOp.Rotate(");
aDescr += (anEntry+", ");
TDF_Tool::Entry(theAxis->GetEntry(), anEntry);
aDescr += (anEntry+", ");
//Make a Python command
TCollection_AsciiString anEntry, aDescr;
+ TDF_Tool::Entry(aCopy->GetEntry(), aDescr);
+ aDescr += " = geompy.MakeRotation(";
TDF_Tool::Entry(theObject->GetEntry(), anEntry);
- aDescr += (anEntry+" = ITransformOperations.RotateCopy(");
aDescr += (anEntry+", ");
TDF_Tool::Entry(theAxis->GetEntry(), anEntry);
aDescr += (anEntry+", ");
//Make a Python command
TCollection_AsciiString anEntry, aDescr;
TDF_Tool::Entry(theObject->GetEntry(), anEntry);
- aDescr += (anEntry+" = ITransformOperations.Rotate1D(");
+ aDescr += (anEntry+" = geompy.MultiRotate1D(");
aDescr += (anEntry+", ");
TDF_Tool::Entry(theAxis->GetEntry(), anEntry);
aDescr += (anEntry+", ");
//Make a Python command
TCollection_AsciiString anEntry, aDescr;
TDF_Tool::Entry(theObject->GetEntry(), anEntry);
- aDescr += (anEntry+" = ITransformOperations.Rotate2D(");
+ aDescr += (anEntry+" = geompy.MultiRotate2D(");
aDescr += (anEntry+", ");
TDF_Tool::Entry(theAxis->GetEntry(), anEntry);
aDescr += (anEntry+", ");
--- /dev/null
+using namespace std;
+
+#include "GEOM_Gen_i.hh"
+#include <TCollection_AsciiString.hxx>
+#include <TCollection_ExtendedString.hxx>
+#include <TColStd_HSequenceOfAsciiString.hxx>
+#include <Resource_DataMapOfAsciiStringAsciiString.hxx>
+
+Engines::TMPFile* GEOM_Gen_i::DumpPython(CORBA::Object_ptr theStudy,
+ CORBA::Boolean isPublished,
+ CORBA::Boolean& isValidScript)
+{
+ SALOMEDS::Study_var aStudy = SALOMEDS::Study::_narrow(theStudy);
+ if(CORBA::is_nil(aStudy))
+ return new Engines::TMPFile(0);
+
+ SALOMEDS::SObject_var aSO = aStudy->FindComponent(ComponentDataType());
+ if(CORBA::is_nil(aSO))
+ return new Engines::TMPFile(0);
+
+ Resource_DataMapOfAsciiStringAsciiString aMap;
+ TCollection_AsciiString s("qwertyuioplkjhgfdsazxcvbnmQWERTYUIOPLKJHGFDSAZXCVBNM0987654321_");
+
+ SALOMEDS::ChildIterator_var Itr = aStudy->NewChildIterator(aSO);
+ for(Itr->InitEx(true); Itr->More(); Itr->Next()) {
+ SALOMEDS::SObject_var aValue = Itr->Value();
+ char* IOR = aValue->GetIOR();
+ if(strlen(IOR) > 0) {
+ CORBA::Object_var obj = _orb->string_to_object(IOR);
+ GEOM::GEOM_Object_var GO = GEOM::GEOM_Object::_narrow(obj);
+ if(!CORBA::is_nil(GO)) {
+ TCollection_AsciiString aName(aValue->GetName());
+ int p, p2=1, e = aName.Length();
+ while ((p = aName.FirstLocationNotInSet(s, p2, e))) {
+ aName.SetValue(p, '_');
+ p2=p;
+ }
+ aMap.Bind(TCollection_AsciiString(GO->GetEntry()), aName);
+ }
+ }
+ }
+
+ bool aValidScript;
+ TCollection_AsciiString aScript = _impl->DumpPython(aStudy->StudyId(), aMap, isPublished, aValidScript);
+
+ int aLen = aScript.Length();
+ unsigned char* aBuffer = new unsigned char[aLen+1];
+ strcpy((char*)aBuffer, aScript.ToCString());
+
+ CORBA::Octet* anOctetBuf = (CORBA::Octet*)aBuffer;
+ Engines::TMPFile_var aStreamFile = new Engines::TMPFile(aLen+1, aLen+1, anOctetBuf, 1);
+ isValidScript = aValidScript;
+
+ return aStreamFile._retn();
+}
virtual GEOM::GEOM_Object_ptr GetIORFromString(const char* stringIOR);
+ virtual Engines::TMPFile* DumpPython(CORBA::Object_ptr theStudy,
+ CORBA::Boolean isPublished,
+ CORBA::Boolean& isValidScript);
+
//********************************************************************************************************//
// Internal methods
//********************************************************************************************************//
GEOM_ITransformOperations_i.cc \
GEOM_IMeasureOperations_i.cc \
GEOM_IGroupOperations_i.cc \
- GEOM_Gen_i.cc
+ GEOM_Gen_i.cc \
+ GEOM_DumpPython.cc
LIB_SERVER_IDL = SALOME_Component.idl SALOMEDS.idl SALOME_Exception.idl \
GEOM_Gen.idl SALOME_GenericObj.idl