From 9df889d74f1a623d4cc4e6478749bf7d15a52b6a Mon Sep 17 00:00:00 2001 From: nds Date: Fri, 24 Apr 2015 19:14:28 +0300 Subject: [PATCH] GUI for extrusion/revolution features. --- .../FeaturesPlugin_Extrusion.cpp | 13 ++- src/FeaturesPlugin/FeaturesPlugin_Extrusion.h | 42 +++++-- src/FeaturesPlugin/extrusion_widget.xml | 104 ++++++++++++++++-- 3 files changed, 139 insertions(+), 20 deletions(-) diff --git a/src/FeaturesPlugin/FeaturesPlugin_Extrusion.cpp b/src/FeaturesPlugin/FeaturesPlugin_Extrusion.cpp index 3056c2682..9a0b37766 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Extrusion.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_Extrusion.cpp @@ -14,6 +14,8 @@ #include #include #include +#include +#include #include using namespace std; @@ -33,8 +35,15 @@ void FeaturesPlugin_Extrusion::initAttributes() FeaturesPlugin_Extrusion::LIST_ID(), ModelAPI_AttributeSelectionList::typeId())); // extrusion works with faces always aSelection->setSelectionType("FACE"); - data()->addAttribute(FeaturesPlugin_Extrusion::SIZE_ID(), ModelAPI_AttributeDouble::typeId()); + data()->addAttribute(FeaturesPlugin_Extrusion::REVERSE_ID(), ModelAPI_AttributeBoolean::typeId()); + data()->addAttribute(FeaturesPlugin_Extrusion::TO_SIZE_ID(), ModelAPI_AttributeDouble::typeId()); + //data()->addAttribute(FeaturesPlugin_Extrusion::FROM_SIZE_ID(), ModelAPI_AttributeDouble::typeId()); + + //data()->addAttribute(FeaturesPlugin_Extrusion::AXIS_OBJECT_ID(), ModelAPI_AttributeReference::typeId()); + + //data()->addAttribute(FeaturesPlugin_Extrusion::FROM_OBJECT_ID(), ModelAPI_AttributeReference::typeId()); + //data()->addAttribute(FeaturesPlugin_Extrusion::TO_OBJECT_ID(), ModelAPI_AttributeReference::typeId()); } void FeaturesPlugin_Extrusion::execute() @@ -52,7 +61,7 @@ void FeaturesPlugin_Extrusion::execute() setError(aContextError); break; } - double aSize = real(FeaturesPlugin_Extrusion::SIZE_ID())->value(); + double aSize = real(FeaturesPlugin_Extrusion::TO_SIZE_ID())->value(); if (boolean(FeaturesPlugin_Extrusion::REVERSE_ID())->value()) aSize = -aSize; diff --git a/src/FeaturesPlugin/FeaturesPlugin_Extrusion.h b/src/FeaturesPlugin/FeaturesPlugin_Extrusion.h index 2150ce720..f3e788049 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Extrusion.h +++ b/src/FeaturesPlugin/FeaturesPlugin_Extrusion.h @@ -38,19 +38,47 @@ class FeaturesPlugin_Extrusion : public ModelAPI_Feature 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 extrusion size - inline static const std::string& SIZE_ID() + inline static const std::string& TO_SIZE_ID() { - static const std::string MY_SIZE_ID("size"); - return MY_SIZE_ID; + static const std::string MY_TO_SIZE_ID("to_size"); + return MY_TO_SIZE_ID; } - /// attribute name of reverse direction - inline static const std::string& REVERSE_ID() + + /// attribute name of extrusion size + inline static const std::string& FROM_SIZE_ID() { - static const std::string MY_REVERSE_ID("reverse"); - return MY_REVERSE_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; + } + /// attribute name of reverse direction + inline static const std::string& REVERSE_ID() + { + static const std::string MY_REVERSE_ID("reverse"); + return MY_REVERSE_ID; + } + /// Returns the kind of a feature FEATURESPLUGIN_EXPORT virtual const std::string& getKind() { diff --git a/src/FeaturesPlugin/extrusion_widget.xml b/src/FeaturesPlugin/extrusion_widget.xml index adbe17b11..8144d2db6 100644 --- a/src/FeaturesPlugin/extrusion_widget.xml +++ b/src/FeaturesPlugin/extrusion_widget.xml @@ -8,15 +8,97 @@ type_choice="Faces"> - - - - + + + + + + + + --> + + -- 2.39.2