]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Improvement #615: Widgets position in Extrusion and Rotation features must be changed.
authordbv <dbv@opencascade.com>
Tue, 23 Jun 2015 08:56:54 +0000 (11:56 +0300)
committerdbv <dbv@opencascade.com>
Tue, 23 Jun 2015 09:54:17 +0000 (12:54 +0300)
18 files changed:
src/FeaturesPlugin/FeaturesPlugin_Extrusion.cpp
src/FeaturesPlugin/FeaturesPlugin_Extrusion.h
src/FeaturesPlugin/FeaturesPlugin_ExtrusionBoolean.cpp
src/FeaturesPlugin/FeaturesPlugin_ExtrusionBoolean.h
src/FeaturesPlugin/FeaturesPlugin_Revolution.cpp
src/FeaturesPlugin/FeaturesPlugin_Revolution.h
src/FeaturesPlugin/FeaturesPlugin_RevolutionBoolean.cpp
src/FeaturesPlugin/FeaturesPlugin_RevolutionBoolean.h
src/FeaturesPlugin/extrusion_widget.xml
src/FeaturesPlugin/extrusioncut_widget.xml
src/FeaturesPlugin/extrusionfuse_widget.xml
src/FeaturesPlugin/revolution_widget.xml
src/FeaturesPlugin/revolutioncut_widget.xml
src/FeaturesPlugin/revolutionfuse_widget.xml
src/GeomAlgoAPI/GeomAlgoAPI_Prism.cpp
src/GeomAlgoAPI/GeomAlgoAPI_Prism.h
src/GeomAlgoAPI/GeomAlgoAPI_Revolution.cpp
src/GeomAlgoAPI/GeomAlgoAPI_Revolution.h

index 4a3e69108abd64ad1b708626cd5dc9059a5f3479..31015f839abb36d5fa51821dd90da970ed525b85 100644 (file)
@@ -4,7 +4,8 @@
 // Created:     30 May 2014
 // Author:      Vitaly SMETANNIKOV
 
-#include "FeaturesPlugin_Extrusion.h"
+#include <FeaturesPlugin_Extrusion.h>
+
 #include <ModelAPI_Session.h>
 #include <ModelAPI_Validator.h>
 #include <ModelAPI_Document.h>
 #include <ModelAPI_AttributeBoolean.h>
 #include <ModelAPI_AttributeString.h>
 #include <ModelAPI_AttributeReference.h>
-#include <GeomAlgoAPI_Extrusion.h>
-#include <GeomAlgoAPI_FaceBuilder.h>
+
 #include <GeomAlgoAPI_Prism.h>
 
-using namespace std;
 #define _LATERAL_TAG 1
 #define _FIRST_TAG 2
 #define _LAST_TAG 3
 #define EDGE 6
 
+//=================================================================================================
 FeaturesPlugin_Extrusion::FeaturesPlugin_Extrusion()
 {
 }
 
+//=================================================================================================
 void FeaturesPlugin_Extrusion::initAttributes()
 {
   AttributeSelectionListPtr aSelection = 
     std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(data()->addAttribute(
-    FeaturesPlugin_Extrusion::LIST_ID(), ModelAPI_AttributeSelectionList::typeId()));
+    LIST_ID(), ModelAPI_AttributeSelectionList::typeId()));
   // extrusion works with faces always
   aSelection->setSelectionType("FACE");
 
-  data()->addAttribute(FeaturesPlugin_Extrusion::TO_SIZE_ID(), ModelAPI_AttributeDouble::typeId());
-  data()->addAttribute(FeaturesPlugin_Extrusion::FROM_SIZE_ID(), ModelAPI_AttributeDouble::typeId());
+  data()->addAttribute(CREATION_METHOD(), ModelAPI_AttributeString::typeId());
+
+  data()->addAttribute(TO_SIZE_ID(), ModelAPI_AttributeDouble::typeId());
+  data()->addAttribute(TO_OBJECT_ID(), ModelAPI_AttributeSelection::typeId());
 
-  data()->addAttribute(FeaturesPlugin_Extrusion::FROM_OBJECT_ID(), ModelAPI_AttributeSelection::typeId());
-  data()->addAttribute(FeaturesPlugin_Extrusion::TO_OBJECT_ID(), ModelAPI_AttributeSelection::typeId());
+  data()->addAttribute(FROM_SIZE_ID(), ModelAPI_AttributeDouble::typeId());
+  data()->addAttribute(FROM_OBJECT_ID(), ModelAPI_AttributeSelection::typeId());
 
-  ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), FeaturesPlugin_Extrusion::FROM_OBJECT_ID());
-  ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), FeaturesPlugin_Extrusion::TO_OBJECT_ID());
+  ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), TO_OBJECT_ID());
+  ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), FROM_OBJECT_ID());
 }
 
