FeaturesPlugin.h
FeaturesPlugin_Plugin.h
FeaturesPlugin_Extrusion.h
+ FeaturesPlugin_ExtrusionCut.h
FeaturesPlugin_Revolution.h
+ FeaturesPlugin_Rotation.h
FeaturesPlugin_Boolean.h
FeaturesPlugin_Group.h
FeaturesPlugin_Placement.h
SET(PROJECT_SOURCES
FeaturesPlugin_Plugin.cpp
FeaturesPlugin_Extrusion.cpp
+ FeaturesPlugin_ExtrusionCut.cpp
FeaturesPlugin_Revolution.cpp
+ FeaturesPlugin_Rotation.cpp
FeaturesPlugin_Boolean.cpp
FeaturesPlugin_Group.cpp
FeaturesPlugin_Placement.cpp
SET(XML_RESOURCES
plugin-Features.xml
extrusion_widget.xml
+ extrusioncut_widget.xml
revolution_widget.xml
+ rotation_widget.xml
boolean_widget.xml
group_widget.xml
placement_widget.xml
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+// File: FeaturesPlugin_ExtrusionCut.cpp
+// Created: 12 May 2015
+// Author: Dmitry Bobylev
+
+#include <FeaturesPlugin_ExtrusionCut.h>
+
+#include <ModelAPI_AttributeDouble.h>
+#include <ModelAPI_AttributeSelectionList.h>
+#include <ModelAPI_AttributeReference.h>
+#include <ModelAPI_Validator.h>
+#include <ModelAPI_Session.h>
+
+//=================================================================================================
+FeaturesPlugin_ExtrusionCut::FeaturesPlugin_ExtrusionCut()
+{
+}
+
+//=================================================================================================
+void FeaturesPlugin_ExtrusionCut::initAttributes()
+{
+ data()->addAttribute(FeaturesPlugin_ExtrusionCut::SKETCH_OBJECT_ID(), ModelAPI_AttributeReference::typeId());
+
+ data()->addAttribute(FeaturesPlugin_ExtrusionCut::TO_SIZE_ID(), ModelAPI_AttributeDouble::typeId());
+ data()->addAttribute(FeaturesPlugin_ExtrusionCut::FROM_SIZE_ID(), ModelAPI_AttributeDouble::typeId());
+
+ data()->addAttribute(FeaturesPlugin_ExtrusionCut::AXIS_OBJECT_ID(), ModelAPI_AttributeReference::typeId());
+
+ data()->addAttribute(FeaturesPlugin_ExtrusionCut::FROM_OBJECT_ID(), ModelAPI_AttributeSelection::typeId());
+ data()->addAttribute(FeaturesPlugin_ExtrusionCut::TO_OBJECT_ID(), ModelAPI_AttributeSelection::typeId());
+
+ ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), FeaturesPlugin_ExtrusionCut::FROM_OBJECT_ID());
+ ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), FeaturesPlugin_ExtrusionCut::TO_OBJECT_ID());
+
+ AttributeSelectionListPtr aSelection =
+ std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(data()->addAttribute(
+ FeaturesPlugin_ExtrusionCut::LIST_ID(), ModelAPI_AttributeSelectionList::typeId()));
+ // extrusion works with faces always
+ aSelection->setSelectionType("SOLID");
+}
+
+//=================================================================================================
+void FeaturesPlugin_ExtrusionCut::execute()
+{
+}
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+// File: FeaturesPlugin_ExtrusionCut.h
+// Created: 12 May 2015
+// Author: Dmitry Bobylev
+
+#ifndef FeaturesPlugin_ExtrusionCut_H_
+#define FeaturesPlugin_ExtrusionCut_H_
+
+#include <FeaturesPlugin.h>
+
+#include <ModelAPI_Feature.h>
+
+/** \class FeaturesPlugin_ExtrusionCut
+ * \ingroup Plugins
+ */
+class FeaturesPlugin_ExtrusionCut : public ModelAPI_Feature
+{
+ public:
+ /// Revolution kind.
+ inline static const std::string& ID()
+ {
+ static const std::string MY_REVOLUTION_ID("ExtrusionCut");
+ return MY_REVOLUTION_ID;
+ }
+
+ /// attribute name of references sketch entities list, it should contain a sketch result or
+ /// a pair a sketch result to sketch face
+ inline static const std::string& LIST_ID()
+ {
+ static const std::string MY_GROUP_LIST_ID("main_objects");
+ return MY_GROUP_LIST_ID;
+ }
+
+ /// attribute name of an object to which the extrusion grows
+ inline static const std::string& SKETCH_OBJECT_ID()
+ {
+ static const std::string MY_TO_OBJECT_ID("sketch");
+ return MY_TO_OBJECT_ID;
+ }
+
+ /// Attribute name of an object to which the extrusion grows.
+ inline static const std::string& AXIS_OBJECT_ID()
+ {
+ static const std::string MY_TO_OBJECT_ID("axis_object");
+ return MY_TO_OBJECT_ID;
+ }
+
+ /// attribute name of extrusion size
+ inline static const std::string& TO_SIZE_ID()
+ {
+ static const std::string MY_TO_SIZE_ID("to_size");
+ return MY_TO_SIZE_ID;
+ }
+
+ /// attribute name of extrusion size
+ inline static const std::string& FROM_SIZE_ID()
+ {
+ static const std::string MY_FROM_SIZE_ID("from_size");
+ return MY_FROM_SIZE_ID;
+ }
+
+ /// attribute name of an object to which the extrusion grows
+ inline static const std::string& TO_OBJECT_ID()
+ {
+ static const std::string MY_TO_OBJECT_ID("to_object");
+ return MY_TO_OBJECT_ID;
+ }
+
+ /// attribute name of tool object
+ inline static const std::string& FROM_OBJECT_ID()
+ {
+ static const std::string MY_FROM_OBJECT_ID("from_object");
+ return MY_FROM_OBJECT_ID;
+ }
+
+ /// Returns the kind of a feature
+ FEATURESPLUGIN_EXPORT virtual const std::string& getKind()
+ {
+ static std::string MY_KIND = FeaturesPlugin_ExtrusionCut::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_ExtrusionCut();
+};
+
+#endif
#include <ModelAPI_ResultBody.h>
#include <ModelAPI_AttributeSelection.h>
#include <ModelAPI_AttributeBoolean.h>
+#include <ModelAPI_AttributeSelectionList.h>
#include <GeomAPI_Edge.h>
#include <GeomAPI_Face.h>
void FeaturesPlugin_Placement::initAttributes()
{
+ /* Modification for specification of 1.3.0
+ AttributeSelectionListPtr aSelection =
+ std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(data()->addAttribute(
+ FeaturesPlugin_Placement::LIST_ID(), ModelAPI_AttributeSelectionList::typeId()));
+ // extrusion works with faces always
+ aSelection->setSelectionType("SOLID");
+ */
data()->addAttribute(FeaturesPlugin_Placement::BASE_OBJECT_ID(), ModelAPI_AttributeSelection::typeId());
data()->addAttribute(FeaturesPlugin_Placement::ATTRACT_OBJECT_ID(), ModelAPI_AttributeSelection::typeId());
data()->addAttribute(FeaturesPlugin_Placement::REVERSE_ID(), ModelAPI_AttributeBoolean::typeId());
static const std::string MY_PLACEMENT_ID("Placement");
return MY_PLACEMENT_ID;
}
+ /// attribute name of references sketch entities list, it should contain a sketch result or
+ /// a pair a sketch result to sketch face
+ /*Modification for specification of 1.3.0
+ inline static const std::string& LIST_ID()
+ {
+ static const std::string MY_GROUP_LIST_ID("base");
+ return MY_GROUP_LIST_ID;
+ }*/
/// attribute name of referenced object
inline static const std::string& BASE_OBJECT_ID()
{
#include <FeaturesPlugin_Boolean.h>
#include <FeaturesPlugin_Extrusion.h>
+#include <FeaturesPlugin_ExtrusionCut.h>
#include <FeaturesPlugin_Group.h>
#include <FeaturesPlugin_Placement.h>
#include <FeaturesPlugin_Revolution.h>
+#include <FeaturesPlugin_Rotation.h>
#include <ModelAPI_Session.h>
if (theFeatureID == FeaturesPlugin_Extrusion::ID()) {
return FeaturePtr(new FeaturesPlugin_Extrusion);
} else if (theFeatureID == FeaturesPlugin_Revolution::ID()) {
- return FeaturePtr(new FeaturesPlugin_Revolution);
+ return FeaturePtr(new FeaturesPlugin_Revolution);
+ } else if (theFeatureID == FeaturesPlugin_Rotation::ID()) {
+ return FeaturePtr(new FeaturesPlugin_Rotation);
} else if (theFeatureID == FeaturesPlugin_Boolean::ID()) {
return FeaturePtr(new FeaturesPlugin_Boolean);
} else if (theFeatureID == FeaturesPlugin_Group::ID()) {
return FeaturePtr(new FeaturesPlugin_Group);
} else if (theFeatureID == FeaturesPlugin_Placement::ID()) {
return FeaturePtr(new FeaturesPlugin_Placement);
+ } else if (theFeatureID == FeaturesPlugin_ExtrusionCut::ID()) {
+ return FeaturePtr(new FeaturesPlugin_ExtrusionCut);
}
// feature of such kind is not found
return FeaturePtr();
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+// File: FeaturesPlugin_Rotation.cpp
+// Created: 12 May 2015
+// Author: Dmitry Bobylev
+
+#include <FeaturesPlugin_Rotation.h>
+
+#include <ModelAPI_AttributeDouble.h>
+#include <ModelAPI_AttributeSelectionList.h>
+#include <ModelAPI_Session.h>
+
+//=================================================================================================
+FeaturesPlugin_Rotation::FeaturesPlugin_Rotation()
+{
+}
+
+//=================================================================================================
+void FeaturesPlugin_Rotation::initAttributes()
+{
+ AttributeSelectionListPtr aSelection =
+ std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(data()->addAttribute(
+ FeaturesPlugin_Rotation::LIST_ID(), ModelAPI_AttributeSelectionList::typeId()));
+ // revolution works with faces always
+ aSelection->setSelectionType("SOLID");
+
+ data()->addAttribute(FeaturesPlugin_Rotation::AXIS_OBJECT_ID(), ModelAPI_AttributeSelection::typeId());
+
+ data()->addAttribute(FeaturesPlugin_Rotation::ANGLE_ID(), ModelAPI_AttributeDouble::typeId());
+}
+
+//=================================================================================================
+void FeaturesPlugin_Rotation::execute()
+{
+}
--- /dev/null
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+// File: FeaturesPlugin_Rotation.h
+// Created: 12 May 2015
+// Author: Dmitry Bobylev
+
+#ifndef FeaturesPlugin_Rotation_H_
+#define FeaturesPlugin_Rotation_H_
+
+#include <FeaturesPlugin.h>
+
+#include <ModelAPI_Feature.h>
+
+/** \class FeaturesPlugin_Rotation
+ * \ingroup Plugins
+ * \brief Feature for creation of revolution from the planar face.
+ * Revolution creates the lateral faces based on edges of the base face and
+ * the start and end faces and/or start and end angles.
+ */
+class FeaturesPlugin_Rotation : public ModelAPI_Feature
+{
+ public:
+ /// Revolution kind.
+ inline static const std::string& ID()
+ {
+ static const std::string MY_REVOLUTION_ID("Rotation");
+ return MY_REVOLUTION_ID;
+ }
+
+ /// Attribute name of references sketch entities list, it should contain a sketch result or
+ /// a pair a sketch result to sketch face.
+ inline static const std::string& LIST_ID()
+ {
+ static const std::string MY_GROUP_LIST_ID("base");
+ return MY_GROUP_LIST_ID;
+ }
+
+ /// Attribute name of an object to which the extrusion grows.
+ inline static const std::string& AXIS_OBJECT_ID()
+ {
+ static const std::string MY_TO_OBJECT_ID("axis_object");
+ return MY_TO_OBJECT_ID;
+ }
+
+ /// Attribute name of revolution angle.
+ inline static const std::string& ANGLE_ID()
+ {
+ static const std::string MY_TO_ANGLE_ID("angle");
+ return MY_TO_ANGLE_ID;
+ }
+
+ /// \return the kind of a feature.
+ FEATURESPLUGIN_EXPORT virtual const std::string& getKind()
+ {
+ static std::string MY_KIND = FeaturesPlugin_Rotation::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_Rotation();
+};
+
+#endif
--- /dev/null
+<!-- Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
+
+<source>
+ <groupbox title="Revolution">
+ <shape_selector id="main_objects"
+ label="Select an object"
+ icon=":icons/sketch.png"
+ tooltip="Select a destination element"
+ shape_types="face edge vertex"
+ default="<sketch>"
+ />
+ <shape_selector id="axis_object"
+ icon=":icons/axis.png"
+ label="Axis"
+ tooltip="Select an edge for axis"
+ shape_types="edge"
+ default="">
+ <validator id="GeomValidators_ShapeType" parameters="line"/>
+ </shape_selector>
+ <groupbox title="From">
+ <shape_selector id="from_object"
+ icon=":icons/plane.png"
+ label="Plane face"
+ tooltip="Select a planar face"
+ shape_types="face"
+ default="<sketch>">
+ <validator id="GeomValidators_Face" parameters="plane"/>
+ </shape_selector>
+ <doublevalue
+ id="from_size"
+ label="Angle"
+ min="0"
+ step="1.0"
+ default="0"
+ icon=":icons/angle_down.png"
+ tooltip="Height">
+ </doublevalue>
+ </groupbox>
+ <groupbox title="To">
+ <shape_selector id="to_object"
+ icon=":icons/plane_inverted.png"
+ label="Plane face"
+ tooltip="Select a planar face"
+ shape_types="face"
+ default="<sketch>">
+ <validator id="GeomValidators_Face" parameters="plane"/>
+ </shape_selector>
+ <doublevalue
+ id="to_size"
+ label="Angle"
+ min="0"
+ step="1.0"
+ default="0"
+ icon=":icons/angle_down.png"
+ tooltip="Height">
+ </doublevalue>
+ </groupbox>
+ </groupbox>
+ <multi_selector id="main_objects"
+ label="Cut from:"
+ icon=":icons/cut_shape.png"
+ tooltip="Select a sketch face"
+ type_choice="Solids">
+ </multi_selector>
+</source>
<!-- Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
<source>
+ <!--Modification for specification of 1.3.0
+ <multi_selector id="base"
+ label="Select a sketch face"
+ icon=":icons/cut_shape.png"
+ tooltip="Select a sketch face"
+ type_choice="Solids">
+ </multi_selector>-->
+ <!--Modification for specification of 1.3.0
+ icon=":icons/placement_from.png"-->
<shape_selector id="placement_base_object"
label="Select an object"
icon=":icons/cut_shape.png"
tooltip="Select a destination element"
shape_types="face edge vertex"
/>
+ <!--Modification for specification of 1.3.0
+ icon=":icons/placement_to.png"-->
<shape_selector id="placement_attractable_object"
label="Select an object"
- icon=":icons/cut_shape.png"
+ icon=":icons/cut_shape.png"
tooltip="Select an element of moved object"
shape_types="face edge vertex"
concealment="true" >
<feature id="Placement" title="Placement" tooltip="Perform moving of an object to specified position" icon=":icons/placement.png">
<source path="placement_widget.xml"/>
</feature>
+ <!--Modification for specification of 1.3.0
+ <feature id="Rotation" title="Movement" tooltip="" icon=":icons/placement.png">
+ <source path="rotation_widget.xml"/>
+ </feature>
+ <feature id="ExtrusionCut" title="RevolutionCut" tooltip="" icon=":icons/placement.png">
+ <source path="extrusioncut_widget.xml"/>
+ </feature>-->
</group>
<group id="Collections">
<feature id="Group"
--- /dev/null
+<!-- Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
+
+<source>
+ <multi_selector id="base"
+ label="Select a sketch face"
+ icon=":icons/cut_shape.png"
+ tooltip="Select a sketch face"
+ type_choice="Solids">
+ </multi_selector>
+ <shape_selector id="axis_object"
+ icon=":icons/axis.png"
+ label="Axis"
+ tooltip="Select an edge for axis"
+ shape_types="edge"
+ default="">
+ </shape_selector>
+ <doublevalue
+ id="angle"
+ label="Angle"
+ min="0"
+ step="1.0"
+ default="0"
+ icon=":icons/radius.png"
+ tooltip="Angle">
+ </doublevalue>
+</source>
\ No newline at end of file
myTypeCombo->setVisible(false);
}
- QLabel* aListLabel = new QLabel(tr("Selected objects:"), this);
+// Modification for specification of 1.3.0
+ std::string aLabelText = "";//theData->getProperty("label");
+ QLabel* aListLabel = new QLabel(!aLabelText.empty() ? aLabelText.c_str()
+ : tr("Selected objects:"), this);
aMainLay->addWidget(aListLabel, 1, 0);
// if the xml definition contains one type, an information label should be shown near to the latest
if (aShapeTypes.size() == 1) {
<file>icons/shape_group.png</file>
<file>icons/fixed.png</file>
<file>icons/placement.png</file>
+ <file>icons/placement_from.png</file>
+ <file>icons/placement_to.png</file>
<file>icons/geom_export.png</file>
<file>icons/horisontal.png</file>
<file>icons/vertical.png</file>