From: azv Date: Tue, 16 Aug 2016 07:59:42 +0000 (+0300) Subject: Dump Python in the High Level Parameterized Geometry API (issue #1648) X-Git-Tag: V_2.5.0~137^2~47 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=d199bb7538eca84f1dec1f124db573bb30363920;p=modules%2Fshaper.git Dump Python in the High Level Parameterized Geometry API (issue #1648) * Dump for BuildPlugin_Vertex --- diff --git a/src/BuildAPI/BuildAPI_Vertex.cpp b/src/BuildAPI/BuildAPI_Vertex.cpp index b1723c84e..1ac2f8749 100644 --- a/src/BuildAPI/BuildAPI_Vertex.cpp +++ b/src/BuildAPI/BuildAPI_Vertex.cpp @@ -6,6 +6,7 @@ #include "BuildAPI_Vertex.h" +#include #include //================================================================================================== @@ -46,3 +47,13 @@ VertexPtr addVertex(const std::shared_ptr& thePart, std::shared_ptr aFeature = thePart->addFeature(BuildAPI_Vertex::ID()); return VertexPtr(new BuildAPI_Vertex(aFeature, theBaseObjects)); } + +//================================================================================================== +void BuildAPI_Vertex::dump(ModelHighAPI_Dumper& theDumper) const +{ + FeaturePtr aBase = feature(); + std::string aPartName = theDumper.name(aBase->document()); + + theDumper << aBase << " = model.addVertex(" << aPartName << ", " + << aBase->selectionList(BuildPlugin_Vertex::BASE_OBJECTS_ID()) << ")" << std::endl; +} diff --git a/src/BuildAPI/BuildAPI_Vertex.h b/src/BuildAPI/BuildAPI_Vertex.h index a01ea4c14..d4dc4b8c5 100644 --- a/src/BuildAPI/BuildAPI_Vertex.h +++ b/src/BuildAPI/BuildAPI_Vertex.h @@ -41,6 +41,10 @@ public: /// Modify base attribute of the feature. BUILDAPI_EXPORT void setBase(const std::list& theBaseObjects); + + /// Dump wrapped feature + BUILDAPI_EXPORT + virtual void dump(ModelHighAPI_Dumper& theDumper) const; }; /// Pointer on Vertex object. diff --git a/src/PythonAPI/model/__init__.py b/src/PythonAPI/model/__init__.py index 58ddaac99..fc24671cd 100644 --- a/src/PythonAPI/model/__init__.py +++ b/src/PythonAPI/model/__init__.py @@ -13,6 +13,7 @@ from roots import * # Built-in features +from build import * from sketcher import * from connection import * from construction import * diff --git a/src/PythonAPI/model/build/__init__.py b/src/PythonAPI/model/build/__init__.py new file mode 100644 index 000000000..e700be81f --- /dev/null +++ b/src/PythonAPI/model/build/__init__.py @@ -0,0 +1,4 @@ +"""Package for Build plugin for the Parametric Geometry API of the Modeler. +""" + +from BuildAPI import addVertex