SET(PROJECT_HEADERS
FeaturesAPI.h
+ FeaturesAPI_Boolean.h
FeaturesAPI_Placement.h
FeaturesAPI_Rotation.h
FeaturesAPI_Translation.h
)
SET(PROJECT_SOURCES
+ FeaturesAPI_Boolean.cpp
FeaturesAPI_Placement.cpp
FeaturesAPI_Rotation.cpp
FeaturesAPI_Translation.cpp
%include "std_shared_ptr.i"
// shared pointers
+%shared_ptr(FeaturesAPI_Boolean)
%shared_ptr(FeaturesAPI_Placement)
%shared_ptr(FeaturesAPI_Rotation)
%shared_ptr(FeaturesAPI_Translation)
// all supported interfaces
+%include "FeaturesAPI_Boolean.h"
%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_Boolean.cpp
+// Created: 07 June 2016
+// Author: Dmitry Bobylev
+
+#include "FeaturesAPI_Boolean.h"
+
+#include <ModelHighAPI_Integer.h>
+#include <ModelHighAPI_Selection.h>
+#include <ModelHighAPI_Tools.h>
+
+//==================================================================================================
+FeaturesAPI_Boolean::FeaturesAPI_Boolean(const std::shared_ptr<ModelAPI_Feature> & theFeature)
+: ModelHighAPI_Interface(theFeature)
+{
+ initialize();
+}
+
+//==================================================================================================
+FeaturesAPI_Boolean::FeaturesAPI_Boolean(const std::shared_ptr<ModelAPI_Feature> & theFeature,
+ const ModelHighAPI_Integer& theBoolType,
+ const std::list<ModelHighAPI_Selection>& theMainObjects,
+ const std::list<ModelHighAPI_Selection>& theToolObjects)
+: ModelHighAPI_Interface(theFeature)
+{
+ if(initialize()) {
+ setBoolType(theBoolType);
+ setMainObjects(theMainObjects);
+ setToolObjects(theToolObjects);
+ }
+}
+
+//==================================================================================================
+FeaturesAPI_Boolean::~FeaturesAPI_Boolean()
+{
+
+}
+
+//==================================================================================================
+void FeaturesAPI_Boolean::setBoolType(const ModelHighAPI_Integer& theBoolType)
+{
+ fillAttribute(theBoolType, myboolType);
+
+ execute();
+}
+
+//==================================================================================================
+void FeaturesAPI_Boolean::setMainObjects(const std::list<ModelHighAPI_Selection>& theMainObjects)
+{
+ fillAttribute(theMainObjects, mymainObjects);
+
+ execute();
+}
+
+//==================================================================================================
+void FeaturesAPI_Boolean::setToolObjects(const std::list<ModelHighAPI_Selection>& theToolObjects)
+{
+ fillAttribute(theToolObjects, mytoolObjects);
+
+ execute();
+}
+
+// TODO(spo): make add* as static functions of the class
+//==================================================================================================
+BooleanPtr addCut(const std::shared_ptr<ModelAPI_Document> & thePart,
+ const std::list<ModelHighAPI_Selection>& theMainObjects,
+ const std::list<ModelHighAPI_Selection>& theToolObjects)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_Boolean::ID());
+ return BooleanPtr(new FeaturesAPI_Boolean(aFeature,
+ FeaturesPlugin_Boolean::BOOL_CUT,
+ theMainObjects,
+ theToolObjects));
+}
+
+//==================================================================================================
+BooleanPtr addFuse(const std::shared_ptr<ModelAPI_Document> & thePart,
+ const std::list<ModelHighAPI_Selection>& theObjects)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_Boolean::ID());
+ std::list<ModelHighAPI_Selection> aToolObjects;
+ return BooleanPtr(new FeaturesAPI_Boolean(aFeature,
+ FeaturesPlugin_Boolean::BOOL_FUSE,
+ theObjects,
+ aToolObjects));
+}
+
+//==================================================================================================
+BooleanPtr addFuse(const std::shared_ptr<ModelAPI_Document> & thePart,
+ const std::list<ModelHighAPI_Selection>& theMainObjects,
+ const std::list<ModelHighAPI_Selection>& theToolObjects)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_Boolean::ID());
+ return BooleanPtr(new FeaturesAPI_Boolean(aFeature,
+ FeaturesPlugin_Boolean::BOOL_FUSE,
+ theMainObjects,
+ theToolObjects));
+}
+
+//==================================================================================================
+BooleanPtr addCommon(const std::shared_ptr<ModelAPI_Document> & thePart,
+ const std::list<ModelHighAPI_Selection>& theMainObjects,
+ const std::list<ModelHighAPI_Selection>& theToolObjects)
+{
+ std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_Boolean::ID());
+ return BooleanPtr(new FeaturesAPI_Boolean(aFeature,
+ FeaturesPlugin_Boolean::BOOL_COMMON,
+ theMainObjects,
+ theToolObjects));
+}
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
+
+// File: FeaturesAPI_Boolean.h
+// Created: 07 June 2016
+// Author: Dmitry Bobylev
+
+#ifndef FeaturesAPI_Boolean_H_
+#define FeaturesAPI_Boolean_H_
+
+#include "FeaturesAPI.h"
+
+#include <FeaturesPlugin_Boolean.h>
+
+#include <ModelHighAPI_Interface.h>
+#include <ModelHighAPI_Macro.h>
+
+class ModelHighAPI_Integer;
+class ModelHighAPI_Selection;
+
+/// \class FeaturesAPI_Boolean
+/// \ingroup CPPHighAPI
+/// \brief Interface for Boolean feature.
+class FeaturesAPI_Boolean : public ModelHighAPI_Interface
+{
+public:
+ /// Constructor without values.
+ FEATURESAPI_EXPORT
+ explicit FeaturesAPI_Boolean(const std::shared_ptr<ModelAPI_Feature> & theFeature);
+
+ /// Constructor with values.
+ FEATURESAPI_EXPORT
+ FeaturesAPI_Boolean(const std::shared_ptr<ModelAPI_Feature> & theFeature,
+ const ModelHighAPI_Integer& theBoolType,
+ const std::list<ModelHighAPI_Selection>& theMainObjects,
+ const std::list<ModelHighAPI_Selection>& theToolObjects);
+
+ /// Destructor.
+ FEATURESAPI_EXPORT
+ virtual ~FeaturesAPI_Boolean();
+
+ INTERFACE_3(FeaturesPlugin_Boolean::ID(),
+ boolType, FeaturesPlugin_Boolean::TYPE_ID(), ModelAPI_AttributeInteger, /** Operation type */,
+ mainObjects, FeaturesPlugin_Boolean::OBJECT_LIST_ID(), ModelAPI_AttributeSelectionList, /** Main objects */,
+ toolObjects, FeaturesPlugin_Boolean::TOOL_LIST_ID(), ModelAPI_AttributeSelectionList, /** Tool objects*/)
+
+ /// Set operation type.
+ FEATURESAPI_EXPORT
+ void setBoolType(const ModelHighAPI_Integer& theBoolType);
+
+ /// Set main objects.
+ FEATURESAPI_EXPORT
+ void setMainObjects(const std::list<ModelHighAPI_Selection>& theMainObjects);
+
+ /// Set tool objects.
+ FEATURESAPI_EXPORT
+ void setToolObjects(const std::list<ModelHighAPI_Selection>& theToolObjects);
+};
+
+/// Pointer on Boolean object.
+typedef std::shared_ptr<FeaturesAPI_Boolean> BooleanPtr;
+
+/// \ingroup CPPHighAPI
+/// \brief Create Boolean Cut feature.
+FEATURESAPI_EXPORT
+BooleanPtr addCut(const std::shared_ptr<ModelAPI_Document> & thePart,
+ const std::list<ModelHighAPI_Selection>& theMainObjects,
+ const std::list<ModelHighAPI_Selection>& theToolObjects);
+
+/// \ingroup CPPHighAPI
+/// \brief Create Boolean Fuse feature.
+FEATURESAPI_EXPORT
+BooleanPtr addFuse(const std::shared_ptr<ModelAPI_Document> & thePart,
+ const std::list<ModelHighAPI_Selection>& theObjects);
+
+/// \ingroup CPPHighAPI
+/// \brief Create Boolean Fuse feature.
+FEATURESAPI_EXPORT
+BooleanPtr addFuse(const std::shared_ptr<ModelAPI_Document> & thePart,
+ const std::list<ModelHighAPI_Selection>& theMainObjects,
+ const std::list<ModelHighAPI_Selection>& theToolObjects);
+
+/// \ingroup CPPHighAPI
+/// \brief Create Boolean Common feature.
+FEATURESAPI_EXPORT
+BooleanPtr addCommon(const std::shared_ptr<ModelAPI_Document> & thePart,
+ const std::list<ModelHighAPI_Selection>& theMainObjects,
+ const std::list<ModelHighAPI_Selection>& theToolObjects);
+
+#endif // FeaturesAPI_Boolean_H_
#include <ModelHighAPI_Interface.h>
#include <ModelHighAPI_Macro.h>
-class ModelHighAPI_Double;
class ModelHighAPI_Selection;
/// \class FeaturesAPI_Placement
#include <ModelHighAPI_swig.h>
#include "FeaturesAPI.h"
+ #include "FeaturesAPI_Boolean.h"
#include "FeaturesAPI_Placement.h"
#include "FeaturesAPI_Rotation.h"
#include "FeaturesAPI_Translation.h"
# "addImport", "exportToFile",
"addAxis",
- "addAddition", "addSubtraction", "addIntersection",
+ "addCut", "addFuse", "addCommon",
"addExtrusion",
# "addExtrusionCut", "addExtrusionFuse",
"addRevolution",
ExchangeAPI.ExchangeAPI_Export(self.part.addFeature("Export"))
import FeaturesAPI
- model.features.boolean.Boolean(self.part.addFeature("Boolean"))
+ FeaturesAPI.FeaturesAPI_Boolean(self.part.addFeature("Boolean"))
model.features.extrusion.Extrusion(self.part.addFeature("Extrusion"))
# model.features.extrusion_boolean.ExtrusionBoolean(self.part.addFeature("ExtrusionCut"))
# model.features.extrusion_boolean.ExtrusionBoolean(self.part.addFeature("ExtrusionFuse"))