FeaturesPlugin_Movement.h
FeaturesPlugin_Boolean.h
FeaturesPlugin_Group.h
+ FeaturesPlugin_Partition.h
FeaturesPlugin_Placement.h
FeaturesPlugin_CompositeBoolean.h
FeaturesPlugin_ExtrusionBoolean.h
FeaturesPlugin_Movement.cpp
FeaturesPlugin_Boolean.cpp
FeaturesPlugin_Group.cpp
+ FeaturesPlugin_Partition.cpp
FeaturesPlugin_Placement.cpp
FeaturesPlugin_CompositeBoolean.cpp
FeaturesPlugin_ExtrusionBoolean.cpp
movement_widget.xml
boolean_widget.xml
group_widget.xml
+ partition_widget.xml
placement_widget.xml
)
#define _LAST_TAG 3
#define EDGE 6
-#define DEBUG_COMPSOLID
+//#define DEBUG_COMPSOLID
//#define DEBUG_COMPSOLID_SHAPE
//=================================================================================================
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
+
+// File: FeaturesPlugin_Partition.cpp
+// Created: 31 Jul 2015
+// Author: Natalia ERMOLAEVA
+
+#include "FeaturesPlugin_Partition.h"
+
+#include <ModelAPI_Data.h>
+#include <ModelAPI_Document.h>
+#include <ModelAPI_AttributeReference.h>
+#include <ModelAPI_AttributeInteger.h>
+#include <ModelAPI_BodyBuilder.h>
+#include <ModelAPI_ResultBody.h>
+#include <ModelAPI_AttributeSelectionList.h>
+#include <ModelAPI_Session.h>
+#include <ModelAPI_Validator.h>
+
+//=================================================================================================
+FeaturesPlugin_Partition::FeaturesPlugin_Partition()
+{
+}
+
+//=================================================================================================
+void FeaturesPlugin_Partition::initAttributes()
+{
+
+ AttributeSelectionListPtr aSelection =
+ std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(data()->addAttribute(
+ FeaturesPlugin_Partition::OBJECT_LIST_ID(), ModelAPI_AttributeSelectionList::typeId()));
+ aSelection->setSelectionType("SOLID");
+
+ aSelection = std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(data()->addAttribute(
+ FeaturesPlugin_Partition::TOOL_LIST_ID(), ModelAPI_AttributeSelectionList::typeId()));
+ aSelection->setSelectionType("SOLID");
+
+ ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), TOOL_LIST_ID());
+}
+
+//=================================================================================================
+std::shared_ptr<GeomAPI_Shape> FeaturesPlugin_Partition::getShape(const std::string& theAttrName)
+{
+ std::shared_ptr<ModelAPI_AttributeReference> aObjRef = std::dynamic_pointer_cast<
+ ModelAPI_AttributeReference>(data()->attribute(theAttrName));
+ if (aObjRef) {
+ std::shared_ptr<ModelAPI_ResultBody> aConstr = std::dynamic_pointer_cast<
+ ModelAPI_ResultBody>(aObjRef->value());
+ if (aConstr)
+ return aConstr->shape();
+ }
+ return std::shared_ptr<GeomAPI_Shape>();
+}
+
+//=================================================================================================
+void FeaturesPlugin_Partition::execute()
+{
+}
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
+
+// File: FeaturesPlugin_Partition.h
+// Created: 31 Jul 2015
+// Author: Natalia ERMOLAEVA
+
+#ifndef FeaturesPlugin_Partition_H_
+#define FeaturesPlugin_Partition_H_
+
+#include "FeaturesPlugin.h"
+#include <ModelAPI_Feature.h>
+
+/**\class FeaturesPlugin_Partition
+ * \ingroup Plugins
+ * \brief Feature for applying of Partition operations on Solids. Partition makes conjunctional
+ * faces of solids as shared. The result of partitions is a compsolid.
+ * Main objects are solids, tool objects are solids or faces
+ */
+class FeaturesPlugin_Partition : public ModelAPI_Feature
+{
+public:
+ /// Extrusion kind
+ inline static const std::string& ID()
+ {
+ static const std::string MY_ID("Partition");
+ return MY_ID;
+ }
+ /// attribute name of referenced object
+ inline static const std::string& OBJECT_LIST_ID()
+ {
+ static const std::string MY_OBJECT_LIST_ID("main_objects");
+ return MY_OBJECT_LIST_ID;
+ }
+ /// attribute name of tool object
+ inline static const std::string& TOOL_LIST_ID()
+ {
+ static const std::string MY_TOOL_LIST_ID("tool_objects");
+ return MY_TOOL_LIST_ID;
+ }
+
+ /// Returns the kind of a feature
+ FEATURESPLUGIN_EXPORT virtual const std::string& getKind()
+ {
+ static std::string MY_KIND = FeaturesPlugin_Partition::ID();
+ return MY_KIND;
+ }
+
+ /// Creates a new part document if needed
+ FEATURESPLUGIN_EXPORT virtual void execute();
+
+ /// Request for initialization of data model of the feature: adding all attributes
+ FEATURESPLUGIN_EXPORT virtual void initAttributes();
+
+ /// Use plugin manager for features creation
+ FeaturesPlugin_Partition();
+
+private:
+ std::shared_ptr<GeomAPI_Shape> getShape(const std::string& theAttrName);
+
+};
+
+#endif
#include <FeaturesPlugin_ExtrusionFuse.h>
#include <FeaturesPlugin_Group.h>
#include <FeaturesPlugin_Movement.h>
+#include <FeaturesPlugin_Partition.h>
#include <FeaturesPlugin_Placement.h>
#include <FeaturesPlugin_Revolution.h>
#include <FeaturesPlugin_RevolutionCut.h>
return FeaturePtr(new FeaturesPlugin_Boolean);
} else if (theFeatureID == FeaturesPlugin_Group::ID()) {
return FeaturePtr(new FeaturesPlugin_Group);
+ } else if (theFeatureID == FeaturesPlugin_Partition::ID()) {
+ return FeaturePtr(new FeaturesPlugin_Partition);
} else if (theFeatureID == FeaturesPlugin_Placement::ID()) {
return FeaturePtr(new FeaturesPlugin_Placement);
} else if (theFeatureID == FeaturesPlugin_ExtrusionCut::ID()) {
--- /dev/null
+<!-- Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
+
+<source>
+ <multi_selector id="main_objects"
+ label="Main objects"
+ icon=":icons/cut_shape.png"
+ tooltip="Select a solid objects"
+ type_choice="Solids"
+ use_choice="false"
+ concealment="true">
+ <validator id="PartSet_DifferentObjects"/>
+ <validator id="GeomValidators_ShapeType" parameters="empty,solid"/>
+ </multi_selector>
+ <multi_selector id="tool_objects"
+ label="Tool object"
+ icon=":icons/cut_tool.png"
+ tooltip="Select a tool solid"
+ type_choice="Faces"
+ concealment="true" >
+ <validator id="PartSet_DifferentObjects"/>
+ </multi_selector>
+</source>
<feature id="Boolean" title="Boolean" tooltip="Perform boolean operations with solids" icon=":icons/cut.png">
<source path="boolean_widget.xml"/>
</feature>
+ <feature id="Partition" title="Partition" tooltip="Perform partition operations with solids" icon=":icons/partition.png">
+ <source path="partition_widget.xml"/>
+ </feature>
</group>
<group id="Collections">
<feature id="Group"
<file>icons/radius.png</file>
<file>icons/perpendicular.png</file>
<file>icons/parallel.png</file>
+ <file>icons/partition.png</file>
<file>icons/length.png</file>
<file>icons/distance.png</file>
<file>icons/radius_constr.png</file>