+//=================================================================================================
 void FeaturesPlugin_Extrusion::execute()
 {
-  AttributeSelectionListPtr aFaceRefs = selectionList(FeaturesPlugin_Extrusion::LIST_ID());
+  AttributeSelectionListPtr aFaceRefs = selectionList(LIST_ID());
+
+  // Getting sizes.
+  double aFromSize = real(FROM_SIZE_ID())->value();
+  double aToSize = real(TO_SIZE_ID())->value();
 
   // Getting bounding planes.
   std::shared_ptr<GeomAPI_Shape> aFromShape;
   std::shared_ptr<GeomAPI_Shape> aToShape;
 
-  std::shared_ptr<ModelAPI_AttributeSelection> anObjRef = selection(FeaturesPlugin_Extrusion::FROM_OBJECT_ID());
-  if(anObjRef.get() != NULL) {
-    aFromShape = std::dynamic_pointer_cast<GeomAPI_Shape>(anObjRef->value());
-    if(aFromShape.get() == NULL && anObjRef->context().get() != NULL) {
-      aFromShape = anObjRef->context()->shape();
+  if(string(CREATION_METHOD())->value() == "ByPlanesAndOffsets") {
+    std::shared_ptr<ModelAPI_AttributeSelection> anObjRef = selection(FROM_OBJECT_ID());
+    if(anObjRef.get() != NULL) {
+      aFromShape = std::dynamic_pointer_cast<GeomAPI_Shape>(anObjRef->value());
+      if(aFromShape.get() == NULL && anObjRef->context().get() != NULL) {
+        aFromShape = anObjRef->context()->shape();
+      }
     }
-  }
-  anObjRef = selection(FeaturesPlugin_Extrusion::TO_OBJECT_ID());
-  if(anObjRef.get() != NULL) {
-    aToShape = std::dynamic_pointer_cast<GeomAPI_Shape>(anObjRef->value());
-    if(aToShape.get() == NULL && anObjRef->context().get() != NULL) {
-      aToShape =  anObjRef->context()->shape();
+    anObjRef = selection(TO_OBJECT_ID());
+    if(anObjRef.get() != NULL) {
+      aToShape = std::dynamic_pointer_cast<GeomAPI_Shape>(anObjRef->value());
+      if(aToShape.get() == NULL && anObjRef->context().get() != NULL) {
+        aToShape =  anObjRef->context()->shape();
+      }
     }
   }
 
-  // Getting sizes.
-  double aFromSize = real(FeaturesPlugin_Extrusion::FROM_SIZE_ID())->value();
-  double aToSize = real(FeaturesPlugin_Extrusion::TO_SIZE_ID())->value();
-
   // for each selected face generate a result
   int anIndex = 0, aResultIndex = 0;
   for(; anIndex < aFaceRefs->size(); anIndex++) {
@@ -111,7 +117,7 @@ void FeaturesPlugin_Extrusion::execute()
         aBaseShape = std::dynamic_pointer_cast<GeomAPI_Shape>(aConstruction->face(aFaceIndex));
       }
 
-      GeomAlgoAPI_Prism aFeature(aBaseShape, aFromShape, aFromSize, aToShape, aToSize);
+      GeomAlgoAPI_Prism aFeature(aBaseShape, aToShape, aToSize, aFromShape, aFromSize);
       if(!aFeature.isDone()) {
         static const std::string aFeatureError = "Extrusion algorithm failed";
         setError(aFeatureError);
@@ -143,7 +149,7 @@ void FeaturesPlugin_Extrusion::execute()
   removeResults(aResultIndex);
 }
 
-//============================================================================
+//=================================================================================================
 void FeaturesPlugin_Extrusion::LoadNamingDS(GeomAlgoAPI_Prism& theFeature,
                                             std::shared_ptr<ModelAPI_ResultBody> theResultBody,
                                             std::shared_ptr<GeomAPI_Shape> theBasis,
index 3a97d81bb308f5509c81caf63d9824501dbd45c3..2d72d49bb1817b83d968303509ff4f32257ffcf0 100644 (file)
@@ -47,6 +47,13 @@ class FeaturesPlugin_Extrusion : public ModelAPI_Feature
     return MY_TO_OBJECT_ID;
   }
 
+  /// attribute name for creation method
+  inline static const std::string& CREATION_METHOD()
+  {
+    static const std::string METHOD_ATTR("CreationMethod");
+    return METHOD_ATTR;
+  }
+
   /// attribute name of extrusion size
   inline static const std::string& TO_SIZE_ID()
   {
index af44526a7365eabfbec01ec6380130b2301dfc31..76bf4d291186c67625cac0c2908a084e41aaccdb 100644 (file)
@@ -8,6 +8,7 @@
 
 #include <ModelAPI_AttributeDouble.h>
 #include <ModelAPI_AttributeSelection.h>
+#include <ModelAPI_AttributeString.h>
 #include <ModelAPI_Session.h>
 #include <ModelAPI_Validator.h>
 
 //=================================================================================================
 void FeaturesPlugin_ExtrusionBoolean::initMakeSolidsAttributes()
 {
-  data()->addAttribute(FROM_OBJECT_ID(), ModelAPI_AttributeSelection::typeId());
-  data()->addAttribute(FROM_SIZE_ID(), ModelAPI_AttributeDouble::typeId());
+  data()->addAttribute(CREATION_METHOD(), ModelAPI_AttributeString::typeId());
 
   data()->addAttribute(TO_OBJECT_ID(), ModelAPI_AttributeSelection::typeId());
   data()->addAttribute(TO_SIZE_ID(), ModelAPI_AttributeDouble::typeId());
 
-  ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), FROM_OBJECT_ID());
+  data()->addAttribute(FROM_OBJECT_ID(), ModelAPI_AttributeSelection::typeId());
+  data()->addAttribute(FROM_SIZE_ID(), ModelAPI_AttributeDouble::typeId());
+
   ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), TO_OBJECT_ID());
+  ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), FROM_OBJECT_ID());
 }
 
 //=================================================================================================
 ListOfShape FeaturesPlugin_ExtrusionBoolean::MakeSolids(const ListOfShape& theFaces)
 {
+  // Getting extrusion sizes.
+  double aFromSize = real(FROM_SIZE_ID())->value();
+  double aToSize = real(TO_SIZE_ID())->value();
+
   // Getting extrusion bounding planes.
   std::shared_ptr<GeomAPI_Shape> aFromShape;
   std::shared_ptr<GeomAPI_Shape> aToShape;
-  std::shared_ptr<ModelAPI_AttributeSelection> anObjRef = selection(FROM_OBJECT_ID());
-  if(anObjRef.get() != NULL) {
-    aFromShape = std::dynamic_pointer_cast<GeomAPI_Shape>(anObjRef->value());
-    if(aFromShape.get() == NULL && anObjRef->context().get() != NULL) {
-      aFromShape = anObjRef->context()->shape();
+
+  if(string(CREATION_METHOD())->value() == "ByPlanesAndOffsets") {
+    std::shared_ptr<ModelAPI_AttributeSelection> anObjRef = selection(FROM_OBJECT_ID());
+    if(anObjRef.get() != NULL) {
+      aFromShape = std::dynamic_pointer_cast<GeomAPI_Shape>(anObjRef->value());
+      if(aFromShape.get() == NULL && anObjRef->context().get() != NULL) {
+        aFromShape = anObjRef->context()->shape();
+      }
     }
-  }
-  anObjRef = selection(TO_OBJECT_ID());
-  if(anObjRef.get() != NULL) {
-    aToShape = std::dynamic_pointer_cast<GeomAPI_Shape>(anObjRef->value());
-    if(aToShape.get() == NULL && anObjRef->context().get() != NULL) {
-      aToShape =  anObjRef->context()->shape();
+    anObjRef = selection(TO_OBJECT_ID());
+    if(anObjRef.get() != NULL) {
+      aToShape = std::dynamic_pointer_cast<GeomAPI_Shape>(anObjRef->value());
+      if(aToShape.get() == NULL && anObjRef->context().get() != NULL) {
+        aToShape =  anObjRef->context()->shape();
+      }
     }
   }
 
-  // Getting extrusion sizes.
-  double aFromSize = real(FROM_SIZE_ID())->value();
-  double aToSize = real(TO_SIZE_ID())->value();
-
   // Extrude faces.
   ListOfShape anExtrusionList;
   for(ListOfShape::const_iterator aFacesIt = theFaces.begin(); aFacesIt != theFaces.end(); aFacesIt++) {
     std::shared_ptr<GeomAPI_Shape> aBaseShape = *aFacesIt;
-    GeomAlgoAPI_Prism aPrismAlgo(aBaseShape, aFromShape, aFromSize, aToShape, aToSize);
+    GeomAlgoAPI_Prism aPrismAlgo(aBaseShape, aToShape, aToSize, aFromShape, aFromSize);
 
     // Checking that the algorithm worked properly.
     if(!aPrismAlgo.isDone() || aPrismAlgo.shape()->isNull() || !aPrismAlgo.isValid()) {
index a5963a348598bf8189a2a0ce43ff6f71f9e1335a..8fd63449f45f3af31475a6d6785744f8eba45a42 100644 (file)
 class FeaturesPlugin_ExtrusionBoolean : public FeaturesPlugin_CompositeBoolean
 {
  public:
+
+  /// attribute name for creation method
+  inline static const std::string& CREATION_METHOD()
+  {
+    static const std::string METHOD_ATTR("CreationMethod");
+    return METHOD_ATTR;
+  }
+
   /// Attribute name of an object from which the extrusion grows.
   inline static const std::string& FROM_OBJECT_ID()
   {
index 21aab45135e1d8c29ba74dff3573880bedd6a96e..4a7795a06717745094491cfd10e4cb0666b12082 100644 (file)
@@ -6,21 +6,17 @@
 
 #include <FeaturesPlugin_Revolution.h>
 
-#include <GeomAlgoAPI_FaceBuilder.h>
-#include <GeomAlgoAPI_Rotation.h>
-#include <GeomAPI_Ax3.h>
-#include <GeomAPI_Edge.h>
-#include <GeomAPI_Lin.h>
-#include <GeomAPI_Pln.h>
-#include <GeomAPI_XYZ.h>
-
 #include <ModelAPI_AttributeDouble.h>
 #include <ModelAPI_AttributeSelectionList.h>
+#include <ModelAPI_AttributeString.h>
 #include <ModelAPI_Session.h>
 #include <ModelAPI_Validator.h>
 #include <ModelAPI_ResultConstruction.h>
 #include <ModelAPI_ResultBody.h>
 
+#include <GeomAPI_Edge.h>
+#include <GeomAPI_Lin.h>
+
 #define FACE 4
 #define EDGE 6
 #define _LATERAL_TAG 1
@@ -37,55 +33,67 @@ void FeaturesPlugin_Revolution::initAttributes()
 {
   AttributeSelectionListPtr aSelection = 
     std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(data()->addAttribute(
-    FeaturesPlugin_Revolution::LIST_ID(), ModelAPI_AttributeSelectionList::typeId()));
+    LIST_ID(), ModelAPI_AttributeSelectionList::typeId()));
   // revolution works with faces always
   aSelection->setSelectionType("FACE");
 
-  data()->addAttribute(FeaturesPlugin_Revolution::AXIS_OBJECT_ID(), ModelAPI_AttributeSelection::typeId());
+  data()->addAttribute(AXIS_OBJECT_ID(), ModelAPI_AttributeSelection::typeId());
+
+  data()->addAttribute(CREATION_METHOD(), ModelAPI_AttributeString::typeId());
 
-  data()->addAttribute(FeaturesPlugin_Revolution::FROM_OBJECT_ID(), ModelAPI_AttributeSelection::typeId());
-  data()->addAttribute(FeaturesPlugin_Revolution::FROM_ANGLE_ID(), ModelAPI_AttributeDouble::typeId());
+  data()->addAttribute(TO_OBJECT_ID(), ModelAPI_AttributeSelection::typeId());
+  data()->addAttribute(TO_ANGLE_ID(), ModelAPI_AttributeDouble::typeId());
 
-  data()->addAttribute(FeaturesPlugin_Revolution::TO_OBJECT_ID(), ModelAPI_AttributeSelection::typeId());
-  data()->addAttribute(FeaturesPlugin_Revolution::TO_ANGLE_ID(), ModelAPI_AttributeDouble::typeId());
+  data()->addAttribute(FROM_OBJECT_ID(), ModelAPI_AttributeSelection::typeId());
+  data()->addAttribute(FROM_ANGLE_ID(), ModelAPI_AttributeDouble::typeId());
 
-  ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), FeaturesPlugin_Revolution::FROM_OBJECT_ID());
-  ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), FeaturesPlugin_Revolution::TO_OBJECT_ID());
+  ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), TO_OBJECT_ID());
+  ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), FROM_OBJECT_ID());
 }
 
 //=================================================================================================
 void FeaturesPlugin_Revolution::execute()
 {
-  AttributeSelectionListPtr aFaceRefs = selectionList(FeaturesPlugin_Revolution::LIST_ID());
+  AttributeSelectionListPtr aFaceRefs = selectionList(LIST_ID());
 
   //Getting axis.
   std::shared_ptr<GeomAPI_Ax1> anAxis;
   std::shared_ptr<GeomAPI_Edge> anEdge;
-  std::shared_ptr<ModelAPI_AttributeSelection> anObjRef = selection(FeaturesPlugin_Revolution::AXIS_OBJECT_ID());
+  std::shared_ptr<ModelAPI_AttributeSelection> anObjRef = selection(AXIS_OBJECT_ID());
   if(anObjRef && anObjRef->value() && anObjRef->value()->isEdge()) {
-    anEdge = std::shared_ptr<GeomAPI_Edge>(new GeomAPI_Edge(anObjRef->value()));
+    anEdge = std::make_shared<GeomAPI_Edge>(anObjRef->value());
+  } else if(anObjRef->context() && anObjRef->context()->shape() && anObjRef->context()->shape()->isEdge()) {
+    anEdge = std::make_shared<GeomAPI_Edge>(anObjRef->context()->shape());
   }
   if(anEdge) {
-    anAxis = std::shared_ptr<GeomAPI_Ax1>(new GeomAPI_Ax1(anEdge->line()->location(), anEdge->line()->direction()));
+    anAxis = std::make_shared<GeomAPI_Ax1>(anEdge->line()->location(), anEdge->line()->direction());
   }
 
-  // Getting bounding planes.
-  std::shared_ptr<GeomAPI_Shape> aFromShape(new GeomAPI_Shape());
-  std::shared_ptr<GeomAPI_Shape> aToShape(new GeomAPI_Shape());
+  // Getting angles.
+  double aFromAngle = real(FROM_ANGLE_ID())->value();
+  double aToAngle = real(TO_ANGLE_ID())->value();
 
-  anObjRef = selection(FeaturesPlugin_Revolution::FROM_OBJECT_ID());
-  if(anObjRef) {
-    aFromShape = std::dynamic_pointer_cast<GeomAPI_Shape>(anObjRef->value());
-  }
-  anObjRef = selection(FeaturesPlugin_Revolution::TO_OBJECT_ID());
-  if(anObjRef) {
-    aToShape = std::dynamic_pointer_cast<GeomAPI_Shape>(anObjRef->value());
+  // Getting bounding planes.
+  std::shared_ptr<GeomAPI_Shape> aFromShape;
+  std::shared_ptr<GeomAPI_Shape> aToShape;
+
+  if(string(CREATION_METHOD())->value() == "ByPlanesAndOffsets") {
+    anObjRef = selection(FROM_OBJECT_ID());
+    if(anObjRef.get() != NULL) {
+      aFromShape = std::dynamic_pointer_cast<GeomAPI_Shape>(anObjRef->value());
+      if(aFromShape.get() == NULL && anObjRef->context().get() != NULL) {
+        aFromShape = anObjRef->context()->shape();
+      }
+    }
+    anObjRef = selection(TO_OBJECT_ID());
+    if(anObjRef.get() != NULL) {
+      aToShape = std::dynamic_pointer_cast<GeomAPI_Shape>(anObjRef->value());
+      if(aToShape.get() == NULL && anObjRef->context().get() != NULL) {
+        aToShape =  anObjRef->context()->shape();
+      }
+    }
   }
 
-  // Getting angles.
-  double aFromAngle = real(FeaturesPlugin_Revolution::FROM_ANGLE_ID())->value();
-  double aToAngle = real(FeaturesPlugin_Revolution::TO_ANGLE_ID())->value();
-
   // for each selected face generate a result
   int anIndex = 0, aResultIndex = 0;
   for(; anIndex < aFaceRefs->size(); anIndex++) {
@@ -121,7 +129,7 @@ void FeaturesPlugin_Revolution::execute()
         aBaseShape = std::dynamic_pointer_cast<GeomAPI_Shape>(aConstruction->face(aFaceIndex));
       }
 
-      GeomAlgoAPI_Revolution aFeature(aBaseShape, anAxis, aFromShape, aFromAngle, aToShape, aToAngle);
+      GeomAlgoAPI_Revolution aFeature(aBaseShape, anAxis, aToShape, aToAngle, aFromShape, aFromAngle);
       if(!aFeature.isDone()) {
         static const std::string aFeatureError = "Revolution algorithm failed";
         setError(aFeatureError);
index 160cc890cdde64c1f54e6b47bd4eb1c7e424b49c..9edc1dc0ec00526e4301b880619f07d74c5ae2e3 100644 (file)
@@ -46,6 +46,13 @@ class FeaturesPlugin_Revolution : public ModelAPI_Feature
     return MY_AXIS_ID;
   }
 
+  /// attribute name for creation method
+  inline static const std::string& CREATION_METHOD()
+  {
+    static const std::string METHOD_ATTR("CreationMethod");
+    return METHOD_ATTR;
+  }
+
   /// Attribute name of revolution angle.
   inline static const std::string& TO_ANGLE_ID()
   {
index 09a0fd72b3ce491cea6bd16f674b6342561a90a4..a5f5140a3bd85f036cc5d08af9bf353d01701271 100644 (file)
@@ -8,6 +8,7 @@
 
 #include <ModelAPI_AttributeDouble.h>
 #include <ModelAPI_AttributeSelection.h>
+#include <ModelAPI_AttributeString.h>
 #include <ModelAPI_Session.h>
 #include <ModelAPI_Validator.h>
 
@@ -20,14 +21,16 @@ void FeaturesPlugin_RevolutionBoolean::initMakeSolidsAttributes()
 {
   data()->addAttribute(FeaturesPlugin_RevolutionBoolean::AXIS_OBJECT_ID(), ModelAPI_AttributeSelection::typeId());
 
-  data()->addAttribute(FROM_OBJECT_ID(), ModelAPI_AttributeSelection::typeId());
-  data()->addAttribute(FROM_ANGLE_ID(), ModelAPI_AttributeDouble::typeId());
+  data()->addAttribute(CREATION_METHOD(), ModelAPI_AttributeString::typeId());
 
   data()->addAttribute(TO_OBJECT_ID(), ModelAPI_AttributeSelection::typeId());
   data()->addAttribute(TO_ANGLE_ID(), ModelAPI_AttributeDouble::typeId());
 
-  ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), FROM_OBJECT_ID());
+  data()->addAttribute(FROM_OBJECT_ID(), ModelAPI_AttributeSelection::typeId());
+  data()->addAttribute(FROM_ANGLE_ID(), ModelAPI_AttributeDouble::typeId());
+
   ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), TO_OBJECT_ID());
