SET(PROJECT_HEADERS
FeaturesAPI.h
+ FeaturesAPI_Placement.h
FeaturesAPI_Rotation.h
FeaturesAPI_Translation.h
)
SET(PROJECT_SOURCES
+ FeaturesAPI_Placement.cpp
FeaturesAPI_Rotation.cpp
FeaturesAPI_Translation.cpp
)
%include "std_shared_ptr.i"
// shared pointers
+%shared_ptr(FeaturesAPI_Placement)
%shared_ptr(FeaturesAPI_Rotation)
%shared_ptr(FeaturesAPI_Translation)
// all supported interfaces
+%include "FeaturesAPI_Placement.h"
%include "FeaturesAPI_Rotation.h"
%include "FeaturesAPI_Translation.h"
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
+
+// File: FeaturesAPI_Placement.cpp
+// Created: 07 June 2016
+// Author: Dmitry Bobylev
+
+#include "FeaturesAPI_Placement.h"
+
+#include <ModelHighAPI_Tools.h>
+
+//==================================================================================================
+FeaturesAPI_Placement::FeaturesAPI_Placement(const std::shared_ptr<ModelAPI_Feature> & theFeature)
+: ModelHighAPI_Interface(theFeature)
+{
+ initialize();
+}
+
+//==================================================================================================
+FeaturesAPI_Placement::FeaturesAPI_Placement(const std::shared_ptr<ModelAPI_Feature> & theFeature,
+ const std::list<ModelHighAPI_Selection>& theObjects,
+ const ModelHighAPI_Selection& theStartShape,
+ const ModelHighAPI_Selection& theEndShape,
+ const bool theReverseDirection,
+ const bool theCentering)
+: ModelHighAPI_Interface(theFeature)
+{
+ if(initialize()) {
+ setObjects(theObjects);
+ setStartShape(theStartShape);
+ setEndShape(theEndShape);
+ setReverseDirection(theReverseDirection);
+ setCentering(theCentering);
+ }
+}
+
+//==================================================================================================
+FeaturesAPI_Placement::~FeaturesAPI_Placement()
+{
+
+}
+
+//==================================================================================================
+void FeaturesAPI_Placement::setObjects(const std::list<ModelHighAPI_Selection>& theObjects)
+{
+ fillAttribute(theObjects, myobjects);
+
+ execute();
+}
+
+//==================================================================================================
+void FeaturesAPI_Placement::setStartShape(const ModelHighAPI_Selection& theStartShape)
+{
+ fillAttribute(theStartShape, mystartShape);
+
+ execute();
+}
+
+//==================================================================================================
+void FeaturesAPI_Placement::setEndShape(const ModelHighAPI_Selection& theEndShape)
+{
+ fillAttribute(theEndShape, myendShape);
+
+ execute();
+}
+
+//==================================================================================================
+void FeaturesAPI_Placement::setReverseDirection(const bool theReverseDirection)
+{
+ fillAttribute(theReverseDirection, myreverseDirection);
+
+ execute();
+}
+
+//==================================================================================================
+void FeaturesAPI_Placement::setCentering(const bool theCentering)
+{
+ fillAttribute(theCentering, mycentering);
+
+ execute();
+}
+
+// TODO(spo): make add* as static functions of the class
+//==================================================================================================
+PlacementPtr addPlacement(const std::shared_ptr<ModelAPI_Document> & thePart,
+ const std::list<ModelHighAPI_Selection>& theObjects,
+ const ModelHighAPI_Selection& theStartShape,
+ const ModelHighAPI_Selection& theEndShape,
+ const bool theReverseDirection,
+ const bool theCentering)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_Placement::ID());
+ return PlacementPtr(new FeaturesAPI_Placement(aFeature,
+ theObjects,
+ theStartShape,
+ theEndShape,
+ theReverseDirection,
+ theCentering));
+}
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
+
+// File: FeaturesAPI_Placement.h
+// Created: 07 June 2016
+// Author: Dmitry Bobylev
+
+#ifndef FeaturesAPI_Placement_H_
+#define FeaturesAPI_Placement_H_
+
+#include "FeaturesAPI.h"
+
+#include <FeaturesPlugin_Placement.h>
+
+#include <ModelHighAPI_Interface.h>
+#include <ModelHighAPI_Macro.h>
+
+class ModelHighAPI_Double;
+class ModelHighAPI_Selection;
+
+/// \class FeaturesAPI_Placement
+/// \ingroup CPPHighAPI
+/// \brief Interface for Placement feature.
+class FeaturesAPI_Placement : public ModelHighAPI_Interface
+{
+public:
+ /// Constructor without values.
+ FEATURESAPI_EXPORT
+ explicit FeaturesAPI_Placement(const std::shared_ptr<ModelAPI_Feature> & theFeature);
+
+ /// Constructor with values.
+ FEATURESAPI_EXPORT
+ FeaturesAPI_Placement(const std::shared_ptr<ModelAPI_Feature> & theFeature,
+ const std::list<ModelHighAPI_Selection>& theObjects,
+ const ModelHighAPI_Selection& theStartShape,
+ const ModelHighAPI_Selection& theEndShape,
+ const bool theReverseDirection = false,
+ const bool theCentering = false);
+
+ /// Destructor.
+ FEATURESAPI_EXPORT
+ virtual ~FeaturesAPI_Placement();
+
+ INTERFACE_5(FeaturesPlugin_Placement::ID(),
+ objects, FeaturesPlugin_Placement::OBJECTS_LIST_ID(), ModelAPI_AttributeSelectionList, /** Main objects */,
+ startShape, FeaturesPlugin_Placement::START_SHAPE_ID(), ModelAPI_AttributeSelection, /** Start shape */,
+ endShape, FeaturesPlugin_Placement::END_SHAPE_ID(), ModelAPI_AttributeSelection, /** End shape */,
+ reverseDirection, FeaturesPlugin_Placement::REVERSE_ID(), ModelAPI_AttributeBoolean, /** Reverse direction flag */,
+ centering, FeaturesPlugin_Placement::CENTERING_ID(), ModelAPI_AttributeBoolean, /** Centering flag */)
+
+ /// Set objects.
+ FEATURESAPI_EXPORT
+ void setObjects(const std::list<ModelHighAPI_Selection>& theObjects);
+
+ /// Set start shape.
+ FEATURESAPI_EXPORT
+ void setStartShape(const ModelHighAPI_Selection& theStartShape);
+
+ /// Set end shape.
+ FEATURESAPI_EXPORT
+ void setEndShape(const ModelHighAPI_Selection& theEndShape);
+
+ /// Set reverse direction flag.
+ FEATURESAPI_EXPORT
+ void setReverseDirection(const bool theReverseDirection);
+
+ /// Set centering flag.
+ FEATURESAPI_EXPORT
+ void setCentering(const bool theCentering);
+};
+
+/// Pointer on Placement object.
+typedef std::shared_ptr<FeaturesAPI_Placement> PlacementPtr;
+
+/// \ingroup CPPHighAPI
+/// \brief Create Placement feature.
+FEATURESAPI_EXPORT
+PlacementPtr addPlacement(const std::shared_ptr<ModelAPI_Document> & thePart,
+ const std::list<ModelHighAPI_Selection>& theObjects,
+ const ModelHighAPI_Selection& theStartShape,
+ const ModelHighAPI_Selection& theEndShape,
+ const bool theReverseDirection = false,
+ const bool theCentering = false);
+
+#endif // FeaturesAPI_Placement_H_
#include <ModelHighAPI_swig.h>
#include "FeaturesAPI.h"
+ #include "FeaturesAPI_Placement.h"
#include "FeaturesAPI_Rotation.h"
#include "FeaturesAPI_Translation.h"
model.features.revolution.Revolution(self.part.addFeature("Revolution"))
# 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"))
+ FeaturesAPI.FeaturesAPI_Placement(self.part.addFeature("Placement"))
FeaturesAPI.FeaturesAPI_Rotation(self.part.addFeature("Rotation"))
FeaturesAPI.FeaturesAPI_Translation(self.part.addFeature("Translation"))
model.features.group.Group(self.part.addFeature("Group"))