--- /dev/null
+## Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+INCLUDE(Common)
+
+SET(PROJECT_HEADERS
+ FeaturesAPI.h
+ FeaturesAPI_Rotation.h
+ FeaturesAPI_Translation.h
+)
+
+SET(PROJECT_SOURCES
+ FeaturesAPI_Rotation.cpp
+ FeaturesAPI_Translation.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/FeaturesPlugin
+)
+
+#TODO(spo): is ${CAS_DEFINITIONS} necessary?
+ADD_DEFINITIONS(-DFEATURESAPI_EXPORTS ${CAS_DEFINITIONS})
+ADD_LIBRARY(FeaturesAPI SHARED ${PROJECT_SOURCES} ${PROJECT_HEADERS})
+TARGET_LINK_LIBRARIES(FeaturesAPI ${PROJECT_LIBRARIES})
+
+# SWIG wrapper
+
+INCLUDE(PythonAPI)
+
+SET_SOURCE_FILES_PROPERTIES(FeaturesAPI.i PROPERTIES CPLUSPLUS ON)
+SET_SOURCE_FILES_PROPERTIES(FeaturesAPI.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
+ FeaturesAPI
+ ModelHighAPI
+ ModelAPI
+ ${PYTHON_LIBRARIES}
+)
+
+SET(SWIG_MODULE_FeaturesAPI_EXTRA_DEPS ${SWIG_MODULE_FeaturesAPI_EXTRA_DEPS}
+ ${PROJECT_SOURCE_DIR}/src/ModelHighAPI/ModelHighAPI.i
+ doxyhelp.i
+ ${PROJECT_HEADERS}
+)
+
+SWIG_ADD_MODULE(FeaturesAPI python FeaturesAPI.i ${PROJECT_HEADERS})
+SWIG_LINK_LIBRARIES(FeaturesAPI ${SWIG_LINK_LIBRARIES})
+
+IF(WIN32)
+ SET_TARGET_PROPERTIES(_FeaturesAPI PROPERTIES DEBUG_OUTPUT_NAME _FeaturesAPI_d)
+ENDIF(WIN32)
+
+INSTALL(TARGETS _FeaturesAPI DESTINATION ${SHAPER_INSTALL_SWIG})
+INSTALL(TARGETS FeaturesAPI DESTINATION ${SHAPER_INSTALL_BIN})
+INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/FeaturesAPI.py DESTINATION ${SHAPER_INSTALL_SWIG})
+
+# Tests
+INCLUDE(UnitTest)
+
+ADD_UNIT_TESTS(
+)
+
+# ADD_SUBDIRECTORY (Test)
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+#ifndef FEATURESAPI_H
+#define FEATURESAPI_H
+
+#if defined FEATURESAPI_EXPORTS
+#if defined WIN32
+#define FEATURESAPI_EXPORT __declspec( dllexport )
+#else
+#define FEATURESAPI_EXPORT
+#endif
+#else
+#if defined WIN32
+#define FEATURESAPI_EXPORT __declspec( dllimport )
+#else
+#define FEATURESAPI_EXPORT
+#endif
+#endif
+
+#endif
--- /dev/null
+/* FeaturesAPI.i */
+
+%module FeaturesAPI
+
+%{
+ #include "FeaturesAPI_swig.h"
+%}
+
+%include "doxyhelp.i"
+
+// import other modules
+%import "ModelHighAPI.i"
+
+// to avoid error on this
+#define FEATURESAPI_EXPORT
+
+// standard definitions
+%include "typemaps.i"
+%include "std_shared_ptr.i"
+
+// shared pointers
+%shared_ptr(FeaturesAPI_Rotation)
+%shared_ptr(FeaturesAPI_Translation)
+
+// all supported interfaces
+%include "FeaturesAPI_Rotation.h"
+%include "FeaturesAPI_Translation.h"
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
+
+// File: FeaturesAPI_Rotation.cpp
+// Created: 07 June 2016
+// Author: Dmitry Bobylev
+
+#include "FeaturesAPI_Rotation.h"
+
+#include <ModelHighAPI_Tools.h>
+
+//==================================================================================================
+FeaturesAPI_Rotation::FeaturesAPI_Rotation(const std::shared_ptr<ModelAPI_Feature> & theFeature)
+: ModelHighAPI_Interface(theFeature)
+{
+ initialize();
+}
+
+//==================================================================================================
+FeaturesAPI_Rotation::FeaturesAPI_Rotation(const std::shared_ptr<ModelAPI_Feature> & theFeature,
+ const std::list<ModelHighAPI_Selection>& theMainObjects,
+ const ModelHighAPI_Selection& theAxisObject,
+ const ModelHighAPI_Double& theAngle)
+: ModelHighAPI_Interface(theFeature)
+{
+ if(initialize()) {
+ setMainObjects(theMainObjects);
+ setAxisObject(theAxisObject);
+ setAngle(theAngle);
+ }
+}
+
+//==================================================================================================
+FeaturesAPI_Rotation::~FeaturesAPI_Rotation()
+{
+
+}
+
+//==================================================================================================
+void FeaturesAPI_Rotation::setMainObjects(const std::list<ModelHighAPI_Selection>& theMainObjects)
+{
+ fillAttribute(theMainObjects, mymainObjects);
+
+ execute();
+}
+
+//==================================================================================================
+void FeaturesAPI_Rotation::setAxisObject(const ModelHighAPI_Selection& theAxisObject)
+{
+ fillAttribute(theAxisObject, myaxisObject);
+
+ execute();
+}
+
+//==================================================================================================
+void FeaturesAPI_Rotation::setAngle(const ModelHighAPI_Double& theAngle)
+{
+ fillAttribute(theAngle, myangle);
+
+ execute();
+}
+
+// TODO(spo): make add* as static functions of the class
+//==================================================================================================
+RotationPtr addRotation(const std::shared_ptr<ModelAPI_Document> & thePart,
+ const std::list<ModelHighAPI_Selection>& theMainObjects,
+ const ModelHighAPI_Selection& theAxisObject,
+ const ModelHighAPI_Double& theDistance)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_Rotation::ID());
+ return RotationPtr(new FeaturesAPI_Rotation(aFeature, theMainObjects, theAxisObject, theDistance));
+}
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
+
+// File: FeaturesAPI_Rotation.h
+// Created: 07 June 2016
+// Author: Dmitry Bobylev
+
+#ifndef FeaturesAPI_Rotation_H_
+#define FeaturesAPI_Rotation_H_
+
+#include "FeaturesAPI.h"
+
+#include <FeaturesPlugin_Rotation.h>
+
+#include <ModelHighAPI_Interface.h>
+#include <ModelHighAPI_Macro.h>
+
+class ModelHighAPI_Double;
+class ModelHighAPI_Selection;
+
+/// \class FeaturesAPI_Rotation
+/// \ingroup CPPHighAPI
+/// \brief Interface for Rotation feature.
+class FeaturesAPI_Rotation : public ModelHighAPI_Interface
+{
+public:
+ /// Constructor without values.
+ FEATURESAPI_EXPORT
+ explicit FeaturesAPI_Rotation(const std::shared_ptr<ModelAPI_Feature> & theFeature);
+
+ /// Constructor with values.
+ FEATURESAPI_EXPORT
+ FeaturesAPI_Rotation(const std::shared_ptr<ModelAPI_Feature> & theFeature,
+ const std::list<ModelHighAPI_Selection>& theMainObjects,
+ const ModelHighAPI_Selection& theAxisObject,
+ const ModelHighAPI_Double& theAngle);
+
+ /// Destructor.
+ FEATURESAPI_EXPORT
+ virtual ~FeaturesAPI_Rotation();
+
+ INTERFACE_3(FeaturesPlugin_Rotation::ID(),
+ mainObjects, FeaturesPlugin_Rotation::OBJECTS_LIST_ID(), ModelAPI_AttributeSelectionList, /** Main objects */,
+ axisObject, FeaturesPlugin_Rotation::AXIS_OBJECT_ID(), ModelAPI_AttributeSelection, /** Axis object */,
+ angle, FeaturesPlugin_Rotation::ANGLE_ID(), ModelAPI_AttributeDouble, /** Angle */)
+
+ /// Set main objects.
+ FEATURESAPI_EXPORT
+ void setMainObjects(const std::list<ModelHighAPI_Selection>& theMainObjects);
+
+ /// Set axis object.
+ FEATURESAPI_EXPORT
+ void setAxisObject(const ModelHighAPI_Selection& theAxisObject);
+
+ /// Set angle.
+ FEATURESAPI_EXPORT
+ void setAngle(const ModelHighAPI_Double& theAngle);
+};
+
+/// Pointer on Rotation object.
+typedef std::shared_ptr<FeaturesAPI_Rotation> RotationPtr;
+
+/// \ingroup CPPHighAPI
+/// \brief Create Rotation feature.
+FEATURESAPI_EXPORT
+RotationPtr addRotation(const std::shared_ptr<ModelAPI_Document> & thePart,
+ const std::list<ModelHighAPI_Selection>& theMainObjects,
+ const ModelHighAPI_Selection& theAxisObject,
+ const ModelHighAPI_Double& theDistance);
+
+#endif // FeaturesAPI_Rotation_H_
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
+
+// File: FeaturesAPI_Translation.cpp
+// Created: 07 June 2016
+// Author: Dmitry Bobylev
+
+#include "FeaturesAPI_Translation.h"
+
+#include <ModelHighAPI_Tools.h>
+
+//==================================================================================================
+FeaturesAPI_Translation::FeaturesAPI_Translation(const std::shared_ptr<ModelAPI_Feature> & theFeature)
+: ModelHighAPI_Interface(theFeature)
+{
+ initialize();
+}
+
+//==================================================================================================
+FeaturesAPI_Translation::FeaturesAPI_Translation(const std::shared_ptr<ModelAPI_Feature> & theFeature,
+ const std::list<ModelHighAPI_Selection>& theMainObjects,
+ const ModelHighAPI_Selection& theAxisObject,
+ const ModelHighAPI_Double& theDistance)
+: ModelHighAPI_Interface(theFeature)
+{
+ if(initialize()) {
+ setMainObjects(theMainObjects);
+ setAxisObject(theAxisObject);
+ setDistance(theDistance);
+ }
+}
+
+//==================================================================================================
+FeaturesAPI_Translation::~FeaturesAPI_Translation()
+{
+
+}
+
+//==================================================================================================
+void FeaturesAPI_Translation::setMainObjects(const std::list<ModelHighAPI_Selection>& theMainObjects)
+{
+ fillAttribute(theMainObjects, mymainObjects);
+
+ execute();
+}
+
+//==================================================================================================
+void FeaturesAPI_Translation::setAxisObject(const ModelHighAPI_Selection& theAxisObject)
+{
+ fillAttribute(theAxisObject, myaxisObject);
+
+ execute();
+}
+
+//==================================================================================================
+void FeaturesAPI_Translation::setDistance(const ModelHighAPI_Double& theDistance)
+{
+ fillAttribute(theDistance, mydistance);
+
+ execute();
+}
+
+// TODO(spo): make add* as static functions of the class
+//==================================================================================================
+TranslationPtr addTranslation(const std::shared_ptr<ModelAPI_Document> & thePart,
+ const std::list<ModelHighAPI_Selection>& theMainObjects,
+ const ModelHighAPI_Selection& theAxisObject,
+ const ModelHighAPI_Double& theDistance)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_Translation::ID());
+ return TranslationPtr(new FeaturesAPI_Translation(aFeature, theMainObjects, theAxisObject, theDistance));
+}
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
+
+// File: FeaturesAPI_Translation.h
+// Created: 07 June 2016
+// Author: Dmitry Bobylev
+
+#ifndef FeaturesAPI_Translation_H_
+#define FeaturesAPI_Translation_H_
+
+#include "FeaturesAPI.h"
+
+#include <FeaturesPlugin_Translation.h>
+
+#include <ModelHighAPI_Interface.h>
+#include <ModelHighAPI_Macro.h>
+
+class ModelHighAPI_Double;
+class ModelHighAPI_Selection;
+
+/// \class FeaturesAPI_Translation
+/// \ingroup CPPHighAPI
+/// \brief Interface for Translation feature.
+class FeaturesAPI_Translation : public ModelHighAPI_Interface
+{
+public:
+ /// Constructor without values.
+ FEATURESAPI_EXPORT
+ explicit FeaturesAPI_Translation(const std::shared_ptr<ModelAPI_Feature> & theFeature);
+
+ /// Constructor with values.
+ FEATURESAPI_EXPORT
+ FeaturesAPI_Translation(const std::shared_ptr<ModelAPI_Feature> & theFeature,
+ const std::list<ModelHighAPI_Selection>& theMainObjects,
+ const ModelHighAPI_Selection& theAxisObject,
+ const ModelHighAPI_Double& theDistance);
+
+ /// Destructor.
+ FEATURESAPI_EXPORT
+ virtual ~FeaturesAPI_Translation();
+
+ INTERFACE_3(FeaturesPlugin_Translation::ID(),
+ mainObjects, FeaturesPlugin_Translation::OBJECTS_LIST_ID(), ModelAPI_AttributeSelectionList, /** Main objects */,
+ axisObject, FeaturesPlugin_Translation::AXIS_OBJECT_ID(), ModelAPI_AttributeSelection, /** Axis object */,
+ distance, FeaturesPlugin_Translation::DISTANCE_ID(), ModelAPI_AttributeDouble, /** Distance */)
+
+ /// Set main objects.
+ FEATURESAPI_EXPORT
+ void setMainObjects(const std::list<ModelHighAPI_Selection>& theMainObjects);
+
+ /// Set axis object.
+ FEATURESAPI_EXPORT
+ void setAxisObject(const ModelHighAPI_Selection& theAxisObject);
+
+ /// Set distance.
+ FEATURESAPI_EXPORT
+ void setDistance(const ModelHighAPI_Double& theDistance);
+};
+
+/// Pointer on Translation object.
+typedef std::shared_ptr<FeaturesAPI_Translation> TranslationPtr;
+
+/// \ingroup CPPHighAPI
+/// \brief Create Translation feature.
+FEATURESAPI_EXPORT
+TranslationPtr addTranslation(const std::shared_ptr<ModelAPI_Document> & thePart,
+ const std::list<ModelHighAPI_Selection>& theMainObjects,
+ const ModelHighAPI_Selection& theAxisObject,
+ const ModelHighAPI_Double& theDistance);
+
+#endif // FeaturesAPI_Translation_H_
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+// File: FeaturesAPI_swig.h
+// Created: 07 June 2016
+// Author: Dmitry Bobylev
+
+#ifndef FeaturesAPI_swig_H_
+#define FeaturesAPI_swig_H_
+
+ #include <ModelHighAPI_swig.h>
+
+ #include "FeaturesAPI.h"
+ #include "FeaturesAPI_Rotation.h"
+ #include "FeaturesAPI_Translation.h"
+
+#endif // FeaturesAPI_swig_H_
ExchangeAPI.ExchangeAPI_Import(self.part.addFeature("Import"))
ExchangeAPI.ExchangeAPI_Export(self.part.addFeature("Export"))
+ import FeaturesAPI
model.features.boolean.Boolean(self.part.addFeature("Boolean"))
model.features.extrusion.Extrusion(self.part.addFeature("Extrusion"))
# model.features.extrusion_boolean.ExtrusionBoolean(self.part.addFeature("ExtrusionCut"))
# model.features.revolution_boolean.RevolutionBoolean(self.part.addFeature("RevolutionCut"))
# model.features.revolution_boolean.RevolutionBoolean(self.part.addFeature("RevolutionFuse"))
model.features.placement.Placement(self.part.addFeature("Placement"))
- model.features.rotation.Rotation(self.part.addFeature("Rotation"))
- model.features.translation.Translation(self.part.addFeature("Translation"))
+ FeaturesAPI.FeaturesAPI_Rotation(self.part.addFeature("Rotation"))
+ FeaturesAPI.FeaturesAPI_Translation(self.part.addFeature("Translation"))
model.features.group.Group(self.part.addFeature("Group"))
model.parameter.Parameter(self.part.addFeature("Parameter"))