]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Added multirotation feature.
authorClarisse Genrault <clarisse.genrault@cea.fr>
Tue, 4 Apr 2017 12:08:44 +0000 (14:08 +0200)
committerClarisse Genrault <clarisse.genrault@cea.fr>
Tue, 4 Apr 2017 12:08:44 +0000 (14:08 +0200)
src/FeaturesPlugin/CMakeLists.txt
src/FeaturesPlugin/FeaturesPlugin_MultiRotation.cpp
src/FeaturesPlugin/FeaturesPlugin_MultiRotation.h
src/FeaturesPlugin/FeaturesPlugin_MultiTranslation.h
src/FeaturesPlugin/FeaturesPlugin_Plugin.cpp
src/FeaturesPlugin/icons/SVG/multirotation.svg [new file with mode: 0644]
src/FeaturesPlugin/icons/multirotation.png [new file with mode: 0644]
src/FeaturesPlugin/plugin-Features.xml
src/GeomAlgoAPI/GeomAlgoAPI_ShapeTools.cpp
src/GeomAlgoAPI/GeomAlgoAPI_ShapeTools.h

index 193d513e48894da26395251d2d5a4cec5e475e75..e88a18c53146f8ca0788893c1fc8ccbd4d6c647a 100644 (file)
@@ -32,6 +32,7 @@ SET(PROJECT_HEADERS
     FeaturesPlugin_Symmetry.h
     FeaturesPlugin_Scale.h
     FeaturesPlugin_MultiTranslation.h
+    FeaturesPlugin_MultiRotation.h
 )
 
 SET(PROJECT_SOURCES
@@ -62,6 +63,7 @@ SET(PROJECT_SOURCES
     FeaturesPlugin_Symmetry.cpp
     FeaturesPlugin_Scale.cpp
     FeaturesPlugin_MultiTranslation.cpp
+    FeaturesPlugin_MultiRotation.cpp
 )
 
 SET(XML_RESOURCES
@@ -85,6 +87,7 @@ SET(XML_RESOURCES
   symmetry_widget.xml
   scale_widget.xml
   multitranslation_widget.xml
+  multirotation_widget.xml
 )
 
 SET(TEXT_RESOURCES
index 4c1d8470ef11f3813d5f171ef1d303f875165d69..3bd55a63a6e37509e87e02b399bc1269dd31e220 100644 (file)
@@ -111,14 +111,14 @@ void FeaturesPlugin_MultiRotation::performRotation1D()
   // Getting number of copies.
   int nbCopies =
     integer(FeaturesPlugin_MultiRotation::NB_COPIES_ANGULAR_ID())->value();
-    
+
   if (nbCopies <=0) {
     std::string aFeatureError = "Multirotation builder ";
     aFeatureError+=":: the number of copies for the angular direction is null or negative.";
     setError(aFeatureError);
     return;
   }
-  
+
   // Getting angle
   double anAngle;
   std::string useAngularStep =
@@ -128,7 +128,7 @@ void FeaturesPlugin_MultiRotation::performRotation1D()
   } else {
     anAngle = 360./nbCopies;
   }
-  
+
   // Moving each object.
   int aResultIndex = 0;
   std::list<ResultPtr>::iterator aContext = aContextes.begin();
@@ -235,29 +235,29 @@ void FeaturesPlugin_MultiRotation::performRotation2D()
     anAxis = std::shared_ptr<GeomAPI_Ax1>(new GeomAPI_Ax1(anEdge->line()->location(),
                                                           anEdge->line()->direction()));
   }
-  
+
   // Getting number of copies int he angular direction.
   int nbAngular =
     integer(FeaturesPlugin_MultiRotation::NB_COPIES_ANGULAR_ID())->value();
-    
+
   if (nbAngular <=0) {
     std::string aFeatureError = "Multirotation builder ";
     aFeatureError+=":: the number of copies for the angular direction is null or negative.";
     setError(aFeatureError);
     return;
   }
-  
+
   // Getting number of copies int he radial direction.
   int nbRadial =
     integer(FeaturesPlugin_MultiRotation::NB_COPIES_RADIAL_ID())->value();
-    
+
   if (nbRadial <=0) {
     std::string aFeatureError = "Multirotation builder ";
     aFeatureError+=":: the number of copies for the radial direction is null or negative.";
     setError(aFeatureError);
     return;
   }
-  
+
   // Getting angle
   double anAngle;
   std::string useAngularStep =
@@ -267,8 +267,8 @@ void FeaturesPlugin_MultiRotation::performRotation2D()
   } else {
     anAngle = 360./nbAngular;
   }
