]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
GUI for extrusion/revolution features.
authornds <natalia.donis@opencascade.com>
Fri, 24 Apr 2015 16:14:28 +0000 (19:14 +0300)
committernds <natalia.donis@opencascade.com>
Fri, 24 Apr 2015 16:14:28 +0000 (19:14 +0300)
src/FeaturesPlugin/FeaturesPlugin_Extrusion.cpp
src/FeaturesPlugin/FeaturesPlugin_Extrusion.h
src/FeaturesPlugin/extrusion_widget.xml

index 3056c26826725267bb419994850fb66990db52ff..9a0b37766c665f87844ba9ac303813f7c286a72b 100644 (file)
@@ -14,6 +14,8 @@
 #include <ModelAPI_AttributeSelection.h>
 #include <ModelAPI_AttributeSelectionList.h>
 #include <ModelAPI_AttributeBoolean.h>
+#include <ModelAPI_AttributeString.h>
+#include <ModelAPI_AttributeReference.h>
 #include <GeomAlgoAPI_Extrusion.h>
 
 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;
 
index 2150ce72023c8a72023a77e4775e6b52b0387122..f3e7880491ec8c0a8b7d25d1c10d205b4913cc65 100644 (file)
@@ -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()
   {
index adbe17b11541e5971ca8a5724a65584af036ddc2..8144d2db64fbf08925056fd77fb2b0fedd9cde86 100644 (file)
@@ -8,15 +8,97 @@
     type_choice="Faces">
     <validator id="PartSet_SketchEntityValidator" parameters="Sketch"/>
   </multi_selector>
-  <doublevalue
-    id="size"
-    label="Size"
-    min="0"
-    step="1.0"
-    default="1"
-    icon=":icons/dimension_v.png"
-    tooltip="Height">
-    <validator id="GeomValidators_Positive"/>
-  </doublevalue>
-  <boolvalue id="reverse" label="Reverse" default="false" tooltip="Reverse default direction"/>
+  <!--<groupbox title="From">
+    <shape_selector id="from_object"
+                    icon=":icons/plane.png"
+                    label="Plane face"
+                    tooltip="Select a planar face"
+                    shape_types="face" obligatory="false">
+      <validator id="GeomValidators_Face" parameters="plane"/>
+    </shape_selector>
+    <doublevalue
+      id="from_size"
+      label="Size"
+      min="0"
+      step="1.0"
+      default="0"
+      icon=":icons/dimension_down.png"
+      tooltip="Height"
+      obligatory="false">
+      <validator id="GeomValidators_Positive"/>
+    </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"
+                    obligatory="false">
+      <validator id="GeomValidators_Face" parameters="plane"/>
+    </shape_selector>-->
+    <doublevalue
+      id="to_size"
+      label="Size"
+      min="0"
+      step="1.0"
+      default="10"
+      icon=":icons/dimension_up.png"
+      tooltip="Height">
+      <validator id="GeomValidators_Positive"/>
+    </doublevalue>
+    <boolvalue id="reverse" label="Reverse" default="false" tooltip="Reverse default direction"/>
+  </groupbox>-->
+<!--XML definition of the revolution:-->
+<!--  <multi_selector id="base"
+    label="Select a sketch face"
+    icon=":icons/sketch.png"
+    tooltip="Select a sketch face"
+    type_choice="Faces">
+    <validator id="PartSet_SketchEntityValidator" parameters="Sketch"/>
+  </multi_selector>
+  <shape_selector id="axis_object"
+                  icon=":icons/axis.png"
+                  label="Plane face"
+                  tooltip="Select a planar face"
+                  shape_types="edge">
+  </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">
+      <validator id="GeomValidators_Face" parameters="plane"/>
+    </shape_selector>
+    <doublevalue
+      id="from_size"
+      label="Size"
+      min="0"
+      step="1.0"
+      default="0"
+      icon=":icons/angle_down.png"
+      tooltip="Height">
+      <validator id="GeomValidators_Positive"/>
+    </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">
+      <validator id="GeomValidators_Face" parameters="plane"/>
+    </shape_selector>
+    <doublevalue
+      id="to_size"
+      label="Size"
+      min="0"
+      step="1.0"
+      default="10"
+      icon=":icons/angle_up.png"
+      tooltip="Height">
+      <validator id="GeomValidators_Positive"/>
+    </doublevalue>
+  </groupbox>-->
 </source>