+  ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), FROM_OBJECT_ID());
 }
 
 //=================================================================================================
@@ -39,38 +42,43 @@ ListOfShape FeaturesPlugin_RevolutionBoolean::MakeSolids(const ListOfShape& theF
   std::shared_ptr<ModelAPI_AttributeSelection> anObjRef = selection(FeaturesPlugin_RevolutionBoolean::AXIS_OBJECT_ID());
   if(anObjRef && anObjRef->value() && anObjRef->value()->isEdge()) {
     anEdge = std::shared_ptr<GeomAPI_Edge>(new GeomAPI_Edge(anObjRef->value()));
+  } else if(anObjRef->context() && anObjRef->context()->shape() && anObjRef->context()->shape()->isEdge()) {
+    anEdge = std::make_shared<GeomAPI_Edge>(anObjRef->context()->shape());
   }
   if(anEdge) {
     anAxis = std::shared_ptr<GeomAPI_Ax1>(new GeomAPI_Ax1(anEdge->line()->location(), anEdge->line()->direction()));
   }
 
+  // Getting revolution angles.
+  double aFromAngle = real(FROM_ANGLE_ID())->value();
+  double aToAngle = real(TO_ANGLE_ID())->value();
+
   // Getting revolution bounding planes.
   std::shared_ptr<GeomAPI_Shape> aFromShape;
   std::shared_ptr<GeomAPI_Shape> aToShape;
-  anObjRef = selection(FROM_OBJECT_ID());
-  if(anObjRef.get() != NULL) {
-    aFromShape = std::dynamic_pointer_cast<GeomAPI_Shape>(anObjRef->value());
-    if(aFromShape.get() == NULL && anObjRef->context().get() != NULL) {
-      aFromShape = anObjRef->context()->shape();
+
+  if(string(CREATION_METHOD())->value() == "ByPlanesAndOffsets") {
+    anObjRef = selection(FROM_OBJECT_ID());
+    if(anObjRef.get() != NULL) {
+      aFromShape = std::dynamic_pointer_cast<GeomAPI_Shape>(anObjRef->value());
+      if(aFromShape.get() == NULL && anObjRef->context().get() != NULL) {
+        aFromShape = anObjRef->context()->shape();
+      }
     }
-  }
-  anObjRef = selection(TO_OBJECT_ID());
-  if(anObjRef.get() != NULL) {
-    aToShape = std::dynamic_pointer_cast<GeomAPI_Shape>(anObjRef->value());
-    if(aToShape.get() == NULL && anObjRef->context().get() != NULL) {
-      aToShape =  anObjRef->context()->shape();
+    anObjRef = selection(TO_OBJECT_ID());
+    if(anObjRef.get() != NULL) {
+      aToShape = std::dynamic_pointer_cast<GeomAPI_Shape>(anObjRef->value());
+      if(aToShape.get() == NULL && anObjRef->context().get() != NULL) {
+        aToShape =  anObjRef->context()->shape();
+      }
     }
   }
 
-  // Getting revolution angles.
-  double aFromAngle = real(FROM_ANGLE_ID())->value();
-  double aToAngle = real(TO_ANGLE_ID())->value();
-
   // Revol faces.
   ListOfShape aRevolutionList;
   for(ListOfShape::const_iterator aFacesIt = theFaces.begin(); aFacesIt != theFaces.end(); aFacesIt++) {
     std::shared_ptr<GeomAPI_Shape> aBaseShape = *aFacesIt;
-    GeomAlgoAPI_Revolution aRevolAlgo(aBaseShape, anAxis, aFromShape, aFromAngle, aToShape, aToAngle);
+    GeomAlgoAPI_Revolution aRevolAlgo(aBaseShape, anAxis, aToShape, aToAngle, aFromShape, aFromAngle);
 
     // Checking that the algorithm worked properly.
     if(!aRevolAlgo.isDone() || aRevolAlgo.shape()->isNull() || !aRevolAlgo.isValid()) {
index e9fe6fb7e9090abcc64eea477d6f736532dfa42d..354f5badce048f6c30915df19c872104ac133be9 100644 (file)
@@ -22,6 +22,13 @@ public:
     return MY_AXIS_ID;
   }
 
+  /// attribute name for creation method
+  inline static const std::string& CREATION_METHOD()
+  {
+    static const std::string METHOD_ATTR("CreationMethod");
+    return METHOD_ATTR;
+  }
+
   /// Attribute name of an object from which the revolution grows.
   inline static const std::string& FROM_OBJECT_ID()
   {
index 76e185daccf81621a29c3e6fcd1a99061e6dca84..85f3179d3d0eeac1ae7c065a5524f0b9140b4d13 100644 (file)
@@ -9,43 +9,71 @@
     type_choice="Faces Compound">
     <validator id="PartSet_SketchEntityValidator" parameters="Sketch"/>
   </multi_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="&lt;sketch&gt;">
-      <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">
-    </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="&lt;sketch&gt;">
-      <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">
-    </doublevalue>
-  </groupbox>
+  <toolbox id="CreationMethod">
+    <box id="ByOffsets" title="By offsets">
+      <groupbox>
+        <doublevalue
+          id="to_size"
+          label="Size"
+          min="0"
+          step="1.0"
+          default="10"
+          icon=":icons/dimension_up.png"
+          tooltip="Size">
+        </doublevalue>
+      </groupbox>
+      <groupbox>
+        <doublevalue
+          id="from_size"
+          label="Size"
+          min="0"
+          step="1.0"
+          default="0"
+          icon=":icons/dimension_down.png"
+          tooltip="Size">
+        </doublevalue>
+      </groupbox>
+    </box>
+    <box id="ByPlanesAndOffsets" title="By bounding planes and offsets">
+      <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="&lt;base sketch&gt;">
+          <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="Size">
+        </doublevalue>
+      </groupbox>
+      <groupbox title="From">
+        <shape_selector id="from_object"
+                        icon=":icons/plane.png"
+                        label="Plane face"
+                        tooltip="Select a planar face"
+                        shape_types="face"
+                        default="&lt;base sketch&gt;">
+          <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="Size">
+        </doublevalue>
+      </groupbox>
+    </box>    
+  </toolbox>
   <validator id="GeomValidators_ZeroOffset" parameters="from_object,to_object,from_size,to_size"/>
 </source>
index bb0d6b5f869041f4b3474930f41062ab183199e5..4c1a3c256c6a78e7803c5c28f2a925df746dcae3 100755 (executable)
@@ -5,38 +5,66 @@
     <sketch_launcher id="sketch"
       label="Sketch"
       icon=":icons/sketch.png"
-      tooltip="Create or edit a sketch">/>
+      tooltip="Create or edit a sketch">
     </sketch_launcher>
-    <groupbox title="From">
-      <shape_selector id="from_object"
-                      icon=":icons/plane.png"
-                      label="Plane face"
-                      tooltip="Select a planar face"
-                      shape_types="face"
-                      default="&lt;sketch&gt;">
-        <validator id="GeomValidators_Face" parameters="plane"/>
-      </shape_selector>
-      <doublevalue id="from_size" label="Size"
-        min="0" step="1.0" default="10"
-        icon=":icons/dimension_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="&lt;sketch&gt;">
-        <validator id="GeomValidators_Face" parameters="plane"/>
-      </shape_selector>
-      <doublevalue  id="to_size"
-        label="Size" min="0" step="1.0" default="0"
-        icon=":icons/dimension_up.png"
-        tooltip="Height">
-      </doublevalue>
-    </groupbox>
+    <toolbox id="CreationMethod">
+      <box id="ByOffsets" title="By offsets">
+        <groupbox>
+          <doublevalue
+            id="to_size"
+            label="Size"
+            min="0"
+            step="1.0"
+            default="10"
+            icon=":icons/dimension_up.png"
+            tooltip="Size">
+          </doublevalue>
+        </groupbox>
+        <groupbox>
+          <doublevalue
+            id="from_size"
+            label="Size"
+            min="0"
+            step="1.0"
+            default="0"
+            icon=":icons/dimension_down.png"
+            tooltip="Size">
+          </doublevalue>
+        </groupbox>
+      </box>
+      <box id="ByPlanesAndOffsets" title="By bounding planes and offsets">
+        <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="&lt;base sketch&gt;">
+            <validator id="GeomValidators_Face" parameters="plane"/>
+          </shape_selector>
+          <doublevalue  id="to_size"
+            label="Size" min="0" step="1.0" default="0"
+            icon=":icons/dimension_up.png"
+            tooltip="Size">
+          </doublevalue>
+        </groupbox>        
+        <groupbox title="From">
+          <shape_selector id="from_object"
+                          icon=":icons/plane.png"
+                          label="Plane face"
+                          tooltip="Select a planar face"
+                          shape_types="face"
+                          default="&lt;base sketch&gt;">
+            <validator id="GeomValidators_Face" parameters="plane"/>
+          </shape_selector>
+          <doublevalue id="from_size" label="Size"
+            min="0" step="1.0" default="10"
+            icon=":icons/dimension_down.png"
+            tooltip="Size">
+          </doublevalue>
+        </groupbox>
+      </box>
+    </toolbox>
   </groupbox>
   <multi_selector id="boolean_objects"
     label="Cut from:"
index f7b0acbe2422a72931f6ba57f0e391d2e0079554..08a2605f801dce5ec956f623cae4dd2417e5096c 100644 (file)
@@ -5,38 +5,66 @@
     <sketch_launcher id="sketch"
       label="Sketch"
       icon=":icons/sketch.png"
-      tooltip="Create or edit a sketch">/>
+      tooltip="Create or edit a sketch">
     </sketch_launcher>
-    <groupbox title="From">
-      <shape_selector id="from_object"
-                      icon=":icons/plane.png"
-                      label="Plane face"
-                      tooltip="Select a planar face"
-                      shape_types="face"
-                      default="&lt;sketch&gt;">
-        <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">
-      </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="&lt;sketch&gt;">
-        <validator id="GeomValidators_Face" parameters="plane"/>
-      </shape_selector>
-      <doublevalue  id="to_size"
-        label="Size" min="0" step="1.0" default="0"
-        icon=":icons/dimension_up.png"
-        tooltip="Height">
-      </doublevalue>
-    </groupbox>
+    <toolbox id="CreationMethod">
+      <box id="ByOffsets" title="By offsets">
+        <groupbox>
+          <doublevalue
+            id="to_size"
+            label="Size"
+            min="0"
+            step="1.0"
+            default="10"
+            icon=":icons/dimension_up.png"
+            tooltip="Size">
+          </doublevalue>
+        </groupbox>
+        <groupbox>
+          <doublevalue
+            id="from_size"
+            label="Size"
+            min="0"
+            step="1.0"
+            default="0"
+            icon=":icons/dimension_down.png"
+            tooltip="Size">
+          </doublevalue>
+        </groupbox>
+      </box>
+      <box id="ByPlanesAndOffsets" title="By bounding planes and offsets">
+        <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="&lt;base sketch&gt;">
+            <validator id="GeomValidators_Face" parameters="plane"/>
+          </shape_selector>
+          <doublevalue  id="to_size"
+            label="Size" min="0" step="1.0" default="0"
+            icon=":icons/dimension_up.png"
+            tooltip="Size">
+          </doublevalue>
+        </groupbox>
+        <groupbox title="From">
+          <shape_selector id="from_object"
+                          icon=":icons/plane.png"
+                          label="Plane face"
+                          tooltip="Select a planar face"
+                          shape_types="face"
+                          default="&lt;base sketch&gt;">
+            <validator id="GeomValidators_Face" parameters="plane"/>
+          </shape_selector>
+          <doublevalue id="from_size" label="Size"
+            min="0" step="1.0" default="10"
+            icon=":icons/dimension_down.png"
+            tooltip="Size">
+          </doublevalue>
+        </groupbox>
+      </box>
+    </toolbox>
   </groupbox>
   <multi_selector id="boolean_objects"
     label="Fuse with:"
index a6f9e53089fc7c31f759f6e8ea69ce1b5a882358..c11aa4c19fa304c9e7577204c284d2ad03ea5d0f 100644 (file)
                   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="&lt;sketch&gt;">
-      <validator id="GeomValidators_Face" parameters="plane"/>
-    </shape_selector>
-    <doublevalue
-      id="from_angle"
-      label="Angle"
-      min="0"
-      step="1.0"
-      default="0"
-      icon=":icons/angle_down.png"
-      tooltip="Angle">
-    </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="&lt;sketch&gt;">
-      <validator id="GeomValidators_Face" parameters="plane"/>
-    </shape_selector>
-    <doublevalue
-      id="to_angle"
-      label="Angle"
-      min="0"
-      step="1.0"
-      default="360"
-      icon=":icons/angle_up.png"
-      tooltip="Angle">
-    </doublevalue>
-  </groupbox>
+  <toolbox id="CreationMethod">
+    <box id="ByOffsets" title="By offsets">
+      <groupbox>
+        <doublevalue
+          id="to_angle"
+          label="Angle"
+          min="0"
+          step="1.0"
+          default="360"
+          icon=":icons/angle_up.png"
+          tooltip="Angle">
+        </doublevalue>
+      </groupbox>
+      <groupbox>
+        <doublevalue
+          id="from_angle"
+          label="Angle"
+          min="0"
+          step="1.0"
+          default="0"
+          icon=":icons/angle_down.png"
+          tooltip="Angle">
+        </doublevalue>
+      </groupbox>
+    </box>
+    <box id="ByPlanesAndOffsets" title="By bounding planes and offsets">
+      <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="&lt;base sketch&gt;">
+          <validator id="GeomValidators_Face" parameters="plane"/>
+        </shape_selector>
+        <doublevalue
+          id="to_angle"
+          label="Angle"
+          min="0"
+          step="1.0"
+          default="360"
+          icon=":icons/angle_up.png"
+          tooltip="Angle">
+        </doublevalue>
+      </groupbox>
+      <groupbox title="From">
+        <shape_selector id="from_object"
+                        icon=":icons/plane.png"
+                        label="Plane face"
+                        tooltip="Select a planar face"
+                        shape_types="face"
+                        default="&lt;base sketch&gt;">
+          <validator id="GeomValidators_Face" parameters="plane"/>
+        </shape_selector>
+        <doublevalue
+          id="from_angle"
+          label="Angle"
+          min="0"
+          step="1.0"
+          default="0"
+          icon=":icons/angle_down.png"
+          tooltip="Angle">
+        </doublevalue>
+      </groupbox>
+    </box>
+  </toolbox>
   <validator id="GeomValidators_ZeroOffset" parameters="from_object,to_object,from_angle,to_angle"/>
 </source>
\ No newline at end of file
index 9f0ca37326987894450d95158a61d35615375080..6d1683b35242582b9aee11537fd6f03ddb67d400 100644 (file)
@@ -5,7 +5,7 @@
     <sketch_launcher id="sketch"
       label="Sketch"
       icon=":icons/sketch.png"
-      tooltip="Create or edit a sketch">/>
+      tooltip="Create or edit a sketch">
     </sketch_launcher>
     <shape_selector id="axis_object"
                     icon=":icons/axis.png"
                     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="&lt;sketch&gt;">
-        <validator id="GeomValidators_Face" parameters="plane"/>
-      </shape_selector>
-      <doublevalue id="from_angle" label="Angle"
-        min="0" step="1.0" default="0"
-        icon=":icons/angle_down.png"
-        tooltip="Angle">
-      </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="&lt;sketch&gt;">
-        <validator id="GeomValidators_Face" parameters="plane"/>
-      </shape_selector>
-      <doublevalue  id="to_angle" label="Angle"
-        min="0" step="1.0" default="0"
-        icon=":icons/angle_up.png"
-        tooltip="Angle">
-      </doublevalue>
-    </groupbox>
+    <toolbox id="CreationMethod">
+      <box id="ByOffsets" title="By offsets">
+        <groupbox>
+          <doublevalue
+            id="to_angle"
+            label="Angle"
+            min="0"
+            step="1.0"
+            default="360"
+            icon=":icons/angle_up.png"
+            tooltip="Angle">
+          </doublevalue>
+        </groupbox>
+        <groupbox>
+          <doublevalue
+            id="from_angle"
+            label="Angle"
+            min="0"
+            step="1.0"
+            default="0"
+            icon=":icons/angle_down.png"
+            tooltip="Angle">
+          </doublevalue>
+        </groupbox>
+      </box>
+      <box id="ByPlanesAndOffsets" title="By bounding planes and offsets">
+        <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="&lt;sketch&gt;">
+            <validator id="GeomValidators_Face" parameters="plane"/>
+          </shape_selector>
+          <doublevalue  id="to_angle" label="Angle"
+            min="0" step="1.0" default="0"
+            icon=":icons/angle_up.png"
+            tooltip="Angle">
+          </doublevalue>
+        </groupbox>
+        <groupbox title="From">
+          <shape_selector id="from_object"
+                          icon=":icons/plane.png"
+                          label="Plane face"
+                          tooltip="Select a planar face"
+                          shape_types="face"
+                          default="&lt;sketch&gt;">
+            <validator id="GeomValidators_Face" parameters="plane"/>
+          </shape_selector>
+          <doublevalue id="from_angle" label="Angle"
+            min="0" step="1.0" default="0"
+            icon=":icons/angle_down.png"
+            tooltip="Angle">
+          </doublevalue>
+        </groupbox>
+      </box>
+    </toolbox>
   </groupbox>
   <multi_selector id="boolean_objects"
     label="Cut from:"
index cbf047351763409338fe65dc6074c48a61d46865..a039094de3e1a7ac1c7a931b13170041ba048ae0 100644 (file)
@@ -5,7 +5,7 @@
     <sketch_launcher id="sketch"
       label="Sketch"
       icon=":icons/sketch.png"
-      tooltip="Create or edit a sketch">/>
+      tooltip="Create or edit a sketch">
     </sketch_launcher>
     <shape_selector id="axis_object"
                     icon=":icons/axis.png"
                     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="&lt;sketch&gt;">
-        <validator id="GeomValidators_Face" parameters="plane"/>
-      </shape_selector>
-      <doublevalue id="from_angle" label="Angle"
-        min="0" step="1.0" default="0"
-        icon=":icons/angle_down.png"
-        tooltip="Angle">
-      </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="&lt;sketch&gt;">
-        <validator id="GeomValidators_Face" parameters="plane"/>
-      </shape_selector>
-      <doublevalue  id="to_angle" label="Angle"
-        min="0" step="1.0" default="0"
-        icon=":icons/angle_up.png"
-        tooltip="Angle">
-      </doublevalue>
-    </groupbox>
+    <toolbox id="CreationMethod">
+      <box id="ByOffsets" title="By offsets">
+        <groupbox>
+          <doublevalue
+            id="to_angle"
+            label="Angle"
+            min="0"
+            step="1.0"
+            default="360"
+            icon=":icons/angle_up.png"
+            tooltip="Angle">
+          </doublevalue>
+        </groupbox>
+        <groupbox>
+          <doublevalue
+            id="from_angle"
+            label="Angle"
+            min="0"
+            step="1.0"
+            default="0"
+            icon=":icons/angle_down.png"
+            tooltip="Angle">
+          </doublevalue>
+        </groupbox>
+      </box>
+      <box id="ByPlanesAndOffsets" title="By bounding planes and offsets">
+        <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="&lt;sketch&gt;">
+            <validator id="GeomValidators_Face" parameters="plane"/>
+          </shape_selector>
+          <doublevalue  id="to_angle" label="Angle"
+            min="0" step="1.0" default="0"
+            icon=":icons/angle_up.png"
+            tooltip="Angle">
+          </doublevalue>
+        </groupbox>
+        <groupbox title="From">
+          <shape_selector id="from_object"
+                          icon=":icons/plane.png"
+                          label="Plane face"
+                          tooltip="Select a planar face"
+                          shape_types="face"
+                          default="&lt;sketch&gt;">
+            <validator id="GeomValidators_Face" parameters="plane"/>
+          </shape_selector>
+          <doublevalue id="from_angle" label="Angle"
+            min="0" step="1.0" default="0"
+            icon=":icons/angle_down.png"
+            tooltip="Angle">
+          </doublevalue>
+        </groupbox>
+      </box>
+    </toolbox>
   </groupbox>
   <multi_selector id="boolean_objects"
     label="Fuse with:"
index 6d36708b4c699a6cfcbd55349ba7877b570eef1b..4c7eb7ed10fd0fa984980f6a38874855bd6a04a7 100644 (file)
 
 //=================================================================================================
 GeomAlgoAPI_Prism::GeomAlgoAPI_Prism(std::shared_ptr<GeomAPI_Shape> theBasis,
-                                     double                         theFromSize,
-                                     double                         theToSize)
+                                     double                         theToSize,
+                                     double                         theFromSize)
 : myDone(false)
 {
-  build(theBasis, std::shared_ptr<GeomAPI_Shape>(), theFromSize, std::shared_ptr<GeomAPI_Shape>(), theToSize);
+  build(theBasis, std::shared_ptr<GeomAPI_Shape>(), theToSize, std::shared_ptr<GeomAPI_Shape>(), theFromSize);
 }
 
 //=================================================================================================
 GeomAlgoAPI_Prism::GeomAlgoAPI_Prism(std::shared_ptr<GeomAPI_Shape> theBasis,
-                                     std::shared_ptr<GeomAPI_Shape> theFromShape,
-                                     double                         theFromSize,
                                      std::shared_ptr<GeomAPI_Shape> theToShape,
-                                     double                         theToSize)
+                                     double                         theToSize,
+                                     std::shared_ptr<GeomAPI_Shape> theFromShape,
+                                     double                         theFromSize)
 : myDone(false)
 {
-  build(theBasis, theFromShape, theFromSize, theToShape, theToSize);
+  build(theBasis, theToShape, theToSize, theFromShape, theFromSize);
 }
 
 //=================================================================================================
 void GeomAlgoAPI_Prism::build(const std::shared_ptr<GeomAPI_Shape>& theBasis,
-                              const std::shared_ptr<GeomAPI_Shape>& theFromShape,
-                              double                                theFromSize,
                               const std::shared_ptr<GeomAPI_Shape>& theToShape,
-                              double                                theToSize)
+                              double                                theToSize,
+                              const std::shared_ptr<GeomAPI_Shape>& theFromShape,
+                              double                                theFromSize)
 {
   if(!theBasis ||
     (((!theFromShape && !theToShape) || (theFromShape && theToShape && theFromShape->isEqual(theToShape)))
index 642ff9b305f064acd07f01a3cf67724506a1ca2a..9a5cf59cba607f4076c6f0de53f876059130f164 100644 (file)
@@ -24,25 +24,25 @@ class GeomAlgoAPI_Prism : public GeomAPI_Interface
 public:
   /** \brief Creates extrusion for the given shape along the normal for this shape.
    *  \param[in] theBasis face or wire to be extruded.
-   *  \param[in] theFromSize offset for "from" plane.
    *  \param[in] theToSize offset for "to" plane.
+   *  \param[in] theFromSize offset for "from" plane.
    */
   GEOMALGOAPI_EXPORT GeomAlgoAPI_Prism(std::shared_ptr<GeomAPI_Shape> theBasis,
-                                       double                         theFromSize,
-                                       double                         theToSize);
+                                       double                         theToSize,
+                                       double                         theFromSize);
 
   /** \brief Creates extrusion for the given shape along the normal for this shape.
    *  \param[in] theBasis face or wire to be extruded.
-   *  \param[in] theFromShape bottom bounding shape. Can be empty. In this case offset will be applied to the basis.
-   *  \param[in] theFromSize offset for "from" plane.
    *  \param[in] theToShape top bounding shape.  Can be empty. In this case offset will be applied to the basis.
    *  \param[in] theToSize offset for "to" plane.
+   *  \param[in] theFromShape bottom bounding shape. Can be empty. In this case offset will be applied to the basis.
+   *  \param[in] theFromSize offset for "from" plane.
    */
   GEOMALGOAPI_EXPORT GeomAlgoAPI_Prism(std::shared_ptr<GeomAPI_Shape> theBasis,
-                                       std::shared_ptr<GeomAPI_Shape> theFromShape,
-                                       double                         theFromSize,
                                        std::shared_ptr<GeomAPI_Shape> theToShape,
-                                       double                         theToSize);
+                                       double                         theToSize,
+                                       std::shared_ptr<GeomAPI_Shape> theFromShape,
+                                       double                         theFromSize);
 
   /// \return true if algorithm succeed.
   GEOMALGOAPI_EXPORT bool isDone() const;
@@ -71,10 +71,10 @@ public:
 private:
   /// Builds resulting shape.
   void build(const std::shared_ptr<GeomAPI_Shape>& theBasis,
-             const std::shared_ptr<GeomAPI_Shape>& theFromShape,
-             double                                theFromSize,
              const std::shared_ptr<GeomAPI_Shape>& theToShape,
-             double                                theToSize);
+             double                                theToSize,
+             const std::shared_ptr<GeomAPI_Shape>& theFromShape,
+             double                                theFromSize);
 
 private:
   /// Fields.
index 295886fbda7e802c6518b9cf5dcf0016ae3431ef..1489fcd4b061efacc3f0f948fd04bdf5ebeac27b 100644 (file)
 //=================================================================================================
 GeomAlgoAPI_Revolution::GeomAlgoAPI_Revolution(std::shared_ptr<GeomAPI_Shape> theBasis,
                                                std::shared_ptr<GeomAPI_Ax1>   theAxis,
-                                               double                         theFromAngle,
-                                               double                         theToAngle)
+                                               double                         theToAngle,
+                                               double                         theFromAngle)
 : myDone(false)
 {
-  build(theBasis, theAxis, std::shared_ptr<GeomAPI_Shape>(), theFromAngle, std::shared_ptr<GeomAPI_Shape>(), theToAngle);
+  build(theBasis, theAxis, std::shared_ptr<GeomAPI_Shape>(), theToAngle, std::shared_ptr<GeomAPI_Shape>(), theFromAngle);
 }
 
 //=================================================================================================
 GeomAlgoAPI_Revolution::GeomAlgoAPI_Revolution(std::shared_ptr<GeomAPI_Shape> theBasis,
                                                std::shared_ptr<GeomAPI_Ax1>   theAxis,
-                                               std::shared_ptr<GeomAPI_Shape> theFromShape,
-                                               double                         theFromAngle,
                                                std::shared_ptr<GeomAPI_Shape> theToShape,
-                                               double                         theToAngle)
+                                               double                         theToAngle,
+                                               std::shared_ptr<GeomAPI_Shape> theFromShape,
+                                               double                         theFromAngle)
 : myDone(false)
 {
-  build(theBasis, theAxis, theFromShape, theFromAngle, theToShape, theToAngle);
+  build(theBasis, theAxis, theToShape, theToAngle, theFromShape, theFromAngle);
 }
 
 //=================================================================================================
@@ -107,10 +107,10 @@ TopoDS_Shape GeomAlgoAPI_Revolution::findClosest(const TopoDS_Shape& theShape, c
 //=================================================================================================
 void GeomAlgoAPI_Revolution::build(const std::shared_ptr<GeomAPI_Shape>& theBasis,
                                    const std::shared_ptr<GeomAPI_Ax1>&   theAxis,
-                                   const std::shared_ptr<GeomAPI_Shape>& theFromShape,
-                                   double                                theFromAngle,
                                    const std::shared_ptr<GeomAPI_Shape>& theToShape,
-                                   double                                theToAngle)
+                                   double                                theToAngle,
+                                   const std::shared_ptr<GeomAPI_Shape>& theFromShape,
+                                   double                                theFromAngle)
 {
   if(!theBasis || !theAxis ||
     (((!theFromShape && !theToShape) || (theFromShape && theToShape && theFromShape->isEqual(theToShape)))
index a10b093b05f485a2dd36285423150193fe19fa9c..8e6a0033c32d0d8a7c7c701ee108dd47f961a068 100644 (file)
@@ -34,27 +34,27 @@ class GeomAlgoAPI_Revolution : public GeomAPI_Interface
 public:
   /** \brief Creates revolution for the given shape.
    *  \param[in] theBasis face for revolution.
-   *  \param[in] theFromAngle from angle.
    *  \param[in] theToAngle to angle.
+   *  \param[in] theFromAngle from angle.
    */
   GEOMALGOAPI_EXPORT GeomAlgoAPI_Revolution(std::shared_ptr<GeomAPI_Shape> theBasis,
                                             std::shared_ptr<GeomAPI_Ax1>   theAxis,
-                                            double                         theFromAngle,
-                                            double                         theToAngle);
+                                            double                         theToAngle,
+                                            double                         theFromAngle);
 
   /** \brief Creates revolution for the given shape.
    *  \param[in] theBasis face for revolution.
-   *  \param[in] theFromShape from bounding shape. Can be empty. In this case offset will be applied to the basis.
-   *  \param[in] theFromAngle from angle.
    *  \param[in] theToShape to bounding shape. Can be empty. In this case offset will be applied to the basis.
    *  \param[in] theToAngle to angle.
+   *  \param[in] theFromShape from bounding shape. Can be empty. In this case offset will be applied to the basis.
+   *  \param[in] theFromAngle from angle.
    */
   GEOMALGOAPI_EXPORT GeomAlgoAPI_Revolution(std::shared_ptr<GeomAPI_Shape> theBasis,
                                             std::shared_ptr<GeomAPI_Ax1>   theAxis,
-                                            std::shared_ptr<GeomAPI_Shape> theFromShape,
-                                            double                         theFromAngle,
                                             std::shared_ptr<GeomAPI_Shape> theToShape,
-                                            double                         theToAngle);
+                                            double                         theToAngle,
+                                            std::shared_ptr<GeomAPI_Shape> theFromShape,
+                                            double                         theFromAngle);
 
   /// \return true if algorithm succeed.
   GEOMALGOAPI_EXPORT const bool isDone() const;
@@ -102,10 +102,10 @@ private:
   /// Builds resulting shape.
   void build(const std::shared_ptr<GeomAPI_Shape>& theBasis,
              const std::shared_ptr<GeomAPI_Ax1>&   theAxis,
-             const std::shared_ptr<GeomAPI_Shape>& theFromShape,
-             double                                theFromAngle,
              const std::shared_ptr<GeomAPI_Shape>& theToShape,
-             double                                theToAngle);
+             double                                theToAngle,
+             const std::shared_ptr<GeomAPI_Shape>& theFromShape,
+             double                                theFromAngle);
 
 private:
   /// Fields.