-  
-  // 
+
+  // Getting step
   double aStep = real(FeaturesPlugin_MultiRotation::STEP_RADIAL_ID())->value();
 
   // Moving each object.
@@ -278,8 +278,9 @@ void FeaturesPlugin_MultiRotation::performRotation2D()
         anObjectsIt++, aContext++) {
     std::shared_ptr<GeomAPI_Shape> aBaseShape = *anObjectsIt;
     bool isPart = (*aContext)->groupName() == ModelAPI_ResultPart::group();
-  
-    std::shared_ptr<GeomAPI_Dir> aDir = GeomAlgoAPI_ShapeTools::makeToto(aBaseShape, anAxis);
+
+    std::shared_ptr<GeomAPI_Dir> aDir =
+      GeomAlgoAPI_ShapeTools::buildDirFromAxisAndShape(aBaseShape, anAxis);
     double x = aDir->x();
     double y = aDir->y();
     double z = aDir->z();
@@ -369,7 +370,7 @@ void FeaturesPlugin_MultiRotation::performRotation2D()
         GeomAlgoAPI_CompoundBuilder::compound(aListOfShape);
       ResultBodyPtr aResultBody = document()->createBody(data(), aResultIndex);
       aResultBody->storeModified(aBaseShape, aCompound);
-      
+
       loadNamingDS2(aListOfTranslationAlgo, aResultBody, aBaseShape);
       loadNamingDS3(aListOfRotationAlgo, aResultBody, aBaseShape, nbRadial);
       setResult(aResultBody, aResultIndex);
@@ -430,7 +431,7 @@ void FeaturesPlugin_MultiRotation::loadNamingDS3(
 
   for (std::list<std::shared_ptr<GeomAlgoAPI_Rotation> >::const_iterator anIt =
     theListOfRotationAlgo.begin(); anIt != theListOfRotationAlgo.cend(); ++anIt) {
-    
+
     // naming of faces
     int numFace = 1;
     GeomAPI_ShapeExplorer anExp((*anIt)->shape(), GeomAPI_Shape::FACE);
index b39d4b4412f0461a6f26599df3bfb90f9eb2e729..32746de99dffb1d7e8e68ffbebc66b5633cfa45e 100644 (file)
@@ -16,8 +16,9 @@
 
 /** \class FeaturesPlugin_MultiRotation
  *  \ingroup Plugins
- *  \brief Feature for movement objects along one or two axes an arbitary number of times,
- *         making a copy every time.
+ *  \brief Feature that rotaes object around an axis an number of times.
+ *         The 2D version also makes translated copies of the object and performs the rotation
+ *         on these as well.
  */
 class FeaturesPlugin_MultiRotation : public ModelAPI_Feature
 {
@@ -50,35 +51,35 @@ class FeaturesPlugin_MultiRotation : public ModelAPI_Feature
     return MY_USE_ANGULAR_STEP_ID;
   }
 
-  /// Attribute name of step for the first direction.
+  /// Attribute name of step for the angular.
   inline static const std::string& STEP_ANGULAR_ID()
   {
     static const std::string MY_STEP_ANGULAR_ID("step_angular");
     return MY_STEP_ANGULAR_ID;
   }
 
-  /// Attribute name of number of copies for the first direction.
+  /// Attribute name of number of copies for angular.
   inline static const std::string& NB_COPIES_ANGULAR_ID()
   {
     static const std::string MY_NB_COPIES_ANGULAR_ID("nb_angular");
     return MY_NB_COPIES_ANGULAR_ID;
   }
 
-  /// Attribute name for use second dir.
+  /// Attribute name for use radial dir.
   inline static const std::string& USE_RADIAL_DIR_ID()
   {
     static const std::string MY_USE_RADIAL_DIR_ID("use_radial_dir");
     return MY_USE_RADIAL_DIR_ID;
   }
 
-  /// Attribute name of step for the second direction.
+  /// Attribute name of radial step.
   inline static const std::string& STEP_RADIAL_ID()
   {
     static const std::string MY_STEP_RADIAL_ID("step_radial");
     return MY_STEP_RADIAL_ID;
   }
 
-  /// Attribute name of number of copies for the second direction.
+  /// Attribute name of number of copies for radial.
   inline static const std::string& NB_COPIES_RADIAL_ID()
   {
     static const std::string MY_NB_COPIES_RADIAL_ID("nb_radial");
@@ -102,10 +103,10 @@ class FeaturesPlugin_MultiRotation : public ModelAPI_Feature
   FeaturesPlugin_MultiRotation();
 
 private:
-  /// Perform the multi translation in one direction.
+  /// Perform the multi rotation in one direction.
   void performRotation1D();
 
-  /// Perform the multi translation in two directions.
+  /// Perform the multi totation in two directions.
   void performRotation2D();
 
   void loadNamingDS2(std::list<std::shared_ptr<GeomAlgoAPI_Translation> > theListOfTranslationAlgo,
index 876644239441c156c3864da8a0376f6ec5824aaf..36b9f0df48de4307e397217d05c6f4308b9b1201 100644 (file)
@@ -21,7 +21,7 @@
 class FeaturesPlugin_MultiTranslation : public ModelAPI_Feature
 {
   public:
-  /// Translation kind.
+  /// Multi-translation kind.
   inline static const std::string& ID()
   {
     static const std::string MY_MULTITRANSLATION_ID("MultiTranslation");
index 1509e6c776ec6d654f3293241fa90e03292050f8..563e2ce624b810e9decc47b3ae742b27e383ab48 100644 (file)
@@ -7,6 +7,7 @@
 #include <FeaturesPlugin_ExtrusionCut.h>
 #include <FeaturesPlugin_ExtrusionFuse.h>
 #include <FeaturesPlugin_Intersection.h>
+#include <FeaturesPlugin_MultiRotation.h>
 #include <FeaturesPlugin_MultiTranslation.h>
 #include <FeaturesPlugin_Partition.h>
 #include <FeaturesPlugin_Pipe.h>
@@ -108,6 +109,8 @@ FeaturePtr FeaturesPlugin_Plugin::createFeature(std::string theFeatureID)
     return FeaturePtr(new FeaturesPlugin_Scale);
   } else if (theFeatureID == FeaturesPlugin_MultiTranslation::ID()) {
     return FeaturePtr(new FeaturesPlugin_MultiTranslation);
+  } else if (theFeatureID == FeaturesPlugin_MultiRotation::ID()) {
+    return FeaturePtr(new FeaturesPlugin_MultiRotation);
   }
 
   // feature of such kind is not found
diff --git a/src/FeaturesPlugin/icons/SVG/multirotation.svg b/src/FeaturesPlugin/icons/SVG/multirotation.svg
new file mode 100644 (file)
index 0000000..b84eaa9
--- /dev/null
@@ -0,0 +1,495 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://creativecommons.org/ns#"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   width="16"
+   height="16"
+   id="svg11250"
+   version="1.1"
+   inkscape:version="0.91 r13725"
+   viewBox="0 0 16 16"
+   sodipodi:docname="multi_rotation.svg"
+   inkscape:export-filename="/export/home/ldigallo/DOC_ALYOTECH/icones/Transformations/multi_rotation.png"
+   inkscape:export-xdpi="90"
+   inkscape:export-ydpi="90">
+  <defs
+     id="defs11252">
+    <inkscape:path-effect
+       effect="spiro"
+       id="path-effect4903"
+       is_visible="true" />
+    <marker
+       inkscape:stockid="TriangleOutS"
+       orient="auto"
+       refY="0"
+       refX="0"
+       id="marker8735"
+       style="overflow:visible"
+       inkscape:isstock="true">
+      <path
+         id="path8737"
+         d="m 5.77,0 -8.65,5 0,-10 8.65,5 z"
+         style="fill:#ff0000;fill-opacity:1;fill-rule:evenodd;stroke:#ff0000;stroke-width:1pt;stroke-opacity:1"
+         transform="scale(0.2,0.2)"
+         inkscape:connector-curvature="0" />
+    </marker>
+    <marker
+       inkscape:stockid="TriangleOutS"
+       orient="auto"
+       refY="0"
+       refX="0"
+       id="TriangleOutS"
+       style="overflow:visible"
+       inkscape:isstock="true">
+      <path
+         id="path5715"
+         d="m 5.77,0 -8.65,5 0,-10 8.65,5 z"
+         style="fill:#ff0000;fill-opacity:1;fill-rule:evenodd;stroke:#ff0000;stroke-width:1pt;stroke-opacity:1"
+         transform="scale(0.2,0.2)"
+         inkscape:connector-curvature="0" />
+    </marker>
+    <inkscape:path-effect
+       effect="spiro"
+       id="path-effect13212"
+       is_visible="true" />
+    <marker
+       inkscape:stockid="EmptyTriangleOutS"
+       orient="auto"
+       refY="0"
+       refX="0"
+       id="EmptyTriangleOutS"
+       style="overflow:visible"
+       inkscape:isstock="true">
+      <path
+         id="path5733"
+         d="m 5.77,0 -8.65,5 0,-10 8.65,5 z"
+         style="fill:#ffffff;fill-rule:evenodd;stroke:#ff0000;stroke-width:1pt;stroke-opacity:1"
+         transform="matrix(0.2,0,0,0.2,-0.6,0)"
+         inkscape:connector-curvature="0" />
+    </marker>
+    <marker
+       inkscape:stockid="TriangleOutM"
+       orient="auto"
+       refY="0"
+       refX="0"
+       id="TriangleOutM"
+       style="overflow:visible"
+       inkscape:isstock="true">
+      <path
+         id="path5712"
+         d="m 5.77,0 -8.65,5 0,-10 8.65,5 z"
+         style="fill:#ff0000;fill-opacity:1;fill-rule:evenodd;stroke:#ff0000;stroke-width:1pt;stroke-opacity:1"
+         transform="scale(0.4,0.4)"
+         inkscape:connector-curvature="0" />
+    </marker>
+    <marker
+       inkscape:stockid="Arrow1Send"
+       orient="auto"
+       refY="0"
+       refX="0"
+       id="Arrow1Send"
+       style="overflow:visible"
+       inkscape:isstock="true">
+      <path
+         id="path5582"
+         d="M 0,0 5,-5 -12.5,0 5,5 0,0 Z"
+         style="fill:#ff0000;fill-opacity:1;fill-rule:evenodd;stroke:#ff0000;stroke-width:1pt;stroke-opacity:1"
+         transform="matrix(-0.2,0,0,-0.2,-1.2,0)"
+         inkscape:connector-curvature="0" />
+    </marker>
+    <inkscape:path-effect
+       effect="spiro"
+       id="path-effect12156"
+       is_visible="true" />
+    <inkscape:perspective
+       sodipodi:type="inkscape:persp3d"
+       inkscape:vp_x="0 : 16 : 1"
+       inkscape:vp_y="0 : 1000 : 0"
+       inkscape:vp_z="32 : 16 : 1"
+       inkscape:persp3d-origin="16 : 10.666667 : 1"
+       id="perspective12136" />
+    <inkscape:path-effect
+       effect="spiro"
+       id="path-effect12134"
+       is_visible="true" />
+    <inkscape:path-effect
+       effect="skeletal"
+       id="path-effect12130"
+       is_visible="true"
+       pattern="M 0,5 C 0,2.24 2.24,0 5,0 7.76,0 10,2.24 10,5 10,7.76 7.76,10 5,10 2.24,10 0,7.76 0,5 Z"
+       copytype="single_stretched"
+       prop_scale="1"
+       scale_y_rel="false"
+       spacing="0"
+       normal_offset="0"
+       tang_offset="0"
+       prop_units="false"
+       vertical_pattern="false"
+       fuse_tolerance="0" />
+    <inkscape:path-effect
+       effect="spiro"
+       id="path-effect12128"
+       is_visible="true" />
+    <inkscape:path-effect
+       effect="skeletal"
+       id="path-effect12124"
+       is_visible="true"
+       pattern="M 0,5 C 0,2.24 2.24,0 5,0 7.76,0 10,2.24 10,5 10,7.76 7.76,10 5,10 2.24,10 0,7.76 0,5 Z"
+       copytype="single_stretched"
+       prop_scale="1"
+       scale_y_rel="false"
+       spacing="0"
+       normal_offset="0"
+       tang_offset="0"
+       prop_units="false"
+       vertical_pattern="false"
+       fuse_tolerance="0" />
+    <inkscape:path-effect
+       effect="spiro"
+       id="path-effect12122"
+       is_visible="true" />
+    <inkscape:path-effect
+       effect="skeletal"
+       id="path-effect12118"
+       is_visible="true"
+       pattern="m -0.04465162,5 c 0,-2.76 2.24000002,-5 5.00000002,-5 2.76,0 5,2.24 5,5 0,2.76 -2.24,5 -5,5 -2.76,0 -5.00000002,-2.24 -5.00000002,-5 z"
+       copytype="single_stretched"
+       prop_scale="1"
+       scale_y_rel="false"
+       spacing="0"
+       normal_offset="0"
+       tang_offset="0"
+       prop_units="false"
+       vertical_pattern="false"
+       fuse_tolerance="0" />
+    <marker
+       inkscape:stockid="TriangleOutS"
+       orient="auto"
+       refY="0"
+       refX="0"
+       id="marker18553-4"
+       style="overflow:visible"
+       inkscape:isstock="true">
+      <path
+         inkscape:connector-curvature="0"
+         id="path18555-7"
+         d="m 5.77,0 -8.65,5 0,-10 8.65,5 z"
+         style="fill:#ff0000;fill-opacity:1;fill-rule:evenodd;stroke:#ff0000;stroke-width:1pt;stroke-opacity:1"
+         transform="scale(0.2,0.2)" />
+    </marker>
+    <marker
+       inkscape:stockid="TriangleOutS"
+       orient="auto"
+       refY="0"
+       refX="0"
+       id="marker18553-3"
+       style="overflow:visible"
+       inkscape:isstock="true">
+      <path
+         inkscape:connector-curvature="0"
+         id="path18555-3"
+         d="m 5.77,0 -8.65,5 0,-10 8.65,5 z"
+         style="fill:#ff0000;fill-opacity:1;fill-rule:evenodd;stroke:#ff0000;stroke-width:1pt;stroke-opacity:1"
+         transform="scale(0.2,0.2)" />
+    </marker>
+    <marker
+       inkscape:stockid="TriangleOutS"
+       orient="auto"
+       refY="0"
+       refX="0"
+       id="marker18553-5"
+       style="overflow:visible"
+       inkscape:isstock="true">
+      <path
+         inkscape:connector-curvature="0"
+         id="path18555-73"
+         d="m 5.77,0 -8.65,5 0,-10 8.65,5 z"
+         style="fill:#ff0000;fill-opacity:1;fill-rule:evenodd;stroke:#ff0000;stroke-width:1pt;stroke-opacity:1"
+         transform="scale(0.2,0.2)" />
+    </marker>
+    <marker
+       inkscape:stockid="TriangleOutS"
+       orient="auto"
+       refY="0"
+       refX="0"
+       id="marker8735-6"
+       style="overflow:visible"
+       inkscape:isstock="true">
+      <path
+         inkscape:connector-curvature="0"
+         id="path8737-0"
+         d="m 5.77,0 -8.65,5 0,-10 8.65,5 z"
+         style="fill:#ff0000;fill-opacity:1;fill-rule:evenodd;stroke:#ff0000;stroke-width:1pt;stroke-opacity:1"
+         transform="scale(0.2,0.2)" />
+    </marker>
+    <marker
+       inkscape:stockid="TriangleOutS"
+       orient="auto"
+       refY="0"
+       refX="0"
+       id="marker8735-3"
+       style="overflow:visible"
+       inkscape:isstock="true">
+      <path
+         inkscape:connector-curvature="0"
+         id="path8737-1"
+         d="m 5.77,0 -8.65,5 0,-10 8.65,5 z"
+         style="fill:#ff0000;fill-opacity:1;fill-rule:evenodd;stroke:#ff0000;stroke-width:1pt;stroke-opacity:1"
+         transform="scale(0.2,0.2)" />
+    </marker>
+    <inkscape:path-effect
+       effect="spiro"
+       id="path-effect4481"
+       is_visible="true" />
+    <inkscape:path-effect
+       effect="spiro"
+       id="path-effect4481-6"
+       is_visible="true" />
+    <inkscape:path-effect
+       effect="spiro"
+       id="path-effect4481-6-3"
+       is_visible="true" />
+    <inkscape:path-effect
+       effect="spiro"
+       id="path-effect4481-1"
+       is_visible="true" />
+    <inkscape:path-effect
+       effect="spiro"
+       id="path-effect4481-1-4"
+       is_visible="true" />
+    <inkscape:path-effect
+       effect="spiro"
+       id="path-effect4359"
+       is_visible="true" />
+    <inkscape:path-effect
+       effect="spiro"
+       id="path-effect4734"
+       is_visible="true" />
+    <inkscape:path-effect
+       effect="spiro"
+       id="path-effect4359-3"
+       is_visible="true" />
+    <inkscape:path-effect
+       effect="spiro"
+       id="path-effect4734-3"
+       is_visible="true" />
+    <inkscape:path-effect
+       effect="spiro"
+       id="path-effect4359-85"
+       is_visible="true" />
+    <inkscape:path-effect
+       effect="spiro"
+       id="path-effect4734-0"
+       is_visible="true" />
+    <inkscape:path-effect
+       effect="spiro"
+       id="path-effect4359-8"
+       is_visible="true" />
+    <inkscape:path-effect
+       effect="spiro"
+       id="path-effect4734-4"
+       is_visible="true" />
+    <inkscape:path-effect
+       effect="spiro"
+       id="path-effect4812"
+       is_visible="true" />
+    <inkscape:path-effect
+       effect="spiro"
+       id="path-effect4481-5"
+       is_visible="true" />
+    <inkscape:path-effect
+       effect="spiro"
+       id="path-effect4481-9-0"
+       is_visible="true" />
+    <inkscape:path-effect
+       effect="spiro"
+       id="path-effect4481-9"
+       is_visible="true" />
+    <filter
+       inkscape:label="Pixellize"
+       inkscape:menu="Pixel tools"
+       inkscape:menu-tooltip="Reduce or remove antialiasing around shapes"
+       style="color-interpolation-filters:sRGB"
+       id="filter5039-5">
+      <feColorMatrix
+         values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1000 -500 "
+         id="feColorMatrix5041-7" />
+    </filter>
+    <filter
+       inkscape:label="Pixellize"
+       inkscape:menu="Pixel tools"
+       inkscape:menu-tooltip="Reduce or remove antialiasing around shapes"
+       style="color-interpolation-filters:sRGB"
+       id="filter5039-5-6">
+      <feColorMatrix
+         values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1000 -500 "
+         id="feColorMatrix5041-7-2" />
+    </filter>
+    <filter
+       inkscape:label="Pixellize"
+       inkscape:menu="Pixel tools"
+       inkscape:menu-tooltip="Reduce or remove antialiasing around shapes"
+       style="color-interpolation-filters:sRGB"
+       id="filter5039-5-6-1">
+      <feColorMatrix
+         values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1000 -500 "
+         id="feColorMatrix5041-7-2-9" />
+    </filter>
+    <filter
+       inkscape:label="Pixellize"
+       inkscape:menu="Pixel tools"
+       inkscape:menu-tooltip="Reduce or remove antialiasing around shapes"
+       style="color-interpolation-filters:sRGB"
+       id="filter5039-5-6-1-4">
+      <feColorMatrix
+         values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1000 -500 "
+         id="feColorMatrix5041-7-2-9-3" />
+    </filter>
+    <filter
+       inkscape:label="Pixellize"
+       inkscape:menu="Pixel tools"
+       inkscape:menu-tooltip="Reduce or remove antialiasing around shapes"
+       style="color-interpolation-filters:sRGB"
+       id="filter5039-5-6-1-4-6">
+      <feColorMatrix
+         values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1000 -500 "
+         id="feColorMatrix5041-7-2-9-3-7" />
+    </filter>
+    <filter
+       inkscape:label="Pixellize"
+       inkscape:menu="Pixel tools"
+       inkscape:menu-tooltip="Reduce or remove antialiasing around shapes"
+       style="color-interpolation-filters:sRGB"
+       id="filter5039-5-6-1-4-6-2">
+      <feColorMatrix
+         values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1000 -500 "
+         id="feColorMatrix5041-7-2-9-3-7-6" />
+    </filter>
+    <filter
+       inkscape:label="Pixellize"
+       inkscape:menu="Pixel tools"
+       inkscape:menu-tooltip="Reduce or remove antialiasing around shapes"
+       style="color-interpolation-filters:sRGB"
+       id="filter5039-5-6-1-4-6-2-3">
+      <feColorMatrix
+         values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1000 -500 "
+         id="feColorMatrix5041-7-2-9-3-7-6-9" />
+    </filter>
+  </defs>
+  <sodipodi:namedview
+     id="base"
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1.0"
+     inkscape:pageopacity="0.0"
+     inkscape:pageshadow="2"
+     inkscape:zoom="31.672165"
+     inkscape:cx="2.7791679"
+     inkscape:cy="6.2438977"
+     inkscape:current-layer="layer1"
+     showgrid="true"
+     inkscape:grid-bbox="true"
+     inkscape:document-units="px"
+     inkscape:window-width="1920"
+     inkscape:window-height="1006"
+     inkscape:window-x="0"
+     inkscape:window-y="25"
+     inkscape:window-maximized="1"
+     inkscape:snap-center="false"
+     inkscape:snap-object-midpoints="true"
+     inkscape:snap-others="true"
+     inkscape:snap-nodes="true"
+     inkscape:snap-grids="false"
+     inkscape:object-paths="false"
+     inkscape:snap-intersection-paths="true"
+     inkscape:snap-page="false"
+     showguides="false"
+     inkscape:snap-global="true"
+     inkscape:showpageshadow="false"
+     inkscape:object-nodes="true">
+    <inkscape:grid
+       type="xygrid"
+       id="grid11798" />
+  </sodipodi:namedview>
+  <metadata
+     id="metadata11255">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+        <dc:title />
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <g
+     id="layer1"
+     inkscape:label="Layer 1"
+     inkscape:groupmode="layer"
+     transform="translate(0,-16)">
+    <g
+       transform="matrix(0.61508511,0,0,0.77777773,0.02030893,10.560744)"
+       id="g4929"
+       style="stroke:none;stroke-opacity:1">
+      <path
+         sodipodi:nodetypes="ccccccc"
+         style="fill:#b7d9ea;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+         d="m -0.04504951,16.04505 0,-8.0000005 4.00000001,0 0,4.0000005 4,0 0,4 z"
+         id="path4836"
+         inkscape:connector-curvature="0" />
+      <path
+         sodipodi:nodetypes="ccccccccccc"
+         style="fill:#1b4955;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+         d="m 0.95495049,7.0450495 -1,1 4.00000001,0 0,4.0000005 4,0 0,4 1,-1 0,-4 -4,0 0,-4.0000005 z"
+         id="path4838"
+         inkscape:connector-curvature="0" />
+    </g>
+    <g
+       transform="matrix(0.50384823,0.35279833,-0.44611498,0.63711822,12.416596,13.249382)"
+       id="g4929-3"
+       style="stroke:none;stroke-opacity:1">
+      <path
+         sodipodi:nodetypes="ccccccc"
+         style="fill:#b7d9ea;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+         d="m -0.04504951,16.04505 0,-8.0000005 4.00000001,0 0,4.0000005 4,0 0,4 z"
+         id="path4836-4"
+         inkscape:connector-curvature="0" />
+      <path
+         sodipodi:nodetypes="ccccccccccc"
+         style="fill:#1b4955;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+         d="m 0.95495049,7.0450495 -1,1 4.00000001,0 0,4.0000005 4,0 0,4 1,-1 0,-4 -4,0 0,-4.0000005 z"
+         id="path4838-7"
+         inkscape:connector-curvature="0" />
+    </g>
+    <g
+       transform="matrix(0.2103715,0.57799095,-0.730872,0.26601565,20.064311,22.847031)"
+       id="g4929-3-7"
+       style="stroke:none;stroke-opacity:1">
+      <path
+         sodipodi:nodetypes="ccccccc"
+         style="fill:#b7d9ea;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+         d="m -0.04504951,16.04505 0,-8.0000005 4.00000001,0 0,4.0000005 4,0 0,4 z"
+         id="path4836-4-4"
+         inkscape:connector-curvature="0" />
+      <path
+         sodipodi:nodetypes="ccccccccccc"
+         style="fill:#1b4955;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+         d="m 0.95495049,7.0450495 -1,1 4.00000001,0 0,4.0000005 4,0 0,4 1,-1 0,-4 -4,0 0,-4.0000005 z"
+         id="path4838-7-8"
+         inkscape:connector-curvature="0" />
+    </g>
+    <path
+       style="fill:#fecc02;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.69999999;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       d="M 0.51277295,27.461033 1.700539,26.273267 3.0808095,27.653538 4.4610798,26.273267 5.6488459,27.461033 4.2685755,28.841304 5.6488459,30.221574 4.4610798,31.40934 3.0808095,30.02907 1.700539,31.40934 0.51277295,30.221574 1.8930434,28.841304 0.51277295,27.461033"
+       id="path4453"
+       inkscape:connector-curvature="0" />
+  </g>
+</svg>
diff --git a/src/FeaturesPlugin/icons/multirotation.png b/src/FeaturesPlugin/icons/multirotation.png
new file mode 100644 (file)
index 0000000..fb82a1e
Binary files /dev/null and b/src/FeaturesPlugin/icons/multirotation.png differ
index 07e9f9e067eeb2dddae9ad91ce5c030d88c9e295..2f75ff443e0c49cfd4a6752cf031973a7596d7e9 100644 (file)
@@ -79,6 +79,9 @@
       <feature id="MultiTranslation" title="MultiTranslation" tooltip="Perform multi-translation objects" icon="icons/Features/multitranslation.png">
         <source path="multitranslation_widget.xml"/>
       </feature>
+      <feature id="MultiRotation" title="MultiRotation" tooltip="Perform multi-rotation objects" icon="icons/Features/multirotation.png">
+        <source path="multirotation_widget.xml"/>
+      </feature>
     </group>
   </workbench>
 </plugin>
index 1df2c7f8745f37b64881a809f7885f922452a77e..55dfedee55aa01d3fba5561d4ce204a1377f97c7 100644 (file)
@@ -8,6 +8,7 @@
 
 #include "GeomAlgoAPI_SketchBuilder.h"
 
+#include <GeomAPI_Ax1.h>
 #include <GeomAPI_Edge.h>
 #include <GeomAPI_Dir.h>
 #include <GeomAPI_Face.h>
@@ -33,7 +34,9 @@
 #include <Geom2d_Curve.hxx>
 #include <BRepLib_CheckCurveOnSurface.hxx>
 #include <BRep_Tool.hxx>
+#include <Geom_Line.hxx>
 #include <Geom_Plane.hxx>
+#include <GeomAPI_ProjectPointOnCurve.hxx>
 #include <GeomLib_IsPlanarSurface.hxx>
 #include <GeomLib_Tool.hxx>
 #include <gp_Pln.hxx>
@@ -814,3 +817,20 @@ std::shared_ptr<GeomAPI_Shape> GeomAlgoAPI_ShapeTools::findShape(
 
   return aResultShape;
 }
+
+//==================================================================================================
+std::shared_ptr<GeomAPI_Dir> GeomAlgoAPI_ShapeTools::buildDirFromAxisAndShape(
+                                    const std::shared_ptr<GeomAPI_Shape> theBaseShape,
+                                    const std::shared_ptr<GeomAPI_Ax1> theAxis)
+{
+  gp_Pnt aCentreOfMassPoint =
+    GeomAlgoAPI_ShapeTools::centreOfMass(theBaseShape)->impl<gp_Pnt>();
+  Handle(Geom_Line) aLine = new Geom_Line(theAxis->impl<gp_Ax1>());
+  GeomAPI_ProjectPointOnCurve aPrjTool(aCentreOfMassPoint, aLine);
+  gp_Pnt aPoint = aPrjTool.NearestPoint();
+
+  std::shared_ptr<GeomAPI_Dir> aDir(new GeomAPI_Dir(aCentreOfMassPoint.X()-aPoint.X(),
+                                                    aCentreOfMassPoint.Y()-aPoint.Y(),
+                                                    aCentreOfMassPoint.Z()-aPoint.Z()));
+  return aDir;
+}
\ No newline at end of file
index d3b712585176a24a8e7316e42611d48153ebf8ba..a45e54d4ae6ac85db753361e3fa3ed4d64ee74fa 100644 (file)
@@ -15,6 +15,7 @@
 #include <map>
 #include <set>
 
+class GeomAPI_Ax1;
 class GeomAPI_Edge;
 class GeomAPI_Dir;
 class GeomAPI_Face;
@@ -142,6 +143,13 @@ public:
                                     const std::list<std::shared_ptr<GeomAPI_Pnt> >& thePoints,
                                     const std::set<std::shared_ptr<GeomAPI_Shape> >& theShapes);
 
+  /// \brief Returns a dir from a shape and an axis.
+  /// \param[in] theBaseShape shape whose center of mass serves as the starting point of the dir.
+  /// \param[in] theAxis axis that serves as a direction for the dir
+  /// \return dir that builds from center of mass of the base shape and the axis
+  GEOMALGOAPI_EXPORT static std::shared_ptr<GeomAPI_Dir> buildDirFromAxisAndShape(
+                                    const std::shared_ptr<GeomAPI_Shape> theBaseShape,
+                                    const std::shared_ptr<GeomAPI_Ax1> theAxis);
 };
 
 #endif