From: Clarisse Genrault Date: Fri, 1 Jul 2016 10:06:58 +0000 (+0200) Subject: Parametric API high level for the primitive "Box". X-Git-Tag: V_2.5.0~222 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=0b6a6217d4203167a8044456aed1866335d0c334;p=modules%2Fshaper.git Parametric API high level for the primitive "Box". --- diff --git a/CMakeLists.txt b/CMakeLists.txt index f0884dbda..b24566bcb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -118,6 +118,7 @@ ADD_SUBDIRECTORY (src/ExchangeAPI) ADD_SUBDIRECTORY (src/FeaturesAPI) ADD_SUBDIRECTORY (src/ParametersAPI) ADD_SUBDIRECTORY (src/PartSetAPI) +ADD_SUBDIRECTORY (src/PrimitivesAPI) ADD_SUBDIRECTORY (src/SketchAPI) IF(${HAVE_SALOME}) diff --git a/src/PrimitivesAPI/CMakeLists.txt b/src/PrimitivesAPI/CMakeLists.txt new file mode 100644 index 000000000..e97ba19a5 --- /dev/null +++ b/src/PrimitivesAPI/CMakeLists.txt @@ -0,0 +1,76 @@ +## Copyright (C) 2014-2016 CEA/DEN, EDF R&D + +INCLUDE(Common) + +SET(PROJECT_HEADERS + PrimitivesAPI.h + PrimitivesAPI_Box.h +) + +SET(PROJECT_SOURCES + PrimitivesAPI_Box.cpp +) + +SET(PROJECT_LIBRARIES + ModelAPI + ModelHighAPI +) + +INCLUDE_DIRECTORIES( + ${PROJECT_SOURCE_DIR}/src/Events + ${PROJECT_SOURCE_DIR}/src/ModelAPI + ${PROJECT_SOURCE_DIR}/src/ModelHighAPI +) + +# Plugin headers dependency +INCLUDE_DIRECTORIES( + ${PROJECT_SOURCE_DIR}/src/GeomAPI + ${PROJECT_SOURCE_DIR}/src/GeomAlgoAPI + ${PROJECT_SOURCE_DIR}/src/GeomDataAPI + ${PROJECT_SOURCE_DIR}/src/PrimitivesPlugin +) + +#TODO(spo): is ${CAS_DEFINITIONS} necessary? +ADD_DEFINITIONS(-DPRIMITIVESAPI_EXPORTS ${CAS_DEFINITIONS}) +ADD_LIBRARY(PrimitivesAPI SHARED ${PROJECT_SOURCES} ${PROJECT_HEADERS}) +TARGET_LINK_LIBRARIES(PrimitivesAPI ${PROJECT_LIBRARIES}) + +# SWIG wrapper + +INCLUDE(PythonAPI) + +SET_SOURCE_FILES_PROPERTIES(PrimitivesAPI.i PROPERTIES CPLUSPLUS ON) +SET_SOURCE_FILES_PROPERTIES(PrimitivesAPI.i PROPERTIES SWIG_DEFINITIONS "-shadow") + +#TODO(spo): is ModelAPI necessary or it could be received by INTERFACE_ (may require modern CMake)? +SET(SWIG_LINK_LIBRARIES + PrimitivesAPI + ModelHighAPI + ModelAPI + ${PYTHON_LIBRARIES} +) + +SET(SWIG_MODULE_PrimitivesAPI_EXTRA_DEPS ${SWIG_MODULE_PrimitivesAPI_EXTRA_DEPS} + ${PROJECT_SOURCE_DIR}/src/ModelHighAPI/ModelHighAPI.i + doxyhelp.i + ${PROJECT_HEADERS} +) + +SWIG_ADD_MODULE(PrimitivesAPI python PrimitivesAPI.i ${PROJECT_HEADERS}) +SWIG_LINK_LIBRARIES(PrimitivesAPI ${SWIG_LINK_LIBRARIES}) + +IF(WIN32) + SET_TARGET_PROPERTIES(_PrimitivesAPI PROPERTIES DEBUG_OUTPUT_NAME _PrimitivesAPI_d) +ENDIF(WIN32) + +INSTALL(TARGETS _PrimitivesAPI DESTINATION ${SHAPER_INSTALL_SWIG}) +INSTALL(TARGETS PrimitivesAPI DESTINATION ${SHAPER_INSTALL_BIN}) +INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/PrimitivesAPI.py DESTINATION ${SHAPER_INSTALL_SWIG}) + +# Tests +INCLUDE(UnitTest) + +ADD_UNIT_TESTS( +) + +# ADD_SUBDIRECTORY (Test) diff --git a/src/PrimitivesAPI/PrimitivesAPI.h b/src/PrimitivesAPI/PrimitivesAPI.h new file mode 100644 index 000000000..5ef0b78fc --- /dev/null +++ b/src/PrimitivesAPI/PrimitivesAPI.h @@ -0,0 +1,20 @@ +// Copyright (C) 2014-2016 CEA/DEN, EDF R&D + +#ifndef PRIMITIVESAPI_H +#define PRIMITIVESAPI_H + +#if defined PRIMITIVESAPI_EXPORTS +#if defined WIN32 +#define PRIMITIVESAPI_EXPORT __declspec( dllexport ) +#else +#define PRIMITIVESAPI_EXPORT +#endif +#else +#if defined WIN32 +#define PRIMITIVESAPI_EXPORT __declspec( dllimport ) +#else +#define PRIMITIVESAPI_EXPORT +#endif +#endif + +#endif diff --git a/src/PrimitivesAPI/PrimitivesAPI.i b/src/PrimitivesAPI/PrimitivesAPI.i new file mode 100644 index 000000000..a84b85a33 --- /dev/null +++ b/src/PrimitivesAPI/PrimitivesAPI.i @@ -0,0 +1,25 @@ +/* PrimitivesAPI.i */ + +%module PrimitivesAPI + +%{ + #include "PrimitivesAPI_swig.h" +%} + +%include "doxyhelp.i" + +// import other modules +%import "ModelHighAPI.i" + +// to avoid error on this +#define PRIMITIVESAPI_EXPORT + +// standard definitions +%include "typemaps.i" +%include "std_shared_ptr.i" + +// shared pointers +%shared_ptr(PrimitivesAPI_Box) + +// all supported interfaces +%include "PrimitivesAPI_Box.h" diff --git a/src/PrimitivesAPI/PrimitivesAPI_Box.cpp b/src/PrimitivesAPI/PrimitivesAPI_Box.cpp new file mode 100644 index 000000000..2c2e016cb --- /dev/null +++ b/src/PrimitivesAPI/PrimitivesAPI_Box.cpp @@ -0,0 +1,86 @@ +// Copyright (C) 2014-2016 CEA/DEN, EDF R&D --> + +// File: PrimitivesAPI_Box.cpp +// Created: 28 June 2016 +// Author: Clarisse Genrault + +#include "PrimitivesAPI_Box.h" + +#include + +//================================================================================================== +PrimitivesAPI_Box::PrimitivesAPI_Box(const std::shared_ptr& theFeature) +: ModelHighAPI_Interface(theFeature) +{ + initialize(); +} + +//================================================================================================== +PrimitivesAPI_Box::PrimitivesAPI_Box(const std::shared_ptr& theFeature, + const ModelHighAPI_Double & theDx, + const ModelHighAPI_Double & theDy, + const ModelHighAPI_Double & theDz) +: ModelHighAPI_Interface(theFeature) +{ + if (initialize()) + setDimensions(theDx, theDy, theDz); +} + +//================================================================================================== +PrimitivesAPI_Box::PrimitivesAPI_Box(const std::shared_ptr& theFeature, + const ModelHighAPI_Selection& theFirstPoint, + const ModelHighAPI_Selection& theSecondPoint) +: ModelHighAPI_Interface(theFeature) +{ + if (initialize()) + setPoints(theFirstPoint, theSecondPoint); +} + +//================================================================================================== +PrimitivesAPI_Box::~PrimitivesAPI_Box() +{ + +} + +//================================================================================================== +void PrimitivesAPI_Box::setDimensions(const ModelHighAPI_Double& theDx, + const ModelHighAPI_Double& theDy, + const ModelHighAPI_Double& theDz) +{ + fillAttribute(PrimitivesPlugin_Box::CREATION_METHOD_BY_DIMENSIONS(), creationMethod()); + fillAttribute(theDx, dx()); + fillAttribute(theDy, dy()); + fillAttribute(theDz, dz()); + + execute(); +} + +//================================================================================================== +void PrimitivesAPI_Box::setPoints(const ModelHighAPI_Selection& theFirstPoint, + const ModelHighAPI_Selection& theSecondPoint) +{ + fillAttribute(PrimitivesPlugin_Box::CREATION_METHOD_BY_TWO_POINTS(), creationMethod()); + fillAttribute(theFirstPoint, firstPoint()); + fillAttribute(theSecondPoint, secondPoint()); + + execute(); +} + +//================================================================================================== +BoxPtr addBox(const std::shared_ptr& thePart, + const ModelHighAPI_Double& theDx, + const ModelHighAPI_Double& theDy, + const ModelHighAPI_Double& theDz) +{ + std::shared_ptr aFeature = thePart->addFeature(PrimitivesAPI_Box::ID()); + return BoxPtr(new PrimitivesAPI_Box(aFeature, theDx, theDy, theDz)); +} + +//================================================================================================== +BoxPtr addBox(const std::shared_ptr& thePart, + const ModelHighAPI_Selection& theFirstPoint, + const ModelHighAPI_Selection& theSecondPoint) +{ + std::shared_ptr aFeature = thePart->addFeature(PrimitivesAPI_Box::ID()); + return BoxPtr(new PrimitivesAPI_Box(aFeature, theFirstPoint, theSecondPoint)); +} \ No newline at end of file diff --git a/src/PrimitivesAPI/PrimitivesAPI_Box.h b/src/PrimitivesAPI/PrimitivesAPI_Box.h new file mode 100644 index 000000000..fc084964d --- /dev/null +++ b/src/PrimitivesAPI/PrimitivesAPI_Box.h @@ -0,0 +1,86 @@ +// Copyright (C) 2014-2016 CEA/DEN, EDF R&D --> + +// File: PrimitivesAPI_Box.h +// Created: 28 June 2016 +// Author: Clarisse Genrault (CEA) + +#ifndef PrimitivesAPI_Box_H_ +#define PrimitivesAPI_Box_H_ + +#include "PrimitivesAPI.h" + +#include + +#include +#include + +class ModelHighAPI_Double; +class ModelHighAPI_Selection; + +/// \class PrimitivesPlugin_Box +/// \ingroup CPPHighAPI +/// \brief Interface for primitive Box feature. +class PrimitivesAPI_Box: public ModelHighAPI_Interface +{ +public: + /// Constructor without values. + PRIMITIVESAPI_EXPORT + explicit PrimitivesAPI_Box(const std::shared_ptr& theFeature); + + /// Constructor with values. + PRIMITIVESAPI_EXPORT + explicit PrimitivesAPI_Box(const std::shared_ptr& theFeature, + const ModelHighAPI_Double& theDx, + const ModelHighAPI_Double& theDy, + const ModelHighAPI_Double& theDz); + + /// Constructor with values. + PRIMITIVESAPI_EXPORT + explicit PrimitivesAPI_Box(const std::shared_ptr& theFeature, + const ModelHighAPI_Selection& theFirstPoint, + const ModelHighAPI_Selection& theSecondPoint); + + /// Destructor. + PRIMITIVESAPI_EXPORT + virtual ~PrimitivesAPI_Box(); + + INTERFACE_6(PrimitivesPlugin_Box::ID(), + creationMethod, PrimitivesPlugin_Box::CREATION_METHOD(), + ModelAPI_AttributeString, /** Creation method */, + dx, PrimitivesPlugin_Box::DX_ID(), ModelAPI_AttributeDouble, /** Dimension in X */, + dy, PrimitivesPlugin_Box::DY_ID(), ModelAPI_AttributeDouble, /** Dimension in Y */, + dz, PrimitivesPlugin_Box::DZ_ID(), ModelAPI_AttributeDouble, /** Dimension in Z */, + firstPoint, PrimitivesPlugin_Box::POINT_FIRST_ID(), ModelAPI_AttributeSelection, /** First point */, + secondPoint, PrimitivesPlugin_Box::POINT_SECOND_ID(), ModelAPI_AttributeSelection, /** Second point */) + + /// Set dimensions + PRIMITIVESAPI_EXPORT + void setDimensions(const ModelHighAPI_Double& theDx, + const ModelHighAPI_Double& theDy, + const ModelHighAPI_Double& theDz); + + /// Set points + PRIMITIVESAPI_EXPORT + void setPoints(const ModelHighAPI_Selection& theFirstPoint, + const ModelHighAPI_Selection& theSecondPoint); +}; + +/// Pointer on primitive Box object +typedef std::shared_ptr BoxPtr; + +/// \ingroup CPPHighAPI +/// \brief Create primitive Box feature. +PRIMITIVESAPI_EXPORT +BoxPtr addBox(const std::shared_ptr& thePart, + const ModelHighAPI_Double& theDx, + const ModelHighAPI_Double& theDy, + const ModelHighAPI_Double& theDz); + +/// \ingroup CPPHighAPI +/// \brief Create primitive Box feature. +PRIMITIVESAPI_EXPORT +BoxPtr addBox(const std::shared_ptr& thePart, + const ModelHighAPI_Selection& theFirstPoint, + const ModelHighAPI_Selection& theSecondPoint); + +#endif // PrimitivesAPI_Box_H_ \ No newline at end of file diff --git a/src/PrimitivesAPI/PrimitivesAPI_swig.h b/src/PrimitivesAPI/PrimitivesAPI_swig.h new file mode 100644 index 000000000..c3bbe6d35 --- /dev/null +++ b/src/PrimitivesAPI/PrimitivesAPI_swig.h @@ -0,0 +1,15 @@ +// Copyright (C) 2014-2016 CEA/DEN, EDF R&D + +// File: PrimitivesAPI_swig.h +// Created: 28 June 2016 +// Author: Clarisse Genrault (CEA) + +#ifndef PrimitivesAPI_swig_H_ +#define PrimitivesAPI_swig_H_ + + #include + + #include "PrimitivesAPI_Box.h" + + +#endif // PrimitivesAPI_swig_H_ diff --git a/src/PrimitivesPlugin/PrimitivesPlugin.h b/src/PrimitivesPlugin/PrimitivesPlugin.h index a2996d38d..5b616dc1e 100644 --- a/src/PrimitivesPlugin/PrimitivesPlugin.h +++ b/src/PrimitivesPlugin/PrimitivesPlugin.h @@ -1,4 +1,4 @@ -// Copyright (C) 2014-20xx CEA/DEN, EDF R&D --> +// Copyright (C) 2014-2016 CEA/DEN, EDF R&D --> #ifndef PRIMITIVESPLUGIN_H #define PRIMITIVESPLUGIN_H diff --git a/src/PrimitivesPlugin/PrimitivesPlugin_Box.cpp b/src/PrimitivesPlugin/PrimitivesPlugin_Box.cpp index 734d87d8f..8f150802e 100644 --- a/src/PrimitivesPlugin/PrimitivesPlugin_Box.cpp +++ b/src/PrimitivesPlugin/PrimitivesPlugin_Box.cpp @@ -24,35 +24,35 @@ PrimitivesPlugin_Box::PrimitivesPlugin_Box() // Nothing to do during instantiati //================================================================================================= void PrimitivesPlugin_Box::initAttributes() { - data()->addAttribute(PrimitivesPlugin_Box::METHOD(), ModelAPI_AttributeString::typeId()); + data()->addAttribute(PrimitivesPlugin_Box::CREATION_METHOD(), ModelAPI_AttributeString::typeId()); - data()->addAttribute(PrimitivesPlugin_Box::DX(), ModelAPI_AttributeDouble::typeId()); - data()->addAttribute(PrimitivesPlugin_Box::DY(), ModelAPI_AttributeDouble::typeId()); - data()->addAttribute(PrimitivesPlugin_Box::DZ(), ModelAPI_AttributeDouble::typeId()); + data()->addAttribute(PrimitivesPlugin_Box::DX_ID(), ModelAPI_AttributeDouble::typeId()); + data()->addAttribute(PrimitivesPlugin_Box::DY_ID(), ModelAPI_AttributeDouble::typeId()); + data()->addAttribute(PrimitivesPlugin_Box::DZ_ID(), ModelAPI_AttributeDouble::typeId()); - data()->addAttribute(PrimitivesPlugin_Box::POINT_FIRST(), ModelAPI_AttributeSelection::typeId()); - data()->addAttribute(PrimitivesPlugin_Box::POINT_SECOND(), ModelAPI_AttributeSelection::typeId()); + data()->addAttribute(PrimitivesPlugin_Box::POINT_FIRST_ID(), ModelAPI_AttributeSelection::typeId()); + data()->addAttribute(PrimitivesPlugin_Box::POINT_SECOND_ID(), ModelAPI_AttributeSelection::typeId()); } //================================================================================================= void PrimitivesPlugin_Box::execute() { - AttributeStringPtr aMethodTypeAttr = string(PrimitivesPlugin_Box::METHOD()); + AttributeStringPtr aMethodTypeAttr = string(PrimitivesPlugin_Box::CREATION_METHOD()); std::string aMethodType = aMethodTypeAttr->value(); - if (aMethodType == "BoxByDimensions") + if (aMethodType == CREATION_METHOD_BY_DIMENSIONS()) createBoxByDimensions(); - if (aMethodType == "BoxByTwoPoints") + if (aMethodType == CREATION_METHOD_BY_TWO_POINTS()) createBoxByTwoPoints(); } //================================================================================================= void PrimitivesPlugin_Box::createBoxByDimensions() { - double aDx = real(PrimitivesPlugin_Box::DX())->value(); - double aDy = real(PrimitivesPlugin_Box::DY())->value(); - double aDz = real(PrimitivesPlugin_Box::DZ())->value(); + double aDx = real(PrimitivesPlugin_Box::DX_ID())->value(); + double aDy = real(PrimitivesPlugin_Box::DY_ID())->value(); + double aDz = real(PrimitivesPlugin_Box::DZ_ID())->value(); std::shared_ptr aBoxAlgo(new GeomAlgoAPI_Box(aDx,aDy,aDz)); @@ -85,8 +85,8 @@ void PrimitivesPlugin_Box::createBoxByDimensions() //================================================================================================= void PrimitivesPlugin_Box::createBoxByTwoPoints() { - AttributeSelectionPtr aRef1 = data()->selection(PrimitivesPlugin_Box::POINT_FIRST()); - AttributeSelectionPtr aRef2 = data()->selection(PrimitivesPlugin_Box::POINT_SECOND()); + AttributeSelectionPtr aRef1 = data()->selection(PrimitivesPlugin_Box::POINT_FIRST_ID()); + AttributeSelectionPtr aRef2 = data()->selection(PrimitivesPlugin_Box::POINT_SECOND_ID()); std::shared_ptr aBoxAlgo; diff --git a/src/PrimitivesPlugin/PrimitivesPlugin_Box.h b/src/PrimitivesPlugin/PrimitivesPlugin_Box.h index 7672d2fb8..8db0d5417 100644 --- a/src/PrimitivesPlugin/PrimitivesPlugin_Box.h +++ b/src/PrimitivesPlugin/PrimitivesPlugin_Box.h @@ -33,46 +33,60 @@ class PrimitivesPlugin_Box : public ModelAPI_Feature return MY_BOX_ID; } - /// attribute name for creation method - inline static const std::string& METHOD() + /// Attribute name for creation method + inline static const std::string& CREATION_METHOD() { - static const std::string METHOD_ATTR("CreationMethod"); - return METHOD_ATTR; + static const std::string MY_CREATION_METHOD_ID("CreationMethod"); + return MY_CREATION_METHOD_ID; + } + + /// Attribute name for creation method + inline static const std::string& CREATION_METHOD_BY_DIMENSIONS() + { + static const std::string MY_CREATION_METHOD_ID("BoxByDimensions"); + return MY_CREATION_METHOD_ID; + } + + /// Attribute name for creation method + inline static const std::string& CREATION_METHOD_BY_TWO_POINTS() + { + static const std::string MY_CREATION_METHOD_ID("BoxByTwoPoints"); + return MY_CREATION_METHOD_ID; } - /// attribute name of first point - inline static const std::string& POINT_FIRST() + /// Attribute name of first point + inline static const std::string& POINT_FIRST_ID() { - static const std::string MY_POINT_FIRST("FirstPoint"); - return MY_POINT_FIRST; + static const std::string MY_POINT_FIRST_ID("FirstPoint"); + return MY_POINT_FIRST_ID; } - /// attribute name of second point - inline static const std::string& POINT_SECOND() + /// Attribute name of second point + inline static const std::string& POINT_SECOND_ID() { - static const std::string MY_POINT_SECOND("SecondPoint"); - return MY_POINT_SECOND; + static const std::string MY_POINT_SECOND_ID("SecondPoint"); + return MY_POINT_SECOND_ID; } - /// attribute first coordinate - inline static const std::string& DX() + /// Attribute first coordinate + inline static const std::string& DX_ID() { - static const std::string MY_DX("dx"); - return MY_DX; + static const std::string MY_DX_ID("dx"); + return MY_DX_ID; } - /// attribute second coordinate - inline static const std::string& DY() + /// Attribute second coordinate + inline static const std::string& DY_ID() { - static const std::string MY_DY("dy"); - return MY_DY; + static const std::string MY_DY_ID("dy"); + return MY_DY_ID; } - /// attribute third coordinate - inline static const std::string& DZ() + /// Attribute third coordinate + inline static const std::string& DZ_ID() { - static const std::string MY_DZ("dz"); - return MY_DZ; + static const std::string MY_DZ_ID("dz"); + return MY_DZ_ID; } /// Returns the kind of a feature diff --git a/src/PythonAPI/CMakeLists.txt b/src/PythonAPI/CMakeLists.txt index f3431c622..2e53fd8fb 100644 --- a/src/PythonAPI/CMakeLists.txt +++ b/src/PythonAPI/CMakeLists.txt @@ -34,6 +34,8 @@ ADD_UNIT_TESTS( TestFeatures.py TestFeaturesExtrusion.py TestFeaturesRevolution.py + + TestPrimitivesBox.py TestMakeBrick1.py TestMakeBrick2.py diff --git a/src/PythonAPI/Test/TestFeatures.py b/src/PythonAPI/Test/TestFeatures.py index d991e3e13..35ff9679e 100644 --- a/src/PythonAPI/Test/TestFeatures.py +++ b/src/PythonAPI/Test/TestFeatures.py @@ -72,6 +72,9 @@ class FeaturesTestCase(FeaturesFixture): FeaturesAPI.FeaturesAPI_Rotation(self.part.addFeature("Rotation")) FeaturesAPI.FeaturesAPI_Translation(self.part.addFeature("Translation")) FeaturesAPI.FeaturesAPI_Group(self.part.addFeature("Group")) + + import PrimitivesAPI + PrimitivesAPI.PrimitivesAPI_Box(self.part.addFeature("Box")) import ParametersAPI ParametersAPI.ParametersAPI_Parameter(self.part.addFeature("Parameter")) diff --git a/src/PythonAPI/Test/TestPrimitivesBox.py b/src/PythonAPI/Test/TestPrimitivesBox.py new file mode 100644 index 000000000..e78b131e4 --- /dev/null +++ b/src/PythonAPI/Test/TestPrimitivesBox.py @@ -0,0 +1,43 @@ +import unittest + +import ModelAPI + +import model + +class PrimitivesAddBox(unittest.TestCase): + + def setUp(self): + model.begin() + # Create part + partset = model.moduleDocument() + self.part = model.addPart(partset).document() + model.do() + + def tearDown(self): + model.end() + model.reset() + +#----------------------------------------------------------------------------- +# TestCases + +class PrimitivesAddBoxTestCase(PrimitivesAddBox): + + def test_add_box_by_dimensions(self): + box = model.addBox(self.part, 50, 20, 10) + model.do() + self.assertEqual(box.creationMethod().value(),"BoxByDimensions") + self.assertEqual(box.dx().value(),50) + self.assertEqual(box.dy().value(),20) + self.assertEqual(box.dz().value(),10) + + def test_add_box_by_two_points(self): + point1 = model.addPoint(self.part,0,0,0).result() + point2 = model.addPoint(self.part,10,10,10).result() + box = model.addBox(self.part, point1[0], point2[0]) + model.do() + self.assertEqual(box.creationMethod().value(),"BoxByTwoPoints") + self.assertEqual(box.firstPoint().context().shape().isVertex(),True) + self.assertEqual(box.secondPoint().context().shape().isVertex(),True) + +if __name__ == "__main__": + unittest.main() diff --git a/src/PythonAPI/examples/MakeBrick3.py b/src/PythonAPI/examples/MakeBrick3.py index 94fa252d2..edfc0b3e5 100644 --- a/src/PythonAPI/examples/MakeBrick3.py +++ b/src/PythonAPI/examples/MakeBrick3.py @@ -19,6 +19,6 @@ mypart = model.addPart(mypartset).document() # Creating the base of the box -extension.addBox( mypart, 10, 20, 30 ) +extension.addBoxScript( mypart, 10, 20, 30 ) model.end() diff --git a/src/PythonAPI/extension/__init__.py b/src/PythonAPI/extension/__init__.py index b57f516a1..1429590dc 100644 --- a/src/PythonAPI/extension/__init__.py +++ b/src/PythonAPI/extension/__init__.py @@ -1,4 +1,4 @@ """User-defined features. """ -from box import addBox \ No newline at end of file +from box import addBoxScript \ No newline at end of file diff --git a/src/PythonAPI/extension/box.py b/src/PythonAPI/extension/box.py index 9d4d66ce9..5897da2c5 100644 --- a/src/PythonAPI/extension/box.py +++ b/src/PythonAPI/extension/box.py @@ -7,7 +7,7 @@ from model import Interface from macros.box.feature import BoxFeature as MY -def addBox(part, *args): +def addBoxScript(part, *args): """Add Box feature to the part and return Box. Pass all args to Box __init__ function. diff --git a/src/PythonAPI/model/__init__.py b/src/PythonAPI/model/__init__.py index e359630fe..58ddaac99 100644 --- a/src/PythonAPI/model/__init__.py +++ b/src/PythonAPI/model/__init__.py @@ -20,3 +20,4 @@ from exchange import * from features import * from parameter import * from partset import * +from primitives import * diff --git a/src/PythonAPI/model/primitives/__init__.py b/src/PythonAPI/model/primitives/__init__.py new file mode 100644 index 000000000..aeb61cd51 --- /dev/null +++ b/src/PythonAPI/model/primitives/__init__.py @@ -0,0 +1,4 @@ +"""Package for Primitives plugin for the Parametric Geometry API of the Modeler. +""" + +from PrimitivesAPI import addBox