]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Merge branch 'BR_EDF_2018_Lot1'
authormpv <mpv@opencascade.com>
Mon, 9 Jul 2018 13:13:01 +0000 (16:13 +0300)
committermpv <mpv@opencascade.com>
Mon, 9 Jul 2018 13:13:01 +0000 (16:13 +0300)
105 files changed:
src/CollectionPlugin/Test/TestGroup.py
src/Config/Config_Common.cpp
src/Config/Config_FeatureReader.cpp
src/Config/Config_Keywords.h
src/Config/Config_WidgetAPI.cpp
src/ConstructionAPI/ConstructionAPI_Point.cpp
src/ConstructionAPI/ConstructionAPI_Point.h
src/ConstructionPlugin/CMakeLists.txt
src/ConstructionPlugin/ConstructionPlugin_Plugin.cpp
src/ConstructionPlugin/ConstructionPlugin_Point.cpp
src/ConstructionPlugin/ConstructionPlugin_Point.h
src/ConstructionPlugin/ConstructionPlugin_Validators.cpp
src/ConstructionPlugin/ConstructionPlugin_Validators.h
src/ConstructionPlugin/Test/TestPoint_Edge.py [new file with mode: 0644]
src/ConstructionPlugin/Test/TestPoint_GeometricalPropertyCenterOfCircle.py [new file with mode: 0644]
src/ConstructionPlugin/Test/TestPoint_GeometricalPropertyCenterOfGravity.py [new file with mode: 0644]
src/ConstructionPlugin/Test/TestPoint_IntersectLineAndPlane.py [new file with mode: 0644]
src/ConstructionPlugin/Test/TestPoint_IntersectLines.py [new file with mode: 0644]
src/ConstructionPlugin/Test/TestPoint_IntersectPlanes.py [new file with mode: 0644]
src/ConstructionPlugin/Test/TestPoint_LineAndPlane.py [deleted file]
src/ConstructionPlugin/Test/TestPoint_ProjectOnEdge.py [new file with mode: 0644]
src/ConstructionPlugin/Test/TestPoint_ProjectOnFace.py [new file with mode: 0644]
src/ConstructionPlugin/icons/point_by_center_of_circle_24x24.png [new file with mode: 0644]
src/ConstructionPlugin/icons/point_by_center_of_gravity_24x24.png [new file with mode: 0644]
src/ConstructionPlugin/icons/point_by_distance_on_edge_24x24.png [new file with mode: 0644]
src/ConstructionPlugin/icons/point_by_geometrical_property_32x32.png [new file with mode: 0644]
src/ConstructionPlugin/icons/point_by_intersection_32x32.png [new file with mode: 0644]
src/ConstructionPlugin/icons/point_by_line_and_plane_intersection_24x24.png [new file with mode: 0644]
src/ConstructionPlugin/icons/point_by_lines_intersection_24x24.png [new file with mode: 0644]
src/ConstructionPlugin/icons/point_by_planes_intersection_24x24.png [new file with mode: 0644]
src/ConstructionPlugin/icons/point_by_projection_32x32.png
src/ConstructionPlugin/icons/point_by_projection_on_edge_24x24.png [new file with mode: 0644]
src/ConstructionPlugin/icons/point_by_projection_on_edge_32x32.png [new file with mode: 0644]
src/ConstructionPlugin/icons/point_by_projection_on_face_24x24.png [new file with mode: 0644]
src/ConstructionPlugin/icons/point_by_projection_on_face_32x32.png [new file with mode: 0644]
src/ConstructionPlugin/icons/point_by_ratio_on_edge_24x24.png [new file with mode: 0644]
src/ConstructionPlugin/icons/shapes.png [new file with mode: 0644]
src/ConstructionPlugin/point_widget.xml
src/FeaturesAPI/CMakeLists.txt
src/FeaturesAPI/FeaturesAPI.i
src/FeaturesAPI/FeaturesAPI_Boolean.cpp [deleted file]
src/FeaturesAPI/FeaturesAPI_Boolean.h [deleted file]
src/FeaturesAPI/FeaturesAPI_BooleanCommon.cpp [new file with mode: 0644]
src/FeaturesAPI/FeaturesAPI_BooleanCommon.h [new file with mode: 0644]
src/FeaturesAPI/FeaturesAPI_BooleanCut.cpp [new file with mode: 0644]
src/FeaturesAPI/FeaturesAPI_BooleanCut.h [new file with mode: 0644]
src/FeaturesAPI/FeaturesAPI_BooleanFill.cpp [new file with mode: 0644]
src/FeaturesAPI/FeaturesAPI_BooleanFill.h [new file with mode: 0644]
src/FeaturesAPI/FeaturesAPI_BooleanFuse.cpp [new file with mode: 0644]
src/FeaturesAPI/FeaturesAPI_BooleanFuse.h [new file with mode: 0644]
src/FeaturesAPI/FeaturesAPI_BooleanSmash.cpp [new file with mode: 0644]
src/FeaturesAPI/FeaturesAPI_BooleanSmash.h [new file with mode: 0644]
src/FeaturesAPI/FeaturesAPI_swig.h
src/FeaturesPlugin/CMakeLists.txt
src/FeaturesPlugin/FeaturesPlugin_Boolean.cpp
src/FeaturesPlugin/FeaturesPlugin_Boolean.h
src/FeaturesPlugin/FeaturesPlugin_BooleanCommon.h [new file with mode: 0644]
src/FeaturesPlugin/FeaturesPlugin_BooleanCut.h [new file with mode: 0644]
src/FeaturesPlugin/FeaturesPlugin_BooleanFill.h [new file with mode: 0644]
src/FeaturesPlugin/FeaturesPlugin_BooleanFuse.h [new file with mode: 0644]
src/FeaturesPlugin/FeaturesPlugin_BooleanSmash.h [new file with mode: 0644]
src/FeaturesPlugin/FeaturesPlugin_Plugin.cpp
src/FeaturesPlugin/FeaturesPlugin_Validators.cpp
src/FeaturesPlugin/FeaturesPlugin_Validators.h
src/FeaturesPlugin/Test/Test2194.py
src/FeaturesPlugin/Test/Test2375.py
src/FeaturesPlugin/Test/Test2394.py
src/FeaturesPlugin/Test/TestBoolean.py
src/FeaturesPlugin/Test/TestBooleanCompSolids.py
src/FeaturesPlugin/Test/TestBooleanSmash.py
src/FeaturesPlugin/Test/TestFillCompFaceSolid.py
src/FeaturesPlugin/Test/TestFillShellSolid.py
src/FeaturesPlugin/Test/TestFillSolidCompFace.py
src/FeaturesPlugin/Test/TestFillSolidCompShell.py
src/FeaturesPlugin/Test/TestFillSolidShell.py
src/FeaturesPlugin/Test/TestMultiBoolean.py
src/FeaturesPlugin/Test/TestSerialBoolean.py
src/FeaturesPlugin/boolean_widget.xml
src/FeaturesPlugin/plugin-Features.xml
src/GeomAlgoAPI/GeomAlgoAPI_PointBuilder.cpp
src/GeomAlgoAPI/GeomAlgoAPI_PointBuilder.h
src/GeomAlgoAPI/GeomAlgoAPI_ShapeTools.cpp
src/GeomValidators/CMakeLists.txt
src/GeomValidators/GeomValidators_BooleanArguments.cpp [deleted file]
src/GeomValidators/GeomValidators_BooleanArguments.h [deleted file]
src/GeomValidators/GeomValidators_Plugin.cpp
src/InitializationPlugin/InitializationPlugin_Plugin.cpp
src/ModelAPI/Test/Test1512.py
src/ModelAPI/Test/Test2228.py
src/ModelHighAPI/ModelHighAPI_Macro.h
src/ModuleBase/CMakeLists.txt
src/ModuleBase/ModuleBase_ParamSpinBox.cpp
src/ModuleBase/ModuleBase_ResultPrs.cpp
src/ModuleBase/ModuleBase_ResultPrs.h
src/ModuleBase/ModuleBase_WidgetFactory.cpp
src/ModuleBase/ModuleBase_WidgetPointInput.cpp [new file with mode: 0644]
src/ModuleBase/ModuleBase_WidgetPointInput.h [new file with mode: 0644]
src/ModuleBase/ModuleBase_WidgetRadiobox.cpp [new file with mode: 0644]
src/ModuleBase/ModuleBase_WidgetRadiobox.h [new file with mode: 0644]
src/XGUI/CMakeLists.txt
src/XGUI/XGUI_InspectionPanel.cpp [new file with mode: 0644]
src/XGUI/XGUI_InspectionPanel.h [new file with mode: 0644]
src/XGUI/XGUI_Workshop.cpp
src/XGUI/XGUI_Workshop.h
src/XGUI/pictures/z_size.png

index ca834e5dfe727bdaa313ac9d256964d117b99277..0ecbd0ddcc35cf5f50bed2d186012f50daaac617 100644 (file)
@@ -234,11 +234,9 @@ aCylinderBody = modelAPI_ResultBody(anExtrusionFt.firstResult())
 # Create a cut
 #=========================================================================
 aSession.startOperation()
-aBooleanFt = aPart.addFeature("Boolean")
+aBooleanFt = aPart.addFeature("Cut")
 aBooleanFt.selectionList("main_objects").append(anExtrusionBody, None)
 aBooleanFt.selectionList("tool_objects").append(aCylinderBody, None)
-aBooleanTypeCut = 0
-aBooleanFt.integer("bool_type").setValue(aBooleanTypeCut)
 aBooleanFt.execute()
 aSession.finishOperation()
 
index 544e7a7ea4c41b925c8207ac0217aebb0ab6f5af..c83a33079f7df2bae5bbb7ee56fa48609e9e2e28 100644 (file)
@@ -68,7 +68,8 @@ bool isAttributeNode(xmlNodePtr theNode)
   // it's parent is "feature" or "source" or page ("case" or "box")
   if(!hasParent(theNode, NODE_FEATURE, NODE_SOURCE,
                          WDG_GROUP, WDG_OPTIONALBOX,
-                         WDG_TOOLBOX_BOX, WDG_SWITCH_CASE, NULL))
+                         WDG_TOOLBOX_BOX, WDG_RADIOBOX_ITEM,
+                         WDG_SWITCH_CASE, NULL))
     return false;
 
   //it should not be a "source" or a "validator" node
@@ -86,7 +87,7 @@ bool isWidgetNode(xmlNodePtr theNode)
     return false;
   // it's parent is "feature" or "source" or a page ("box", "case")
   if(!hasParent(theNode, NODE_FEATURE, NODE_SOURCE, WDG_GROUP, WDG_OPTIONALBOX,
-                         WDG_TOOLBOX_BOX, WDG_SWITCH_CASE, NULL))
+    WDG_TOOLBOX_BOX, WDG_RADIOBOX_ITEM, WDG_SWITCH_CASE, NULL))
     return false;
 
   //it should not be a "source" or a "validator" node
@@ -99,7 +100,8 @@ bool isCaseNode(xmlNodePtr theNode)
   if(!isElementNode(theNode))
     return false;
 
-  return isNode(theNode, WDG_OPTIONALBOX, WDG_SWITCH_CASE, WDG_TOOLBOX_BOX, NULL);
+  return isNode(theNode, WDG_OPTIONALBOX, WDG_SWITCH_CASE, WDG_TOOLBOX_BOX,
+    WDG_RADIOBOX_ITEM, NULL);
 }
 
 bool hasChild(xmlNodePtr theNode)
index c0af30ac45e5c9ed4960cfa46e242c7aebaede56..5d7e5c89ec78683bec76e2bc7a40d85b909ea83a 100644 (file)
@@ -90,8 +90,8 @@ void Config_FeatureReader::processNode(xmlNodePtr theNode)
         aMessage->setMainArgument(isMainArg);
 
         std::list<std::pair<std::string, std::string> > aCases;
-        xmlNodePtr aCaseNode =
-          hasParentRecursive(theNode, WDG_SWITCH_CASE, WDG_TOOLBOX_BOX, WDG_OPTIONALBOX, NULL);
+        xmlNodePtr aCaseNode = hasParentRecursive(theNode,
+          WDG_SWITCH_CASE, WDG_TOOLBOX_BOX, WDG_OPTIONALBOX, WDG_RADIOBOX_ITEM, NULL);
         while(aCaseNode) {
           std::string aCaseNodeID = getProperty(aCaseNode, _ID);
           std::string aSwitchNodeID = "";
@@ -103,6 +103,9 @@ void Config_FeatureReader::processNode(xmlNodePtr theNode)
           else if (!xmlStrcmp(aName, (const xmlChar *) WDG_TOOLBOX_BOX)) {
             aSwitchNode = hasParentRecursive(aCaseNode, WDG_TOOLBOX, NULL);
           }
+          else if (!xmlStrcmp(aName, (const xmlChar *)WDG_RADIOBOX_ITEM)) {
+            aSwitchNode = hasParentRecursive(aCaseNode, WDG_RADIOBOX, NULL);
+          }
           if (!xmlStrcmp(aName, (const xmlChar *) WDG_OPTIONALBOX)) {
             /// the box is optional, attribute is in case
             /// if the optional attribute value is not empty
@@ -113,14 +116,15 @@ void Config_FeatureReader::processNode(xmlNodePtr theNode)
 
           aCases.push_back(std::make_pair(aSwitchNodeID, aCaseNodeID));
           aCaseNode = hasParentRecursive(aSwitchNode, WDG_SWITCH_CASE,
-                                         WDG_TOOLBOX_BOX, WDG_OPTIONALBOX, NULL);
+            WDG_TOOLBOX_BOX, WDG_OPTIONALBOX, WDG_RADIOBOX_ITEM, NULL);
         }
         aMessage->setCases(aCases);
         Events_Loop::loop()->send(aMessage);
       }
     // container pages, like "case" or "box"
     } else if (isNode(theNode, WDG_OPTIONALBOX, WDG_SWITCH, WDG_SWITCH_CASE,
-                      WDG_TOOLBOX, WDG_TOOLBOX_BOX, NULL)) {
+                      WDG_TOOLBOX, WDG_TOOLBOX_BOX,
+                      WDG_RADIOBOX, WDG_RADIOBOX_ITEM, NULL)) {
       storeAttribute(theNode, _ID); // save case:caseId (or box:boxId)
     }
   }
@@ -131,7 +135,7 @@ void Config_FeatureReader::processNode(xmlNodePtr theNode)
 void Config_FeatureReader::cleanup(xmlNodePtr theNode)
 {
   if (isNode(theNode, WDG_OPTIONALBOX, WDG_SWITCH, WDG_SWITCH_CASE,
-             WDG_TOOLBOX, WDG_TOOLBOX_BOX, NULL)) {
+    WDG_TOOLBOX, WDG_TOOLBOX_BOX, WDG_RADIOBOX_ITEM, WDG_RADIOBOX, NULL)) {
     // cleanup id of cases when leave case node
     cleanupAttribute(theNode, _ID);
   }
@@ -144,6 +148,7 @@ bool Config_FeatureReader::processChildren(xmlNodePtr theNode)
     result = isNode(theNode, NODE_FEATURE,
                              WDG_GROUP, WDG_OPTIONALBOX,
                              WDG_TOOLBOX, WDG_TOOLBOX_BOX,
+                             WDG_RADIOBOX, WDG_RADIOBOX_ITEM,
                              WDG_SWITCH, WDG_SWITCH_CASE, NULL);
   }
   return result;
index 2e8261fef44da4f5ab66f704d7f3703c8911f3db..938749424e99eefd2cbf64e33f4c34bf5e9240f2 100644 (file)
@@ -52,11 +52,14 @@ const static char* WDG_FILE_SELECTOR= "file_selector";
 const static char* WDG_EXPR_EDITOR = "expr_editor";
 const static char* WDG_PLACE_HOLDER = "placeholder";
 const static char* WDG_ACTION = "action";
+const static char* WDG_POINT_INPUT = "point_input";
 
 // Containers
 const static char* WDG_GROUP = "groupbox";
 const static char* WDG_OPTIONALBOX = "optionalbox";
 const static char* WDG_TOOLBOX = "toolbox";
+const static char* WDG_RADIOBOX = "radiobox";
+const static char* WDG_RADIOBOX_ITEM = "radio";
 const static char* WDG_TOOLBOX_BOX = "box";
 const static char* WDG_SWITCH = "switch";
 const static char* WDG_SWITCH_CASE = "case";
index 7a9eac960ad4e477375e592cbad2a654c034cf5c..023ad2868ff8a647c819510b5924cef3e8f8eae5 100644 (file)
@@ -99,7 +99,7 @@ bool Config_WidgetAPI::isGroupBoxWidget() const
 
 bool Config_WidgetAPI::isPagedWidget() const
 {
-  return isNode(myCurrentNode, WDG_TOOLBOX, WDG_SWITCH,
+  return isNode(myCurrentNode, WDG_TOOLBOX, WDG_SWITCH, WDG_RADIOBOX,
                 NULL);
 }
 
index 48222cfc4e3c5384f6452d83744718b1778d0e0e..7d536c9fd01ae0d093a4ed35dbabb837c6e41afe 100644 (file)
@@ -45,18 +45,18 @@ ConstructionAPI_Point::ConstructionAPI_Point(const std::shared_ptr<ModelAPI_Feat
   }
 }
 
-/*//==================================================================================================
+//==================================================================================================
 ConstructionAPI_Point::ConstructionAPI_Point(const std::shared_ptr<ModelAPI_Feature>& theFeature,
                                              const ModelHighAPI_Selection& theEdge,
-                                             const ModelHighAPI_Double& theDistanceValue,
-                                             const bool theDistancePercent,
+                                             const ModelHighAPI_Double& theOffset,
+                                             const bool theUseRatio,
                                              const bool theReverse)
 : ModelHighAPI_Interface(theFeature)
 {
   if(initialize()) {
-    setByDistanceOnEdge(theEdge, theDistanceValue, theDistancePercent, theReverse);
+    setByOffsetOnEdge(theEdge, theOffset, theUseRatio, theReverse);
   }
-}*/
+}
 
 //==================================================================================================
 ConstructionAPI_Point::ConstructionAPI_Point(const std::shared_ptr<ModelAPI_Feature>& theFeature,
@@ -67,20 +67,59 @@ ConstructionAPI_Point::ConstructionAPI_Point(const std::shared_ptr<ModelAPI_Feat
   if(initialize()) {
     GeomAPI_Shape::ShapeType aType1 = getShapeType(theObject1);
     GeomAPI_Shape::ShapeType aType2 = getShapeType(theObject2);
-    /*
     if(aType1 == GeomAPI_Shape::VERTEX && aType2 == GeomAPI_Shape::FACE) {
       // If first object is vertex and second object is face then set by projection.
-      setByProjection(theObject1, theObject2);
+      setByProjectionOnFace(theObject1, theObject2);
+    } else if (aType1 == GeomAPI_Shape::VERTEX && aType2 == GeomAPI_Shape::EDGE) {
+      // If first object is vertex and second object is edge then set by projection.
+      setByProjectionOnEdge(theObject1, theObject2);
     } else if(aType1 == GeomAPI_Shape::EDGE && aType2 == GeomAPI_Shape::EDGE) {
       // If both objects are edges then set by lines intersection.
       setByLinesIntersection(theObject1, theObject2);
-    } else */if(aType1 == GeomAPI_Shape::EDGE && aType2 == GeomAPI_Shape::FACE) {
+    } else if(aType1 == GeomAPI_Shape::EDGE && aType2 == GeomAPI_Shape::FACE) {
       // If first object is edge and second object is face then set by line and plane intersection.
       setByLineAndPlaneIntersection(theObject1, theObject2);
     }
   }
 }
 
+//==================================================================================================
+ConstructionAPI_Point::ConstructionAPI_Point(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+                                             const ModelHighAPI_Selection& theObject1,
+                                             const ModelHighAPI_Selection& theObject2,
+                                             const ModelHighAPI_Selection& theObject3)
+: ModelHighAPI_Interface(theFeature)
+{
+  if (initialize())
+  {
+    GeomAPI_Shape::ShapeType aType1 = getShapeType(theObject1);
+    GeomAPI_Shape::ShapeType aType2 = getShapeType(theObject2);
+    GeomAPI_Shape::ShapeType aType3 = getShapeType(theObject3);
+    if (aType1 == GeomAPI_Shape::FACE
+        && aType2 == GeomAPI_Shape::FACE
+        && aType3 == GeomAPI_Shape::FACE)
+    {
+      setByPlanesIntersection(theObject1, theObject2, theObject3);
+    }
+  }
+}
+
+//==================================================================================================
+ConstructionAPI_Point::ConstructionAPI_Point(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+                                             const ModelHighAPI_Selection& theObject,
+                                             const bool theIsCircularEdge)
+: ModelHighAPI_Interface(theFeature)
+{
+  if (initialize())
+  {
+    if (theIsCircularEdge) {
+      setByCenterOfCircle(theObject);
+    } else {
+      setByCenterOfGravity(theObject);
+    }
+  }
+}
+
 //==================================================================================================
 ConstructionAPI_Point::~ConstructionAPI_Point()
 {
@@ -93,36 +132,62 @@ void ConstructionAPI_Point::setByXYZ(const ModelHighAPI_Double& theX,
                                      const ModelHighAPI_Double& theZ)
 {
   //fillAttribute(ConstructionPlugin_Point::CREATION_METHOD_BY_XYZ(), mycreationMethod);
-  fillAttribute(theX, myx);
-  fillAttribute(theY, myy);
-  fillAttribute(theZ, myz);
+
+  // TODO: Fill point attribute
+  //fillAttribute(theX, myx);
+  //fillAttribute(theY, myy);
+  //fillAttribute(theZ, myz);
+
   fillAttribute(ConstructionPlugin_Point::CREATION_METHOD_BY_XYZ(), mycreationMethod);
 
   execute(false);
 }
 
-/*//==================================================================================================
-void ConstructionAPI_Point::setByDistanceOnEdge(const ModelHighAPI_Selection& theEdge,
-                                                const ModelHighAPI_Double& theDistanceValue,
-                                                const bool theDistancePercent,
-                                                const bool theReverse)
+//==================================================================================================
+void ConstructionAPI_Point::setByOffsetOnEdge(const ModelHighAPI_Selection& theEdge,
+                                              const ModelHighAPI_Double& theOffset,
+                                              const bool theUseRatio,
+                                              const bool theReverse)
 {
   fillAttribute(ConstructionPlugin_Point::CREATION_METHOD_BY_DISTANCE_ON_EDGE(), mycreationMethod);
   fillAttribute(theEdge, myedge);
-  fillAttribute(theDistanceValue, mydistanceValue);
-  fillAttribute(theDistancePercent, mydistancePercent);
+  if (theUseRatio) {
+    fillAttribute(ConstructionPlugin_Point::OFFSET_TYPE_BY_RATIO(), myoffsetType);
+    fillAttribute(theOffset, myratio);
+  }
+  else {
+    fillAttribute(ConstructionPlugin_Point::OFFSET_TYPE_BY_DISTANCE(), myoffsetType);
+    fillAttribute(theOffset, mydistance);
+  }
   fillAttribute(theReverse, myreverse);
 
   execute();
 }
 
 //==================================================================================================
-void ConstructionAPI_Point::setByProjection(const ModelHighAPI_Selection& theVertex,
-                                            const ModelHighAPI_Selection& theFace)
+void ConstructionAPI_Point::setByProjectionOnEdge(const ModelHighAPI_Selection& theVertex,
+                                                  const ModelHighAPI_Selection& theEdge)
+{
+  fillAttribute(ConstructionPlugin_Point::CREATION_METHOD_BY_PROJECTION(),
+                mycreationMethod);
+  fillAttribute(ConstructionPlugin_Point::PROJECTION_TYPE_ON_EDGE(),
+                myprojectionType);
+  fillAttribute(theVertex, mypoinToProject);
+  fillAttribute(theEdge, myedgeForPointProjection);
+
+  execute();
+}
+
+//==================================================================================================
+void ConstructionAPI_Point::setByProjectionOnFace(const ModelHighAPI_Selection& theVertex,
+                                                  const ModelHighAPI_Selection& theFace)
 {
-  fillAttribute(ConstructionPlugin_Point::CREATION_METHOD_BY_PROJECTION(), mycreationMethod);
-  fillAttribute(theVertex, mypoint);
-  fillAttribute(theFace, myplane);
+  fillAttribute(ConstructionPlugin_Point::CREATION_METHOD_BY_PROJECTION(),
+                mycreationMethod);
+  fillAttribute(ConstructionPlugin_Point::PROJECTION_TYPE_ON_FACE(),
+                myprojectionType);
+  fillAttribute(theVertex, mypoinToProject);
+  fillAttribute(theFace, myfaceForPointProjection);
 
   execute();
 }
@@ -131,45 +196,124 @@ void ConstructionAPI_Point::setByProjection(const ModelHighAPI_Selection& theVer
 void ConstructionAPI_Point::setByLinesIntersection(const ModelHighAPI_Selection& theEdge1,
                                                    const ModelHighAPI_Selection& theEdge2)
 {
-  fillAttribute(ConstructionPlugin_Point::CREATION_METHOD_BY_LINES_INTERSECTION(), mycreationMethod);
-  fillAttribute(theEdge1, myfirstLine);
-  fillAttribute(theEdge2, mysecondLine);
+  fillAttribute(ConstructionPlugin_Point::CREATION_METHOD_BY_INTERSECTION(), mycreationMethod);
+  fillAttribute(ConstructionPlugin_Point::INTERSECTION_TYPE_BY_LINES(),
+                myintersectionType);
+  fillAttribute(theEdge1, myintersectionLine1);
+  fillAttribute(theEdge2, myintersectionLine2);
 
   execute();
-}*/
+}
 
 //==================================================================================================
 void ConstructionAPI_Point::setByLineAndPlaneIntersection(const ModelHighAPI_Selection& theEdge,
                                                           const ModelHighAPI_Selection& theFace)
 {
-  fillAttribute(
-    ConstructionPlugin_Point::CREATION_METHOD_BY_LINE_AND_PLANE_INTERSECTION(), mycreationMethod);
+  fillAttribute(ConstructionPlugin_Point::CREATION_METHOD_BY_INTERSECTION(), mycreationMethod);
+  fillAttribute(ConstructionPlugin_Point::INTERSECTION_TYPE_BY_LINE_AND_PLANE(),
+                myintersectionType);
   fillAttribute(theEdge, myintersectionLine);
   fillAttribute(theFace, myintersectionPlane);
   fillAttribute("", useOffset()); // not used by default
   execute();
 }
 
+//==================================================================================================
+void ConstructionAPI_Point::setByPlanesIntersection(const ModelHighAPI_Selection& theFace1,
+                                                    const ModelHighAPI_Selection& theFace2,
+                                                    const ModelHighAPI_Selection& theFace3)
+{
+  fillAttribute(ConstructionPlugin_Point::CREATION_METHOD_BY_INTERSECTION(), mycreationMethod);
+  fillAttribute(ConstructionPlugin_Point::INTERSECTION_TYPE_BY_PLANES(),
+                myintersectionType);
+  fillAttribute(theFace1, myintersectionPlane1);
+  fillAttribute(theFace2, myintersectionPlane2);
+  fillAttribute(theFace3, myintersectionPlane3);
+
+  execute();
+}
+
+//==================================================================================================
+void ConstructionAPI_Point::setByCenterOfGravity(const ModelHighAPI_Selection& theObject)
+{
+  fillAttribute(ConstructionPlugin_Point::CREATION_METHOD_BY_GEOMETRICAL_PROPERTY(),
+                mycreationMethod);
+  fillAttribute(ConstructionPlugin_Point::GEOMETRICAL_PROPERTY_TYPE_BY_CENTER_OF_GRAVITY(),
+                mygeometricalPropertyType);
+  fillAttribute(theObject, myobjectForCenterOfGravity);
+}
+
+//==================================================================================================
+void ConstructionAPI_Point::setByCenterOfCircle(const ModelHighAPI_Selection& theObject)
+{
+  fillAttribute(ConstructionPlugin_Point::CREATION_METHOD_BY_GEOMETRICAL_PROPERTY(),
+                mycreationMethod);
+  fillAttribute(ConstructionPlugin_Point::GEOMETRICAL_PROPERTY_TYPE_BY_CENTER_OF_CIRCLE(),
+                mygeometricalPropertyType);
+  fillAttribute(theObject, myobjectForCenterOfCircle);
+}
+
 //==================================================================================================
 void ConstructionAPI_Point::dump(ModelHighAPI_Dumper& theDumper) const
 {
   FeaturePtr aBase = feature();
   const std::string& aDocName = theDumper.name(aBase->document());
-  const std::string& aMeth = creationMethod()->value();
+  const std::string aMeth = creationMethod()->value();
 
   // common part
   theDumper << aBase << " = model.addPoint(" << aDocName << ", ";
 
   if (aMeth == "" || // default is XYZ
       aMeth == ConstructionPlugin_Point::CREATION_METHOD_BY_XYZ()) {
-    theDumper << x() << ", " << y() << ", " << z() << ")" << std::endl;
-  } else if (aMeth == ConstructionPlugin_Point::CREATION_METHOD_BY_LINE_AND_PLANE_INTERSECTION()) {
-    theDumper << intersectionLine() << ", " <<intersectionPlane() ;
-    if (!useOffset()->value().empty()) { // call method with defined offset
-      theDumper << ", " << offset() << ", " << reverseOffset();
+    theDumper << point() << ")" << std::endl;
+  } else if (aMeth == ConstructionPlugin_Point::CREATION_METHOD_BY_INTERSECTION()) {
+    const std::string anIntersectionType = intersectionType()->value();
+    if (anIntersectionType == ConstructionPlugin_Point::INTERSECTION_TYPE_BY_LINES())
+    {
+      theDumper << intersectionLine1() << ", " << intersectionLine2();
+    }
+    else if (anIntersectionType == ConstructionPlugin_Point::INTERSECTION_TYPE_BY_LINE_AND_PLANE())
+    {
+      theDumper << intersectionLine() << ", " << intersectionPlane();
+      if (!useOffset()->value().empty()) { // call method with defined offset
+        theDumper << ", " << offset() << ", " << reverseOffset();
+      }
+    }
+    else if (anIntersectionType == ConstructionPlugin_Point::INTERSECTION_TYPE_BY_PLANES())
+    {
+      theDumper << intersectionPlane1() << ", "
+                << intersectionPlane2() << ", "
+                << intersectionPlane3();
+    }
+  } else if (aMeth == ConstructionPlugin_Point::CREATION_METHOD_BY_DISTANCE_ON_EDGE()) {
+    theDumper << edge() << ", ";
+    if (offsetType()->value() == ConstructionPlugin_Point::OFFSET_TYPE_BY_DISTANCE()) {
+      theDumper << distance() << ", " << false;
+    }
+    else {
+      theDumper << ratio() << ", " << true;
+    }
+    theDumper << ", " << reverse()->value();
+  } else if (aMeth == ConstructionPlugin_Point::CREATION_METHOD_BY_PROJECTION()) {
+    theDumper << poinToProject() << ", ";
+    if (projectionType()->value() == ConstructionPlugin_Point::PROJECTION_TYPE_ON_EDGE()) {
+      theDumper << edgeForPointProjection();
+    } else {
+      theDumper << faceForPointProjection();
+    }
+  } else if (aMeth == ConstructionPlugin_Point::CREATION_METHOD_BY_GEOMETRICAL_PROPERTY()) {
+    if (geometricalPropertyType()->value() ==
+          ConstructionPlugin_Point::GEOMETRICAL_PROPERTY_TYPE_BY_CENTER_OF_GRAVITY())
+    {
+      theDumper << objectForCenterOfGravity();
+    }
+    else
+    {
+      theDumper << objectForCenterOfCircle() << ", " << true;
     }
-    theDumper << ")" << std::endl;
   }
+
+  theDumper << ")" << std::endl;
 }
 
 //==================================================================================================
@@ -182,16 +326,16 @@ PointPtr addPoint(const std::shared_ptr<ModelAPI_Document>& thePart,
   return PointPtr(new ConstructionAPI_Point(aFeature, theX, theY, theZ));
 }
 
-/*//==================================================================================================
+//==================================================================================================
 PointPtr addPoint(const std::shared_ptr<ModelAPI_Document> & thePart,
                   const ModelHighAPI_Selection& theEdge,
-                  const ModelHighAPI_Double& theDistanceValue,
-                  const bool theDistancePercent,
+                  const ModelHighAPI_Double& theOffset,
+                  const bool theUseRatio,
                   const bool theReverse)
 {
   std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(ConstructionAPI_Point::ID());
-  return PointPtr(new ConstructionAPI_Point(aFeature, theEdge, theDistanceValue, theDistancePercent, theReverse));
-}*/
+  return PointPtr(new ConstructionAPI_Point(aFeature, theEdge, theOffset, theUseRatio, theReverse));
+}
 
 //==================================================================================================
 PointPtr addPoint(const std::shared_ptr<ModelAPI_Document> & thePart,
@@ -218,3 +362,22 @@ PointPtr addPoint(const std::shared_ptr<ModelAPI_Document> & thePart,
 
   return anAPI;
 }
+
+//==================================================================================================
+PointPtr addPoint(const std::shared_ptr<ModelAPI_Document> & thePart,
+                  const ModelHighAPI_Selection& theObject1,
+                  const ModelHighAPI_Selection& theObject2,
+                  const ModelHighAPI_Selection& theObject3)
+{
+  std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(ConstructionAPI_Point::ID());
+  return PointPtr(new ConstructionAPI_Point(aFeature, theObject1, theObject2, theObject3));
+}
+
+//==================================================================================================
+PointPtr addPoint(const std::shared_ptr<ModelAPI_Document> & thePart,
+                  const ModelHighAPI_Selection& theObject,
+                  const bool theIsCircularEdge)
+{
+  std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(ConstructionAPI_Point::ID());
+  return PointPtr(new ConstructionAPI_Point(aFeature, theObject, theIsCircularEdge));
+}
index 322176c4a771da37892a58d1dd92790ada02ffea..5df24daaf754f344d53078716ae3b0ea0e987046 100644 (file)
@@ -49,41 +49,63 @@ public:
                         const ModelHighAPI_Double& theY,
                         const ModelHighAPI_Double& theZ);
 
-  /*/// Constructor with values.
+  /// Constructor with values.
   CONSTRUCTIONAPI_EXPORT
   ConstructionAPI_Point(const std::shared_ptr<ModelAPI_Feature>& theFeature,
                         const ModelHighAPI_Selection& theEdge,
-                        const ModelHighAPI_Double& theDistanceValue,
-                        const bool theDistancePercent = false,
+                        const ModelHighAPI_Double& theOffset,
+                        const bool theUseRatio = false,
                         const bool theReverse = false);
-  */
+
   /// Constructor with values: intersected objects.
   CONSTRUCTIONAPI_EXPORT
   ConstructionAPI_Point(const std::shared_ptr<ModelAPI_Feature>& theFeature,
                         const ModelHighAPI_Selection& theObject1,
                         const ModelHighAPI_Selection& theObject2);
 
+  /// Constructor with values: intersected objects.
+  CONSTRUCTIONAPI_EXPORT
+  ConstructionAPI_Point(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+                        const ModelHighAPI_Selection& theObject1,
+                        const ModelHighAPI_Selection& theObject2,
+                        const ModelHighAPI_Selection& theObject3);
+
+  /// Constructor with values: object and circular edge flag.
+  CONSTRUCTIONAPI_EXPORT
+  ConstructionAPI_Point(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+                        const ModelHighAPI_Selection& theObject,
+                        const bool theIsCircularEdge = false);
+
   /// Destructor.
   CONSTRUCTIONAPI_EXPORT
   virtual ~ConstructionAPI_Point();
 
-  INTERFACE_9(ConstructionPlugin_Point::ID(),
-              x, ConstructionPlugin_Point::X(), ModelAPI_AttributeDouble, /** X attribute */,
-              y, ConstructionPlugin_Point::Y(), ModelAPI_AttributeDouble, /** Y attribute */,
-              z, ConstructionPlugin_Point::Z(), ModelAPI_AttributeDouble, /** Z attribute */,
-              creationMethod, ConstructionPlugin_Point::CREATION_METHOD(),
-              ModelAPI_AttributeString, /** Creation method */,
-              intersectionLine, ConstructionPlugin_Point::INTERSECTION_LINE(),
-              ModelAPI_AttributeSelection, /** Line for intersection */,
-              intersectionPlane, ConstructionPlugin_Point::INTERSECTION_PLANE(),
-              ModelAPI_AttributeSelection, /** Plane for intersection */,
-              useOffset, ConstructionPlugin_Point::USE_OFFSET(),
-              ModelAPI_AttributeString, /** Use offset */,
-              offset, ConstructionPlugin_Point::OFFSET(),
-              ModelAPI_AttributeDouble, /** Offset */,
-              reverseOffset, ConstructionPlugin_Point::REVERSE_OFFSET(),
-              ModelAPI_AttributeBoolean, /** Reverse offset */)
-
+  INTERFACE_25(ConstructionPlugin_Point::ID(),
+    point, ConstructionPlugin_Point::point3d(), GeomDataAPI_Point, /** Point attribute */,
+    creationMethod, ConstructionPlugin_Point::CREATION_METHOD(),  ModelAPI_AttributeString, /** Creation method */,
+    intersectionType, ConstructionPlugin_Point::INTERSECTION_TYPE(), ModelAPI_AttributeString, /** Type of the intersection */,
+    intersectionLine1, ConstructionPlugin_Point::INTERSECTION_LINE_1(), ModelAPI_AttributeSelection, /** Line for intersection */,
+    intersectionLine2, ConstructionPlugin_Point::INTERSECTION_LINE_2(), ModelAPI_AttributeSelection, /** Line for intersection */,
+    intersectionLine, ConstructionPlugin_Point::INTERSECTION_LINE(),  ModelAPI_AttributeSelection, /** Line for intersection */,
+    intersectionPlane, ConstructionPlugin_Point::INTERSECTION_PLANE(), ModelAPI_AttributeSelection, /** Plane for intersection */,
+    intersectionPlane1, ConstructionPlugin_Point::INTERSECTION_PLANE_1(), ModelAPI_AttributeSelection, /** Plane for intersection */,
+    intersectionPlane2, ConstructionPlugin_Point::INTERSECTION_PLANE_2(), ModelAPI_AttributeSelection, /** Plane for intersection */,
+    intersectionPlane3, ConstructionPlugin_Point::INTERSECTION_PLANE_3(), ModelAPI_AttributeSelection, /** Plane for intersection */,
+    useOffset, ConstructionPlugin_Point::USE_OFFSET(), ModelAPI_AttributeString, /** Use offset */,
+    offset, ConstructionPlugin_Point::OFFSET(), ModelAPI_AttributeDouble, /** Offset */,
+    reverseOffset, ConstructionPlugin_Point::REVERSE_OFFSET(), ModelAPI_AttributeBoolean, /** Reverse offset */,
+    edge, ConstructionPlugin_Point::EDGE(), ModelAPI_AttributeSelection, /** Edge */,
+    offsetType, ConstructionPlugin_Point::OFFSET_TYPE(), ModelAPI_AttributeString, /** Type of the offset on edge */,
+    distance, ConstructionPlugin_Point::DISTANCE(), ModelAPI_AttributeDouble, /** Distance */,
+    ratio, ConstructionPlugin_Point::RATIO(), ModelAPI_AttributeDouble, /** Ratio */,
+    reverse, ConstructionPlugin_Point::REVERSE(), ModelAPI_AttributeBoolean, /** Reverse */,
+    poinToProject, ConstructionPlugin_Point::POINT_TO_PROJECT(), ModelAPI_AttributeSelection, /** Point to project*/,
+    projectionType, ConstructionPlugin_Point::PROJECTION_TYPE(), ModelAPI_AttributeString, /** Type of the point projection */,
+    faceForPointProjection, ConstructionPlugin_Point::FACE_FOR_POINT_PROJECTION(), ModelAPI_AttributeSelection, /** Face for point projection */,
+    edgeForPointProjection, ConstructionPlugin_Point::EDGE_FOR_POINT_PROJECTION(), ModelAPI_AttributeSelection, /** Edge for point projection */,
+    geometricalPropertyType, ConstructionPlugin_Point::GEOMETRICAL_PROPERTY_TYPE(), ModelAPI_AttributeString, /** Type of the geometrical property */,
+    objectForCenterOfGravity, ConstructionPlugin_Point::OBJECT_FOR_CENTER_OF_GRAVITY(), ModelAPI_AttributeSelection, /** Object for center of gravity */,
+    objectForCenterOfCircle, ConstructionPlugin_Point::OBJECT_FOR_CENTER_OF_CIRCLE(), ModelAPI_AttributeSelection, /** Object for center of circle */)
 
   /// Set point values.
   CONSTRUCTIONAPI_EXPORT
@@ -91,28 +113,47 @@ public:
                 const ModelHighAPI_Double & theY,
                 const ModelHighAPI_Double & theZ);
 
-  /*/// Set edge and distance on it for point.
+  /// Set edge and distance on it for point.
+  CONSTRUCTIONAPI_EXPORT
+  void setByOffsetOnEdge(const ModelHighAPI_Selection& theEdge,
+                         const ModelHighAPI_Double& theOffset,
+                         const bool theUseRatio = false,
+                         const bool theReverse = false);
+
+  /// Set point and edge for projection.
   CONSTRUCTIONAPI_EXPORT
-  void setByDistanceOnEdge(const ModelHighAPI_Selection& theEdge,
-                           const ModelHighAPI_Double& theDistanceValue,
-                           const bool theDistancePercent = false,
-                           const bool theReverse = false);
+  void setByProjectionOnEdge(const ModelHighAPI_Selection& theVertex,
+                             const ModelHighAPI_Selection& theEdge);
 
-  /// Set point and plane for projection.
+  /// Set point and face for projection.
   CONSTRUCTIONAPI_EXPORT
-  void setByProjection(const ModelHighAPI_Selection& theVertex,
-                       const ModelHighAPI_Selection& theFace);
+  void setByProjectionOnFace(const ModelHighAPI_Selection& theVertex,
+                             const ModelHighAPI_Selection& theFace);
 
   /// Set lines for intersections.
   CONSTRUCTIONAPI_EXPORT
   void setByLinesIntersection(const ModelHighAPI_Selection& theEdge1,
                               const ModelHighAPI_Selection& theEdge2);
-  */
+
   /// Set line and plane for intersections.
   CONSTRUCTIONAPI_EXPORT
   void setByLineAndPlaneIntersection(const ModelHighAPI_Selection& theEdge,
                                      const ModelHighAPI_Selection& theFace);
 
+  /// Set faces for intersections.
+  CONSTRUCTIONAPI_EXPORT
+  void setByPlanesIntersection(const ModelHighAPI_Selection& theFace1,
+                               const ModelHighAPI_Selection& theFace2,
+                               const ModelHighAPI_Selection& theFace3);
+
+  /// Set object for center of gravity.
+  CONSTRUCTIONAPI_EXPORT
+  void setByCenterOfGravity(const ModelHighAPI_Selection& theObject);
+
+  /// Set object for center of circular edge.
+  CONSTRUCTIONAPI_EXPORT
+    void setByCenterOfCircle(const ModelHighAPI_Selection& theObject);
+
   /// Dump wrapped feature
   CONSTRUCTIONAPI_EXPORT
   virtual void dump(ModelHighAPI_Dumper& theDumper) const;
@@ -129,15 +170,15 @@ PointPtr addPoint(const std::shared_ptr<ModelAPI_Document> & thePart,
                   const ModelHighAPI_Double & theY,
                   const ModelHighAPI_Double & theZ);
 
-/*/// \ingroup CPPHighAPI
+/// \ingroup CPPHighAPI
 /// \brief Create Point feature
 CONSTRUCTIONAPI_EXPORT
 PointPtr addPoint(const std::shared_ptr<ModelAPI_Document> & thePart,
                   const ModelHighAPI_Selection& theEdge,
-                  const ModelHighAPI_Double& theDistanceValue,
-                  const bool theDistancePercent = false,
+                  const ModelHighAPI_Double& theOffset,
+                  const bool theUseRatio = false,
                   const bool theReverse = false);
-*/
+
 /// \ingroup CPPHighAPI
 /// \brief Create Point feature as an intersection of selected plane (or planar face) and edge
 CONSTRUCTIONAPI_EXPORT
@@ -155,4 +196,19 @@ PointPtr addPoint(const std::shared_ptr<ModelAPI_Document> & thePart,
                   const ModelHighAPI_Double& theDistanceValue,
                   const bool theReverse = false);
 
+/// \ingroup CPPHighAPI
+/// \brief Create Point feature as an intersection of selected planes.
+CONSTRUCTIONAPI_EXPORT
+PointPtr addPoint(const std::shared_ptr<ModelAPI_Document> & thePart,
+                  const ModelHighAPI_Selection& theObject1,
+                  const ModelHighAPI_Selection& theObject2,
+                  const ModelHighAPI_Selection& theObject3);
+
+/// \ingroup CPPHighAPI
+/// \brief Create Point feature as a geometrical property.
+CONSTRUCTIONAPI_EXPORT
+PointPtr addPoint(const std::shared_ptr<ModelAPI_Document> & thePart,
+                  const ModelHighAPI_Selection& theObject,
+                  const bool theIsCircularEdge = false);
+
 #endif /* SRC_CONSTRUCTIONAPI_CONSTRUCTIONAPI_POINT_H_ */
index 0cbcec0492bf9101f1f075eb76bc8e953d89dea0..a9705702fbfe2c6eea3ec2c75730ae996a306e57 100644 (file)
@@ -54,6 +54,7 @@ SET(PROJECT_LIBRARIES
     ModelAPI
     GeomAPI
     GeomAlgoAPI
+       GeomDataAPI
 )
 
 SOURCE_GROUP ("Resource Files" FILES ${TEXT_RESOURCES})
@@ -72,12 +73,20 @@ INCLUDE_DIRECTORIES(
   ../GeomAPI
   ../GeomAlgoAPI
   ../Events
+  ../GeomDataAPI
 )
 
 
 ADD_UNIT_TESTS(TestAxisCreation.py
                UnitTestAxis.py
                TestPoint_XYZ.py
-               TestPoint_LineAndPlane.py
+               TestPoint_IntersectLines.py
+               TestPoint_IntersectLineAndPlane.py
+               TestPoint_IntersectPlanes.py
+               TestPoint_Edge.py
+               TestPoint_ProjectOnEdge.py
+               TestPoint_ProjectOnFace.py
+               TestPoint_GeometricalPropertyCenterOfGravity.py
+               TestPoint_GeometricalPropertyCenterOfCircle.py
                TestPointName.py
                TestPlane.py)
index a9f231b8246e11fa14ab5eb9b98677a2b53b0707..3eaecc591c14106c2b7948e6f3e7ee54b2f8bdca 100644 (file)
@@ -52,6 +52,8 @@ ConstructionPlugin_Plugin::ConstructionPlugin_Plugin()
                               new ConstructionPlugin_ValidatorPlaneTwoParallelPlanes());
   aFactory->registerValidator("ConstructionPlugin_ValidatorAxisTwoNotParallelPlanes",
                               new ConstructionPlugin_ValidatorAxisTwoNotParallelPlanes());
+  aFactory->registerValidator("ConstructionPlugin_ValidatorPointThreeNonParallelPlanes",
+                              new ConstructionPlugin_ValidatorPointThreeNonParallelPlanes());
 
   Config_PropManager::registerProp(SKETCH_TAB_NAME, "planes_size", "Size", Config_Prop::DblSpin,
                                    PLANE_SIZE);
index 08ff70a3a7a2ed8a7f5cdba439c975df2f0fe4ef..03c12caff77e0acd965610dd9381c15543e3dd2c 100644 (file)
@@ -29,6 +29,9 @@
 #include <GeomAlgoAPI_PointBuilder.h>
 #include <GeomAlgoAPI_ShapeTools.h>
 
+#include <GeomAPI_Circ.h>
+#include <GeomDataAPI_Point.h>
+
 #include <GeomAPI_Edge.h>
 #include <GeomAPI_Pnt.h>
 #include <GeomAPI_Vertex.h>
@@ -49,29 +52,38 @@ const std::string& ConstructionPlugin_Point::getKind()
 //==================================================================================================
 void ConstructionPlugin_Point::initAttributes()
 {
-  data()->addAttribute(X(), ModelAPI_AttributeDouble::typeId());
-  data()->addAttribute(Y(), ModelAPI_AttributeDouble::typeId());
-  data()->addAttribute(Z(), ModelAPI_AttributeDouble::typeId());
+  data()->addAttribute(point3d(), GeomDataAPI_Point::typeId());
 
   data()->addAttribute(CREATION_METHOD(), ModelAPI_AttributeString::typeId());
 
-  /*data()->addAttribute(EDGE(), ModelAPI_AttributeSelection::typeId());
-  data()->addAttribute(DISTANCE_VALUE(), ModelAPI_AttributeDouble::typeId());
-  data()->addAttribute(DISTANCE_PERCENT(), ModelAPI_AttributeBoolean::typeId());
-  data()->addAttribute(REVERSE(), ModelAPI_AttributeBoolean::typeId());
-
-  data()->addAttribute(POINT(), ModelAPI_AttributeSelection::typeId());
-  data()->addAttribute(PLANE(), ModelAPI_AttributeSelection::typeId());
+  data()->addAttribute(INTERSECTION_LINE_1(), ModelAPI_AttributeSelection::typeId());
+  data()->addAttribute(INTERSECTION_LINE_2(), ModelAPI_AttributeSelection::typeId());
 
-  data()->addAttribute(FIRST_LINE(), ModelAPI_AttributeSelection::typeId());
-  data()->addAttribute(SECOND_LINE(), ModelAPI_AttributeSelection::typeId());
-*/
   data()->addAttribute(INTERSECTION_LINE(), ModelAPI_AttributeSelection::typeId());
   data()->addAttribute(INTERSECTION_PLANE(), ModelAPI_AttributeSelection::typeId());
-
   data()->addAttribute(USE_OFFSET(), ModelAPI_AttributeString::typeId());
   data()->addAttribute(OFFSET(), ModelAPI_AttributeDouble::typeId());
   data()->addAttribute(REVERSE_OFFSET(), ModelAPI_AttributeBoolean::typeId());
+
+  data()->addAttribute(EDGE(), ModelAPI_AttributeSelection::typeId());
+  data()->addAttribute(OFFSET_TYPE(), ModelAPI_AttributeString::typeId());
+  data()->addAttribute(DISTANCE(), ModelAPI_AttributeDouble::typeId());
+  data()->addAttribute(RATIO(), ModelAPI_AttributeDouble::typeId());
+  data()->addAttribute(REVERSE(), ModelAPI_AttributeBoolean::typeId());
+
+  data()->addAttribute(POINT_TO_PROJECT(), ModelAPI_AttributeSelection::typeId());
+  data()->addAttribute(PROJECTION_TYPE(), ModelAPI_AttributeString::typeId());
+  data()->addAttribute(EDGE_FOR_POINT_PROJECTION(), ModelAPI_AttributeSelection::typeId());
+  data()->addAttribute(FACE_FOR_POINT_PROJECTION(), ModelAPI_AttributeSelection::typeId());
+
+  data()->addAttribute(INTERSECTION_TYPE(), ModelAPI_AttributeString::typeId());
+  data()->addAttribute(INTERSECTION_PLANE_1(), ModelAPI_AttributeSelection::typeId());
+  data()->addAttribute(INTERSECTION_PLANE_2(), ModelAPI_AttributeSelection::typeId());
+  data()->addAttribute(INTERSECTION_PLANE_3(), ModelAPI_AttributeSelection::typeId());
+
+  data()->addAttribute(GEOMETRICAL_PROPERTY_TYPE(), ModelAPI_AttributeString::typeId());
+  data()->addAttribute(OBJECT_FOR_CENTER_OF_GRAVITY(), ModelAPI_AttributeSelection::typeId());
+  data()->addAttribute(OBJECT_FOR_CENTER_OF_CIRCLE(), ModelAPI_AttributeSelection::typeId());
 }
 
 //==================================================================================================
@@ -85,26 +97,42 @@ void ConstructionPlugin_Point::execute()
     string(CREATION_METHOD())->value() : CREATION_METHOD_BY_XYZ();
   if(aCreationMethod == CREATION_METHOD_BY_XYZ()) {
     aShape = createByXYZ();
-  }/* else if(aCreationMethod == CREATION_METHOD_BY_DISTANCE_ON_EDGE()) {
+  } else if(aCreationMethod == CREATION_METHOD_BY_DISTANCE_ON_EDGE()) {
     aShape = createByDistanceOnEdge();
   } else if(aCreationMethod == CREATION_METHOD_BY_PROJECTION()) {
-    aShape = createByProjection();
-  } else if(aCreationMethod == CREATION_METHOD_BY_LINES_INTERSECTION()) {
-    aShape = createByLinesIntersection();
-  }*/ else if(aCreationMethod == CREATION_METHOD_BY_LINE_AND_PLANE_INTERSECTION()) {
-    // this may produce several points
-    std::list<std::shared_ptr<GeomAPI_Vertex> > aPoints = createByLineAndPlaneIntersection();
-    if (!aPoints.empty()) { // if no points found produce the standard error later
-      int anIndex = 0;
-      std::list<std::shared_ptr<GeomAPI_Vertex> >::iterator aPIter = aPoints.begin();
-      for(; aPIter != aPoints.end(); aPIter++, anIndex++) {
-        std::shared_ptr<ModelAPI_ResultConstruction> aConstr =
-          document()->createConstruction(data(), anIndex);
-        aConstr->setShape(*aPIter);
-        setResult(aConstr, anIndex);
+    if (string(PROJECTION_TYPE())->value() == PROJECTION_TYPE_ON_EDGE()) {
+      aShape = createByProjectionOnEdge();
+    } else {
+      aShape = createByProjectionOnFace();
+    }
+  } else if(aCreationMethod == CREATION_METHOD_BY_INTERSECTION()) {
+    std::string anIntersectionType = string(INTERSECTION_TYPE())->value();
+    if (anIntersectionType == INTERSECTION_TYPE_BY_LINES()) {
+      aShape = createByLinesIntersection();
+    } else if (anIntersectionType == INTERSECTION_TYPE_BY_LINE_AND_PLANE()) {
+      // this may produce several points
+      std::list<std::shared_ptr<GeomAPI_Vertex> > aPoints = createByLineAndPlaneIntersection();
+      if (!aPoints.empty()) { // if no points found produce the standard error later
+        int anIndex = 0;
+        std::list<std::shared_ptr<GeomAPI_Vertex> >::iterator aPIter = aPoints.begin();
+        for (; aPIter != aPoints.end(); aPIter++, anIndex++) {
+          std::shared_ptr<ModelAPI_ResultConstruction> aConstr =
+            document()->createConstruction(data(), anIndex);
+          aConstr->setShape(*aPIter);
+          setResult(aConstr, anIndex);
+        }
+        removeResults(anIndex);
+        return;
       }
-      removeResults(anIndex);
-      return;
+    } else {
+      aShape = createByPlanesIntersection();
+    }
+  } else if (aCreationMethod == CREATION_METHOD_BY_GEOMETRICAL_PROPERTY()) {
+    std::string aGeometricalPropertyType = string(GEOMETRICAL_PROPERTY_TYPE())->value();
+    if (aGeometricalPropertyType == GEOMETRICAL_PROPERTY_TYPE_BY_CENTER_OF_GRAVITY()) {
+      aShape = createByCenterOfGravity();
+    } else {
+      aShape = createByCenterOfCircle();
     }
   }
 
@@ -133,12 +161,12 @@ bool ConstructionPlugin_Point::customisePresentation(ResultPtr theResult,
 //==================================================================================================
 std::shared_ptr<GeomAPI_Vertex> ConstructionPlugin_Point::createByXYZ()
 {
-  return GeomAlgoAPI_PointBuilder::vertex(real(X())->value(),
-                                          real(Y())->value(),
-                                          real(Z())->value());
+  AttributePointPtr aPoint =
+    std::dynamic_pointer_cast<GeomDataAPI_Point>(data()->attribute(point3d()));
+  return GeomAlgoAPI_PointBuilder::vertex(aPoint->x(), aPoint->y(), aPoint->z());
 }
 
-/*//==================================================================================================
+//==================================================================================================
 std::shared_ptr<GeomAPI_Vertex> ConstructionPlugin_Point::createByDistanceOnEdge()
 {
   // Get edge.
@@ -150,8 +178,15 @@ std::shared_ptr<GeomAPI_Vertex> ConstructionPlugin_Point::createByDistanceOnEdge
   std::shared_ptr<GeomAPI_Edge> anEdge(new GeomAPI_Edge(aShape));
 
   // Get distance value and percent flag.
-  double aValue = real(DISTANCE_VALUE())->value();
-  bool anIsPercent = boolean(DISTANCE_PERCENT())->value();
+  double aValue;
+  bool anIsPercent = false;
+  if (string(OFFSET_TYPE())->value() == OFFSET_TYPE_BY_DISTANCE()) {
+    aValue = real(DISTANCE())->value();
+    anIsPercent = false;
+  } else {
+    aValue = real(RATIO())->value() * 100.0;
+    anIsPercent = true;
+  }
 
   // Get reverse flag.
   bool anIsReverse = boolean(REVERSE())->value();
@@ -160,10 +195,32 @@ std::shared_ptr<GeomAPI_Vertex> ConstructionPlugin_Point::createByDistanceOnEdge
 }
 
 //==================================================================================================
-std::shared_ptr<GeomAPI_Vertex> ConstructionPlugin_Point::createByProjection()
+std::shared_ptr<GeomAPI_Vertex> ConstructionPlugin_Point::createByProjectionOnEdge()
 {
   // Get point.
-  AttributeSelectionPtr aPointSelection = selection(POINT());
+  AttributeSelectionPtr aPointSelection = selection(POINT_TO_PROJECT());
+  GeomShapePtr aPointShape = aPointSelection->value();
+  if (!aPointShape.get()) {
+    aPointShape = aPointSelection->context()->shape();
+  }
+  std::shared_ptr<GeomAPI_Vertex> aVertex(new GeomAPI_Vertex(aPointShape));
+
+  // Get edge.
+  AttributeSelectionPtr anEdgeSelection = selection(EDGE_FOR_POINT_PROJECTION());
+  GeomShapePtr anEdgeShape = anEdgeSelection->value();
+  if (!anEdgeShape.get()) {
+    anEdgeShape = anEdgeSelection->context()->shape();
+  }
+  std::shared_ptr<GeomAPI_Edge> anEdge(new GeomAPI_Edge(anEdgeShape));
+
+  return GeomAlgoAPI_PointBuilder::vertexByProjection(aVertex, anEdge);
+}
+
+//==================================================================================================
+std::shared_ptr<GeomAPI_Vertex> ConstructionPlugin_Point::createByProjectionOnFace()
+{
+  // Get point.
+  AttributeSelectionPtr aPointSelection = selection(POINT_TO_PROJECT());
   GeomShapePtr aPointShape = aPointSelection->value();
   if(!aPointShape.get()) {
     aPointShape = aPointSelection->context()->shape();
@@ -171,7 +228,7 @@ std::shared_ptr<GeomAPI_Vertex> ConstructionPlugin_Point::createByProjection()
   std::shared_ptr<GeomAPI_Vertex> aVertex(new GeomAPI_Vertex(aPointShape));
 
   // Get plane.
-  AttributeSelectionPtr aPlaneSelection = selection(PLANE());
+  AttributeSelectionPtr aPlaneSelection = selection(FACE_FOR_POINT_PROJECTION());
   GeomShapePtr aPlaneShape = aPlaneSelection->value();
   if(!aPlaneShape.get()) {
     aPlaneShape = aPlaneSelection->context()->shape();
@@ -185,7 +242,7 @@ std::shared_ptr<GeomAPI_Vertex> ConstructionPlugin_Point::createByProjection()
 std::shared_ptr<GeomAPI_Vertex> ConstructionPlugin_Point::createByLinesIntersection()
 {
   // Get first line.
-  AttributeSelectionPtr aFirstLineSelection= selection(FIRST_LINE());
+  AttributeSelectionPtr aFirstLineSelection= selection(INTERSECTION_LINE_1());
   GeomShapePtr aFirstLineShape = aFirstLineSelection->value();
   if(!aFirstLineShape.get()) {
     aFirstLineShape = aFirstLineSelection->context()->shape();
@@ -193,7 +250,7 @@ std::shared_ptr<GeomAPI_Vertex> ConstructionPlugin_Point::createByLinesIntersect
   std::shared_ptr<GeomAPI_Edge> aFirstEdge(new GeomAPI_Edge(aFirstLineShape));
 
   // Get second line.
-  AttributeSelectionPtr aSecondLineSelection= selection(SECOND_LINE());
+  AttributeSelectionPtr aSecondLineSelection= selection(INTERSECTION_LINE_2());
   GeomShapePtr aSecondLineShape = aSecondLineSelection->value();
   if(!aSecondLineShape.get()) {
     aSecondLineShape = aSecondLineSelection->context()->shape();
@@ -202,7 +259,6 @@ std::shared_ptr<GeomAPI_Vertex> ConstructionPlugin_Point::createByLinesIntersect
 
   return GeomAlgoAPI_PointBuilder::vertexByIntersection(aFirstEdge, aSecondEdge);
 }
-*/
 
 //==================================================================================================
 std::list<std::shared_ptr<GeomAPI_Vertex> >
@@ -236,3 +292,90 @@ std::list<std::shared_ptr<GeomAPI_Vertex> >
   return GeomAlgoAPI_ShapeTools::intersect(anEdge, aFace,
     aPlaneSelection->context()->groupName() == ModelAPI_ResultConstruction::group());
 }
+
+//==================================================================================================
+std::shared_ptr<GeomAPI_Vertex> ConstructionPlugin_Point::createByPlanesIntersection()
+{
+  // Get plane.
+  AttributeSelectionPtr aPlaneSelection1 = selection(INTERSECTION_PLANE_1());
+  GeomShapePtr aPlaneShape1 = aPlaneSelection1->value();
+  if (!aPlaneShape1.get()) {
+    aPlaneShape1 = aPlaneSelection1->context()->shape();
+  }
+  std::shared_ptr<GeomAPI_Face> aFace1(new GeomAPI_Face(aPlaneShape1));
+  std::shared_ptr<GeomAPI_Pln> aPln1 = aFace1->getPlane();
+
+  // Get plane.
+  AttributeSelectionPtr aPlaneSelection2 = selection(INTERSECTION_PLANE_2());
+  GeomShapePtr aPlaneShape2 = aPlaneSelection2->value();
+  if (!aPlaneShape2.get()) {
+    aPlaneShape2 = aPlaneSelection2->context()->shape();
+  }
+  std::shared_ptr<GeomAPI_Face> aFace2(new GeomAPI_Face(aPlaneShape2));
+  std::shared_ptr<GeomAPI_Pln> aPln2 = aFace2->getPlane();
+
+  // Get plane.
+  AttributeSelectionPtr aPlaneSelection3 = selection(INTERSECTION_PLANE_3());
+  GeomShapePtr aPlaneShape3 = aPlaneSelection3->value();
+  if (!aPlaneShape3.get()) {
+    aPlaneShape3 = aPlaneSelection3->context()->shape();
+  }
+  std::shared_ptr<GeomAPI_Face> aFace3(new GeomAPI_Face(aPlaneShape3));
+  std::shared_ptr<GeomAPI_Pln> aPln3 = aFace3->getPlane();
+
+  std::shared_ptr<GeomAPI_Vertex> aVertex;
+
+  std::shared_ptr<GeomAPI_Lin> anIntersectLine = aPln1->intersect(aPln2);
+  if (!anIntersectLine.get()) {
+    return aVertex;
+  }
+
+  std::shared_ptr<GeomAPI_Pnt> aPnt = aPln3->intersect(anIntersectLine);
+  if (aPnt.get()) {
+    aVertex.reset(new GeomAPI_Vertex(aPnt->x(), aPnt->y(), aPnt->z()));
+  }
+
+  return aVertex;
+}
+
+//==================================================================================================
+std::shared_ptr<GeomAPI_Vertex> ConstructionPlugin_Point::createByCenterOfGravity()
+{
+  // Get shape.
+  AttributeSelectionPtr aShapeSelection = selection(OBJECT_FOR_CENTER_OF_GRAVITY());
+  GeomShapePtr aShape = aShapeSelection->value();
+  if (!aShape.get())
+  {
+    aShape = aShapeSelection->context()->shape();
+  }
+
+  std::shared_ptr<GeomAPI_Vertex> aVertex;
+  std::shared_ptr<GeomAPI_Pnt> aPnt = GeomAlgoAPI_ShapeTools::centreOfMass(aShape);
+  if (aPnt.get())
+  {
+    aVertex.reset(new GeomAPI_Vertex(aPnt->x(), aPnt->y(), aPnt->z()));
+  }
+
+  return aVertex;
+}
+
+//==================================================================================================
+std::shared_ptr<GeomAPI_Vertex> ConstructionPlugin_Point::createByCenterOfCircle()
+{
+  // Get shape.
+  AttributeSelectionPtr aShapeSelection = selection(OBJECT_FOR_CENTER_OF_CIRCLE());
+  GeomShapePtr aShape = aShapeSelection->value();
+  if (!aShape.get()) {
+    aShape = aShapeSelection->context()->shape();
+  }
+  std::shared_ptr<GeomAPI_Edge> anEdge(new GeomAPI_Edge(aShape));
+  std::shared_ptr<GeomAPI_Circ> aCirc = anEdge->circle();
+
+  std::shared_ptr<GeomAPI_Vertex> aVertex;
+  std::shared_ptr<GeomAPI_Pnt> aPnt = aCirc->center();
+  if (aPnt.get()) {
+    aVertex.reset(new GeomAPI_Vertex(aPnt->x(), aPnt->y(), aPnt->z()));
+  }
+
+  return aVertex;
+}
index f983ec3270015565d858b96836e67beecd008c14..e04696cbcde36535f002c1f9ea813852e0639606 100644 (file)
@@ -60,7 +60,7 @@ public:
     static const std::string MY_CREATION_METHOD_ID("by_xyz");
     return MY_CREATION_METHOD_ID;
   }
-  /*
+
   /// Attribute name for creation method.
   inline static const std::string& CREATION_METHOD_BY_DISTANCE_ON_EDGE()
   {
@@ -76,58 +76,64 @@ public:
   }
 
   /// Attribute name for creation method.
-  inline static const std::string& CREATION_METHOD_BY_LINES_INTERSECTION()
+  inline static const std::string& CREATION_METHOD_BY_INTERSECTION()
   {
-    static const std::string MY_CREATION_METHOD_ID("by_lines_intersection");
+    static const std::string MY_CREATION_METHOD_ID("by_intersection");
     return MY_CREATION_METHOD_ID;
   }
-  */
+
   /// Attribute name for creation method.
-  inline static const std::string& CREATION_METHOD_BY_LINE_AND_PLANE_INTERSECTION()
+  inline static const std::string& CREATION_METHOD_BY_GEOMETRICAL_PROPERTY()
   {
-    static const std::string MY_CREATION_METHOD_ID("by_line_and_plane_intersection");
+    static const std::string MY_CREATION_METHOD_ID("by_geometrical_property");
     return MY_CREATION_METHOD_ID;
   }
 
-  /// Attribute name for X coordinate.
-  inline static const std::string& X()
+  inline static const std::string& point3d()
   {
-    static const std::string POINT_ATTR_X("x");
-    return POINT_ATTR_X;
+    static const std::string POINT_ATTR("point3d");
+    return POINT_ATTR;
   }
 
-  /// Attribute name for Y coordinate.
-  inline static const std::string& Y()
+  /// Attribute name for selected edge.
+  inline static const std::string& EDGE()
   {
-    static const std::string POINT_ATTR_Y("y");
-    return POINT_ATTR_Y;
+    static const std::string ATTR_ID("edge");
+    return ATTR_ID;
   }
 
-  /// Attribute name for Z coordinate.
-  inline static const std::string& Z()
+  /// Attribute name for offset type on selected edge.
+  inline static const std::string& OFFSET_TYPE()
   {
-    static const std::string POINT_ATTR_Z("z");
-    return POINT_ATTR_Z;
+    static const std::string ATTR_ID("offset_type");
+    return ATTR_ID;
   }
 
-  /*/// Attribute name for selected edge.
-  inline static const std::string& EDGE()
+  /// Attribute name for offset type by distance.
+  inline static const std::string& OFFSET_TYPE_BY_DISTANCE()
   {
-    static const std::string ATTR_ID("edge");
+    static const std::string ATTR_ID("offset_type_by_distance");
+    return ATTR_ID;
+  }
+
+  /// Attribute name for offset type by ratio.
+  inline static const std::string& OFFSET_TYPE_BY_RATIO()
+  {
+    static const std::string ATTR_ID("offset_type_by_ratio");
     return ATTR_ID;
   }
 
   /// Attribute name for distance.
-  inline static const std::string& DISTANCE_VALUE()
+  inline static const std::string& DISTANCE()
   {
-    static const std::string ATTR_ID("value");
+    static const std::string ATTR_ID("distance");
     return ATTR_ID;
   }
 
   /// Attribute name for percent flag.
-  inline static const std::string& DISTANCE_PERCENT()
+  inline static const std::string& RATIO()
   {
-    static const std::string ATTR_ID("percent");
+    static const std::string ATTR_ID("ratio");
     return ATTR_ID;
   }
 
@@ -138,34 +144,89 @@ public:
     return ATTR_ID;
   }
 
-  /// Attribute name for point.
-  inline static const std::string& POINT()
+  /// Attribute name for point to projection.
+  inline static const std::string& POINT_TO_PROJECT()
+  {
+    static const std::string ATTR_ID("point_to_project");
+    return ATTR_ID;
+  }
+
+  /// Attribute name for projection type.
+  inline static const std::string& PROJECTION_TYPE()
+  {
+    static const std::string ATTR_ID("projection_type");
+    return ATTR_ID;
+  }
+
+  /// Attribute name for projection type on edge.
+  inline static const std::string& PROJECTION_TYPE_ON_EDGE()
   {
-    static const std::string ATTR_ID("point");
+    static const std::string ATTR_ID("projection_type_on_edge");
     return ATTR_ID;
   }
 
-  /// Attribute name for plane.
-  inline static const std::string& PLANE()
+  /// Attribute name for projection type on face.
+  inline static const std::string& PROJECTION_TYPE_ON_FACE()
   {
-    static const std::string ATTR_ID("plane");
+    static const std::string ATTR_ID("projection_type_on_face");
     return ATTR_ID;
   }
 
-  /// Attribute name for selected first line.
-  inline static const std::string& FIRST_LINE()
+  /// Attribute name for edge for point projection.
+  inline static const std::string& EDGE_FOR_POINT_PROJECTION()
+  {
+    static const std::string ATTR_ID("edge_for_point_projection");
+    return ATTR_ID;
+  }
+
+  /// Attribute name for face for point projection.
+  inline static const std::string& FACE_FOR_POINT_PROJECTION()
+  {
+    static const std::string ATTR_ID("face_for_point_projection");
+    return ATTR_ID;
+  }
+
+  /// Attribute name for intersection type.
+  inline static const std::string& INTERSECTION_TYPE()
+  {
+    static const std::string ATTR_ID("intersection_type");
+    return ATTR_ID;
+  }
+
+  /// Attribute name for intersection type by lines.
+  inline static const std::string& INTERSECTION_TYPE_BY_LINES()
+  {
+    static const std::string MY_CREATION_METHOD_ID("intersection_type_by_lines");
+    return MY_CREATION_METHOD_ID;
+  }
+
+  /// Attribute name for intersection type by line and plane.
+  inline static const std::string& INTERSECTION_TYPE_BY_LINE_AND_PLANE()
+  {
+    static const std::string MY_CREATION_METHOD_ID("intersection_type_by_line_and_plane");
+    return MY_CREATION_METHOD_ID;
+  }
+
+  /// Attribute name for intersection type by planes.
+  inline static const std::string& INTERSECTION_TYPE_BY_PLANES()
+  {
+    static const std::string MY_CREATION_METHOD_ID("intersection_type_by_planes");
+    return MY_CREATION_METHOD_ID;
+  }
+
+  /// Attribute name for selected first intersection line.
+  inline static const std::string& INTERSECTION_LINE_1()
   {
-    static const std::string ATTR_ID("first_line");
+    static const std::string ATTR_ID("intersection_line_1");
     return ATTR_ID;
   }
 
-  /// Attribute name for selected second line.
-  inline static const std::string& SECOND_LINE()
+  /// Attribute name for selected second intersection line.
+  inline static const std::string& INTERSECTION_LINE_2()
   {
-    static const std::string ATTR_ID("second_line");
+    static const std::string ATTR_ID("intersection_line_2");
     return ATTR_ID;
   }
-  */
 
   /// Attribute name for selected intersection line.
   inline static const std::string& INTERSECTION_LINE()
@@ -202,6 +263,62 @@ public:
     return ATTR_ID;
   }
 
+  /// Attribute name for selected intersection plane.
+  inline static const std::string& INTERSECTION_PLANE_1()
+  {
+    static const std::string ATTR_ID("intersection_plane_1");
+    return ATTR_ID;
+  }
+
+  /// Attribute name for selected intersection plane.
+  inline static const std::string& INTERSECTION_PLANE_2()
+  {
+    static const std::string ATTR_ID("intersection_plane_2");
+    return ATTR_ID;
+  }
+
+  /// Attribute name for selected intersection plane.
+  inline static const std::string& INTERSECTION_PLANE_3()
+  {
+    static const std::string ATTR_ID("intersection_plane_3");
+    return ATTR_ID;
+  }
+
+  /// Attribute name for property type.
+  inline static const std::string& GEOMETRICAL_PROPERTY_TYPE()
+  {
+    static const std::string ATTR_ID("geometrical_property_type");
+    return ATTR_ID;
+  }
+
+  /// Attribute name for property type by center of gravity.
+  inline static const std::string& GEOMETRICAL_PROPERTY_TYPE_BY_CENTER_OF_GRAVITY()
+  {
+    static const std::string PROPERTY_TYPE("geometrical_property_type_by_center_of_gravity");
+    return PROPERTY_TYPE;
+  }
+
+  /// Attribute name for property type by center of circle.
+  inline static const std::string& GEOMETRICAL_PROPERTY_TYPE_BY_CENTER_OF_CIRCLE()
+  {
+    static const std::string PROPERTY_TYPE("geometrical_property_type_by_center_of_circle");
+    return PROPERTY_TYPE;
+  }
+
+  /// Attribute name for selected object for center of gravity.
+  inline static const std::string& OBJECT_FOR_CENTER_OF_GRAVITY()
+  {
+    static const std::string ATTR_ID("object_for_center_of_gravity");
+    return ATTR_ID;
+  }
+
+  /// Attribute name for selected object for center of cricle.
+  inline static const std::string& OBJECT_FOR_CENTER_OF_CIRCLE()
+  {
+    static const std::string ATTR_ID("object_for_center_of_circle");
+    return ATTR_ID;
+  }
+
   /// Creates a new part document if needed.
   CONSTRUCTIONPLUGIN_EXPORT virtual void execute();
 
@@ -220,11 +337,14 @@ public:
 
 private:
   std::shared_ptr<GeomAPI_Vertex> createByXYZ();
-  /*std::shared_ptr<GeomAPI_Vertex> createByDistanceOnEdge();
-  std::shared_ptr<GeomAPI_Vertex> createByProjection();
-  std::shared_ptr<GeomAPI_Vertex> createByLinesIntersection();*/
+  std::shared_ptr<GeomAPI_Vertex> createByDistanceOnEdge();
+  std::shared_ptr<GeomAPI_Vertex> createByProjectionOnEdge();
+  std::shared_ptr<GeomAPI_Vertex> createByProjectionOnFace();
+  std::shared_ptr<GeomAPI_Vertex> createByLinesIntersection();
   std::list<std::shared_ptr<GeomAPI_Vertex> > createByLineAndPlaneIntersection();
-
+  std::shared_ptr<GeomAPI_Vertex> createByPlanesIntersection();
+  std::shared_ptr<GeomAPI_Vertex> createByCenterOfGravity();
+  std::shared_ptr<GeomAPI_Vertex> createByCenterOfCircle();
 };
 
 #endif
index 146e3055af468545c0cf0ab585acd1b943e8ca28..2390b83a4eec2b9e9327890a0c3d83f748dc02c5 100644 (file)
@@ -83,6 +83,11 @@ bool ConstructionPlugin_ValidatorPointLines::isValid(const AttributePtr& theAttr
   std::shared_ptr<GeomAPI_Lin> aLine1 = aLineEdge1->line();
   std::shared_ptr<GeomAPI_Lin> aLine2 = aLineEdge2->line();
 
+  if (!aLine1.get() || !aLine2.get()) {
+    theError = "Selected edge is not a line.";
+    return false;
+  }
+
   if(!aLine1->isCoplanar(aLine2)) {
     theError = "Selected lines not coplanar.";
     return false;
@@ -392,6 +397,81 @@ bool ConstructionPlugin_ValidatorAxisTwoNotParallelPlanes::isValid(
   return true;
 }
 
+//==================================================================================================
+bool ConstructionPlugin_ValidatorPointThreeNonParallelPlanes::isValid(
+  const AttributePtr& theAttribute,
+  const std::list<std::string>& theArguments,
+  Events_InfoMessage& theError) const
+{
+  FeaturePtr aFeature = ModelAPI_Feature::feature(theAttribute->owner());
+
+  AttributeSelectionPtr anAttribute1 =
+    std::dynamic_pointer_cast<ModelAPI_AttributeSelection>(theAttribute);
+  AttributeSelectionPtr anAttribute2 = aFeature->selection(theArguments.front());
+  AttributeSelectionPtr anAttribute3 = aFeature->selection(theArguments.back());
+
+  GeomShapePtr aShape1 = anAttribute1->value();
+  ResultPtr aContext1 = anAttribute1->context();
+  if (!aContext1.get()) {
+    theError = "One of the attribute not initialized.";
+    return false;
+  }
+  if (!aShape1.get()) {
+    aShape1 = aContext1->shape();
+  }
+
+  std::shared_ptr<GeomAPI_Pln> aPln1 = getPln(aShape1);
+  if (!aPln1.get()) {
+    theError = "Wrong shape types selected.";
+    return false;
+  }
+  std::shared_ptr<GeomAPI_Dir> aDir1 = aPln1->direction();
+
+  if (anAttribute2.get()) {
+    GeomShapePtr aShape2 = anAttribute2->value();
+    ResultPtr aContext2 = anAttribute2->context();
+    if (!aShape2.get() && aContext2.get()) {
+      aShape2 = aContext2->shape();
+    }
+
+    if (aShape2.get()) {
+      std::shared_ptr<GeomAPI_Pln> aPln2 = getPln(aShape2);
+      if (!aPln2.get()) {
+        theError = "Wrong shape types selected.";
+        return false;
+      }
+      std::shared_ptr<GeomAPI_Dir> aDir2 = aPln2->direction();
+      if (aDir1->isParallel(aDir2)) {
+        theError = "Planes are parallel.";
+        return false;
+      }
+    }
+  }
+
+  if (anAttribute3.get()) {
+    GeomShapePtr aShape3 = anAttribute3->value();
+    ResultPtr aContext3 = anAttribute3->context();
+    if (!aShape3.get() && aContext3.get()) {
+      aShape3 = aContext3->shape();
+    }
+
+    if (aShape3.get()) {
+      std::shared_ptr<GeomAPI_Pln> aPln3 = getPln(aShape3);
+      if (!aPln3.get()) {
+        theError = "Wrong shape types selected.";
+        return false;
+      }
+      std::shared_ptr<GeomAPI_Dir> aDir3 = aPln3->direction();
+      if (aDir1->isParallel(aDir3)) {
+        theError = "Planes are parallel.";
+        return false;
+      }
+    }
+  }
+
+  return true;
+}
+
 std::shared_ptr<GeomAPI_Edge> getEdge(const GeomShapePtr theShape)
 {
   if(!theShape->isEdge()) {
index 3254672de855045b8786492e870c7e97ecd00c63..e5dbdd2891c53a6cfc299ffff0e2bf0f57b75da6 100644 (file)
@@ -113,4 +113,19 @@ public:
                         Events_InfoMessage& theError) const;
 };
 
+/// \class ConstructionPlugin_ValidatorPointThreeNonParallelPlanes
+/// \ingroup Validators
+/// \brief A validator for selection three non parallel planes.
+class ConstructionPlugin_ValidatorPointThreeNonParallelPlanes: public ModelAPI_AttributeValidator
+{
+public:
+  //! \return True if the attribute is valid.
+  //! \param[in] theAttribute the checked attribute.
+  //! \param[in] theArguments arguments of the attribute.
+  //! \param[out] theError error message.
+  virtual bool isValid(const AttributePtr& theAttribute,
+                       const std::list<std::string>& theArguments,
+                       Events_InfoMessage& theError) const;
+};
+
 #endif
\ No newline at end of file
diff --git a/src/ConstructionPlugin/Test/TestPoint_Edge.py b/src/ConstructionPlugin/Test/TestPoint_Edge.py
new file mode 100644 (file)
index 0000000..4f6c5ef
--- /dev/null
@@ -0,0 +1,67 @@
+## Copyright (C) 2014-2017  CEA/DEN, EDF R&D
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+## See http:##www.salome-platform.org/ or
+## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+##
+
+"""
+Test case for Construction Point feature by coordinates.
+"""
+
+from salome.shaper import model
+from GeomAPI import *
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
+SketchLine_1 = Sketch_1.addLine(0, 0, 100, 100)
+SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False)
+SketchPoint_1 = SketchProjection_1.createdFeature()
+SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchLine_1.startPoint(), SketchPoint_1.result())
+model.do()
+Point_2 = model.addPoint(Part_1_doc, model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), 50, False, False)
+Point_3 = model.addPoint(Part_1_doc, model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), 0.4, True, False)
+Point_4 = model.addPoint(Part_1_doc, model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), 0.4, True, True)
+Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 50, 10)
+Point_5 = model.addPoint(Part_1_doc, model.selection("EDGE", "Cylinder_1_1/Face_1&Cylinder_1_1/Face_2"), 0.25, True, False)
+Point_6 = model.addPoint(Part_1_doc, model.selection("EDGE", "Cylinder_1_1/Face_1&Cylinder_1_1/Face_2"), 0.25, True, True)
+model.do()
+model.end()
+
+assert (len(Point_2.results()) > 0)
+rightPosition = GeomAPI_Vertex(35.3553390593, 35.3553390593, 0)
+assert(rightPosition.isEqual(Point_2.results()[0].resultSubShapePair()[0].shape()))
+
+assert (len(Point_3.results()) > 0)
+rightPosition = GeomAPI_Vertex(40, 40, 0)
+assert(rightPosition.isEqual(Point_3.results()[0].resultSubShapePair()[0].shape()))
+
+assert (len(Point_4.results()) > 0)
+rightPosition = GeomAPI_Vertex(60, 60, 0)
+assert(rightPosition.isEqual(Point_4.results()[0].resultSubShapePair()[0].shape()))
+
+assert (len(Point_5.results()) > 0)
+rightPosition = GeomAPI_Vertex(0, 50, 10)
+assert(rightPosition.isEqual(Point_5.results()[0].resultSubShapePair()[0].shape()))
+
+assert (len(Point_6.results()) > 0)
+rightPosition = GeomAPI_Vertex(0, -50, 10)
+assert(rightPosition.isEqual(Point_6.results()[0].resultSubShapePair()[0].shape()))
+
+assert(model.checkPythonDump())
diff --git a/src/ConstructionPlugin/Test/TestPoint_GeometricalPropertyCenterOfCircle.py b/src/ConstructionPlugin/Test/TestPoint_GeometricalPropertyCenterOfCircle.py
new file mode 100644 (file)
index 0000000..e08fa11
--- /dev/null
@@ -0,0 +1,55 @@
+## Copyright (C) 2014-2017  CEA/DEN, EDF R&D
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+## See http:##www.salome-platform.org/ or
+## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+##
+
+"""
+Test case for Construction Point feature by center of gravity.
+"""
+
+from salome.shaper import model
+from GeomAPI import *
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
+SketchCircle_1 = Sketch_1.addCircle(-50, 25, 25)
+SketchArc_1 = Sketch_1.addArc(50, 25, 25, 25, 75, 25, True)
+model.do()
+Cylinder_1 = model.addCylinder(Part_1_doc, model.selection("VERTEX", "PartSet/Origin"), model.selection("EDGE", "PartSet/OZ"), 10, 100)
+Point_2 = model.addPoint(Part_1_doc, model.selection("EDGE", "Sketch_1/Edge-SketchCircle_1_2"), True)
+Point_3 = model.addPoint(Part_1_doc, model.selection("EDGE", "Sketch_1/Edge-SketchArc_1_2"), True)
+Point_4 = model.addPoint(Part_1_doc, model.selection("EDGE", "Cylinder_1_1/Face_1&Cylinder_1_1/Face_2"), True)
+model.do()
+model.end()
+
+assert (len(Point_2.results()) > 0)
+rightPosition = GeomAPI_Vertex(-50, 25, 0)
+assert(rightPosition.isEqual(Point_2.results()[0].resultSubShapePair()[0].shape()))
+
+assert (len(Point_3.results()) > 0)
+rightPosition = GeomAPI_Vertex(50, 25, 0)
+assert(rightPosition.isEqual(Point_3.results()[0].resultSubShapePair()[0].shape()))
+
+assert (len(Point_4.results()) > 0)
+rightPosition = GeomAPI_Vertex(0, 0, 100)
+assert(rightPosition.isEqual(Point_4.results()[0].resultSubShapePair()[0].shape()))
+
+assert(model.checkPythonDump())
diff --git a/src/ConstructionPlugin/Test/TestPoint_GeometricalPropertyCenterOfGravity.py b/src/ConstructionPlugin/Test/TestPoint_GeometricalPropertyCenterOfGravity.py
new file mode 100644 (file)
index 0000000..9332523
--- /dev/null
@@ -0,0 +1,60 @@
+## Copyright (C) 2014-2017  CEA/DEN, EDF R&D
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+## See http:##www.salome-platform.org/ or
+## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+##
+
+"""
+Test case for Construction Point feature by center of gravity.
+"""
+
+from salome.shaper import model
+from GeomAPI import *
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ"))
+SketchCircle_1 = Sketch_1.addCircle(-50, 25, 25)
+SketchCircle_2 = Sketch_1.addCircle(50, 25, 25)
+model.do()
+Box_1 = model.addBox(Part_1_doc, 50, 50, 50)
+Point_2 = model.addPoint(Part_1_doc, model.selection("COMPOUND", "Sketch_1"))
+Point_3 = model.addPoint(Part_1_doc, model.selection("SOLID", "Box_1_1"))
+Point_4 = model.addPoint(Part_1_doc, model.selection("FACE", "Box_1_1/Top"))
+Point_5 = model.addPoint(Part_1_doc, model.selection("EDGE", "Box_1_1/Left&Box_1_1/Top"))
+model.do()
+model.end()
+
+assert (len(Point_2.results()) > 0)
+rightPosition = GeomAPI_Vertex(0, 0, 25)
+assert(rightPosition.isEqual(Point_2.results()[0].resultSubShapePair()[0].shape()))
+
+assert (len(Point_3.results()) > 0)
+rightPosition = GeomAPI_Vertex(25, 25, 25)
+assert(rightPosition.isEqual(Point_3.results()[0].resultSubShapePair()[0].shape()))
+
+assert (len(Point_4.results()) > 0)
+rightPosition = GeomAPI_Vertex(25, 25, 50)
+assert(rightPosition.isEqual(Point_4.results()[0].resultSubShapePair()[0].shape()))
+
+assert (len(Point_5.results()) > 0)
+rightPosition = GeomAPI_Vertex(25, 0, 50)
+assert(rightPosition.isEqual(Point_5.results()[0].resultSubShapePair()[0].shape()))
+
+assert(model.checkPythonDump())
diff --git a/src/ConstructionPlugin/Test/TestPoint_IntersectLineAndPlane.py b/src/ConstructionPlugin/Test/TestPoint_IntersectLineAndPlane.py
new file mode 100644 (file)
index 0000000..635ab81
--- /dev/null
@@ -0,0 +1,55 @@
+## Copyright (C) 2014-2017  CEA/DEN, EDF R&D
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+## See http:##www.salome-platform.org/ or
+## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+##
+
+"""
+Test case for Construction Point feature as intersection of line and plane.
+"""
+
+from salome.shaper import model
+from GeomAPI import *
+
+model.begin()
+partSet = model.moduleDocument()
+Sketch_1 = model.addSketch(partSet, model.defaultPlane("XOY"))
+SketchPoint_1 = Sketch_1.addPoint(model.selection("VERTEX", "Origin"))
+SketchCircle_1 = Sketch_1.addCircle(0, 0, 60)
+SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.result(), SketchCircle_1.center())
+model.do()
+Sketch_2 = model.addSketch(partSet, model.defaultPlane("XOZ"))
+SketchLine_1 = Sketch_2.addLine(60, 100, 0, 20)
+SketchArc_1 = Sketch_2.addArc(0, 0, -65.89631323066888, 61.2998850129882, -90, 0, False)
+model.do()
+
+# point by sketch face and a line
+Point_1 = model.addPoint(partSet, model.selection("EDGE", "Sketch_2/Edge-SketchLine_1"), model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f"))
+model.do()
+# check the point position
+rightPosition = GeomAPI_Vertex(-15, 0, 0)
+assert(rightPosition.isEqual(Point_1.results()[0].resultSubShapePair()[0].shape()))
+
+# point by sketch face and an arc, intersection outside of the face, offset is defined
+Point_2 = model.addPoint(partSet, model.selection("EDGE", "Sketch_2/Edge-SketchArc_1"), model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f"), 10, True)
+# check the point position
+rightPosition = GeomAPI_Vertex(-89.442719099991606, 0, -10)
+assert(rightPosition.isEqual(Point_2.results()[0].resultSubShapePair()[0].shape()))
+
+
+model.end()
+assert(model.checkPythonDump())
diff --git a/src/ConstructionPlugin/Test/TestPoint_IntersectLines.py b/src/ConstructionPlugin/Test/TestPoint_IntersectLines.py
new file mode 100644 (file)
index 0000000..f3b0847
--- /dev/null
@@ -0,0 +1,51 @@
+## Copyright (C) 2014-2017  CEA/DEN, EDF R&D
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+## See http:##www.salome-platform.org/ or
+## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+##
+
+"""
+Test case for Construction Point feature by lines intersection.
+"""
+
+from salome.shaper import model
+from GeomAPI import *
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
+SketchProjection_1 = Sketch_1.addProjection(model.selection("VERTEX", "PartSet/Origin"), False)
+SketchPoint_1 = SketchProjection_1.createdFeature()
+SketchLine_1 = Sketch_1.addLine(-50, 50, 50, 50)
+model.do()
+Box_1 = model.addBox(Part_1_doc, 25, 100, 100)
+Point_2 = model.addPoint(Part_1_doc, model.selection("EDGE", "Box_1_1/Back&Box_1_1/Bottom"), model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"))
+Point_3 = model.addPoint(Part_1_doc, model.selection("EDGE", "Sketch_1/Edge-SketchLine_1"), model.selection("EDGE", "Box_1_1/Front&Box_1_1/Bottom"))
+model.do()
+model.end()
+
+assert (len(Point_2.results()) > 0)
+rightPosition = GeomAPI_Vertex(0, 50, 0)
+assert(rightPosition.isEqual(Point_2.results()[0].resultSubShapePair()[0].shape()))
+
+assert (len(Point_3.results()) > 0)
+rightPosition = GeomAPI_Vertex(25, 50, 0)
+assert(rightPosition.isEqual(Point_3.results()[0].resultSubShapePair()[0].shape()))
+
+assert(model.checkPythonDump())
diff --git a/src/ConstructionPlugin/Test/TestPoint_IntersectPlanes.py b/src/ConstructionPlugin/Test/TestPoint_IntersectPlanes.py
new file mode 100644 (file)
index 0000000..16d8977
--- /dev/null
@@ -0,0 +1,50 @@
+## Copyright (C) 2014-2017  CEA/DEN, EDF R&D
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+## See http:##www.salome-platform.org/ or
+## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+##
+
+"""
+Test case for Construction Point feature by planes intersection.
+"""
+
+from salome.shaper import model
+from GeomAPI import *
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Point_2 = model.addPoint(Part_1_doc, 50, 50, 50)
+Plane_4 = model.addPlane(Part_1_doc, model.selection("EDGE", "PartSet/OY"), model.selection("VERTEX", "Point_1"), False)
+Plane_5 = model.addPlane(Part_1_doc, model.selection("EDGE", "PartSet/OX"), model.selection("VERTEX", "Point_1"), False)
+Plane_6 = model.addPlane(Part_1_doc, model.selection("EDGE", "PartSet/OZ"), model.selection("VERTEX", "Point_1"), True)
+Point_3 = model.addPoint(Part_1_doc, model.selection("FACE", "Plane_1"), model.selection("FACE", "Plane_2"), model.selection("FACE", "Plane_3"))
+Box_1 = model.addBox(Part_1_doc, 50, 25, 100)
+Point_4 = model.addPoint(Part_1_doc, model.selection("FACE", "Plane_1"), model.selection("FACE", "Plane_3"), model.selection("FACE", "Box_1_1/Right"))
+model.do()
+model.end()
+
+assert (len(Point_3.results()) > 0)
+rightPosition = GeomAPI_Vertex(50, 50, 50)
+assert(rightPosition.isEqual(Point_3.results()[0].resultSubShapePair()[0].shape()))
+
+assert (len(Point_4.results()) > 0)
+rightPosition = GeomAPI_Vertex(50, 25, 50)
+assert(rightPosition.isEqual(Point_4.results()[0].resultSubShapePair()[0].shape()))
+
+assert(model.checkPythonDump())
diff --git a/src/ConstructionPlugin/Test/TestPoint_LineAndPlane.py b/src/ConstructionPlugin/Test/TestPoint_LineAndPlane.py
deleted file mode 100644 (file)
index 635ab81..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-## Copyright (C) 2014-2017  CEA/DEN, EDF R&D
-##
-## This library is free software; you can redistribute it and/or
-## modify it under the terms of the GNU Lesser General Public
-## License as published by the Free Software Foundation; either
-## version 2.1 of the License, or (at your option) any later version.
-##
-## This library is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU Lesser General Public
-## License along with this library; if not, write to the Free Software
-## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-##
-## See http:##www.salome-platform.org/ or
-## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
-##
-
-"""
-Test case for Construction Point feature as intersection of line and plane.
-"""
-
-from salome.shaper import model
-from GeomAPI import *
-
-model.begin()
-partSet = model.moduleDocument()
-Sketch_1 = model.addSketch(partSet, model.defaultPlane("XOY"))
-SketchPoint_1 = Sketch_1.addPoint(model.selection("VERTEX", "Origin"))
-SketchCircle_1 = Sketch_1.addCircle(0, 0, 60)
-SketchConstraintCoincidence_1 = Sketch_1.setCoincident(SketchPoint_1.result(), SketchCircle_1.center())
-model.do()
-Sketch_2 = model.addSketch(partSet, model.defaultPlane("XOZ"))
-SketchLine_1 = Sketch_2.addLine(60, 100, 0, 20)
-SketchArc_1 = Sketch_2.addArc(0, 0, -65.89631323066888, 61.2998850129882, -90, 0, False)
-model.do()
-
-# point by sketch face and a line
-Point_1 = model.addPoint(partSet, model.selection("EDGE", "Sketch_2/Edge-SketchLine_1"), model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f"))
-model.do()
-# check the point position
-rightPosition = GeomAPI_Vertex(-15, 0, 0)
-assert(rightPosition.isEqual(Point_1.results()[0].resultSubShapePair()[0].shape()))
-
-# point by sketch face and an arc, intersection outside of the face, offset is defined
-Point_2 = model.addPoint(partSet, model.selection("EDGE", "Sketch_2/Edge-SketchArc_1"), model.selection("FACE", "Sketch_1/Face-SketchCircle_1_2f"), 10, True)
-# check the point position
-rightPosition = GeomAPI_Vertex(-89.442719099991606, 0, -10)
-assert(rightPosition.isEqual(Point_2.results()[0].resultSubShapePair()[0].shape()))
-
-
-model.end()
-assert(model.checkPythonDump())
diff --git a/src/ConstructionPlugin/Test/TestPoint_ProjectOnEdge.py b/src/ConstructionPlugin/Test/TestPoint_ProjectOnEdge.py
new file mode 100644 (file)
index 0000000..af44576
--- /dev/null
@@ -0,0 +1,50 @@
+## Copyright (C) 2014-2017  CEA/DEN, EDF R&D
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+## See http:##www.salome-platform.org/ or
+## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+##
+
+"""
+Test case for Construction Point feature by coordinates.
+"""
+
+from salome.shaper import model
+from GeomAPI import *
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOY"))
+SketchCircle_1 = Sketch_1.addCircle(0, 0, 100)
+SketchPoint_1 = Sketch_1.addPoint(100, 100)
+model.do()
+Box_1 = model.addBox(Part_1_doc, 50, 50, 50)
+Point_2 = model.addPoint(Part_1_doc, model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_1"), model.selection("EDGE", "Sketch_1/Edge-SketchCircle_1_2"))
+Point_3 = model.addPoint(Part_1_doc, model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_1"), model.selection("EDGE", "Box_1_1/Front&Box_1_1/Right"))
+model.do()
+model.end()
+
+assert (len(Point_2.results()) > 0)
+rightPosition = GeomAPI_Vertex(70.7106781187, 70.7106781187, 0)
+assert(rightPosition.isEqual(Point_2.results()[0].resultSubShapePair()[0].shape()))
+
+assert (len(Point_3.results()) > 0)
+rightPosition = GeomAPI_Vertex(50, 50, 0)
+assert(rightPosition.isEqual(Point_3.results()[0].resultSubShapePair()[0].shape()))
+
+assert(model.checkPythonDump())
diff --git a/src/ConstructionPlugin/Test/TestPoint_ProjectOnFace.py b/src/ConstructionPlugin/Test/TestPoint_ProjectOnFace.py
new file mode 100644 (file)
index 0000000..1b5218e
--- /dev/null
@@ -0,0 +1,49 @@
+## Copyright (C) 2014-2017  CEA/DEN, EDF R&D
+##
+## This library is free software; you can redistribute it and/or
+## modify it under the terms of the GNU Lesser General Public
+## License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+##
+## This library is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## Lesser General Public License for more details.
+##
+## You should have received a copy of the GNU Lesser General Public
+## License along with this library; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+## See http:##www.salome-platform.org/ or
+## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+##
+
+"""
+Test case for Construction Point feature by projection point on face.
+"""
+
+from salome.shaper import model
+from GeomAPI import *
+
+model.begin()
+partSet = model.moduleDocument()
+Part_1 = model.addPart(partSet)
+Part_1_doc = Part_1.document()
+Sketch_1 = model.addSketch(Part_1_doc, model.defaultPlane("XOZ"))
+SketchPoint_1 = Sketch_1.addPoint(50, 50)
+model.do()
+Box_1 = model.addBox(Part_1_doc, 10, 100, 100)
+Point_2 = model.addPoint(Part_1_doc, model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_1"), model.selection("FACE", "Box_1_1/Front"))
+Point_3 = model.addPoint(Part_1_doc, model.selection("VERTEX", "Sketch_1/Vertex-SketchPoint_1"), model.selection("FACE", "PartSet/XOY"))
+model.do()
+model.end()
+
+assert (len(Point_2.results()) > 0)
+rightPosition = GeomAPI_Vertex(10, 0, 50)
+assert(rightPosition.isEqual(Point_2.results()[0].resultSubShapePair()[0].shape()))
+
+assert (len(Point_3.results()) > 0)
+rightPosition = GeomAPI_Vertex(50, 0, 0)
+assert(rightPosition.isEqual(Point_3.results()[0].resultSubShapePair()[0].shape()))
+
+assert(model.checkPythonDump())
diff --git a/src/ConstructionPlugin/icons/point_by_center_of_circle_24x24.png b/src/ConstructionPlugin/icons/point_by_center_of_circle_24x24.png
new file mode 100644 (file)
index 0000000..d582a93
Binary files /dev/null and b/src/ConstructionPlugin/icons/point_by_center_of_circle_24x24.png differ
diff --git a/src/ConstructionPlugin/icons/point_by_center_of_gravity_24x24.png b/src/ConstructionPlugin/icons/point_by_center_of_gravity_24x24.png
new file mode 100644 (file)
index 0000000..564fe3a
Binary files /dev/null and b/src/ConstructionPlugin/icons/point_by_center_of_gravity_24x24.png differ
diff --git a/src/ConstructionPlugin/icons/point_by_distance_on_edge_24x24.png b/src/ConstructionPlugin/icons/point_by_distance_on_edge_24x24.png
new file mode 100644 (file)
index 0000000..e00036b
Binary files /dev/null and b/src/ConstructionPlugin/icons/point_by_distance_on_edge_24x24.png differ
diff --git a/src/ConstructionPlugin/icons/point_by_geometrical_property_32x32.png b/src/ConstructionPlugin/icons/point_by_geometrical_property_32x32.png
new file mode 100644 (file)
index 0000000..e0bfc92
Binary files /dev/null and b/src/ConstructionPlugin/icons/point_by_geometrical_property_32x32.png differ
diff --git a/src/ConstructionPlugin/icons/point_by_intersection_32x32.png b/src/ConstructionPlugin/icons/point_by_intersection_32x32.png
new file mode 100644 (file)
index 0000000..ae3fb79
Binary files /dev/null and b/src/ConstructionPlugin/icons/point_by_intersection_32x32.png differ
diff --git a/src/ConstructionPlugin/icons/point_by_line_and_plane_intersection_24x24.png b/src/ConstructionPlugin/icons/point_by_line_and_plane_intersection_24x24.png
new file mode 100644 (file)
index 0000000..1955e2e
Binary files /dev/null and b/src/ConstructionPlugin/icons/point_by_line_and_plane_intersection_24x24.png differ
diff --git a/src/ConstructionPlugin/icons/point_by_lines_intersection_24x24.png b/src/ConstructionPlugin/icons/point_by_lines_intersection_24x24.png
new file mode 100644 (file)
index 0000000..4a01f70
Binary files /dev/null and b/src/ConstructionPlugin/icons/point_by_lines_intersection_24x24.png differ
diff --git a/src/ConstructionPlugin/icons/point_by_planes_intersection_24x24.png b/src/ConstructionPlugin/icons/point_by_planes_intersection_24x24.png
new file mode 100644 (file)
index 0000000..6d5966a
Binary files /dev/null and b/src/ConstructionPlugin/icons/point_by_planes_intersection_24x24.png differ
index 91900fe806e777b1f55c0797af479920a770e343..2cc179da641eece987e49026e4eaad0b4ae39c7e 100644 (file)
Binary files a/src/ConstructionPlugin/icons/point_by_projection_32x32.png and b/src/ConstructionPlugin/icons/point_by_projection_32x32.png differ
diff --git a/src/ConstructionPlugin/icons/point_by_projection_on_edge_24x24.png b/src/ConstructionPlugin/icons/point_by_projection_on_edge_24x24.png
new file mode 100644 (file)
index 0000000..4364ed0
Binary files /dev/null and b/src/ConstructionPlugin/icons/point_by_projection_on_edge_24x24.png differ
diff --git a/src/ConstructionPlugin/icons/point_by_projection_on_edge_32x32.png b/src/ConstructionPlugin/icons/point_by_projection_on_edge_32x32.png
new file mode 100644 (file)
index 0000000..187864f
Binary files /dev/null and b/src/ConstructionPlugin/icons/point_by_projection_on_edge_32x32.png differ
diff --git a/src/ConstructionPlugin/icons/point_by_projection_on_face_24x24.png b/src/ConstructionPlugin/icons/point_by_projection_on_face_24x24.png
new file mode 100644 (file)
index 0000000..c16d2d0
Binary files /dev/null and b/src/ConstructionPlugin/icons/point_by_projection_on_face_24x24.png differ
diff --git a/src/ConstructionPlugin/icons/point_by_projection_on_face_32x32.png b/src/ConstructionPlugin/icons/point_by_projection_on_face_32x32.png
new file mode 100644 (file)
index 0000000..91900fe
Binary files /dev/null and b/src/ConstructionPlugin/icons/point_by_projection_on_face_32x32.png differ
diff --git a/src/ConstructionPlugin/icons/point_by_ratio_on_edge_24x24.png b/src/ConstructionPlugin/icons/point_by_ratio_on_edge_24x24.png
new file mode 100644 (file)
index 0000000..ac0e749
Binary files /dev/null and b/src/ConstructionPlugin/icons/point_by_ratio_on_edge_24x24.png differ
diff --git a/src/ConstructionPlugin/icons/shapes.png b/src/ConstructionPlugin/icons/shapes.png
new file mode 100644 (file)
index 0000000..ea5fb26
Binary files /dev/null and b/src/ConstructionPlugin/icons/shapes.png differ
index 20f2f3cb9a553f37184ac9ddb5199261f3d5c868..d82ab6c45f78eeff6da38dbac4aa1ec1aa661fee 100644 (file)
@@ -25,23 +25,8 @@ email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com
          title="By X, Y, Z"
          tooltip="Point at a given distance from the origin."
          icon="icons/Construction/point_by_xyz_32x32.png">
-      <doublevalue id="x"
-                   label="X "
-                   tooltip="X coordinate."
-                   icon="icons/Construction/x_size.png"
-                   default="0"/>
-      <doublevalue id="y"
-                   label="Y "
-                   tooltip="Y coordinate."
-                   icon="icons/Construction/y_size.png"
-                   default="0"/>
-      <doublevalue id="z"
-                   label="Z "
-                   tooltip="Z coordinate."
-                   icon="icons/Construction/z_size.png"
-                   default="0"/>
+      <point_input id="point3d"/>
     </box>
-<!--
     <box id="by_distance_on_edge"
          title="By distance on edge"
          tooltip="Point on an edge, at a given distance of one of its end."
@@ -53,86 +38,197 @@ email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com
                       shape_types="edge">
         <validator id="GeomValidators_Finite"/>
       </shape_selector>
-      <groupbox title="Distance">
-        <doublevalue id="value"
-                     label="Value"
-                     tooltip="Distance value."
-                     icon="icons/Construction/distance_value.png"
-                     default="50"/>
-        <boolvalue id="percent"
-                   label="Percent(%)"
-                   tooltip="Distance in percent from length."
-                   default="true"/>
-      </groupbox>
+      <radiobox id="offset_type">
+        <radio id="offset_type_by_distance"
+             title="Distance on edge by value"
+             tooltip="Point on an edge, at a given distance specified by value."
+             icon="icons/Construction/point_by_distance_on_edge_24x24.png">
+          <doublevalue id="distance"
+             label="Distance"
+             tooltip="Distance value."
+             min="0.0"
+             default="10">
+          </doublevalue>
+        </radio>
+        <radio id="offset_type_by_ratio"
+             title="Distance on edge by ratio"
+             tooltip="Point on an edge, at a given distance specified by ratio."
+             icon="icons/Construction/point_by_ratio_on_edge_24x24.png">
+          <doublevalue id="ratio"
+             label="Ratio"
+             tooltip="Ratio value."
+             min="0.0"
+             max="1.0"
+             default="0.5">
+          </doublevalue>
+        </radio>
+      </radiobox>
       <boolvalue id="reverse"
            label="Reverse"
            tooltip="Distance from edge end point."
            default="false"/>
     </box>
     <box id="by_projection"
-         title="By projection"
-         tooltip="Point on face surface by projection selected point."
+         title="By projection on edge or plane"
+         tooltip="Point on edge or plane by projection selected point."
          icon="icons/Construction/point_by_projection_32x32.png">
-      <shape_selector id="point"
+      <shape_selector id="point_to_project"
                       label="Point"
                       tooltip="Point for projection."
                       icon="icons/Construction/point.png"
                       shape_types="vertex">
       </shape_selector>
-      <shape_selector id="plane"
-                      label="Plane"
-                      tooltip="Plane for projection."
-                      icon="icons/Construction/face.png"
-                      shape_types="face">
-        <validator id="GeomValidators_Face" parameters="plane"/>
-      </shape_selector>
+      <toolbox id="projection_type">
+        <box id="projection_type_on_edge"
+             title="By projection on edge"
+             tooltip="Point on edge by projection selected point."
+             icon="icons/Construction/point_by_projection_on_edge_24x24.png">
+          <shape_selector id="edge_for_point_projection"
+                          label="edge"
+                          tooltip="Edge for projection."
+                          icon="icons/Construction/edge.png"
+                          shape_types="edge">
+          </shape_selector>
+        </box>
+        <box id="projection_type_on_face"
+             title="By projection on face"
+             tooltip="Point on face surface by projection selected point."
+             icon="icons/Construction/point_by_projection_on_face_24x24.png">
+          <shape_selector id="face_for_point_projection"
+                          label="face"
+                          tooltip="Face for projection."
+                          icon="icons/Construction/face.png"
+                          shape_types="face">
+            <validator id="GeomValidators_Face" parameters="plane"/>
+          </shape_selector>
+        </box>
+      </toolbox>
     </box>
-    <box id="by_lines_intersection"
-         title="By two lines intersection"
-         tooltip="Point by intersection of two coplanar lines."
-         icon="icons/Construction/point_by_lines_intersection_32x32.png">
-      <shape_selector id="first_line"
-                      label="First line"
-                      tooltip="First line."
-                      icon="icons/Construction/edge.png"
-                      shape_types="edge">
-        <validator id="GeomValidators_ShapeType" parameters="line"/>
-        <validator id="ConstructionPlugin_ValidatorPointLines" parameters="second_line"/>
-      </shape_selector>
-      <shape_selector id="second_line"
-                      label="Second line"
-                      tooltip="Second line."
-                      icon="icons/Construction/edge.png"
-                      shape_types="edge">
-        <validator id="GeomValidators_ShapeType" parameters="line"/>
-        <validator id="ConstructionPlugin_ValidatorPointLines" parameters="first_line"/>
-      </shape_selector>
+    <box id="by_intersection"
+         title="By intersection of objects"
+         tooltip="Point on intersection of different objects."
+         icon="icons/Construction/point_by_intersection_32x32.png">
+      <toolbox id="intersection_type">
+        <box id="intersection_type_by_lines"
+             title="By two lines intersection"
+             tooltip="Point by intersection of two coplanar lines."
+             icon="icons/Construction/point_by_lines_intersection_24x24.png">
+          <shape_selector id="intersection_line_1"
+                          label="First line"
+                          tooltip="First line."
+                          icon="icons/Construction/edge.png"
+                          shape_types="edge">
+            <validator id="GeomValidators_ShapeType" parameters="line"/>
+            <validator id="ConstructionPlugin_ValidatorPointLines"
+                       parameters="intersection_line_2"/>
+          </shape_selector>
+          <shape_selector id="intersection_line_2"
+                          label="Second line"
+                          tooltip="Second line."
+                          icon="icons/Construction/edge.png"
+                          shape_types="edge">
+            <validator id="GeomValidators_ShapeType" parameters="line"/>
+            <validator id="ConstructionPlugin_ValidatorPointLines"
+                       parameters="intersection_line_1"/>
+          </shape_selector>
+        </box>
+        <box id="intersection_type_by_line_and_plane"
+             title="By line and plane intersection"
+             tooltip="Point by intersection of line and plane."
+             icon="icons/Construction/point_by_line_and_plane_intersection_24x24.png">
+          <shape_selector id="intersection_line"
+                          label="Line"
+                          tooltip="Line for intersection."
+                          icon="icons/Construction/edge.png"
+                          shape_types="edge">
+            <validator id="ConstructionPlugin_ValidatorPointEdgeAndPlaneNotParallel"
+                       parameters="intersection_plane"/>
+          </shape_selector>
+          <shape_selector id="intersection_plane"
+                          label="Plane"
+                          tooltip="Plane for intersection."
+                          icon="icons/Construction/face.png"
+                          shape_types="face">
+            <validator id="GeomValidators_Face" parameters="plane"/>
+            <validator id="ConstructionPlugin_ValidatorPointEdgeAndPlaneNotParallel"
+                       parameters="intersection_line"/>
+          </shape_selector>
+          <optionalbox id="use_offset" title="Offset from the plane">
+            <doublevalue id="offset"
+                         label="Distance "
+                         tooltip="Distance from the plane"
+                         min="0"
+                         default="0"/>
+            <boolvalue id="reverse_offset"
+                       label="Reverse"
+                       tooltip="Reverse offset value"
+                       default="false"/>
+          </optionalbox>
+        </box>
+        <box id="intersection_type_by_planes"
+             title="By three planes intersection"
+             tooltip="Point by intersection of three planes."
+             icon="icons/Construction/point_by_planes_intersection_24x24.png">
+          <shape_selector id="intersection_plane_1"
+                          label="1st plane"
+                          tooltip="Select a planar face."
+                          icon="icons/Construction/face.png"
+                          shape_types="face">
+            <validator id="GeomValidators_Face" parameters="plane"/>
+            <validator id="ConstructionPlugin_ValidatorPointThreeNonParallelPlanes"
+                       parameters="intersection_plane_2, intersection_plane_3"/>
+          </shape_selector>
+          <shape_selector id="intersection_plane_2"
+                          label="2nd plane"
+                          tooltip="Select a planar face."
+                          icon="icons/Construction/face.png"
+                          shape_types="face">
+            <validator id="GeomValidators_Face" parameters="plane"/>
+            <validator id="ConstructionPlugin_ValidatorPointThreeNonParallelPlanes"
+                       parameters="intersection_plane_1, intersection_plane_3"/>
+          </shape_selector>
+          <shape_selector id="intersection_plane_3"
+                          label="3rd plane"
+                          tooltip="Select a planar face."
+                          icon="icons/Construction/face.png"
+                          shape_types="face">
+            <validator id="GeomValidators_Face" parameters="plane"/>
+            <validator id="ConstructionPlugin_ValidatorPointThreeNonParallelPlanes"
+                       parameters="intersection_plane_1, intersection_plane_2"/>
+          </shape_selector>
+        </box>
+        </toolbox>
     </box>
--->
-    <box id="by_line_and_plane_intersection"
-         title="By line and plane intersection"
-         tooltip="Point by intersection of line and plane."
-         icon="icons/Construction/point_by_line_and_plane_intersection_32x32.png">
-      <shape_selector id="intersection_line"
-                      label="Line"
-                      tooltip="Line for intersection."
-                      icon="icons/Construction/edge.png"
-                      shape_types="edge">
-        <validator id="ConstructionPlugin_ValidatorPointEdgeAndPlaneNotParallel" parameters="intersection_plane"/>
-      </shape_selector>
-      <shape_selector id="intersection_plane"
-                      label="Plane"
-                      tooltip="Plane for intersection."
-                      icon="icons/Construction/face.png"
-                      shape_types="face">
-        <validator id="GeomValidators_Face" parameters="plane"/>
-        <validator id="ConstructionPlugin_ValidatorPointEdgeAndPlaneNotParallel" parameters="intersection_line"/>
-      </shape_selector>
-      <optionalbox id="use_offset" title="Offset from the plane">
-        <doublevalue id="offset" label="Distance " tooltip="Distance from the plane" min="0" default="0"/>
-        <boolvalue id="reverse_offset" label="Reverse" tooltip="Reverse offset value" default="false"/>
-      </optionalbox>
+    <box id="by_geometrical_property"
+         title="By geometrical property of object"
+         tooltip="Point by center of gravity or center of circle."
+         icon="icons/Construction/point_by_geometrical_property_32x32.png">
+      <toolbox id="geometrical_property_type">
+        <box id="geometrical_property_type_by_center_of_gravity"
+             title="By center of gravity"
+             tooltip="Point by center of gravity."
+             icon="icons/Construction/point_by_center_of_gravity_24x24.png">
+          <shape_selector id="object_for_center_of_gravity"
+                          label="Object"
+                          tooltip="Object for center of gravity."
+                          icon="icons/Construction/shapes.png"
+                          shape_types="vertices edges wires faces shells solids compsolids compounds">
+            <validator id="GeomValidators_Finite"/>
+          </shape_selector>
+        </box>
+        <box id="geometrical_property_type_by_center_of_circle"
+             title="By center of circle"
+             tooltip="Point by center of circle."
+             icon="icons/Construction/point_by_center_of_circle_24x24.png">
+          <shape_selector id="object_for_center_of_circle"
+                          label="Object"
+                          tooltip="Object for center of circle."
+                          icon="icons/Construction/edge.png"
+                          shape_types="edges">
+            <validator id="GeomValidators_ShapeType" parameters="circle"/>
+          </shape_selector>
+        </box>
+      </toolbox>
     </box>
-
   </toolbox>
 </source>
index 83e853688b8a54f2efe19def56dfe5c474a0c7a4..b511fc640dbfc008d3933856aa46ac03d8f16dfe 100644 (file)
@@ -22,7 +22,11 @@ INCLUDE(Common)
 
 SET(PROJECT_HEADERS
   FeaturesAPI.h
-  FeaturesAPI_Boolean.h
+  FeaturesAPI_BooleanCut.h
+  FeaturesAPI_BooleanFuse.h
+  FeaturesAPI_BooleanCommon.h
+  FeaturesAPI_BooleanSmash.h
+  FeaturesAPI_BooleanFill.h
   FeaturesAPI_Extrusion.h
   FeaturesAPI_ExtrusionBoolean.h
   FeaturesAPI_Fillet.h
@@ -45,7 +49,11 @@ SET(PROJECT_HEADERS
 )
 
 SET(PROJECT_SOURCES
-  FeaturesAPI_Boolean.cpp
+  FeaturesAPI_BooleanCut.cpp
+  FeaturesAPI_BooleanFuse.cpp
+  FeaturesAPI_BooleanCommon.cpp
+  FeaturesAPI_BooleanSmash.cpp
+  FeaturesAPI_BooleanFill.cpp
   FeaturesAPI_Extrusion.cpp
   FeaturesAPI_ExtrusionBoolean.cpp
   FeaturesAPI_Fillet.cpp
index 01d1c9197b4239835df6ef0ef6ea6b9a706dfc53..dd6b5897ff2cc212c8d7c5d16c23d7ecd41c9547 100644 (file)
 %include "std_shared_ptr.i"
 
 // shared pointers
-%shared_ptr(FeaturesAPI_Boolean)
+%shared_ptr(FeaturesAPI_BooleanCut)
+%shared_ptr(FeaturesAPI_BooleanFuse)
+%shared_ptr(FeaturesAPI_BooleanCommon)
+%shared_ptr(FeaturesAPI_BooleanSmash)
+%shared_ptr(FeaturesAPI_BooleanFill)
 %shared_ptr(FeaturesAPI_Extrusion)
 %shared_ptr(FeaturesAPI_ExtrusionBoolean)
 %shared_ptr(FeaturesAPI_ExtrusionCut)
 %shared_ptr(FeaturesAPI_Union)
 
 // all supported interfaces
-%include "FeaturesAPI_Boolean.h"
+%include "FeaturesAPI_BooleanCut.h"
+%include "FeaturesAPI_BooleanFuse.h"
+%include "FeaturesAPI_BooleanCommon.h"
+%include "FeaturesAPI_BooleanSmash.h"
+%include "FeaturesAPI_BooleanFill.h"
 %include "FeaturesAPI_Extrusion.h"
 %include "FeaturesAPI_ExtrusionBoolean.h"
 %include "FeaturesAPI_Fillet.h"
diff --git a/src/FeaturesAPI/FeaturesAPI_Boolean.cpp b/src/FeaturesAPI/FeaturesAPI_Boolean.cpp
deleted file mode 100644 (file)
index dda4405..0000000
+++ /dev/null
@@ -1,178 +0,0 @@
-// Copyright (C) 2014-2017  CEA/DEN, EDF R&D
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or
-// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
-//
-
-#include "FeaturesAPI_Boolean.h"
-
-#include <ModelHighAPI_Dumper.h>
-#include <ModelHighAPI_Integer.h>
-#include <ModelHighAPI_Selection.h>
-#include <ModelHighAPI_Tools.h>
-
-//==================================================================================================
-FeaturesAPI_Boolean::FeaturesAPI_Boolean(const std::shared_ptr<ModelAPI_Feature>& theFeature)
-: ModelHighAPI_Interface(theFeature)
-{
-  initialize();
-}
-
-//==================================================================================================
-FeaturesAPI_Boolean::FeaturesAPI_Boolean(const std::shared_ptr<ModelAPI_Feature>& theFeature,
-                                         const ModelHighAPI_Integer& theBoolType,
-                                         const std::list<ModelHighAPI_Selection>& theMainObjects,
-                                         const std::list<ModelHighAPI_Selection>& theToolObjects)
-: ModelHighAPI_Interface(theFeature)
-{
-  if(initialize()) {
-    fillAttribute(theBoolType, myboolType);
-    fillAttribute(theMainObjects, mymainObjects);
-    fillAttribute(theToolObjects, mytoolObjects);
-
-    execute(false);
-  }
-}
-
-//==================================================================================================
-FeaturesAPI_Boolean::~FeaturesAPI_Boolean()
-{
-
-}
-
-//==================================================================================================
-void FeaturesAPI_Boolean::setBoolType(const ModelHighAPI_Integer& theBoolType)
-{
-  fillAttribute(theBoolType, myboolType);
-
-  execute();
-}
-
-//==================================================================================================
-void FeaturesAPI_Boolean::setMainObjects(const std::list<ModelHighAPI_Selection>& theMainObjects)
-{
-  fillAttribute(theMainObjects, mymainObjects);
-
-  execute();
-}
-
-//==================================================================================================
-void FeaturesAPI_Boolean::setToolObjects(const std::list<ModelHighAPI_Selection>& theToolObjects)
-{
-  fillAttribute(theToolObjects, mytoolObjects);
-
-  execute();
-}
-
-//==================================================================================================
-void FeaturesAPI_Boolean::dump(ModelHighAPI_Dumper& theDumper) const
-{
-  FeaturePtr aBase = feature();
-
-  FeaturesPlugin_Boolean::OperationType aType =
-      (FeaturesPlugin_Boolean::OperationType)aBase->integer(
-      FeaturesPlugin_Boolean::TYPE_ID())->value();
-
-  theDumper << aBase << " = model.add";
-
-  switch(aType) {
-    case FeaturesPlugin_Boolean::BOOL_CUT:    theDumper << "Cut";    break;
-    case FeaturesPlugin_Boolean::BOOL_FUSE:   theDumper << "Fuse";   break;
-    case FeaturesPlugin_Boolean::BOOL_COMMON: theDumper << "Common"; break;
-    case FeaturesPlugin_Boolean::BOOL_FILL:   theDumper << "Fill";   break;
-    case FeaturesPlugin_Boolean::BOOL_SMASH:  theDumper << "Smash";  break;
-  }
-
-  const std::string& aDocName = theDumper.name(aBase->document());
-  AttributeSelectionListPtr anObjects =
-    aBase->selectionList(FeaturesPlugin_Boolean::OBJECT_LIST_ID());
-  AttributeSelectionListPtr aTools = aBase->selectionList(FeaturesPlugin_Boolean::TOOL_LIST_ID());
-
-  theDumper << "(" << aDocName << ", " << anObjects << ", " << aTools << ")" << std::endl;
-}
-
-//==================================================================================================
-BooleanPtr addCut(const std::shared_ptr<ModelAPI_Document>& thePart,
-                  const std::list<ModelHighAPI_Selection>& theMainObjects,
-                  const std::list<ModelHighAPI_Selection>& theToolObjects)
-{
-  std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_Boolean::ID());
-  return BooleanPtr(new FeaturesAPI_Boolean(aFeature,
-                                            FeaturesPlugin_Boolean::BOOL_CUT,
-                                            theMainObjects,
-                                            theToolObjects));
-}
-
-//==================================================================================================
-BooleanPtr addFuse(const std::shared_ptr<ModelAPI_Document>& thePart,
-                   const std::list<ModelHighAPI_Selection>& theObjects)
-{
-  std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_Boolean::ID());
-  std::list<ModelHighAPI_Selection> aToolObjects;
-  return BooleanPtr(new FeaturesAPI_Boolean(aFeature,
-                                            FeaturesPlugin_Boolean::BOOL_FUSE,
-                                            theObjects,
-                                            aToolObjects));
-}
-
-//==================================================================================================
-BooleanPtr addFuse(const std::shared_ptr<ModelAPI_Document>& thePart,
-                   const std::list<ModelHighAPI_Selection>& theMainObjects,
-                   const std::list<ModelHighAPI_Selection>& theToolObjects)
-{
-  std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_Boolean::ID());
-  return BooleanPtr(new FeaturesAPI_Boolean(aFeature,
-                                            FeaturesPlugin_Boolean::BOOL_FUSE,
-                                            theMainObjects,
-                                            theToolObjects));
-}
-
-//==================================================================================================
-BooleanPtr addCommon(const std::shared_ptr<ModelAPI_Document>& thePart,
-                     const std::list<ModelHighAPI_Selection>& theMainObjects,
-                     const std::list<ModelHighAPI_Selection>& theToolObjects)
-{
-  std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_Boolean::ID());
-  return BooleanPtr(new FeaturesAPI_Boolean(aFeature,
-                                            FeaturesPlugin_Boolean::BOOL_COMMON,
-                                            theMainObjects,
-                                            theToolObjects));
-}
-
-//==================================================================================================
-BooleanPtr addSmash(const std::shared_ptr<ModelAPI_Document>& thePart,
-                    const std::list<ModelHighAPI_Selection>& theMainObjects,
-                    const std::list<ModelHighAPI_Selection>& theToolObjects)
-{
-  std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_Boolean::ID());
-  return BooleanPtr(new FeaturesAPI_Boolean(aFeature,
-                                            FeaturesPlugin_Boolean::BOOL_SMASH,
-                                            theMainObjects,
-                                            theToolObjects));
-}
-
-//==================================================================================================
-BooleanPtr addFill(const std::shared_ptr<ModelAPI_Document>& thePart,
-                   const std::list<ModelHighAPI_Selection>& theMainObjects,
-                   const std::list<ModelHighAPI_Selection>& theToolObjects)
-{
-  std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_Boolean::ID());
-  return BooleanPtr(new FeaturesAPI_Boolean(aFeature,
-                                            FeaturesPlugin_Boolean::BOOL_FILL,
-                                            theMainObjects,
-                                            theToolObjects));
-}
diff --git a/src/FeaturesAPI/FeaturesAPI_Boolean.h b/src/FeaturesAPI/FeaturesAPI_Boolean.h
deleted file mode 100644 (file)
index 7b1b25e..0000000
+++ /dev/null
@@ -1,124 +0,0 @@
-// Copyright (C) 2014-2017  CEA/DEN, EDF R&D
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or
-// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
-//
-
-#ifndef FeaturesAPI_Boolean_H_
-#define FeaturesAPI_Boolean_H_
-
-#include "FeaturesAPI.h"
-
-#include <FeaturesPlugin_Boolean.h>
-
-#include <ModelHighAPI_Interface.h>
-#include <ModelHighAPI_Macro.h>
-
-class ModelHighAPI_Integer;
-class ModelHighAPI_Selection;
-
-/// \class FeaturesAPI_Boolean
-/// \ingroup CPPHighAPI
-/// \brief Interface for Boolean feature.
-class FeaturesAPI_Boolean: public ModelHighAPI_Interface
-{
-public:
-  /// Constructor without values.
-  FEATURESAPI_EXPORT
-  explicit FeaturesAPI_Boolean(const std::shared_ptr<ModelAPI_Feature>& theFeature);
-
-  /// Constructor with values.
-  FEATURESAPI_EXPORT
-  FeaturesAPI_Boolean(const std::shared_ptr<ModelAPI_Feature>& theFeature,
-                      const ModelHighAPI_Integer& theBoolType,
-                      const std::list<ModelHighAPI_Selection>& theMainObjects,
-                      const std::list<ModelHighAPI_Selection>& theToolObjects);
-
-  /// Destructor.
-  FEATURESAPI_EXPORT
-  virtual ~FeaturesAPI_Boolean();
-
-  INTERFACE_3(FeaturesPlugin_Boolean::ID(),
-              boolType, FeaturesPlugin_Boolean::TYPE_ID(),
-              ModelAPI_AttributeInteger, /** Operation type */,
-              mainObjects, FeaturesPlugin_Boolean::OBJECT_LIST_ID(),
-              ModelAPI_AttributeSelectionList, /** Main objects */,
-              toolObjects, FeaturesPlugin_Boolean::TOOL_LIST_ID(),
-              ModelAPI_AttributeSelectionList, /** Tool objects*/)
-
-  /// Set operation type.
-  FEATURESAPI_EXPORT
-  void setBoolType(const ModelHighAPI_Integer& theBoolType);
-
-  /// Set main objects.
-  FEATURESAPI_EXPORT
-  void setMainObjects(const std::list<ModelHighAPI_Selection>& theMainObjects);
-
-  /// Set tool objects.
-  FEATURESAPI_EXPORT
-  void setToolObjects(const std::list<ModelHighAPI_Selection>& theToolObjects);
-
-  /// Dump wrapped feature
-  FEATURESAPI_EXPORT
-  virtual void dump(ModelHighAPI_Dumper& theDumper) const;
-};
-
-/// Pointer on Boolean object.
-typedef std::shared_ptr<FeaturesAPI_Boolean> BooleanPtr;
-
-/// \ingroup CPPHighAPI
-/// \brief Create Boolean Cut feature.
-FEATURESAPI_EXPORT
-BooleanPtr addCut(const std::shared_ptr<ModelAPI_Document>& thePart,
-                  const std::list<ModelHighAPI_Selection>& theMainObjects,
-                  const std::list<ModelHighAPI_Selection>& theToolObjects);
-
-/// \ingroup CPPHighAPI
-/// \brief Create Boolean Fuse feature.
-FEATURESAPI_EXPORT
-BooleanPtr addFuse(const std::shared_ptr<ModelAPI_Document>& thePart,
-                   const std::list<ModelHighAPI_Selection>& theObjects);
-
-/// \ingroup CPPHighAPI
-/// \brief Create Boolean Fuse feature.
-FEATURESAPI_EXPORT
-BooleanPtr addFuse(const std::shared_ptr<ModelAPI_Document>& thePart,
-                   const std::list<ModelHighAPI_Selection>& theMainObjects,
-                   const std::list<ModelHighAPI_Selection>& theToolObjects);
-
-/// \ingroup CPPHighAPI
-/// \brief Create Boolean Common feature.
-FEATURESAPI_EXPORT
-BooleanPtr addCommon(const std::shared_ptr<ModelAPI_Document>& thePart,
-                     const std::list<ModelHighAPI_Selection>& theMainObjects,
-                     const std::list<ModelHighAPI_Selection>& theToolObjects);
-
-/// \ingroup CPPHighAPI
-/// \brief Create Boolean Smash feature.
-FEATURESAPI_EXPORT
-BooleanPtr addSmash(const std::shared_ptr<ModelAPI_Document>& thePart,
-                    const std::list<ModelHighAPI_Selection>& theMainObjects,
-                    const std::list<ModelHighAPI_Selection>& theToolObjects);
-
-/// \ingroup CPPHighAPI
-/// \brief Create Boolean Fill feature.
-FEATURESAPI_EXPORT
-BooleanPtr addFill(const std::shared_ptr<ModelAPI_Document>& thePart,
-                   const std::list<ModelHighAPI_Selection>& theMainObjects,
-                   const std::list<ModelHighAPI_Selection>& theToolObjects);
-
-#endif // FeaturesAPI_Boolean_H_
diff --git a/src/FeaturesAPI/FeaturesAPI_BooleanCommon.cpp b/src/FeaturesAPI/FeaturesAPI_BooleanCommon.cpp
new file mode 100644 (file)
index 0000000..bd53854
--- /dev/null
@@ -0,0 +1,99 @@
+// Copyright (C) 2014-2017  CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or
+// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+//
+
+#include "FeaturesAPI_BooleanCommon.h"
+
+#include <ModelHighAPI_Dumper.h>
+#include <ModelHighAPI_Selection.h>
+#include <ModelHighAPI_Tools.h>
+
+//==================================================================================================
+FeaturesAPI_BooleanCommon::FeaturesAPI_BooleanCommon(
+  const std::shared_ptr<ModelAPI_Feature>& theFeature)
+: ModelHighAPI_Interface(theFeature)
+{
+  initialize();
+}
+
+//==================================================================================================
+FeaturesAPI_BooleanCommon::FeaturesAPI_BooleanCommon(
+  const std::shared_ptr<ModelAPI_Feature>& theFeature,
+  const std::list<ModelHighAPI_Selection>& theMainObjects,
+  const std::list<ModelHighAPI_Selection>& theToolObjects)
+: ModelHighAPI_Interface(theFeature)
+{
+  if(initialize()) {
+    fillAttribute(theMainObjects, mymainObjects);
+    fillAttribute(theToolObjects, mytoolObjects);
+
+    execute(false);
+  }
+}
+
+//==================================================================================================
+FeaturesAPI_BooleanCommon::~FeaturesAPI_BooleanCommon()
+{
+}
+
+
+//==================================================================================================
+void FeaturesAPI_BooleanCommon::setMainObjects(
+  const std::list<ModelHighAPI_Selection>& theMainObjects)
+{
+  fillAttribute(theMainObjects, mymainObjects);
+
+  execute();
+}
+
+//==================================================================================================
+void FeaturesAPI_BooleanCommon::setToolObjects(
+  const std::list<ModelHighAPI_Selection>& theToolObjects)
+{
+  fillAttribute(theToolObjects, mytoolObjects);
+
+  execute();
+}
+
+//==================================================================================================
+void FeaturesAPI_BooleanCommon::dump(ModelHighAPI_Dumper& theDumper) const
+{
+  FeaturePtr aBase = feature();
+
+  theDumper << aBase << " = model.addCommon";
+
+  const std::string& aDocName = theDumper.name(aBase->document());
+  AttributeSelectionListPtr anObjects =
+    aBase->selectionList(FeaturesPlugin_BooleanCommon::OBJECT_LIST_ID());
+  AttributeSelectionListPtr aTools =
+    aBase->selectionList(FeaturesPlugin_BooleanCommon::TOOL_LIST_ID());
+
+  theDumper << "(" << aDocName << ", " << anObjects << ", " << aTools << ")" << std::endl;
+}
+
+//==================================================================================================
+BooleanCommonPtr addCommon(const std::shared_ptr<ModelAPI_Document>& thePart,
+                           const std::list<ModelHighAPI_Selection>& theMainObjects,
+                           const std::list<ModelHighAPI_Selection>& theToolObjects)
+{
+  std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_BooleanCommon::ID());
+  return BooleanCommonPtr(new FeaturesAPI_BooleanCommon(aFeature,
+                                                        theMainObjects,
+                                                        theToolObjects));
+}
diff --git a/src/FeaturesAPI/FeaturesAPI_BooleanCommon.h b/src/FeaturesAPI/FeaturesAPI_BooleanCommon.h
new file mode 100644 (file)
index 0000000..56e49bb
--- /dev/null
@@ -0,0 +1,83 @@
+// Copyright (C) 2014-2017  CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or
+// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+//
+
+#ifndef FeaturesAPI_BooleanCommon_H_
+#define FeaturesAPI_BooleanCommon_H_
+
+#include "FeaturesAPI.h"
+
+#include <FeaturesPlugin_BooleanCommon.h>
+
+#include <ModelHighAPI_Interface.h>
+#include <ModelHighAPI_Macro.h>
+
+class ModelHighAPI_Integer;
+class ModelHighAPI_Selection;
+
+/// \class FeaturesAPI_BooleanCommon
+/// \ingroup CPPHighAPI
+/// \brief Interface for Boolean Common feature.
+class FeaturesAPI_BooleanCommon: public ModelHighAPI_Interface
+{
+public:
+  /// Constructor without values.
+  FEATURESAPI_EXPORT
+  explicit FeaturesAPI_BooleanCommon(const std::shared_ptr<ModelAPI_Feature>& theFeature);
+
+  /// Constructor with values.
+  FEATURESAPI_EXPORT
+  FeaturesAPI_BooleanCommon(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+                            const std::list<ModelHighAPI_Selection>& theMainObjects,
+                            const std::list<ModelHighAPI_Selection>& theToolObjects);
+
+  /// Destructor.
+  FEATURESAPI_EXPORT
+  virtual ~FeaturesAPI_BooleanCommon();
+
+  INTERFACE_2(FeaturesPlugin_BooleanCommon::ID(),
+              mainObjects, FeaturesPlugin_BooleanCommon::OBJECT_LIST_ID(),
+              ModelAPI_AttributeSelectionList, /** Main objects */,
+              toolObjects, FeaturesPlugin_BooleanCommon::TOOL_LIST_ID(),
+              ModelAPI_AttributeSelectionList, /** Tool objects*/)
+
+  /// Set main objects.
+  FEATURESAPI_EXPORT
+  void setMainObjects(const std::list<ModelHighAPI_Selection>& theMainObjects);
+
+  /// Set tool objects.
+  FEATURESAPI_EXPORT
+  void setToolObjects(const std::list<ModelHighAPI_Selection>& theToolObjects);
+
+  /// Dump wrapped feature
+  FEATURESAPI_EXPORT
+  virtual void dump(ModelHighAPI_Dumper& theDumper) const;
+};
+
+/// Pointer on Boolean object.
+typedef std::shared_ptr<FeaturesAPI_BooleanCommon> BooleanCommonPtr;
+
+/// \ingroup CPPHighAPI
+/// \brief Create Boolean Common feature.
+FEATURESAPI_EXPORT
+BooleanCommonPtr addCommon(const std::shared_ptr<ModelAPI_Document>& thePart,
+                           const std::list<ModelHighAPI_Selection>& theMainObjects,
+                           const std::list<ModelHighAPI_Selection>& theToolObjects);
+
+#endif // FeaturesAPI_BooleanCommon_H_
diff --git a/src/FeaturesAPI/FeaturesAPI_BooleanCut.cpp b/src/FeaturesAPI/FeaturesAPI_BooleanCut.cpp
new file mode 100644 (file)
index 0000000..496b1fd
--- /dev/null
@@ -0,0 +1,96 @@
+// Copyright (C) 2014-2017  CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or
+// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+//
+
+#include "FeaturesAPI_BooleanCut.h"
+
+#include <ModelHighAPI_Dumper.h>
+#include <ModelHighAPI_Selection.h>
+#include <ModelHighAPI_Tools.h>
+
+//==================================================================================================
+FeaturesAPI_BooleanCut::FeaturesAPI_BooleanCut(const std::shared_ptr<ModelAPI_Feature>& theFeature)
+: ModelHighAPI_Interface(theFeature)
+{
+  initialize();
+}
+
+//==================================================================================================
+FeaturesAPI_BooleanCut::FeaturesAPI_BooleanCut(
+  const std::shared_ptr<ModelAPI_Feature>& theFeature,
+  const std::list<ModelHighAPI_Selection>& theMainObjects,
+  const std::list<ModelHighAPI_Selection>& theToolObjects)
+: ModelHighAPI_Interface(theFeature)
+{
+  if(initialize()) {
+    fillAttribute(theMainObjects, mymainObjects);
+    fillAttribute(theToolObjects, mytoolObjects);
+
+    execute(false);
+  }
+}
+
+//==================================================================================================
+FeaturesAPI_BooleanCut::~FeaturesAPI_BooleanCut()
+{
+}
+
+
+//==================================================================================================
+void FeaturesAPI_BooleanCut::setMainObjects(const std::list<ModelHighAPI_Selection>& theMainObjects)
+{
+  fillAttribute(theMainObjects, mymainObjects);
+
+  execute();
+}
+
+//==================================================================================================
+void FeaturesAPI_BooleanCut::setToolObjects(const std::list<ModelHighAPI_Selection>& theToolObjects)
+{
+  fillAttribute(theToolObjects, mytoolObjects);
+
+  execute();
+}
+
+//==================================================================================================
+void FeaturesAPI_BooleanCut::dump(ModelHighAPI_Dumper& theDumper) const
+{
+  FeaturePtr aBase = feature();
+
+  theDumper << aBase << " = model.addCut";
+
+  const std::string& aDocName = theDumper.name(aBase->document());
+  AttributeSelectionListPtr anObjects =
+    aBase->selectionList(FeaturesPlugin_BooleanCut::OBJECT_LIST_ID());
+  AttributeSelectionListPtr aTools =
+    aBase->selectionList(FeaturesPlugin_BooleanCut::TOOL_LIST_ID());
+
+  theDumper << "(" << aDocName << ", " << anObjects << ", " << aTools << ")" << std::endl;
+}
+
+//==================================================================================================
+BooleanCutPtr addCut(const std::shared_ptr<ModelAPI_Document>& thePart,
+                     const std::list<ModelHighAPI_Selection>& theMainObjects,
+                     const std::list<ModelHighAPI_Selection>& theToolObjects)
+{
+  std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_BooleanCut::ID());
+  return BooleanCutPtr(new FeaturesAPI_BooleanCut(aFeature,
+                                                  theMainObjects,
+                                                  theToolObjects));
+}
diff --git a/src/FeaturesAPI/FeaturesAPI_BooleanCut.h b/src/FeaturesAPI/FeaturesAPI_BooleanCut.h
new file mode 100644 (file)
index 0000000..c39dd49
--- /dev/null
@@ -0,0 +1,83 @@
+// Copyright (C) 2014-2017  CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or
+// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+//
+
+#ifndef FeaturesAPI_BooleanCut_H_
+#define FeaturesAPI_BooleanCut_H_
+
+#include "FeaturesAPI.h"
+
+#include <FeaturesPlugin_BooleanCut.h>
+
+#include <ModelHighAPI_Interface.h>
+#include <ModelHighAPI_Macro.h>
+
+class ModelHighAPI_Integer;
+class ModelHighAPI_Selection;
+
+/// \class FeaturesAPI_BooleanCut
+/// \ingroup CPPHighAPI
+/// \brief Interface for Boolean Cut feature.
+class FeaturesAPI_BooleanCut: public ModelHighAPI_Interface
+{
+public:
+  /// Constructor without values.
+  FEATURESAPI_EXPORT
+  explicit FeaturesAPI_BooleanCut(const std::shared_ptr<ModelAPI_Feature>& theFeature);
+
+  /// Constructor with values.
+  FEATURESAPI_EXPORT
+  FeaturesAPI_BooleanCut(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+                         const std::list<ModelHighAPI_Selection>& theMainObjects,
+                         const std::list<ModelHighAPI_Selection>& theToolObjects);
+
+  /// Destructor.
+  FEATURESAPI_EXPORT
+  virtual ~FeaturesAPI_BooleanCut();
+
+  INTERFACE_2(FeaturesPlugin_BooleanCut::ID(),
+              mainObjects, FeaturesPlugin_BooleanCut::OBJECT_LIST_ID(),
+              ModelAPI_AttributeSelectionList, /** Main objects */,
+              toolObjects, FeaturesPlugin_BooleanCut::TOOL_LIST_ID(),
+              ModelAPI_AttributeSelectionList, /** Tool objects*/)
+
+  /// Set main objects.
+  FEATURESAPI_EXPORT
+  void setMainObjects(const std::list<ModelHighAPI_Selection>& theMainObjects);
+
+  /// Set tool objects.
+  FEATURESAPI_EXPORT
+  void setToolObjects(const std::list<ModelHighAPI_Selection>& theToolObjects);
+
+  /// Dump wrapped feature
+  FEATURESAPI_EXPORT
+  virtual void dump(ModelHighAPI_Dumper& theDumper) const;
+};
+
+/// Pointer on Boolean object.
+typedef std::shared_ptr<FeaturesAPI_BooleanCut> BooleanCutPtr;
+
+/// \ingroup CPPHighAPI
+/// \brief Create Boolean Cut feature.
+FEATURESAPI_EXPORT
+BooleanCutPtr addCut(const std::shared_ptr<ModelAPI_Document>& thePart,
+                     const std::list<ModelHighAPI_Selection>& theMainObjects,
+                     const std::list<ModelHighAPI_Selection>& theToolObjects);
+
+#endif // FeaturesAPI_BooleanCut_H_
diff --git a/src/FeaturesAPI/FeaturesAPI_BooleanFill.cpp b/src/FeaturesAPI/FeaturesAPI_BooleanFill.cpp
new file mode 100644 (file)
index 0000000..f992420
--- /dev/null
@@ -0,0 +1,99 @@
+// Copyright (C) 2014-2017  CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or
+// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+//
+
+#include "FeaturesAPI_BooleanFill.h"
+
+#include <ModelHighAPI_Dumper.h>
+#include <ModelHighAPI_Selection.h>
+#include <ModelHighAPI_Tools.h>
+
+//==================================================================================================
+FeaturesAPI_BooleanFill::FeaturesAPI_BooleanFill(
+  const std::shared_ptr<ModelAPI_Feature>& theFeature)
+: ModelHighAPI_Interface(theFeature)
+{
+  initialize();
+}
+
+//==================================================================================================
+FeaturesAPI_BooleanFill::FeaturesAPI_BooleanFill(
+  const std::shared_ptr<ModelAPI_Feature>& theFeature,
+  const std::list<ModelHighAPI_Selection>& theMainObjects,
+  const std::list<ModelHighAPI_Selection>& theToolObjects)
+: ModelHighAPI_Interface(theFeature)
+{
+  if(initialize()) {
+    fillAttribute(theMainObjects, mymainObjects);
+    fillAttribute(theToolObjects, mytoolObjects);
+
+    execute(false);
+  }
+}
+
+//==================================================================================================
+FeaturesAPI_BooleanFill::~FeaturesAPI_BooleanFill()
+{
+}
+
+
+//==================================================================================================
+void FeaturesAPI_BooleanFill::setMainObjects(
+  const std::list<ModelHighAPI_Selection>& theMainObjects)
+{
+  fillAttribute(theMainObjects, mymainObjects);
+
+  execute();
+}
+
+//==================================================================================================
+void FeaturesAPI_BooleanFill::setToolObjects(
+  const std::list<ModelHighAPI_Selection>& theToolObjects)
+{
+  fillAttribute(theToolObjects, mytoolObjects);
+
+  execute();
+}
+
+//==================================================================================================
+void FeaturesAPI_BooleanFill::dump(ModelHighAPI_Dumper& theDumper) const
+{
+  FeaturePtr aBase = feature();
+
+  theDumper << aBase << " = model.addFill";
+
+  const std::string& aDocName = theDumper.name(aBase->document());
+  AttributeSelectionListPtr anObjects =
+    aBase->selectionList(FeaturesPlugin_BooleanFill::OBJECT_LIST_ID());
+  AttributeSelectionListPtr aTools =
+    aBase->selectionList(FeaturesPlugin_BooleanFill::TOOL_LIST_ID());
+
+  theDumper << "(" << aDocName << ", " << anObjects << ", " << aTools << ")" << std::endl;
+}
+
+//==================================================================================================
+BooleanFillPtr addFill(const std::shared_ptr<ModelAPI_Document>& thePart,
+                       const std::list<ModelHighAPI_Selection>& theMainObjects,
+                       const std::list<ModelHighAPI_Selection>& theToolObjects)
+{
+  std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_BooleanFill::ID());
+  return BooleanFillPtr(new FeaturesAPI_BooleanFill(aFeature,
+                                                    theMainObjects,
+                                                    theToolObjects));
+}
diff --git a/src/FeaturesAPI/FeaturesAPI_BooleanFill.h b/src/FeaturesAPI/FeaturesAPI_BooleanFill.h
new file mode 100644 (file)
index 0000000..32413f1
--- /dev/null
@@ -0,0 +1,83 @@
+// Copyright (C) 2014-2017  CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or
+// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+//
+
+#ifndef FeaturesAPI_BooleanFill_H_
+#define FeaturesAPI_BooleanFill_H_
+
+#include "FeaturesAPI.h"
+
+#include <FeaturesPlugin_BooleanFill.h>
+
+#include <ModelHighAPI_Interface.h>
+#include <ModelHighAPI_Macro.h>
+
+class ModelHighAPI_Integer;
+class ModelHighAPI_Selection;
+
+/// \class FeaturesAPI_BooleanFill
+/// \ingroup CPPHighAPI
+/// \brief Interface for Boolean Fill feature.
+class FeaturesAPI_BooleanFill: public ModelHighAPI_Interface
+{
+public:
+  /// Constructor without values.
+  FEATURESAPI_EXPORT
+  explicit FeaturesAPI_BooleanFill(const std::shared_ptr<ModelAPI_Feature>& theFeature);
+
+  /// Constructor with values.
+  FEATURESAPI_EXPORT
+  FeaturesAPI_BooleanFill(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+                          const std::list<ModelHighAPI_Selection>& theMainObjects,
+                          const std::list<ModelHighAPI_Selection>& theToolObjects);
+
+  /// Destructor.
+  FEATURESAPI_EXPORT
+  virtual ~FeaturesAPI_BooleanFill();
+
+  INTERFACE_2(FeaturesPlugin_BooleanFill::ID(),
+              mainObjects, FeaturesPlugin_BooleanFill::OBJECT_LIST_ID(),
+              ModelAPI_AttributeSelectionList, /** Main objects */,
+              toolObjects, FeaturesPlugin_BooleanFill::TOOL_LIST_ID(),
+              ModelAPI_AttributeSelectionList, /** Tool objects*/)
+
+  /// Set main objects.
+  FEATURESAPI_EXPORT
+  void setMainObjects(const std::list<ModelHighAPI_Selection>& theMainObjects);
+
+  /// Set tool objects.
+  FEATURESAPI_EXPORT
+  void setToolObjects(const std::list<ModelHighAPI_Selection>& theToolObjects);
+
+  /// Dump wrapped feature
+  FEATURESAPI_EXPORT
+  virtual void dump(ModelHighAPI_Dumper& theDumper) const;
+};
+
+/// Pointer on Boolean object.
+typedef std::shared_ptr<FeaturesAPI_BooleanFill> BooleanFillPtr;
+
+/// \ingroup CPPHighAPI
+/// \brief Create Boolean Fill feature.
+FEATURESAPI_EXPORT
+BooleanFillPtr addFill(const std::shared_ptr<ModelAPI_Document>& thePart,
+                       const std::list<ModelHighAPI_Selection>& theMainObjects,
+                       const std::list<ModelHighAPI_Selection>& theToolObjects);
+
+#endif // FeaturesAPI_BooleanFill_H_
diff --git a/src/FeaturesAPI/FeaturesAPI_BooleanFuse.cpp b/src/FeaturesAPI/FeaturesAPI_BooleanFuse.cpp
new file mode 100644 (file)
index 0000000..c1a043d
--- /dev/null
@@ -0,0 +1,110 @@
+// Copyright (C) 2014-2017  CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or
+// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+//
+
+#include "FeaturesAPI_BooleanFuse.h"
+
+#include <ModelHighAPI_Dumper.h>
+#include <ModelHighAPI_Selection.h>
+#include <ModelHighAPI_Tools.h>
+
+//==================================================================================================
+FeaturesAPI_BooleanFuse::FeaturesAPI_BooleanFuse(
+  const std::shared_ptr<ModelAPI_Feature>& theFeature)
+: ModelHighAPI_Interface(theFeature)
+{
+  initialize();
+}
+
+//==================================================================================================
+FeaturesAPI_BooleanFuse::FeaturesAPI_BooleanFuse(
+  const std::shared_ptr<ModelAPI_Feature>& theFeature,
+  const std::list<ModelHighAPI_Selection>& theMainObjects,
+  const std::list<ModelHighAPI_Selection>& theToolObjects)
+: ModelHighAPI_Interface(theFeature)
+{
+  if(initialize()) {
+    fillAttribute(theMainObjects, mymainObjects);
+    fillAttribute(theToolObjects, mytoolObjects);
+
+    execute(false);
+  }
+}
+
+//==================================================================================================
+FeaturesAPI_BooleanFuse::~FeaturesAPI_BooleanFuse()
+{
+}
+
+
+//==================================================================================================
+void FeaturesAPI_BooleanFuse::setMainObjects(
+  const std::list<ModelHighAPI_Selection>& theMainObjects)
+{
+  fillAttribute(theMainObjects, mymainObjects);
+
+  execute();
+}
+
+//==================================================================================================
+void FeaturesAPI_BooleanFuse::setToolObjects(
+  const std::list<ModelHighAPI_Selection>& theToolObjects)
+{
+  fillAttribute(theToolObjects, mytoolObjects);
+
+  execute();
+}
+
+//==================================================================================================
+void FeaturesAPI_BooleanFuse::dump(ModelHighAPI_Dumper& theDumper) const
+{
+  FeaturePtr aBase = feature();
+
+  theDumper << aBase << " = model.addFuse";
+
+  const std::string& aDocName = theDumper.name(aBase->document());
+  AttributeSelectionListPtr anObjects =
+    aBase->selectionList(FeaturesPlugin_BooleanFuse::OBJECT_LIST_ID());
+  AttributeSelectionListPtr aTools =
+    aBase->selectionList(FeaturesPlugin_BooleanFuse::TOOL_LIST_ID());
+
+  theDumper << "(" << aDocName << ", " << anObjects << ", " << aTools << ")" << std::endl;
+}
+
+//==================================================================================================
+BooleanFusePtr addFuse(const std::shared_ptr<ModelAPI_Document>& thePart,
+                       const std::list<ModelHighAPI_Selection>& theObjects)
+{
+  std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_BooleanFuse::ID());
+  std::list<ModelHighAPI_Selection> aToolObjects;
+  return BooleanFusePtr(new FeaturesAPI_BooleanFuse(aFeature,
+                                                    theObjects,
+                                                    aToolObjects));
+}
+
+//==================================================================================================
+BooleanFusePtr addFuse(const std::shared_ptr<ModelAPI_Document>& thePart,
+                   const std::list<ModelHighAPI_Selection>& theMainObjects,
+                   const std::list<ModelHighAPI_Selection>& theToolObjects)
+{
+  std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_BooleanFuse::ID());
+  return BooleanFusePtr(new FeaturesAPI_BooleanFuse(aFeature,
+                                                    theMainObjects,
+                                                    theToolObjects));
+}
diff --git a/src/FeaturesAPI/FeaturesAPI_BooleanFuse.h b/src/FeaturesAPI/FeaturesAPI_BooleanFuse.h
new file mode 100644 (file)
index 0000000..17b72f7
--- /dev/null
@@ -0,0 +1,89 @@
+// Copyright (C) 2014-2017  CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or
+// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+//
+
+#ifndef FeaturesAPI_BooleanFuse_H_
+#define FeaturesAPI_BooleanFuse_H_
+
+#include "FeaturesAPI.h"
+
+#include <FeaturesPlugin_BooleanFuse.h>
+
+#include <ModelHighAPI_Interface.h>
+#include <ModelHighAPI_Macro.h>
+
+class ModelHighAPI_Integer;
+class ModelHighAPI_Selection;
+
+/// \class FeaturesAPI_BooleanFuse
+/// \ingroup CPPHighAPI
+/// \brief Interface for Boolean Fuse feature.
+class FeaturesAPI_BooleanFuse: public ModelHighAPI_Interface
+{
+public:
+  /// Constructor without values.
+  FEATURESAPI_EXPORT
+  explicit FeaturesAPI_BooleanFuse(const std::shared_ptr<ModelAPI_Feature>& theFeature);
+
+  /// Constructor with values.
+  FEATURESAPI_EXPORT
+  FeaturesAPI_BooleanFuse(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+                         const std::list<ModelHighAPI_Selection>& theMainObjects,
+                         const std::list<ModelHighAPI_Selection>& theToolObjects);
+
+  /// Destructor.
+  FEATURESAPI_EXPORT
+  virtual ~FeaturesAPI_BooleanFuse();
+
+  INTERFACE_2(FeaturesPlugin_BooleanFuse::ID(),
+              mainObjects, FeaturesPlugin_BooleanFuse::OBJECT_LIST_ID(),
+              ModelAPI_AttributeSelectionList, /** Main objects */,
+              toolObjects, FeaturesPlugin_BooleanFuse::TOOL_LIST_ID(),
+              ModelAPI_AttributeSelectionList, /** Tool objects*/)
+
+  /// Set main objects.
+  FEATURESAPI_EXPORT
+  void setMainObjects(const std::list<ModelHighAPI_Selection>& theMainObjects);
+
+  /// Set tool objects.
+  FEATURESAPI_EXPORT
+  void setToolObjects(const std::list<ModelHighAPI_Selection>& theToolObjects);
+
+  /// Dump wrapped feature
+  FEATURESAPI_EXPORT
+  virtual void dump(ModelHighAPI_Dumper& theDumper) const;
+};
+
+/// Pointer on Boolean object.
+typedef std::shared_ptr<FeaturesAPI_BooleanFuse> BooleanFusePtr;
+
+/// \ingroup CPPHighAPI
+/// \brief Create Boolean Fuse feature.
+FEATURESAPI_EXPORT
+BooleanFusePtr addFuse(const std::shared_ptr<ModelAPI_Document>& thePart,
+                       const std::list<ModelHighAPI_Selection>& theObjects);
+
+/// \ingroup CPPHighAPI
+/// \brief Create Boolean Fuse feature.
+FEATURESAPI_EXPORT
+BooleanFusePtr addFuse(const std::shared_ptr<ModelAPI_Document>& thePart,
+                       const std::list<ModelHighAPI_Selection>& theMainObjects,
+                       const std::list<ModelHighAPI_Selection>& theToolObjects);
+
+#endif // FeaturesAPI_BooleanFuse_H_
diff --git a/src/FeaturesAPI/FeaturesAPI_BooleanSmash.cpp b/src/FeaturesAPI/FeaturesAPI_BooleanSmash.cpp
new file mode 100644 (file)
index 0000000..7c7583b
--- /dev/null
@@ -0,0 +1,99 @@
+// Copyright (C) 2014-2017  CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or
+// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+//
+
+#include "FeaturesAPI_BooleanSmash.h"
+
+#include <ModelHighAPI_Dumper.h>
+#include <ModelHighAPI_Selection.h>
+#include <ModelHighAPI_Tools.h>
+
+//==================================================================================================
+FeaturesAPI_BooleanSmash::FeaturesAPI_BooleanSmash(
+  const std::shared_ptr<ModelAPI_Feature>& theFeature)
+: ModelHighAPI_Interface(theFeature)
+{
+  initialize();
+}
+
+//==================================================================================================
+FeaturesAPI_BooleanSmash::FeaturesAPI_BooleanSmash(
+  const std::shared_ptr<ModelAPI_Feature>& theFeature,
+  const std::list<ModelHighAPI_Selection>& theMainObjects,
+  const std::list<ModelHighAPI_Selection>& theToolObjects)
+: ModelHighAPI_Interface(theFeature)
+{
+  if(initialize()) {
+    fillAttribute(theMainObjects, mymainObjects);
+    fillAttribute(theToolObjects, mytoolObjects);
+
+    execute(false);
+  }
+}
+
+//==================================================================================================
+FeaturesAPI_BooleanSmash::~FeaturesAPI_BooleanSmash()
+{
+}
+
+
+//==================================================================================================
+void FeaturesAPI_BooleanSmash::setMainObjects(
+  const std::list<ModelHighAPI_Selection>& theMainObjects)
+{
+  fillAttribute(theMainObjects, mymainObjects);
+
+  execute();
+}
+
+//==================================================================================================
+void FeaturesAPI_BooleanSmash::setToolObjects(
+  const std::list<ModelHighAPI_Selection>& theToolObjects)
+{
+  fillAttribute(theToolObjects, mytoolObjects);
+
+  execute();
+}
+
+//==================================================================================================
+void FeaturesAPI_BooleanSmash::dump(ModelHighAPI_Dumper& theDumper) const
+{
+  FeaturePtr aBase = feature();
+
+  theDumper << aBase << " = model.addSmash";
+
+  const std::string& aDocName = theDumper.name(aBase->document());
+  AttributeSelectionListPtr anObjects =
+    aBase->selectionList(FeaturesPlugin_BooleanSmash::OBJECT_LIST_ID());
+  AttributeSelectionListPtr aTools =
+    aBase->selectionList(FeaturesPlugin_BooleanSmash::TOOL_LIST_ID());
+
+  theDumper << "(" << aDocName << ", " << anObjects << ", " << aTools << ")" << std::endl;
+}
+
+//==================================================================================================
+BooleanSmashPtr addSmash(const std::shared_ptr<ModelAPI_Document>& thePart,
+                         const std::list<ModelHighAPI_Selection>& theMainObjects,
+                         const std::list<ModelHighAPI_Selection>& theToolObjects)
+{
+  std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_BooleanSmash::ID());
+  return BooleanSmashPtr(new FeaturesAPI_BooleanSmash(aFeature,
+                                                      theMainObjects,
+                                                      theToolObjects));
+}
diff --git a/src/FeaturesAPI/FeaturesAPI_BooleanSmash.h b/src/FeaturesAPI/FeaturesAPI_BooleanSmash.h
new file mode 100644 (file)
index 0000000..bfe0d5e
--- /dev/null
@@ -0,0 +1,83 @@
+// Copyright (C) 2014-2017  CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or
+// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+//
+
+#ifndef FeaturesAPI_BooleanSmash_H_
+#define FeaturesAPI_BooleanSmash_H_
+
+#include "FeaturesAPI.h"
+
+#include <FeaturesPlugin_BooleanSmash.h>
+
+#include <ModelHighAPI_Interface.h>
+#include <ModelHighAPI_Macro.h>
+
+class ModelHighAPI_Integer;
+class ModelHighAPI_Selection;
+
+/// \class FeaturesAPI_BooleanSmash
+/// \ingroup CPPHighAPI
+/// \brief Interface for Boolean Smash feature.
+class FeaturesAPI_BooleanSmash: public ModelHighAPI_Interface
+{
+public:
+  /// Constructor without values.
+  FEATURESAPI_EXPORT
+  explicit FeaturesAPI_BooleanSmash(const std::shared_ptr<ModelAPI_Feature>& theFeature);
+
+  /// Constructor with values.
+  FEATURESAPI_EXPORT
+  FeaturesAPI_BooleanSmash(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+                           const std::list<ModelHighAPI_Selection>& theMainObjects,
+                           const std::list<ModelHighAPI_Selection>& theToolObjects);
+
+  /// Destructor.
+  FEATURESAPI_EXPORT
+  virtual ~FeaturesAPI_BooleanSmash();
+
+  INTERFACE_2(FeaturesPlugin_BooleanSmash::ID(),
+              mainObjects, FeaturesPlugin_BooleanSmash::OBJECT_LIST_ID(),
+              ModelAPI_AttributeSelectionList, /** Main objects */,
+              toolObjects, FeaturesPlugin_BooleanSmash::TOOL_LIST_ID(),
+              ModelAPI_AttributeSelectionList, /** Tool objects*/)
+
+  /// Set main objects.
+  FEATURESAPI_EXPORT
+  void setMainObjects(const std::list<ModelHighAPI_Selection>& theMainObjects);
+
+  /// Set tool objects.
+  FEATURESAPI_EXPORT
+  void setToolObjects(const std::list<ModelHighAPI_Selection>& theToolObjects);
+
+  /// Dump wrapped feature
+  FEATURESAPI_EXPORT
+  virtual void dump(ModelHighAPI_Dumper& theDumper) const;
+};
+
+/// Pointer on Boolean object.
+typedef std::shared_ptr<FeaturesAPI_BooleanSmash> BooleanSmashPtr;
+
+/// \ingroup CPPHighAPI
+/// \brief Create Boolean Smash feature.
+FEATURESAPI_EXPORT
+BooleanSmashPtr addSmash(const std::shared_ptr<ModelAPI_Document>& thePart,
+                         const std::list<ModelHighAPI_Selection>& theMainObjects,
+                         const std::list<ModelHighAPI_Selection>& theToolObjects);
+
+#endif // FeaturesAPI_BooleanSmash_H_
index a45b780ca99321045a6d45a2881e6da57641a75c..1c7d2d40b3d643e239f228543875246de580d1bd 100644 (file)
   #include <ModelHighAPI_swig.h>
 
   #include "FeaturesAPI.h"
-  #include "FeaturesAPI_Boolean.h"
+  #include "FeaturesAPI_BooleanCut.h"
+  #include "FeaturesAPI_BooleanFuse.h"
+  #include "FeaturesAPI_BooleanCommon.h"
+  #include "FeaturesAPI_BooleanSmash.h"
+  #include "FeaturesAPI_BooleanFill.h"
   #include "FeaturesAPI_Extrusion.h"
   #include "FeaturesAPI_ExtrusionBoolean.h"
   #include "FeaturesAPI_Fillet.h"
index 535c126e56644c81809dcc98041bf848327290e5..fff06074fc36da686f40aa589785fb27096cd79c 100644 (file)
@@ -30,6 +30,11 @@ SET(PROJECT_HEADERS
     FeaturesPlugin_Rotation.h
     FeaturesPlugin_Translation.h
     FeaturesPlugin_Boolean.h
+    FeaturesPlugin_BooleanCut.h
+    FeaturesPlugin_BooleanFuse.h
+    FeaturesPlugin_BooleanCommon.h
+    FeaturesPlugin_BooleanSmash.h
+    FeaturesPlugin_BooleanFill.h
     FeaturesPlugin_Intersection.h
     FeaturesPlugin_Partition.h
     FeaturesPlugin_Pipe.h
index 64072e62accc7b53a9543440a8e4cbe5483051db..7a765a11c74412b503e7a2a4f9235bd05dc85741 100644 (file)
 #include <map>
 
 //=================================================================================================
-FeaturesPlugin_Boolean::FeaturesPlugin_Boolean()
+FeaturesPlugin_Boolean::FeaturesPlugin_Boolean(const OperationType theOperationType)
+: myOperationType(theOperationType)
 {
 }
 
 //=================================================================================================
 void FeaturesPlugin_Boolean::initAttributes()
 {
-  data()->addAttribute(FeaturesPlugin_Boolean::TYPE_ID(), ModelAPI_AttributeInteger::typeId());
-
   AttributeSelectionListPtr aSelection =
     std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(data()->addAttribute(
     FeaturesPlugin_Boolean::OBJECT_LIST_ID(), ModelAPI_AttributeSelectionList::typeId()));
@@ -80,15 +79,14 @@ std::shared_ptr<GeomAPI_Shape> FeaturesPlugin_Boolean::getShape(const std::strin
 }
 
 //=================================================================================================
-void FeaturesPlugin_Boolean::execute()
+FeaturesPlugin_Boolean::OperationType FeaturesPlugin_Boolean::operationType()
 {
-  // Getting operation type.
-  std::shared_ptr<ModelAPI_AttributeInteger> aTypeAttr = std::dynamic_pointer_cast<
-      ModelAPI_AttributeInteger>(data()->attribute(FeaturesPlugin_Boolean::TYPE_ID()));
-  if (!aTypeAttr)
-    return;
-  OperationType aType = (FeaturesPlugin_Boolean::OperationType)aTypeAttr->value();
+  return myOperationType;
+}
 
+//=================================================================================================
+void FeaturesPlugin_Boolean::execute()
+{
   ListOfShape anObjects, aTools, anEdgesAndFaces, aPlanes;
   std::map<std::shared_ptr<GeomAPI_Shape>, ListOfShape> aCompSolidsObjects;
 
@@ -118,7 +116,7 @@ void FeaturesPlugin_Boolean::execute()
         aCompSolidsObjects[aContextShape].push_back(anObject);
       }
     } else {
-      if(aType != BOOL_FILL
+      if(myOperationType != BOOL_FILL
         && (anObject->shapeType() == GeomAPI_Shape::EDGE
           || anObject->shapeType() == GeomAPI_Shape::FACE))
       {
@@ -141,7 +139,7 @@ void FeaturesPlugin_Boolean::execute()
       ResultPtr aContext = aToolAttr->context();
       aPlanes.push_back(aToolAttr->context()->shape());
     }
-    else if(aType != BOOL_FILL
+    else if (myOperationType != BOOL_FILL
       && (aTool->shapeType() == GeomAPI_Shape::EDGE
         || aTool->shapeType() == GeomAPI_Shape::FACE))
     {
@@ -153,7 +151,7 @@ void FeaturesPlugin_Boolean::execute()
 
   int aResultIndex = 0;
 
-  switch(aType) {
+  switch(myOperationType) {
     case BOOL_CUT:
     case BOOL_COMMON:
     case BOOL_FILL: {
@@ -174,7 +172,7 @@ void FeaturesPlugin_Boolean::execute()
         std::shared_ptr<GeomAlgoAPI_MakeShape> aBoolAlgo;
         GeomShapePtr aResShape;
 
-        switch(aType) {
+        switch(myOperationType) {
           case BOOL_CUT: {
             aBoolAlgo.reset(new GeomAlgoAPI_Boolean(aListWithObject,
                                                     aTools,
@@ -247,18 +245,19 @@ void FeaturesPlugin_Boolean::execute()
         aMakeShapeList.appendAlgo(aBoolAlgo);
 
         if(GeomAlgoAPI_ShapeTools::volume(aResShape) > 1.e-27
-          || (aType != BOOL_CUT && aType != BOOL_COMMON))
+           || (myOperationType != BOOL_CUT && myOperationType != BOOL_COMMON))
         {
           std::shared_ptr<ModelAPI_ResultBody> aResultBody =
             document()->createBody(data(), aResultIndex);
 
           ListOfShape aUsedTools = aTools;
-          if (aType == BOOL_FILL) {
+          if (myOperationType == BOOL_FILL) {
             aUsedTools.insert(aUsedTools.end(), aPlanes.begin(), aPlanes.end());
           }
 
           loadNamingDS(aResultBody, anObject, aUsedTools, aResShape,
-                       aMakeShapeList, *(aBoolAlgo->mapOfSubShapes()), aType == BOOL_FILL);
+                       aMakeShapeList, *(aBoolAlgo->mapOfSubShapes()),
+                       myOperationType == BOOL_FILL);
           setResult(aResultBody, aResultIndex);
           aResultIndex++;
         }
@@ -290,7 +289,7 @@ void FeaturesPlugin_Boolean::execute()
         GeomAlgoAPI_MakeShapeList aMakeShapeList;
         std::shared_ptr<GeomAlgoAPI_MakeShape> aBoolAlgo;
 
-        switch(aType) {
+        switch(myOperationType) {
           case BOOL_CUT: {
             aBoolAlgo.reset(new GeomAlgoAPI_Boolean(aUsedInOperationSolids,
                                                     aTools,
@@ -367,13 +366,13 @@ void FeaturesPlugin_Boolean::execute()
         }
 
         if(GeomAlgoAPI_ShapeTools::volume(aResultShape) > 1.e-27
-          || (aType != BOOL_CUT && aType != BOOL_COMMON))
+           || (myOperationType != BOOL_CUT && myOperationType != BOOL_COMMON))
         {
           std::shared_ptr<ModelAPI_ResultBody> aResultBody =
             document()->createBody(data(), aResultIndex);
 
           ListOfShape aUsedTools = aTools;
-          if (aType == BOOL_FILL) {
+          if (myOperationType == BOOL_FILL) {
             aUsedTools.insert(aUsedTools.end(), aPlanes.begin(), aPlanes.end());
           }
 
@@ -383,7 +382,7 @@ void FeaturesPlugin_Boolean::execute()
                        aResultShape,
                        aMakeShapeList,
                        aMapOfShapes,
-                       aType == BOOL_FILL);
+                       myOperationType == BOOL_FILL);
           setResult(aResultBody, aResultIndex);
           aResultIndex++;
         }
index d49820686883058d1991b778f8ab14a0f6c6ec4c..ce70e57bc619a23adb39ed2f23015eab795ec68b 100644 (file)
@@ -18,8 +18,8 @@
 // email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
 //
 
-#ifndef FeaturesPlugin_Cut_H_
-#define FeaturesPlugin_Cut_H_
+#ifndef FeaturesPlugin_Boolean_H_
+#define FeaturesPlugin_Boolean_H_
 
 #include "FeaturesPlugin.h"
 
@@ -42,13 +42,6 @@ public:
     BOOL_SMASH
   };
 
-  /// Feature kind.
-  inline static const std::string& ID()
-  {
-    static const std::string MY_ID("Boolean");
-    return MY_ID;
-  }
-
   /// Attribute name of main objects.
   inline static const std::string& OBJECT_LIST_ID()
   {
@@ -63,19 +56,8 @@ public:
     return MY_TOOL_LIST_ID;
   }
 
-  /// Attribute name of operation type.
-  inline static const std::string& TYPE_ID()
-  {
-    static const std::string MY_TYPE_ID("bool_type");
-    return MY_TYPE_ID;
-  }
-
-  /// \return the kind of a feature.
-  FEATURESPLUGIN_EXPORT virtual const std::string& getKind()
-  {
-    static std::string MY_KIND = FeaturesPlugin_Boolean::ID();
-    return MY_KIND;
-  }
+  /// \return boolean operation type.
+  FEATURESPLUGIN_EXPORT OperationType operationType();
 
   /// Creates a new part document if needed.
   FEATURESPLUGIN_EXPORT virtual void execute();
@@ -83,8 +65,10 @@ public:
   /// Request for initialization of data model of the feature: adding all attributes.
   FEATURESPLUGIN_EXPORT virtual void initAttributes();
 
+protected:
+
   /// Use plugin manager for features creation.
-  FeaturesPlugin_Boolean();
+  FeaturesPlugin_Boolean(const OperationType theOperationType);
 
 private:
   std::shared_ptr<GeomAPI_Shape> getShape(const std::string& theAttrName);
@@ -97,6 +81,9 @@ private:
                     GeomAlgoAPI_MakeShape& theMakeShape,
                     GeomAPI_DataMapOfShapeShape& theMapOfShapes,
                     const bool theIsStoreAsGenerated = false);
+
+private:
+  OperationType myOperationType;
 };
 
 #endif
diff --git a/src/FeaturesPlugin/FeaturesPlugin_BooleanCommon.h b/src/FeaturesPlugin/FeaturesPlugin_BooleanCommon.h
new file mode 100644 (file)
index 0000000..7acab2e
--- /dev/null
@@ -0,0 +1,54 @@
+// Copyright (C) 2014-2017  CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or
+// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+//
+
+#ifndef FeaturesPlugin_BooleanCommon_H_
+#define FeaturesPlugin_BooleanCommon_H_
+
+#include "FeaturesPlugin_Boolean.h"
+
+/// \class FeaturesPlugin_BooleanCommon
+/// \ingroup Plugins
+/// \brief Feature for applying of Boolean Common operation.
+class FeaturesPlugin_BooleanCommon : public FeaturesPlugin_Boolean
+{
+public:
+
+  /// Feature kind.
+  inline static const std::string& ID()
+  {
+    static const std::string MY_ID("Common");
+    return MY_ID;
+  }
+
+  /// \return the kind of a feature.
+  FEATURESPLUGIN_EXPORT virtual const std::string& getKind()
+  {
+    static std::string MY_KIND = FeaturesPlugin_BooleanCommon::ID();
+    return MY_KIND;
+  }
+
+public:
+
+    /// Use plugin manager for features creation.
+  FeaturesPlugin_BooleanCommon(): FeaturesPlugin_Boolean(BOOL_COMMON) {};
+
+};
+
+#endif
diff --git a/src/FeaturesPlugin/FeaturesPlugin_BooleanCut.h b/src/FeaturesPlugin/FeaturesPlugin_BooleanCut.h
new file mode 100644 (file)
index 0000000..f53afa9
--- /dev/null
@@ -0,0 +1,54 @@
+// Copyright (C) 2014-2017  CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or
+// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+//
+
+#ifndef FeaturesPlugin_BooleanCut_H_
+#define FeaturesPlugin_BooleanCut_H_
+
+#include "FeaturesPlugin_Boolean.h"
+
+/// \class FeaturesPlugin_BooleanCut
+/// \ingroup Plugins
+/// \brief Feature for applying of Boolean Cut operation.
+class FeaturesPlugin_BooleanCut : public FeaturesPlugin_Boolean
+{
+public:
+
+  /// Feature kind.
+  inline static const std::string& ID()
+  {
+    static const std::string MY_ID("Cut");
+    return MY_ID;
+  }
+
+  /// \return the kind of a feature.
+  FEATURESPLUGIN_EXPORT virtual const std::string& getKind()
+  {
+    static std::string MY_KIND = FeaturesPlugin_BooleanCut::ID();
+    return MY_KIND;
+  }
+
+public:
+
+    /// Use plugin manager for features creation.
+  FeaturesPlugin_BooleanCut(): FeaturesPlugin_Boolean(BOOL_CUT) {};
+
+};
+
+#endif
diff --git a/src/FeaturesPlugin/FeaturesPlugin_BooleanFill.h b/src/FeaturesPlugin/FeaturesPlugin_BooleanFill.h
new file mode 100644 (file)
index 0000000..b4cb73b
--- /dev/null
@@ -0,0 +1,54 @@
+// Copyright (C) 2014-2017  CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or
+// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+//
+
+#ifndef FeaturesPlugin_BooleanFill_H_
+#define FeaturesPlugin_BooleanFill_H_
+
+#include "FeaturesPlugin_Boolean.h"
+
+/// \class FeaturesPlugin_BooleanFill
+/// \ingroup Plugins
+/// \brief Feature for applying of Boolean Fill operation.
+class FeaturesPlugin_BooleanFill : public FeaturesPlugin_Boolean
+{
+public:
+
+  /// Feature kind.
+  inline static const std::string& ID()
+  {
+    static const std::string MY_ID("Fill");
+    return MY_ID;
+  }
+
+  /// \return the kind of a feature.
+  FEATURESPLUGIN_EXPORT virtual const std::string& getKind()
+  {
+    static std::string MY_KIND = FeaturesPlugin_BooleanFill::ID();
+    return MY_KIND;
+  }
+
+public:
+
+    /// Use plugin manager for features creation.
+  FeaturesPlugin_BooleanFill(): FeaturesPlugin_Boolean(BOOL_FILL) {};
+
+};
+
+#endif
diff --git a/src/FeaturesPlugin/FeaturesPlugin_BooleanFuse.h b/src/FeaturesPlugin/FeaturesPlugin_BooleanFuse.h
new file mode 100644 (file)
index 0000000..bbd6216
--- /dev/null
@@ -0,0 +1,54 @@
+// Copyright (C) 2014-2017  CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or
+// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+//
+
+#ifndef FeaturesPlugin_BooleanFuse_H_
+#define FeaturesPlugin_BooleanFuse_H_
+
+#include "FeaturesPlugin_Boolean.h"
+
+/// \class FeaturesPlugin_BooleanFuse
+/// \ingroup Plugins
+/// \brief Feature for applying of Boolean Fuse operation.
+class FeaturesPlugin_BooleanFuse : public FeaturesPlugin_Boolean
+{
+public:
+
+  /// Feature kind.
+  inline static const std::string& ID()
+  {
+    static const std::string MY_ID("Fuse");
+    return MY_ID;
+  }
+
+  /// \return the kind of a feature.
+  FEATURESPLUGIN_EXPORT virtual const std::string& getKind()
+  {
+    static std::string MY_KIND = FeaturesPlugin_BooleanFuse::ID();
+    return MY_KIND;
+  }
+
+public:
+
+    /// Use plugin manager for features creation.
+  FeaturesPlugin_BooleanFuse(): FeaturesPlugin_Boolean(BOOL_FUSE) {};
+
+};
+
+#endif
diff --git a/src/FeaturesPlugin/FeaturesPlugin_BooleanSmash.h b/src/FeaturesPlugin/FeaturesPlugin_BooleanSmash.h
new file mode 100644 (file)
index 0000000..86809f9
--- /dev/null
@@ -0,0 +1,54 @@
+// Copyright (C) 2014-2017  CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or
+// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+//
+
+#ifndef FeaturesPlugin_BooleanSmash_H_
+#define FeaturesPlugin_BooleanSmash_H_
+
+#include "FeaturesPlugin_Boolean.h"
+
+/// \class FeaturesPlugin_BooleanSmash
+/// \ingroup Plugins
+/// \brief Feature for applying of Boolean Smash operation.
+class FeaturesPlugin_BooleanSmash : public FeaturesPlugin_Boolean
+{
+public:
+
+  /// Feature kind.
+  inline static const std::string& ID()
+  {
+    static const std::string MY_ID("Smash");
+    return MY_ID;
+  }
+
+  /// \return the kind of a feature.
+  FEATURESPLUGIN_EXPORT virtual const std::string& getKind()
+  {
+    static std::string MY_KIND = FeaturesPlugin_BooleanSmash::ID();
+    return MY_KIND;
+  }
+
+public:
+
+    /// Use plugin manager for features creation.
+  FeaturesPlugin_BooleanSmash(): FeaturesPlugin_Boolean(BOOL_SMASH) {};
+
+};
+
+#endif
index 2a8023433c763f1f06c3752987da571887980439..33f256c1ff88549e3098f90fc87f3fcea7159a76 100644 (file)
 
 #include <FeaturesPlugin_Plugin.h>
 
-#include <FeaturesPlugin_Boolean.h>
+#include <FeaturesPlugin_BooleanCut.h>
+#include <FeaturesPlugin_BooleanFuse.h>
+#include <FeaturesPlugin_BooleanCommon.h>
+#include <FeaturesPlugin_BooleanSmash.h>
+#include <FeaturesPlugin_BooleanFill.h>
 #include <FeaturesPlugin_Extrusion.h>
 #include <FeaturesPlugin_ExtrusionCut.h>
 #include <FeaturesPlugin_ExtrusionFuse.h>
@@ -90,6 +94,8 @@ FeaturesPlugin_Plugin::FeaturesPlugin_Plugin()
                               new FeaturesPlugin_ValidatorFilletSelection);
   aFactory->registerValidator("FeaturesPlugin_ValidatorCircular",
                               new FeaturesPlugin_ValidatorCircular);
+  aFactory->registerValidator("FeaturesPlugin_ValidatorBooleanArguments",
+                              new FeaturesPlugin_ValidatorBooleanArguments);
 
   // register this plugin
   ModelAPI_Session::get()->registerPlugin(this);
@@ -105,8 +111,16 @@ FeaturePtr FeaturesPlugin_Plugin::createFeature(std::string theFeatureID)
     return FeaturePtr(new FeaturesPlugin_Rotation);
   } else if (theFeatureID == FeaturesPlugin_Translation::ID()) {
     return FeaturePtr(new FeaturesPlugin_Translation);
-  } else if (theFeatureID == FeaturesPlugin_Boolean::ID()) {
-    return FeaturePtr(new FeaturesPlugin_Boolean);
+  } else if (theFeatureID == FeaturesPlugin_BooleanCut::ID()) {
+    return FeaturePtr(new FeaturesPlugin_BooleanCut);
+  } else if (theFeatureID == FeaturesPlugin_BooleanFuse::ID()) {
+    return FeaturePtr(new FeaturesPlugin_BooleanFuse);
+  } else if (theFeatureID == FeaturesPlugin_BooleanCommon::ID()) {
+    return FeaturePtr(new FeaturesPlugin_BooleanCommon);
+  } else if (theFeatureID == FeaturesPlugin_BooleanSmash::ID()) {
+    return FeaturePtr(new FeaturesPlugin_BooleanSmash);
+  } else if (theFeatureID == FeaturesPlugin_BooleanFill::ID()) {
+    return FeaturePtr(new FeaturesPlugin_BooleanFill);
   } else if (theFeatureID == FeaturesPlugin_Intersection::ID()) {
     return FeaturePtr(new FeaturesPlugin_Intersection);
   } else if (theFeatureID == FeaturesPlugin_Partition::ID()) {
index 5a06ceaaccb7c195ec89a83c589203d4162ca55a..0a85e1ab4418858699d50ece0707a7faac41a408 100644 (file)
@@ -571,8 +571,9 @@ bool FeaturesPlugin_ValidatorBooleanSelection::isValid(const AttributePtr& theAt
       "Error: This validator can only work with selection list attributes in \"Boolean\" feature.";
     return false;
   }
-  FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(theAttribute->owner());
-  int anOperationType = aFeature->integer("bool_type")->value();
+  std::shared_ptr<FeaturesPlugin_Boolean> aFeature =
+    std::dynamic_pointer_cast<FeaturesPlugin_Boolean>(theAttribute->owner());
+  FeaturesPlugin_Boolean::OperationType anOperationType = aFeature->operationType();
 
   for(int anIndex = 0; anIndex < anAttrSelectionList->size(); ++anIndex) {
     AttributeSelectionPtr anAttrSelection = anAttrSelectionList->value(anIndex);
@@ -1016,3 +1017,137 @@ bool FeaturesPlugin_ValidatorCircular::isValid(const AttributePtr& theAttribute,
   }
   return isValid;
 }
+
+//=================================================================================================
+bool FeaturesPlugin_ValidatorBooleanArguments::isValid(
+  const std::shared_ptr<ModelAPI_Feature>& theFeature,
+  const std::list<std::string>& theArguments,
+  Events_InfoMessage& theError) const
+{
+  if (theArguments.size() != 2)
+  {
+    theError = "Wrong number of arguments (expected 2).";
+    return false;
+  }
+
+  int anObjectsNb = 0, aToolsNb = 0;
+  //int anOperationType = 0;
+
+  std::list<std::string>::const_iterator anIt = theArguments.begin(), aLast = theArguments.end();
+
+  bool isAllInSameCompSolid = true;
+  ResultCompSolidPtr aCompSolid;
+
+  AttributeSelectionListPtr anAttrSelList = theFeature->selectionList(*anIt);
+  if (anAttrSelList)
+  {
+    anObjectsNb = anAttrSelList->size();
+    for (int anIndex = 0; anIndex < anObjectsNb; ++anIndex)
+    {
+      AttributeSelectionPtr anAttr = anAttrSelList->value(anIndex);
+      ResultPtr aContext = anAttr->context();
+      ResultCompSolidPtr aResCompSolidPtr = ModelAPI_Tools::compSolidOwner(aContext);
+      if (aResCompSolidPtr.get())
+      {
+        if (aCompSolid.get())
+        {
+          isAllInSameCompSolid = aCompSolid == aResCompSolidPtr;
+        }
+        else
+        {
+          aCompSolid = aResCompSolidPtr;
+        }
+      }
+      else
+      {
+        isAllInSameCompSolid = false;
+        break;
+      }
+    }
+  }
+  anIt++;
+
+
+  anAttrSelList = theFeature->selectionList(*anIt);
+  if (anAttrSelList)
+  {
+    aToolsNb = anAttrSelList->size();
+    if (isAllInSameCompSolid)
+    {
+      for (int anIndex = 0; anIndex < aToolsNb; ++anIndex)
+      {
+        AttributeSelectionPtr anAttr = anAttrSelList->value(anIndex);
+        ResultPtr aContext = anAttr->context();
+        ResultCompSolidPtr aResCompSolidPtr = ModelAPI_Tools::compSolidOwner(aContext);
+        if (aResCompSolidPtr.get())
+        {
+          if (aCompSolid.get())
+          {
+            isAllInSameCompSolid = aCompSolid == aResCompSolidPtr;
+          }
+          else
+          {
+            aCompSolid = aResCompSolidPtr;
+          }
+        }
+        else
+        {
+          isAllInSameCompSolid = false;
+          break;
+        }
+      }
+    }
+  }
+  anIt++;
+
+  std::shared_ptr<FeaturesPlugin_Boolean> aFeature =
+    std::dynamic_pointer_cast<FeaturesPlugin_Boolean>(theFeature);
+  FeaturesPlugin_Boolean::OperationType anOperationType = aFeature->operationType();
+
+  if (anOperationType == FeaturesPlugin_Boolean::BOOL_FUSE)
+  {
+    // Fuse operation
+    if (anObjectsNb + aToolsNb < 2)
+    {
+      theError = "Not enough arguments for Fuse operation.";
+      return false;
+    }
+    else if (isAllInSameCompSolid)
+    {
+      theError = "Operations only between sub-shapes of the same shape not allowed.";
+      return false;
+    }
+  }
+  else
+  {
+    if (anObjectsNb < 1)
+    {
+      theError = "Objects not selected.";
+      return false;
+    }
+    if (aToolsNb < 1)
+    {
+      theError = "Tools not selected.";
+      return false;
+    }
+    if (isAllInSameCompSolid)
+    {
+      theError = "Operations only between sub-shapes of the same shape not allowed.";
+      return false;
+    }
+  }
+
+  return true;
+}
+
+//=================================================================================================
+bool FeaturesPlugin_ValidatorBooleanArguments::isNotObligatory(std::string theFeature,
+                                                               std::string theAttribute)
+{
+  if (theAttribute == "main_objects" || theAttribute == "tool_objects")
+  {
+    return true;
+  }
+
+  return false;
+}
index 5824ce9dc08753ffb46219711eae7e46bee418ff..c75ad9737149c250af28b9685118f34ecf7e8e0f 100644 (file)
@@ -267,4 +267,25 @@ public:
                        Events_InfoMessage& theError) const;
 };
 
+/** \class FeaturesPlugin_ValidatorBooleanArguments
+*  \ingroup Validators
+*  \brief Validates that boolean operation have enough arguments.
+*/
+class FeaturesPlugin_ValidatorBooleanArguments: public ModelAPI_FeatureValidator
+{
+public:
+  /** \brief Returns true if feature and/or attributes are valid.
+  *  \param[in] theFeature the validated feature.
+  *  \param[in] theArguments the arguments in the configuration file for this validator.
+  *  \param[out] theError error message.
+  *  \returns true if feature is valid.
+  */
+  virtual bool isValid(const std::shared_ptr<ModelAPI_Feature>& theFeature,
+                                             const std::list<std::string>& theArguments,
+                                             Events_InfoMessage& theError) const;
+
+  /// \return true if the attribute in feature is not obligatory for the feature execution.
+  virtual bool isNotObligatory(std::string theFeature, std::string theAttribute);
+};
+
 #endif
index fc260d3309b9ea995759aa44a97db55d3337dcdf..d42a091f4bbae90c466733cbd0661411913bdc5e 100644 (file)
@@ -34,7 +34,7 @@ SketchCircle_3 = Sketch_2.addCircle(-41.97827733564338, 89.35676702647821, 6.102
 model.do()
 Extrusion_2 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_2_2f"), model.selection("FACE", "Sketch_2/Face-SketchCircle_3_2f")], model.selection(), 10, 0)
 Boolean_1 = model.addSmash(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1")], [model.selection("SOLID", "Extrusion_2_1"), model.selection("SOLID", "Extrusion_2_2")])
-Group_1 = model.addGroup(Part_1_doc, [model.selection("FACE", "Extrusion_2_2/To_Face_1"), model.selection("FACE", "Extrusion_2_2/From_Face_1"), model.selection("FACE", "Extrusion_2_2/Generated_Face_1"), model.selection("FACE", "Extrusion_2_1/From_Face_1"), model.selection("FACE", "Boolean_1_1_1/Modified_Face_1"), model.selection("FACE", "Extrusion_1_1/From_Face_1"), model.selection("FACE", "Extrusion_1_1/Generated_Face_1"), model.selection("FACE", "Extrusion_2_2/From_Face_1"), model.selection("FACE", "Extrusion_2_1/Generated_Face_1"), model.selection("FACE", "Extrusion_2_1/From_Face_1"), model.selection("FACE", "Extrusion_2_1/To_Face_1")])
+Group_1 = model.addGroup(Part_1_doc, [model.selection("FACE", "Extrusion_2_2/To_Face_1"), model.selection("FACE", "Extrusion_2_2/From_Face_1"), model.selection("FACE", "Extrusion_2_2/Generated_Face_1"), model.selection("FACE", "Extrusion_2_1/From_Face_1"), model.selection("FACE", "Smash_1_1_1/Modified_Face_1"), model.selection("FACE", "Extrusion_1_1/From_Face_1"), model.selection("FACE", "Extrusion_1_1/Generated_Face_1"), model.selection("FACE", "Extrusion_2_2/From_Face_1"), model.selection("FACE", "Extrusion_2_1/Generated_Face_1"), model.selection("FACE", "Extrusion_2_1/From_Face_1"), model.selection("FACE", "Extrusion_2_1/To_Face_1")])
 model.do()
 model.end()
 
index 16cb0352aac8b8ab30e4ebeb5572d6be94c9d217..1fbbd14c55c7ca53e434808b32df29144492f273 100644 (file)
@@ -206,15 +206,15 @@ SketchConstraintDistance_4 = Sketch_3.setDistance(SketchLine_21.startPoint(), Sk
 model.do()
 Revolution_2 = model.addRevolution(Part_1_doc, [model.selection("COMPOUND", "Sketch_3")], model.selection("EDGE", "PartSet/OZ"), 360, 0)
 Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_2/Face-SketchCircle_13_2f"), model.selection("FACE", "Sketch_2/Face-SketchCircle_14_2f")], model.selection(), model.selection("FACE", "Revolution_1_1/Generated_Face_5"), 0, model.selection(), 0)
-Boolean_1 = model.addCommon(Part_1_doc, [model.selection("SOLID", "Extrusion_1_2"), model.selection("SOLID", "Extrusion_1_1")], [model.selection("SOLID", "Revolution_2_1")])
-Boolean_2 = model.addCut(Part_1_doc, [model.selection("SOLID", "ExtrusionCut_3_1")], [model.selection("SOLID", "Boolean_1_1"), model.selection("SOLID", "Boolean_1_2")])
+Common_1 = model.addCommon(Part_1_doc, [model.selection("SOLID", "Extrusion_1_2"), model.selection("SOLID", "Extrusion_1_1")], [model.selection("SOLID", "Revolution_2_1")])
+Cut_1 = model.addCut(Part_1_doc, [model.selection("SOLID", "ExtrusionCut_3_1")], [model.selection("SOLID", "Common_1_1"), model.selection("SOLID", "Common_1_2")])
 # skip 3 vertices, limitation
-Group_1_objects = [model.selection("VERTEX", "Revolution_1_1/Generated_Face_5&Revolution_1_1/Generated_Face_4"), model.selection("VERTEX", "Revolution_1_1/Generated_Face_4&ExtrusionCut_3_1/Modfied_2"), model.selection("VERTEX", "ExtrusionCut_3_1/Modfied_2&Revolution_1_1/Generated_Face_2"), model.selection("VERTEX", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_1_1/Modfied_4"), model.selection("VERTEX", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_2_1/Modfied_2"), model.selection("VERTEX", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_3_1/Modfied_3"), model.selection("VERTEX", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_2_1/Modfied_4"), model.selection("VERTEX", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_2_1/Modfied_3"), model.selection("VERTEX", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_1_1/Modfied_3"), model.selection("VERTEX", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_1_1/Modfied_5"), model.selection("VERTEX", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_1_1/Modfied_6"), model.selection("VERTEX", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_1_1/Modfied_8"), model.selection("VERTEX", "Revolution_1_1/Generated_Face_2&Boolean_2_1/Modified_Face_1"), model.selection("VERTEX", "ExtrusionCut_2_1/Modfied_5&ExtrusionCut_2_1/Modfied_6"), model.selection("VERTEX", "ExtrusionCut_1_1/Lateral_5095"), model.selection("VERTEX", "ExtrusionCut_2_1/Modfied_2&ExtrusionCut_2_1/Modfied_7"), model.selection("VERTEX", "ExtrusionCut_3_1/Lateral_5004"), model.selection("VERTEX", "ExtrusionCut_2_1/Modfied_4&ExtrusionCut_2_1/Modfied_9"), model.selection("VERTEX", "ExtrusionCut_2_1/Modfied_3&ExtrusionCut_2_1/Modfied_8"), model.selection("VERTEX", "ExtrusionCut_1_1/Lateral_5108"), model.selection("VERTEX", "ExtrusionCut_1_1/Lateral_5082"), model.selection("VERTEX", "ExtrusionCut_1_1/Lateral_5069"), model.selection("VERTEX", "ExtrusionCut_1_1/Lateral_5043"), model.selection("VERTEX", "ExtrusionCut_2_1/Vertex_5024"), model.selection("VERTEX", "ExtrusionCut_2_1/Vertex_5006"), model.selection("VERTEX", "ExtrusionCut_2_1/Vertex_5015"), model.selection("VERTEX", "Extrusion_1_1/Lateral_4"), model.selection("VERTEX", "Extrusion_1_2/Lateral_4"), model.selection("VERTEX", "ExtrusionCut_2_1/Vertex_5033"), model.selection("VERTEX", "ExtrusionCut_2_1/Vertex_5031"), model.selection("VERTEX", "ExtrusionCut_2_1/Vertex_5022"), model.selection("VERTEX", "ExtrusionCut_2_1/Vertex_5004"), model.selection("VERTEX", "ExtrusionCut_2_1/Vertex_5013"), model.selection("VERTEX", "Boolean_1_2/Modified_Face_2&Boolean_1_2/Modified_Face_1"), model.selection("VERTEX", "Boolean_1_1/Modified_Face_2&Boolean_1_1/Modified_Face_1")]
+Group_1_objects = [model.selection("VERTEX", "Revolution_1_1/Generated_Face_5&Revolution_1_1/Generated_Face_4"), model.selection("VERTEX", "Revolution_1_1/Generated_Face_4&ExtrusionCut_3_1/Modfied_2"), model.selection("VERTEX", "ExtrusionCut_3_1/Modfied_2&Revolution_1_1/Generated_Face_2"), model.selection("VERTEX", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_1_1/Modfied_4"), model.selection("VERTEX", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_2_1/Modfied_2"), model.selection("VERTEX", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_3_1/Modfied_3"), model.selection("VERTEX", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_2_1/Modfied_4"), model.selection("VERTEX", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_2_1/Modfied_3"), model.selection("VERTEX", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_1_1/Modfied_3"), model.selection("VERTEX", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_1_1/Modfied_5"), model.selection("VERTEX", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_1_1/Modfied_6"), model.selection("VERTEX", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_1_1/Modfied_8"), model.selection("VERTEX", "Revolution_1_1/Generated_Face_2&Cut_1_1/Modified_Face_1"), model.selection("VERTEX", "ExtrusionCut_2_1/Modfied_5&ExtrusionCut_2_1/Modfied_6"), model.selection("VERTEX", "ExtrusionCut_1_1/Lateral_5095"), model.selection("VERTEX", "ExtrusionCut_2_1/Modfied_2&ExtrusionCut_2_1/Modfied_7"), model.selection("VERTEX", "ExtrusionCut_3_1/Lateral_5004"), model.selection("VERTEX", "ExtrusionCut_2_1/Modfied_4&ExtrusionCut_2_1/Modfied_9"), model.selection("VERTEX", "ExtrusionCut_2_1/Modfied_3&ExtrusionCut_2_1/Modfied_8"), model.selection("VERTEX", "ExtrusionCut_1_1/Lateral_5108"), model.selection("VERTEX", "ExtrusionCut_1_1/Lateral_5082"), model.selection("VERTEX", "ExtrusionCut_1_1/Lateral_5069"), model.selection("VERTEX", "ExtrusionCut_1_1/Lateral_5043"), model.selection("VERTEX", "ExtrusionCut_2_1/Vertex_5024"), model.selection("VERTEX", "ExtrusionCut_2_1/Vertex_5006"), model.selection("VERTEX", "ExtrusionCut_2_1/Vertex_5015"), model.selection("VERTEX", "Extrusion_1_1/Lateral_4"), model.selection("VERTEX", "Extrusion_1_2/Lateral_4"), model.selection("VERTEX", "ExtrusionCut_2_1/Vertex_5033"), model.selection("VERTEX", "ExtrusionCut_2_1/Vertex_5031"), model.selection("VERTEX", "ExtrusionCut_2_1/Vertex_5022"), model.selection("VERTEX", "ExtrusionCut_2_1/Vertex_5004"), model.selection("VERTEX", "ExtrusionCut_2_1/Vertex_5013"), model.selection("VERTEX", "Common_1_2/Modified_Face_2&Common_1_2/Modified_Face_1"), model.selection("VERTEX", "Common_1_1/Modified_Face_2&Common_1_1/Modified_Face_1")]
 Group_1 = model.addGroup(Part_1_doc, Group_1_objects)
 # skip 3 edges, limitation
-Group_2_objects = [model.selection("EDGE", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_2_1/Modfied_3"), model.selection("EDGE", "ExtrusionCut_2_1/Modfied_3"), model.selection("EDGE", "Boolean_2_1/Modified_Face_1&ExtrusionCut_2_1/Generated_Face_1"), model.selection("EDGE", "ExtrusionCut_2_1/Modfied_3&ExtrusionCut_2_1/Modfied_8"), model.selection("EDGE", "ExtrusionCut_2_1/Lateral_5011"), model.selection("EDGE", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_1_1/Modfied_3"), model.selection("EDGE", "ExtrusionCut_1_1/Modfied_3&Boolean_2_1/Modified_Face_1"), model.selection("EDGE", "Boolean_1_2/Modified_Face_2&Boolean_1_2/Modified_Face_1"), model.selection("EDGE", "Boolean_2_1/Modified_Face_1&Boolean_1_2/Modified_Face_2"), model.selection("EDGE", "Boolean_1_2/Modified_Edge_1"), model.selection("EDGE", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_1_1/Modfied_4"), model.selection("EDGE", "ExtrusionCut_1_1/Modfied_3"), model.selection("EDGE", "ExtrusionCut_2_1/Modfied_4"), model.selection("EDGE", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_2_1/Modfied_4"), model.selection("EDGE", "ExtrusionCut_2_1/Modfied_4&ExtrusionCut_2_1/Modfied_9"), model.selection("EDGE", "ExtrusionCut_2_1/Modfied_9&ExtrusionCut_2_1/Generated_Face_1"), model.selection("EDGE", "Boolean_2_1/Modified_Face_1&ExtrusionCut_2_1/Generated_Face_1"), model.selection("EDGE", "ExtrusionCut_2_1/Lateral_5002"), model.selection("EDGE", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_3_1/Modfied_3"), model.selection("EDGE", "Boolean_1_1/Modified_Edge_1"), model.selection("EDGE", "Boolean_1_1/Modified_Face_2&Boolean_1_1/Modified_Face_1"), model.selection("EDGE", "Boolean_2_1/Modified_Face_1&ExtrusionCut_2_1/Generated_Face_1"), model.selection("EDGE", "ExtrusionCut_3_1/Modfied_2&Revolution_1_1/Generated_Face_2"), model.selection("EDGE", "Boolean_2_1/Modified_Face_1&Boolean_1_1/Modified_Face_2"), model.selection("EDGE", "Revolution_1_1/Generated_Face_4&ExtrusionCut_3_1/Modfied_2"), model.selection("EDGE", "Revolution_1_1/Generated_Face_5&Revolution_1_1/Generated_Face_4"), model.selection("EDGE", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_2_1/Modfied_2"), model.selection("EDGE", "ExtrusionCut_2_1/Modfied_2&ExtrusionCut_2_1/Modfied_7"), model.selection("EDGE", "ExtrusionCut_1_1/Modfied_4&Boolean_2_1/Modified_Face_1"), model.selection("EDGE", "ExtrusionCut_1_1/Modfied_4"), model.selection("EDGE", "ExtrusionCut_3_1/Modfied_3"), model.selection("EDGE", "Revolution_1_1/Generated_Face_2&Boolean_2_1/Modified_Face_1"), model.selection("EDGE", "ExtrusionCut_3_1/Modfied_3&Boolean_2_1/Modified_Face_1"), model.selection("EDGE", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_1_1/Modfied_5"), model.selection("EDGE", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_1_1/Modfied_6"), model.selection("EDGE", "ExtrusionCut_1_1/Modfied_6"), model.selection("EDGE", "ExtrusionCut_1_1/Modfied_5"), model.selection("EDGE", "ExtrusionCut_1_1/Modfied_5&Boolean_2_1/Modified_Face_1"), model.selection("EDGE", "ExtrusionCut_1_1/Modfied_6&Boolean_2_1/Modified_Face_1"), model.selection("EDGE", "Revolution_1_1/Generated_Face_4"), model.selection("EDGE", "Boolean_2_1/Modified_Face_1&ExtrusionCut_2_1/Generated_Face_1"), model.selection("EDGE", "ExtrusionCut_2_1/Modfied_5&ExtrusionCut_2_1/Modfied_6"), model.selection("EDGE", "ExtrusionCut_2_1/Modfied_5"), model.selection("EDGE", "Revolution_1_1/Generated_Face_2"), model.selection("EDGE", "ExtrusionCut_2_1/Lateral_5029"), model.selection("EDGE", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_1_1/Modfied_8"), model.selection("EDGE", "ExtrusionCut_1_1/Modfied_8"), model.selection("EDGE", "ExtrusionCut_1_1/Modfied_8&Boolean_2_1/Modified_Face_1"), model.selection("EDGE", "ExtrusionCut_2_1/Modfied_2"), model.selection("EDGE", "ExtrusionCut_2_1/Lateral_5020")]
+Group_2_objects = [model.selection("EDGE", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_2_1/Modfied_3"), model.selection("EDGE", "ExtrusionCut_2_1/Modfied_3"), model.selection("EDGE", "Cut_1_1/Modified_Face_1&ExtrusionCut_2_1/Generated_Face_1"), model.selection("EDGE", "ExtrusionCut_2_1/Modfied_3&ExtrusionCut_2_1/Modfied_8"), model.selection("EDGE", "ExtrusionCut_2_1/Lateral_5011"), model.selection("EDGE", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_1_1/Modfied_3"), model.selection("EDGE", "ExtrusionCut_1_1/Modfied_3&Cut_1_1/Modified_Face_1"), model.selection("EDGE", "Common_1_2/Modified_Face_2&Common_1_2/Modified_Face_1"), model.selection("EDGE", "Cut_1_1/Modified_Face_1&Common_1_2/Modified_Face_2"), model.selection("EDGE", "Common_1_2/Modified_Edge_1"), model.selection("EDGE", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_1_1/Modfied_4"), model.selection("EDGE", "ExtrusionCut_1_1/Modfied_3"), model.selection("EDGE", "ExtrusionCut_2_1/Modfied_4"), model.selection("EDGE", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_2_1/Modfied_4"), model.selection("EDGE", "ExtrusionCut_2_1/Modfied_4&ExtrusionCut_2_1/Modfied_9"), model.selection("EDGE", "ExtrusionCut_2_1/Modfied_9&ExtrusionCut_2_1/Generated_Face_1"), model.selection("EDGE", "Cut_1_1/Modified_Face_1&ExtrusionCut_2_1/Generated_Face_1"), model.selection("EDGE", "ExtrusionCut_2_1/Lateral_5002"), model.selection("EDGE", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_3_1/Modfied_3"), model.selection("EDGE", "Common_1_1/Modified_Edge_1"), model.selection("EDGE", "Common_1_1/Modified_Face_2&Common_1_1/Modified_Face_1"), model.selection("EDGE", "Cut_1_1/Modified_Face_1&ExtrusionCut_2_1/Generated_Face_1"), model.selection("EDGE", "ExtrusionCut_3_1/Modfied_2&Revolution_1_1/Generated_Face_2"), model.selection("EDGE", "Cut_1_1/Modified_Face_1&Common_1_1/Modified_Face_2"), model.selection("EDGE", "Revolution_1_1/Generated_Face_4&ExtrusionCut_3_1/Modfied_2"), model.selection("EDGE", "Revolution_1_1/Generated_Face_5&Revolution_1_1/Generated_Face_4"), model.selection("EDGE", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_2_1/Modfied_2"), model.selection("EDGE", "ExtrusionCut_2_1/Modfied_2&ExtrusionCut_2_1/Modfied_7"), model.selection("EDGE", "ExtrusionCut_1_1/Modfied_4&Cut_1_1/Modified_Face_1"), model.selection("EDGE", "ExtrusionCut_1_1/Modfied_4"), model.selection("EDGE", "ExtrusionCut_3_1/Modfied_3"), model.selection("EDGE", "Revolution_1_1/Generated_Face_2&Cut_1_1/Modified_Face_1"), model.selection("EDGE", "ExtrusionCut_3_1/Modfied_3&Cut_1_1/Modified_Face_1"), model.selection("EDGE", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_1_1/Modfied_5"), model.selection("EDGE", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_1_1/Modfied_6"), model.selection("EDGE", "ExtrusionCut_1_1/Modfied_6"), model.selection("EDGE", "ExtrusionCut_1_1/Modfied_5"), model.selection("EDGE", "ExtrusionCut_1_1/Modfied_5&Cut_1_1/Modified_Face_1"), model.selection("EDGE", "ExtrusionCut_1_1/Modfied_6&Cut_1_1/Modified_Face_1"), model.selection("EDGE", "Revolution_1_1/Generated_Face_4"), model.selection("EDGE", "Cut_1_1/Modified_Face_1&ExtrusionCut_2_1/Generated_Face_1"), model.selection("EDGE", "ExtrusionCut_2_1/Modfied_5&ExtrusionCut_2_1/Modfied_6"), model.selection("EDGE", "ExtrusionCut_2_1/Modfied_5"), model.selection("EDGE", "Revolution_1_1/Generated_Face_2"), model.selection("EDGE", "ExtrusionCut_2_1/Lateral_5029"), model.selection("EDGE", "ExtrusionCut_3_1/Modfied_2&ExtrusionCut_1_1/Modfied_8"), model.selection("EDGE", "ExtrusionCut_1_1/Modfied_8"), model.selection("EDGE", "ExtrusionCut_1_1/Modfied_8&Cut_1_1/Modified_Face_1"), model.selection("EDGE", "ExtrusionCut_2_1/Modfied_2"), model.selection("EDGE", "ExtrusionCut_2_1/Lateral_5020")]
 Group_2 = model.addGroup(Part_1_doc, Group_2_objects)
-Group_3_objects = [model.selection("FACE", "ExtrusionCut_2_1/Modfied_3"), model.selection("FACE", "ExtrusionCut_2_1/Generated_Face_1"), model.selection("FACE", "ExtrusionCut_2_1/Modfied_8"), model.selection("FACE", "ExtrusionCut_1_1/Modfied_3"), model.selection("FACE", "Boolean_1_2/Modified_Face_1"), model.selection("FACE", "ExtrusionCut_1_1/Modfied_4"), model.selection("FACE", "ExtrusionCut_2_1/Modfied_4"), model.selection("FACE", "ExtrusionCut_2_1/Modfied_9"), model.selection("FACE", "Boolean_1_1/Modified_Face_1"), model.selection("FACE", "Revolution_1_1/Generated_Face_5"), model.selection("FACE", "ExtrusionCut_2_1/Generated_Face_1"), model.selection("FACE", "Boolean_2_1/Modified_Face_1"), model.selection("FACE", "ExtrusionCut_2_1/Modfied_2"), model.selection("FACE", "ExtrusionCut_2_1/Modfied_7"), model.selection("FACE", "Boolean_1_1/Modified_Face_2"), model.selection("FACE", "ExtrusionCut_3_1/Modfied_2"), model.selection("FACE", "Revolution_1_1/Generated_Face_4"), model.selection("FACE", "ExtrusionCut_2_1/Generated_Face_1"), model.selection("FACE", "Boolean_1_2/Modified_Face_2"), model.selection("FACE", "Revolution_1_1/Generated_Face_2"), model.selection("FACE", "ExtrusionCut_3_1/Modfied_3"), model.selection("FACE", "ExtrusionCut_1_1/Modfied_5"), model.selection("FACE", "ExtrusionCut_1_1/Modfied_6"), model.selection("FACE", "ExtrusionCut_2_1/Modfied_5"), model.selection("FACE", "ExtrusionCut_2_1/Generated_Face_1"), model.selection("FACE", "ExtrusionCut_2_1/Modfied_6"), model.selection("FACE", "ExtrusionCut_1_1/Modfied_8")]
+Group_3_objects = [model.selection("FACE", "ExtrusionCut_2_1/Modfied_3"), model.selection("FACE", "ExtrusionCut_2_1/Generated_Face_1"), model.selection("FACE", "ExtrusionCut_2_1/Modfied_8"), model.selection("FACE", "ExtrusionCut_1_1/Modfied_3"), model.selection("FACE", "Common_1_2/Modified_Face_1"), model.selection("FACE", "ExtrusionCut_1_1/Modfied_4"), model.selection("FACE", "ExtrusionCut_2_1/Modfied_4"), model.selection("FACE", "ExtrusionCut_2_1/Modfied_9"), model.selection("FACE", "Common_1_1/Modified_Face_1"), model.selection("FACE", "Revolution_1_1/Generated_Face_5"), model.selection("FACE", "ExtrusionCut_2_1/Generated_Face_1"), model.selection("FACE", "Cut_1_1/Modified_Face_1"), model.selection("FACE", "ExtrusionCut_2_1/Modfied_2"), model.selection("FACE", "ExtrusionCut_2_1/Modfied_7"), model.selection("FACE", "Common_1_1/Modified_Face_2"), model.selection("FACE", "ExtrusionCut_3_1/Modfied_2"), model.selection("FACE", "Revolution_1_1/Generated_Face_4"), model.selection("FACE", "ExtrusionCut_2_1/Generated_Face_1"), model.selection("FACE", "Common_1_2/Modified_Face_2"), model.selection("FACE", "Revolution_1_1/Generated_Face_2"), model.selection("FACE", "ExtrusionCut_3_1/Modfied_3"), model.selection("FACE", "ExtrusionCut_1_1/Modfied_5"), model.selection("FACE", "ExtrusionCut_1_1/Modfied_6"), model.selection("FACE", "ExtrusionCut_2_1/Modfied_5"), model.selection("FACE", "ExtrusionCut_2_1/Generated_Face_1"), model.selection("FACE", "ExtrusionCut_2_1/Modfied_6"), model.selection("FACE", "ExtrusionCut_1_1/Modfied_8")]
 Group_3 = model.addGroup(Part_1_doc, Group_3_objects)
 model.end()
 
index e5e950d461fd67949e9c6fa70f8bf96f52ca3f3a..d3d2fde6c4949d8fc64839711bdfe8edd63c43c5 100644 (file)
@@ -85,10 +85,10 @@ SketchLine_9 = SketchProjection_4.createdFeature()
 SketchConstraintCoincidence_12 = Sketch_2.setCoincident(SketchLine_4.startPoint(), SketchLine_9.result())
 Extrusion_1.setNestedSketch(Sketch_2)
 
-Boolean_1 = model.addFill(Part_1_doc, [model.selection("SOLID", "Revolution_1_1")], [model.selection("SOLID", "Extrusion_1_1")])
+Fill_1 = model.addFill(Part_1_doc, [model.selection("SOLID", "Revolution_1_1")], [model.selection("SOLID", "Extrusion_1_1")])
 
 Point_2 = model.addPoint(Part_1_doc, "x", "y", "-z")
-Axis_4 = model.addAxis(Part_1_doc, model.selection("VERTEX", "Point_1"), model.selection("VERTEX", "Boolean_1_1_2/Modified_Face_3&Boolean_1_1_2/Modified_Face_2&Boolean_1_1_2/Modified_Face_1"))
+Axis_4 = model.addAxis(Part_1_doc, model.selection("VERTEX", "Point_1"), model.selection("VERTEX", "Fill_1_1_2/Modified_Face_3&Fill_1_1_2/Modified_Face_2&Fill_1_1_2/Modified_Face_1"))
 Plane_4 = model.addPlane(Part_1_doc, model.selection("EDGE", "Axis_1"), model.selection("VERTEX", "Point_1"), True)
 Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "Plane_1"), "haut_ext_tuyau", True)
 Plane_5.result().setName("Plane_2 arrivee tuyau")
@@ -96,17 +96,17 @@ Plane_6 = model.addPlane(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Gene
 Plane_7 = model.addPlane(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face_4"), model.selection("EDGE", "Extrusion_1_1/Generated_Face_4&Extrusion_1_1/From_Face_1"), 45)
 Plane_8 = model.addPlane(Part_1_doc, model.selection("FACE", "Extrusion_1_1/Generated_Face_4"), model.selection("EDGE", "Extrusion_1_1/Generated_Face_3&Extrusion_1_1/Generated_Face_4"), "90+45")
 
-Boolean_2 = model.addFill(Part_1_doc, [model.selection("SOLID", "Boolean_1_1_1")], [model.selection("FACE", "Plane_5")])
-Boolean_3 = model.addFill(Part_1_doc, [model.selection("SOLID", "Boolean_2_1_2")], [model.selection("FACE", "Plane_3")])
-Boolean_4 = model.addFill(Part_1_doc, [model.selection("SOLID", "Boolean_3_1_2")], [model.selection("FACE", "Plane_4")])
-Boolean_4.result().setColor(102, 51, 51)
-Boolean_4.result().subResult(0).setColor(153, 153, 76)
-Boolean_4.result().subResult(1).setColor(0, 204, 204)
-Boolean_4.result().subResult(2).setColor(51, 51, 102)
-Boolean_4.result().subResult(3).setColor(102, 204, 102)
-Boolean_4.result().subResult(4).setColor(204, 204, 0)
+Fill_2 = model.addFill(Part_1_doc, [model.selection("SOLID", "Fill_1_1_1")], [model.selection("FACE", "Plane_5")])
+Fill_3 = model.addFill(Part_1_doc, [model.selection("SOLID", "Fill_2_1_2")], [model.selection("FACE", "Plane_3")])
+Fill_4 = model.addFill(Part_1_doc, [model.selection("SOLID", "Fill_3_1_2")], [model.selection("FACE", "Plane_4")])
+Fill_4.result().setColor(102, 51, 51)
+Fill_4.result().subResult(0).setColor(153, 153, 76)
+Fill_4.result().subResult(1).setColor(0, 204, 204)
+Fill_4.result().subResult(2).setColor(51, 51, 102)
+Fill_4.result().subResult(3).setColor(102, 204, 102)
+Fill_4.result().subResult(4).setColor(204, 204, 0)
 
-Union_1 = model.addUnion(Part_1_doc, [model.selection("SOLID", "Boolean_4_1_4"), model.selection("SOLID", "Boolean_4_1_2")])
+Union_1 = model.addUnion(Part_1_doc, [model.selection("SOLID", "Fill_4_1_4"), model.selection("SOLID", "Fill_4_1_2")])
 
 Point_3 = model.addPoint(Part_1_doc, model.selection("EDGE", "Axis_1"), model.selection("FACE", "Plane_2 arrivee tuyau"))
 
@@ -170,33 +170,33 @@ model.do()
 
 Revolution_2 = model.addRevolution(Part_1_doc, [model.selection("FACE", "Sketch_4/Face-SketchArc_2_2f-SketchLine_18r")], model.selection("EDGE", "Sketch_4/Edge-SketchLine_18"), 0, 180)
 
-Boolean_5 = model.addCut(Part_1_doc, [model.selection("SOLID", "Revolution_2_1")], [model.selection("SOLID", "Extrusion_3_1")])
-Boolean_5.result().setName("demi-sphere")
+Cut_1 = model.addCut(Part_1_doc, [model.selection("SOLID", "Revolution_2_1")], [model.selection("SOLID", "Extrusion_3_1")])
+Cut_1.result().setName("demi-sphere")
 
 Plane_9 = model.addPlane(Part_1_doc, model.selection("VERTEX", "Extrusion_2_1/Generated_Face_10&Extrusion_2_1/Generated_Face_1&Extrusion_2_1/From_Face_4"), model.selection("VERTEX", "Extrusion_2_1/Generated_Face_10&Extrusion_2_1/Generated_Face_1&Extrusion_2_1/To_Face_4"), model.selection("VERTEX", "Extrusion_2_1/Generated_Face_2&Extrusion_2_1/Generated_Face_10&Extrusion_2_1/To_Face_4"))
 Plane_10 = model.addPlane(Part_1_doc, model.selection("VERTEX", "Extrusion_2_1/Generated_Face_12&Extrusion_2_1/Generated_Face_11&Extrusion_2_1/To_Face_1"), model.selection("VERTEX", "Extrusion_2_1/Generated_Face_13&Extrusion_2_1/Generated_Face_12&Extrusion_2_1/To_Face_1"), model.selection("VERTEX", "Extrusion_2_1/Generated_Face_13&Extrusion_2_1/Generated_Face_12&Extrusion_2_1/From_Face_1"))
 Plane_11 = model.addPlane(Part_1_doc, model.selection("VERTEX", "Extrusion_2_1/Generated_Face_5&Extrusion_2_1/Generated_Face_7&Extrusion_2_1/To_Face_3"), model.selection("VERTEX", "Extrusion_2_1/Generated_Face_3&Extrusion_2_1/Generated_Face_7&Extrusion_2_1/To_Face_3"), model.selection("VERTEX", "Extrusion_2_1/Generated_Face_5&Extrusion_2_1/Generated_Face_7&Extrusion_2_1/From_Face_3"))
 Plane_12 = model.addPlane(Part_1_doc, model.selection("VERTEX", "Extrusion_2_1/Generated_Face_1&Extrusion_2_1/Generated_Face_4&Extrusion_2_1/To_Face_4"), model.selection("VERTEX", "Extrusion_2_1/Generated_Face_2&Extrusion_2_1/Generated_Face_4&Extrusion_2_1/To_Face_4"), model.selection("VERTEX", "Extrusion_2_1/Generated_Face_2&Extrusion_2_1/Generated_Face_4&Extrusion_2_1/From_Face_4"))
 
-Recover_1 = model.addRecover(Part_1_doc, Boolean_5, [Extrusion_3.result()])
+Recover_1 = model.addRecover(Part_1_doc, Cut_1, [Extrusion_3.result()])
 
 Plane_13 = model.addPlane(Part_1_doc, model.selection("FACE", "Recover_1_1/Shape4"), model.selection("EDGE", "Recover_1_1/Shape4&Recover_1_1/Shape6"), "90+45")
 Plane_14 = model.addPlane(Part_1_doc, model.selection("FACE", "Recover_1_1/Shape1"), model.selection("EDGE", "Recover_1_1/Shape1&Recover_1_1/Shape6"), "90+45")
 Plane_15 = model.addPlane(Part_1_doc, model.selection("FACE", "Recover_1_1/Shape2"), model.selection("EDGE", "Recover_1_1/Shape2&Recover_1_1/Shape6"), "90+45")
 Plane_16 = model.addPlane(Part_1_doc, model.selection("FACE", "Recover_1_1/Shape6"), model.selection("EDGE", "Recover_1_1/Shape3&Recover_1_1/Shape6"), 45)
 
-Boolean_6_objects_2 = [model.selection("FACE", "Plane_6"), model.selection("FACE", "Plane_7"), model.selection("FACE", "Plane_8"), model.selection("FACE", "Plane_9"), model.selection("FACE", "Plane_10"), model.selection("FACE", "Plane_11"), model.selection("FACE", "Plane_12"), model.selection("FACE", "Plane_13")]
-Boolean_6 = model.addFill(Part_1_doc, [model.selection("SOLID", "demi-sphere")], Boolean_6_objects_2)
+Fill_5_objects_2 = [model.selection("FACE", "Plane_6"), model.selection("FACE", "Plane_7"), model.selection("FACE", "Plane_8"), model.selection("FACE", "Plane_9"), model.selection("FACE", "Plane_10"), model.selection("FACE", "Plane_11"), model.selection("FACE", "Plane_12"), model.selection("FACE", "Plane_13")]
+Fill_5 = model.addFill(Part_1_doc, [model.selection("SOLID", "demi-sphere")], Fill_5_objects_2)
 
-Union_2_objects = [model.selection("SOLID", "Boolean_6_1_16"), model.selection("SOLID", "Boolean_6_1_13"), model.selection("SOLID", "Boolean_6_1_14")]
+Union_2_objects = [model.selection("SOLID", "Fill_5_1_16"), model.selection("SOLID", "Fill_5_1_13"), model.selection("SOLID", "Fill_5_1_14")]
 Union_2 = model.addUnion(Part_1_doc, Union_2_objects)
-Union_3_objects = [model.selection("SOLID", "Boolean_6_1_10/Boolean_6_1_10"), model.selection("SOLID", "Boolean_6_1_3/Boolean_6_1_3"), model.selection("SOLID", "Boolean_6_1_5/Boolean_6_1_5"), model.selection("SOLID", "Boolean_6_1_11/Boolean_6_1_11")]
+Union_3_objects = [model.selection("SOLID", "Fill_5_1_10/Fill_5_1_10"), model.selection("SOLID", "Fill_5_1_3/Fill_5_1_3"), model.selection("SOLID", "Fill_5_1_5/Fill_5_1_5"), model.selection("SOLID", "Fill_5_1_11/Fill_5_1_11")]
 Union_3 = model.addUnion(Part_1_doc, Union_3_objects)
-Union_4_objects = [model.selection("SOLID", "Boolean_6_1_12/Boolean_6_1_12"), model.selection("SOLID", "Boolean_6_1_6/Boolean_6_1_6"), model.selection("SOLID", "Boolean_6_1_4/Boolean_6_1_4")]
+Union_4_objects = [model.selection("SOLID", "Fill_5_1_12/Fill_5_1_12"), model.selection("SOLID", "Fill_5_1_6/Fill_5_1_6"), model.selection("SOLID", "Fill_5_1_4/Fill_5_1_4")]
 Union_4 = model.addUnion(Part_1_doc, Union_4_objects)
-Union_5_objects = [model.selection("SOLID", "Boolean_6_1_2/Boolean_6_1_2"), model.selection("SOLID", "Boolean_6_1_1/Boolean_6_1_1"), model.selection("SOLID", "Boolean_6_1_7/Boolean_6_1_7")]
+Union_5_objects = [model.selection("SOLID", "Fill_5_1_2/Fill_5_1_2"), model.selection("SOLID", "Fill_5_1_1/Fill_5_1_1"), model.selection("SOLID", "Fill_5_1_7/Fill_5_1_7")]
 Union_5 = model.addUnion(Part_1_doc, Union_5_objects)
-Union_6_objects = [model.selection("SOLID", "Boolean_6_1_8/Boolean_6_1_8"), model.selection("SOLID", "Boolean_6_1_9/Boolean_6_1_9"), model.selection("SOLID", "Boolean_6_1_15/Boolean_6_1_15")]
+Union_6_objects = [model.selection("SOLID", "Fill_5_1_8/Fill_5_1_8"), model.selection("SOLID", "Fill_5_1_9/Fill_5_1_9"), model.selection("SOLID", "Fill_5_1_15/Fill_5_1_15")]
 Union_6 = model.addUnion(Part_1_doc, Union_6_objects)
 Union_6.result().setColor(0, 0, 204)
 Union_6.result().subResult(0).setColor(204, 102, 102)
index 8398e133abcf9b1f9d664b7f9b08227c501aceb3..84c893e42829b58855d77b96d9f86c14683f756d 100644 (file)
@@ -124,11 +124,9 @@ aSession.finishOperation()
 # Create a pacman as boolean cut of the prism from the cylinder
 #=========================================================================
 aSession.startOperation()
-aBooleanFt = aPart.addFeature("Boolean")
+aBooleanFt = aPart.addFeature("Cut")
 aBooleanFt.selectionList("main_objects").append(extrudedObjects[0], extrudedObjects[0].shape())
 aBooleanFt.selectionList("tool_objects").append(extrudedObjects[1], extrudedObjects[1].shape())
-kBooleanTypeCut = 0
-aBooleanFt.integer("bool_type").setValue(kBooleanTypeCut)
 aBooleanFt.execute()
 aSession.finishOperation()
 
index e2589d6d7a866c70635eb64e7279d21a6a6fedfe..aad16ba714d654c94eaffb02c514b836091c545f 100644 (file)
@@ -117,11 +117,9 @@ aSession.finishOperation()
 # Create a pacman as boolean cut of the prism from the cylinder
 #=========================================================================
 aSession.startOperation()
-aBooleanFt = aPart.addFeature("Boolean")
+aBooleanFt = aPart.addFeature("Cut")
 aBooleanFt.selectionList("main_objects").append(modelAPI_ResultCompSolid(extrudedObjects[0]).subResult(1), None)
 aBooleanFt.selectionList("tool_objects").append(extrudedObjects[1], None)
-aBooleanType = 0
-aBooleanFt.integer("bool_type").setValue(aBooleanType)
 aBooleanFt.execute()
 aSession.finishOperation()
 
@@ -134,11 +132,9 @@ aSession.undo()
 # Fuse
 #=========================================================================
 aSession.startOperation()
-aBooleanFt = aPart.addFeature("Boolean")
+aBooleanFt = aPart.addFeature("Fuse")
 aBooleanFt.selectionList("main_objects").append(modelAPI_ResultCompSolid(extrudedObjects[0]).subResult(1), None)
 aBooleanFt.selectionList("tool_objects").append(extrudedObjects[1], None)
-aBooleanType = 1
-aBooleanFt.integer("bool_type").setValue(aBooleanType)
 aBooleanFt.execute()
 aSession.finishOperation()
 
index 410c09da8731ba2813a88284f83cbeb3fdce1d91..4be9090f0e551b493dc458e67340fb9c5939cab5 100644 (file)
@@ -108,11 +108,9 @@ aSession.finishOperation()
 # Smash prism into the cylinder
 #=========================================================================
 aSession.startOperation()
-aBooleanFt = aPart.addFeature("Boolean")
+aBooleanFt = aPart.addFeature("Smash")
 aBooleanFt.selectionList("main_objects").append(extrudedObjects[0], extrudedObjects[0].shape())
 aBooleanFt.selectionList("tool_objects").append(extrudedObjects[1], extrudedObjects[1].shape())
-kBooleanTypeSmash = 3
-aBooleanFt.integer("bool_type").setValue(kBooleanTypeSmash)
 aBooleanFt.execute()
 aSession.finishOperation()
 
index 1fc541327b6952524415f0fde96c2c9da165ba6e..1f58f43bfa0533c5c7af70735e070048409f59d9 100644 (file)
@@ -52,7 +52,7 @@ model.do()
 Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Left"), "Shift", True)
 Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchArc_1_2f-SketchLine_2f-SketchLine_3f")])
 Boolean_1 = model.addFill(Part_1_doc, [model.selection("FACE", "Face_1_1")], [model.selection("FACE", "Plane_2")])
-Boolean_2 = model.addFill(Part_1_doc, [model.selection("COMPOUND", "Boolean_1_1")], [model.selection("SOLID", "Box_1_1")])
+Boolean_2 = model.addFill(Part_1_doc, [model.selection("COMPOUND", "Fill_1_1")], [model.selection("SOLID", "Box_1_1")])
 model.do()
 
 model.checkBooleansResult(Boolean_2, model, 1, [6], [0], [6], [22], [44])
index c1e57f1d7a839b6a0e32bc1eb7f02f3a87ac5e52..07d7fcaa1289fc0126ae1151196899ce68253206 100644 (file)
@@ -52,7 +52,7 @@ model.do()
 Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Left"), "Shift", True)
 Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchArc_1_2f-SketchLine_2f-SketchLine_3f")])
 Boolean_1 = model.addFill(Part_1_doc, [model.selection("FACE", "Face_1_1")], [model.selection("FACE", "Plane_2")])
-Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Boolean_1_1_2"), model.selection("FACE", "Boolean_1_1_1")])
+Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Fill_1_1_2"), model.selection("FACE", "Fill_1_1_1")])
 Boolean_2 = model.addFill(Part_1_doc, [model.selection("SHELL", "Shell_1_1")], [model.selection("SOLID", "Box_1_1")])
 model.do()
 
index 759c501ad2c38f8ea6a0dad5017953ee886b3141..370f919adcc954a23ffb186c2dee1bbc16033693 100644 (file)
@@ -52,7 +52,7 @@ model.do()
 Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Left"), "Shift/3", True)
 Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchArc_1_2f-SketchLine_2f-SketchLine_3f")])
 Boolean_1 = model.addFill(Part_1_doc, [model.selection("FACE", "Face_1_1")], [model.selection("FACE", "Plane_2")])
-Boolean_2 = model.addFill(Part_1_doc, [model.selection("SOLID", "Box_1_1")], [model.selection("COMPOUND", "Boolean_1_1")])
+Boolean_2 = model.addFill(Part_1_doc, [model.selection("SOLID", "Box_1_1")], [model.selection("COMPOUND", "Fill_1_1")])
 model.do()
 
 model.checkBooleansResult(Boolean_2, model, 1, [2], [2], [14], [60], [120])
index 8e965a51c815e37afdf8fc222f390dbbcec4cf80..ec7fe1163b257f1d4216ef748c99d0fd5623296f 100644 (file)
@@ -52,7 +52,7 @@ model.do()
 Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Left"), "Shift/3", True)
 Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchArc_1_2f-SketchLine_2f-SketchLine_3f")])
 Boolean_1 = model.addFill(Part_1_doc, [model.selection("FACE", "Face_1_1")], [model.selection("FACE", "Plane_2")])
-Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Boolean_1_1_2"), model.selection("FACE", "Boolean_1_1_1")])
+Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Fill_1_1_2"), model.selection("FACE", "Fill_1_1_1")])
 MultiTranslation_1 = model.addMultiTranslation(Part_1_doc, [model.selection("SHELL", "Shell_1_1")], model.selection("EDGE", "PartSet/OZ"), 1, 3)
 Boolean_2 = model.addFill(Part_1_doc, [model.selection("SOLID", "Box_1_1")], [model.selection("COMPOUND", "LinearCopy_1_1")])
 model.do()
index 6cf9389d1c23c1e82813a54c984df7ebc5fc4e71..beb13ea39d4bf03d66b730ce494c2b34e00d7b83 100644 (file)
@@ -52,7 +52,7 @@ model.do()
 Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Left"), "Shift/3", True)
 Face_1 = model.addFace(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchArc_1_2f-SketchLine_2f-SketchLine_3f")])
 Boolean_1 = model.addFill(Part_1_doc, [model.selection("FACE", "Face_1_1")], [model.selection("FACE", "Plane_2")])
-Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Boolean_1_1_2"), model.selection("FACE", "Boolean_1_1_1")])
+Shell_1 = model.addShell(Part_1_doc, [model.selection("FACE", "Fill_1_1_2"), model.selection("FACE", "Fill_1_1_1")])
 Boolean_2 = model.addFill(Part_1_doc, [model.selection("SOLID", "Box_1_1")], [model.selection("SHELL", "Shell_1_1")])
 model.do()
 
index 6884e490e23ba5fa66b48d4ff15377927c2f3065..d332d786fc90cb259aa8e40e66976b007a36984e 100644 (file)
@@ -114,7 +114,7 @@ for i in xrange(0, N * N):
     anExtrusionFt.real("from_size").setValue(0)
     anExtrusionFt.real("to_size").setValue(10)
     anExtrusionFt.real("to_offset").setValue(0) #TODO: remove
-    anExtrusionFt.real("from_offset").setValue(0) #TODO: remove        
+    anExtrusionFt.real("from_offset").setValue(0) #TODO: remove
     # v1.0.2 from master
     # anExtrusionFt.selection("extrusion_face").setValue(
     #    aSketchResult, aSketchFaces[0])
@@ -194,13 +194,11 @@ aSession.finishOperation()
 aCurrentResult = modelAPI_ResultBody(aBox.firstResult())
 aSession.startOperation()
 
-aBooleanFt = aPart.addFeature("Boolean")
+aBooleanFt = aPart.addFeature("Cut")
 aBooleanFt.selectionList("main_objects").append(aCurrentResult, aCurrentResult.shape())
 for i in xrange(0, N * N):
     anExtrusionResult = modelAPI_ResultBody(anExtrusions[i].firstResult())
     aBooleanFt.selectionList("tool_objects").append(anExtrusionResult, anExtrusionResult.shape())
-kBooleanTypeCut = 0
-aBooleanFt.integer("bool_type").setValue(kBooleanTypeCut)
 aBooleanFt.execute()
 aFactory = ModelAPI_Session.get().validators()
 assert (aFactory.validate(aBooleanFt))
index c7361d2741bbdec4b397e1e07dc9108640cdf5e2..08f4887d07488c6f1f049f4ceadef476e6623d10 100644 (file)
@@ -114,7 +114,7 @@ for i in xrange(0, N * N):
     anExtrusionFt.real("from_size").setValue(0)
     anExtrusionFt.real("to_size").setValue(10)
     anExtrusionFt.real("to_offset").setValue(0) #TODO: remove
-    anExtrusionFt.real("from_offset").setValue(0) #TODO: remove        
+    anExtrusionFt.real("from_offset").setValue(0) #TODO: remove
     # v1.0.2 from master
     # anExtrusionFt.selection("extrusion_face").setValue(
     #    aSketchResult, aSketchFaces[0])
@@ -197,11 +197,9 @@ aSession.startOperation()
 aFactory = ModelAPI_Session.get().validators()
 for i in xrange(0, N * N):
     anExtrusionResult = modelAPI_ResultBody(anExtrusions[i].firstResult())
-    aBooleanFt = aPart.addFeature("Boolean")
+    aBooleanFt = aPart.addFeature("Cut")
     aBooleanFt.selectionList("main_objects").append(aCurrentResult, aCurrentResult.shape())
     aBooleanFt.selectionList("tool_objects").append(anExtrusionResult, anExtrusionResult.shape())
-    kBooleanTypeCut = 0
-    aBooleanFt.integer("bool_type").setValue(kBooleanTypeCut)
     aBooleanFt.execute()
     assert (aFactory.validate(aBooleanFt))
     assert (len(aBooleanFt.results()) > 0)
index 015c1d0e5ecf409bcd4ed3915749fcdbdb73aca3..888ccf8031afb6f104b03bee7a39f200b1d1d4f0 100644 (file)
@@ -20,16 +20,6 @@ email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com
 -->
 
 <source>
-  <module_choice id="bool_type"
-    widget_type="radiobuttons"
-    buttons_dir="horizontal"
-    label="Operation type"
-    tooltip="Type of boolean operation"
-    string_list="Cut Fuse Common Fill Smash"
-    use_in_title="true"
-    icons_list="icons/Features/bool_cut.png icons/Features/bool_fuse.png icons/Features/bool_common.png icons/Features/bool_fill.png icons/Features/bool_smash.png"
-    default="0"
-  />
   <multi_selector id="main_objects"
     label="Main objects"
     icon=""
@@ -50,5 +40,5 @@ email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com
     <validator id="PartSet_DifferentObjects"/>
     <validator id="FeaturesPlugin_ValidatorBooleanSelection"/>
   </multi_selector>
-  <validator id="GeomValidators_BooleanArguments" parameters="main_objects,tool_objects,bool_type"/>
+  <validator id="FeaturesPlugin_ValidatorBooleanArguments" parameters="main_objects,tool_objects"/>
 </source>
index edfabe40704aa47434513f49579d383ad6fb9a6c..b09cf282b0819a0fa28f5634dffc31db17a74715 100644 (file)
@@ -54,7 +54,19 @@ email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com
       </feature>
     </group>
     <group id="Boolean">
-      <feature id="Boolean" title="Boolean" tooltip="Perform boolean operations with objects" icon="icons/Features/cut.png"
+      <feature id="Cut" title="Cut" tooltip="Perform boolean cut operation with objects" icon="icons/Features/bool_cut.png"
+               auto_preview="false">
+          <source path="boolean_widget.xml"/>
+      </feature>
+      <feature id="Fuse" title="Fuse" tooltip="Perform boolean fuse operation with objects" icon="icons/Features/bool_fuse.png"
+               auto_preview="false">
+          <source path="boolean_widget.xml"/>
+      </feature>
+      <feature id="Common" title="Common" tooltip="Perform boolean common operation with objects" icon="icons/Features/bool_common.png"
+               auto_preview="false">
+          <source path="boolean_widget.xml"/>
+      </feature>
+      <feature id="Smash" title="Smash" tooltip="Perform boolean smash operation with objects" icon="icons/Features/bool_smash.png"
                auto_preview="false">
           <source path="boolean_widget.xml"/>
       </feature>
@@ -65,6 +77,10 @@ email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com
                auto_preview="false">
           <source path="partition_widget.xml"/>
       </feature>
+      <feature id="Fill" title="Fill" tooltip="Perform boolean fill operation with objects" icon="icons/Features/bool_fill.png"
+               auto_preview="false">
+          <source path="boolean_widget.xml"/>
+      </feature>
       <feature id="Union" title="Union" tooltip="Perform union operations with shapes" icon="icons/Features/union.png">
           <source path="union_widget.xml"/>
       </feature>
index 19796f0a2be92a843e839c3f66d4300f6ac81746..ce7be932c4557724520697e7176ff191817a03d1 100644 (file)
 #include <Geom_Line.hxx>
 #include <GeomAdaptor_Curve.hxx>
 #include <GeomAPI_ExtremaCurveCurve.hxx>
+#include <GeomAPI_ProjectPointOnCurve.hxx>
 #include <gp_Pln.hxx>
 #include <gp_Pnt.hxx>
 #include <TopoDS.hxx>
+#include <TopoDS_Edge.hxx>
 #include <TopoDS_Vertex.hxx>
 
 //==================================================================================================
@@ -122,19 +124,54 @@ std::shared_ptr<GeomAPI_Vertex> GeomAlgoAPI_PointBuilder::vertexOnEdge(
   return aVertex;
 }
 
+//==================================================================================================
+std::shared_ptr<GeomAPI_Vertex> GeomAlgoAPI_PointBuilder::vertexByProjection(
+  const std::shared_ptr<GeomAPI_Vertex> theVertex,
+  const std::shared_ptr<GeomAPI_Edge> theEdge)
+{
+  std::shared_ptr<GeomAPI_Vertex> aVertex;
+
+  if (!theVertex.get() || !theEdge.get()) {
+    return aVertex;
+  }
+
+  std::shared_ptr<GeomAPI_Pnt> aProjPnt = theVertex->point();
+  gp_Pnt aPnt(aProjPnt->x(), aProjPnt->y(), aProjPnt->z());
+
+  TopoDS_Edge anEdge = TopoDS::Edge(theEdge->impl<TopoDS_Shape>());
+  double aFirstOnCurve, aLastOnCurve;
+  Handle(Geom_Curve) aCurve = BRep_Tool::Curve(anEdge, aFirstOnCurve, aLastOnCurve);
+
+  if (aCurve.IsNull()) {
+    return aVertex;
+  }
+
+  GeomAPI_ProjectPointOnCurve aProjection(aPnt, aCurve);
+
+  if (aProjection.NbPoints() == 0) {
+    return aVertex;
+  }
+
+  gp_Pnt aNearestPoint = aProjection.NearestPoint();
+
+  aVertex.reset(new GeomAPI_Vertex(aNearestPoint.X(), aNearestPoint.Y(), aNearestPoint.Z()));
+
+  return aVertex;
+}
+
 //==================================================================================================
 std::shared_ptr<GeomAPI_Vertex> GeomAlgoAPI_PointBuilder::vertexByProjection(
     const std::shared_ptr<GeomAPI_Vertex> theVertex,
-    const std::shared_ptr<GeomAPI_Face> thePlane)
+    const std::shared_ptr<GeomAPI_Face> theFace)
 {
   std::shared_ptr<GeomAPI_Vertex> aVertex;
 
-  if(!theVertex.get() || !thePlane.get() || !thePlane->isPlanar()) {
+  if(!theVertex.get() || !theFace.get() || !theFace->isPlanar()) {
     return aVertex;
   }
 
   std::shared_ptr<GeomAPI_Pnt> aProjPnt = theVertex->point();
-  std::shared_ptr<GeomAPI_Pln> aProjPln = thePlane->getPlane();
+  std::shared_ptr<GeomAPI_Pln> aProjPln = theFace->getPlane();
 
   std::shared_ptr<GeomAPI_Pnt> aPnt = aProjPln->project(aProjPnt);
 
index 50e478752be06c4bc527332569d746fc6ab0496b..f75ecd2ab5c2d8eb3568be8827c51d7f8cd5305e 100644 (file)
@@ -56,13 +56,21 @@ public:
                                                       const bool theIsPercent = false,
                                                       const bool theIsReverse = false);
 
+  /// \brief Creates vertex by projection another vertex on edge.
+  /// \param[in] theVertex vertex to project.
+  /// \param[in] theEdge edge for projection.
+  /// \return created vertex.
+  static std::shared_ptr<GeomAPI_Vertex>
+    vertexByProjection(const std::shared_ptr<GeomAPI_Vertex> theVertex,
+    const std::shared_ptr<GeomAPI_Edge> theEdge);
+
   /// \brief Creates vertex by projection another vertex on plane.
   /// \param[in] theVertex vertex to project.
-  /// \param[in] thePlane face for projection. Should be planar.
+  /// \param[in] theFace face for projection. Should be planar.
   /// \return created vertex.
   static std::shared_ptr<GeomAPI_Vertex>
     vertexByProjection(const std::shared_ptr<GeomAPI_Vertex> theVertex,
-                       const std::shared_ptr<GeomAPI_Face> thePlane);
+                       const std::shared_ptr<GeomAPI_Face> theFace);
 
   /// \brief Creates vertex by intersection two coplanar lines.
   /// \param[in] theEdge1 first linear edge.
index 32384bf25021c13c6191deb79e34a5ae931a021c..ac3bee2557ca5faee1c330a6731ebeef1bbbe7b7 100644 (file)
 #include <BRepBuilderAPI_MakeVertex.hxx>
 #include <TopoDS_Edge.hxx>
 
+//==================================================================================================
+static GProp_GProps props(const TopoDS_Shape& theShape)
+{
+  GProp_GProps aGProps;
+
+  if (theShape.ShapeType() == TopAbs_EDGE || theShape.ShapeType() == TopAbs_WIRE)
+  {
+    BRepGProp::LinearProperties(theShape, aGProps);
+  }
+  else if (theShape.ShapeType() == TopAbs_FACE || theShape.ShapeType() == TopAbs_SHELL)
+  {
+    const Standard_Real anEps = 1.e-6;
+    BRepGProp::SurfaceProperties(theShape, aGProps, anEps);
+  }
+  else if (theShape.ShapeType() == TopAbs_SOLID || theShape.ShapeType() == TopAbs_COMPSOLID)
+  {
+    BRepGProp::VolumeProperties(theShape, aGProps);
+  }
+  else if (theShape.ShapeType() == TopAbs_COMPOUND)
+  {
+    for (TopoDS_Iterator anIt(theShape); anIt.More(); anIt.Next())
+    {
+      aGProps.Add(props(anIt.Value()));
+    }
+  }
+
+  return aGProps;
+}
+
 //==================================================================================================
 double GeomAlgoAPI_ShapeTools::volume(const std::shared_ptr<GeomAPI_Shape> theShape)
 {
@@ -132,14 +161,11 @@ std::shared_ptr<GeomAPI_Pnt>
   gp_Pnt aCentre;
   if(aShape.ShapeType() == TopAbs_VERTEX) {
     aCentre = BRep_Tool::Pnt(TopoDS::Vertex(aShape));
-  } else if(aShape.ShapeType() == TopAbs_EDGE || aShape.ShapeType() == TopAbs_WIRE) {
-    BRepGProp::LinearProperties(aShape, aGProps);
-    aCentre = aGProps.CentreOfMass();
   } else {
-    const Standard_Real anEps = 1.e-6;
-    BRepGProp::SurfaceProperties(aShape, aGProps, anEps);
+    aGProps = props(aShape);
     aCentre = aGProps.CentreOfMass();
   }
+
   return std::shared_ptr<GeomAPI_Pnt>(new GeomAPI_Pnt(aCentre.X(), aCentre.Y(), aCentre.Z()));
 }
 
index ddc6baa0fef93085d9e4447e8624f367ae40e8c0..529ba42b0e333c3379cfbcb197b02dcd6702385f 100644 (file)
@@ -23,7 +23,6 @@ INCLUDE(Common)
 SET(PROJECT_HEADERS
     GeomValidators.h
     GeomValidators_BodyShapes.h
-    GeomValidators_BooleanArguments.h
     GeomValidators_ConstructionComposite.h
     GeomValidators_DifferentShapes.h
     GeomValidators_Face.h
@@ -44,7 +43,6 @@ SET(PROJECT_HEADERS
 
 SET(PROJECT_SOURCES
     GeomValidators_BodyShapes.cpp
-    GeomValidators_BooleanArguments.cpp
     GeomValidators_ConstructionComposite.cpp
     GeomValidators_DifferentShapes.cpp
     GeomValidators_Face.cpp
diff --git a/src/GeomValidators/GeomValidators_BooleanArguments.cpp b/src/GeomValidators/GeomValidators_BooleanArguments.cpp
deleted file mode 100644 (file)
index 7c16a62..0000000
+++ /dev/null
@@ -1,134 +0,0 @@
-// Copyright (C) 2014-2017  CEA/DEN, EDF R&D
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or
-// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
-//
-
-#include <GeomValidators_BooleanArguments.h>
-
-#include <Events_InfoMessage.h>
-
-#include <ModelAPI_AttributeInteger.h>
-#include <ModelAPI_AttributeSelectionList.h>
-#include <ModelAPI_ResultCompSolid.h>
-#include <ModelAPI_Tools.h>
-
-//=================================================================================================
-bool GeomValidators_BooleanArguments::isValid(const std::shared_ptr<ModelAPI_Feature>& theFeature,
-                                              const std::list<std::string>& theArguments,
-                                              Events_InfoMessage& theError) const
-{
-  if(theArguments.size() != 3) {
-    theError = "Wrong number of arguments (expected 3).";
-    return false;
-  }
-
-  int anObjectsNb = 0, aToolsNb = 0;
-  int anOperationType = 0;
-
-  std::list<std::string>::const_iterator anIt = theArguments.begin(), aLast = theArguments.end();
-
-  bool isAllInSameCompSolid = true;
-  ResultCompSolidPtr aCompSolid;
-
-  AttributeSelectionListPtr anAttrSelList = theFeature->selectionList(*anIt);
-  if(anAttrSelList) {
-    anObjectsNb = anAttrSelList->size();
-    for(int anIndex = 0; anIndex < anObjectsNb; ++anIndex) {
-      AttributeSelectionPtr anAttr = anAttrSelList->value(anIndex);
-      ResultPtr aContext = anAttr->context();
-      ResultCompSolidPtr aResCompSolidPtr = ModelAPI_Tools::compSolidOwner(aContext);
-      if(aResCompSolidPtr.get()) {
-        if(aCompSolid.get()) {
-          isAllInSameCompSolid = aCompSolid == aResCompSolidPtr;
-        } else {
-          aCompSolid = aResCompSolidPtr;
-        }
-      } else {
-        isAllInSameCompSolid = false;
-        break;
-      }
-    }
-  }
-  anIt++;
-
-
-  anAttrSelList = theFeature->selectionList(*anIt);
-  if(anAttrSelList) {
-    aToolsNb = anAttrSelList->size();
-    if(isAllInSameCompSolid) {
-      for(int anIndex = 0; anIndex < aToolsNb; ++anIndex) {
-        AttributeSelectionPtr anAttr = anAttrSelList->value(anIndex);
-        ResultPtr aContext = anAttr->context();
-        ResultCompSolidPtr aResCompSolidPtr = ModelAPI_Tools::compSolidOwner(aContext);
-        if(aResCompSolidPtr.get()) {
-          if(aCompSolid.get()) {
-            isAllInSameCompSolid = aCompSolid == aResCompSolidPtr;
-          } else {
-            aCompSolid = aResCompSolidPtr;
-          }
-        } else {
-          isAllInSameCompSolid = false;
-          break;
-        }
-      }
-    }
-  }
-  anIt++;
-
-  std::shared_ptr<ModelAPI_AttributeInteger> anAttrInt = theFeature->integer(*anIt);
-  if(anAttrInt) {
-    anOperationType = anAttrInt->value();
-  }
-
-  if(anOperationType == 1) {
-    // Fuse operation
-    if(anObjectsNb + aToolsNb < 2) {
-      theError = "Not enough arguments for Fuse operation.";
-      return false;
-    } else if(isAllInSameCompSolid) {
-      theError = "Operations only between sub-shapes of the same shape not allowed.";
-      return false;
-    }
-  } else {
-    if(anObjectsNb < 1) {
-      theError = "Objects not selected.";
-      return false;
-    }
-    if(aToolsNb < 1) {
-      theError = "Tools not selected.";
-      return false;
-    }
-    if(isAllInSameCompSolid) {
-      theError = "Operations only between sub-shapes of the same shape not allowed.";
-      return false;
-    }
-  }
-
-  return true;
-}
-
-//=================================================================================================
-bool GeomValidators_BooleanArguments::isNotObligatory(std::string theFeature,
-                                                      std::string theAttribute)
-{
-  if(theAttribute == "main_objects" || theAttribute == "tool_objects") {
-    return true;
-  }
-
-  return false;
-}
diff --git a/src/GeomValidators/GeomValidators_BooleanArguments.h b/src/GeomValidators/GeomValidators_BooleanArguments.h
deleted file mode 100644 (file)
index a246b42..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-// Copyright (C) 2014-2017  CEA/DEN, EDF R&D
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or
-// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
-//
-
-#ifndef GeomValidators_BooleanArguments_H
-#define GeomValidators_BooleanArguments_H
-
-#include <GeomValidators.h>
-#include <ModelAPI_Feature.h>
-#include <ModelAPI_FeatureValidator.h>
-
-/** \class GeomValidators_BooleanArguments
- *  \ingroup Validators
- *  \brief Validates that boolean operation have enough arguments.
- */
-class GeomValidators_BooleanArguments : public ModelAPI_FeatureValidator
-{
-public:
-  /** \brief Returns true if feature and/or attributes are valid.
-   *  \param[in] theFeature the validated feature.
-   *  \param[in] theArguments the arguments in the configuration file for this validator.
-   *  \param[out] theError error message.
-   *  \returns true if feature is valid.
-   */
-  GEOMVALIDATORS_EXPORT virtual bool isValid(const std::shared_ptr<ModelAPI_Feature>& theFeature,
-                                             const std::list<std::string>& theArguments,
-                                             Events_InfoMessage& theError) const;
-
-  /// \return true if the attribute in feature is not obligatory for the feature execution.
-  GEOMVALIDATORS_EXPORT virtual
-    bool isNotObligatory(std::string theFeature, std::string theAttribute);
-};
-
-#endif
index 2bf421fa055a052270fd028456982a4e5000008d..a5f7386a05850916a64ac4c9d72204b27cd685d8 100644 (file)
@@ -21,7 +21,6 @@
 #include <GeomValidators_Plugin.h>
 
 #include <GeomValidators_BodyShapes.h>
-#include <GeomValidators_BooleanArguments.h>
 #include <GeomValidators_ConstructionComposite.h>
 #include <GeomValidators_Different.h>
 #include <GeomValidators_DifferentShapes.h>
@@ -48,8 +47,6 @@ GeomValidators_Plugin::GeomValidators_Plugin()
   ModelAPI_ValidatorsFactory* aFactory = aMgr->validators();
 
   aFactory->registerValidator("GeomValidators_BodyShapes", new GeomValidators_BodyShapes);
-  aFactory->registerValidator("GeomValidators_BooleanArguments",
-                              new GeomValidators_BooleanArguments);
   aFactory->registerValidator("GeomValidators_ConstructionComposite",
                               new GeomValidators_ConstructionComposite);
   aFactory->registerValidator("GeomValidators_Different", new GeomValidators_Different);
index 5d4781494052ee0537e05832c291c8482f9b5397..c71d8f767d143d3cb01995937782b7718d769093 100644 (file)
@@ -30,6 +30,8 @@
 #include <ModelAPI_Events.h>
 #include <ModelAPI_Result.h>
 
+#include <GeomDataAPI_Point.h>
+
 #include <Events_Message.h>
 #include <Events_InfoMessage.h>
 
@@ -137,10 +139,9 @@ FeaturePtr InitializationPlugin_Plugin::createPoint(DocumentPtr theDoc, const st
                                                     double theX, double theY, double theZ)
 {
   std::shared_ptr<ModelAPI_Feature> aPoint = theDoc->addFeature("Point");
-  //aPoint->string("creation_method")->setValue("by_xyz");
-  aPoint->real("x")->setValue(theX);
-  aPoint->real("y")->setValue(theY);
-  aPoint->real("z")->setValue(theZ);
+  AttributePointPtr aPointAttr = std::dynamic_pointer_cast<GeomDataAPI_Point>
+    (aPoint->data()->attribute("point3d"));
+  aPointAttr->setValue(theX, theY, theZ);
   aPoint->string("creation_method")->setValue("by_xyz");
   aPoint->data()->setName(theName);
   // don't show automatically created feature in the features history
index 9afa65d1cc9c435201da180102fa89834a59b346..4a3be33be3ea5e00b83971b5a256d466aa2e8b82 100755 (executable)
@@ -104,10 +104,9 @@ aSession.finishOperation()
 # Do cut a hole from a box
 #=========================================================================
 aSession.startOperation()
-aCut1 = aPart.addFeature("Boolean")
+aCut1 = aPart.addFeature("Cut")
 aCut1.selectionList("main_objects").append(aBox.firstResult(), None)
 aCut1.selectionList("tool_objects").append(aHoleExt.firstResult(), None)
-aCut1.integer("bool_type").setValue(0) # cut
 aSession.finishOperation()
 
 #=========================================================================
@@ -136,10 +135,9 @@ aSession.finishOperation()
 # Do fuse with a tower. Tower must be an argument (not tool) to add the problem to the faces owners detection.
 #=========================================================================
 aSession.startOperation()
-aFuse = aPart.addFeature("Boolean")
+aFuse = aPart.addFeature("Fuse")
 aFuse.selectionList("main_objects").append(aTower.firstResult(), None)
 aFuse.selectionList("tool_objects").append(aCut1.firstResult(), None)
-aFuse.integer("bool_type").setValue(1) # fuse
 aSession.finishOperation()
 
 #=========================================================================
@@ -156,12 +154,12 @@ def check_owner(selection, topology_type, feature):
 
 # check faces
 check_owner("Extrusion_1_1/Generated_Face_1", "face", aBox)
-check_owner("Boolean_2_1/Modified_Face_3", "face", aBox)
-check_owner("Boolean_1_1/Modified_Face_1", "face", aHoleExt)
-check_owner("Boolean_2_1/Modified_Face_1", "face", aTower)
+check_owner("Fuse_1_1/Modified_Face_3", "face", aBox)
+check_owner("Cut_1_1/Modified_Face_1", "face", aHoleExt)
+check_owner("Fuse_1_1/Modified_Face_1", "face", aTower)
 # check edges without ambiguity
-check_owner("Boolean_2_1/Modified_Face_2&Extrusion_1_1/Generated_Face_2", "edge", aBox)
-check_owner("Boolean_2_1/Modified_Face_1&Extrusion_3_1/To_Face_1_1", "edge", aTower)
+check_owner("Fuse_1_1/Modified_Face_2&Extrusion_1_1/Generated_Face_2", "edge", aBox)
+check_owner("Fuse_1_1/Modified_Face_1&Extrusion_3_1/To_Face_1_1", "edge", aTower)
 
 # check the connected topology method: solid is not a compound of connected topology
 assert(aFuse.firstResult().shape().isConnectedTopology() == False)
index 666faafe6201e4475e107743f0fea6cb39750f72..46c17b094fdf603ae178e0e6e6b1f0a6b055d24c 100644 (file)
@@ -57,7 +57,7 @@ model.do()
 Face_1 = model.addFace(Part_1_doc, [model.selection("EDGE", "Sketch_2/Edge-SketchLine_2"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_3"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_4"), model.selection("EDGE", "Sketch_2/Edge-SketchLine_1")])
 Extrusion_4 = model.addExtrusion(Part_1_doc, [model.selection("WIRE", "Sketch_1/Wire-SketchCircle_2_2f")], model.selection(), model.selection("FACE", "Extrusion_2_1/From_Face_1"), 0, model.selection(), 0)
 Boolean_2 = model.addCut(Part_1_doc, [model.selection("SOLID", "Extrusion_1_1")], [model.selection("SOLID", "Extrusion_4_1")])
-Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Boolean_1_1"), model.selection("SOLID", "Boolean_2_1"), model.selection("FACE", "Face_1_1")])
+Partition_1 = model.addPartition(Part_1_doc, [model.selection("SOLID", "Cut_1_1"), model.selection("SOLID", "Cut_2_1"), model.selection("FACE", "Face_1_1")])
 Remove_SubShapes_1 = model.addRemoveSubShapes(Part_1_doc, model.selection("COMPOUND", "Partition_1_1"))
 Remove_SubShapes_1.setSubShapesToKeep([model.selection("COMPSOLID", "Partition_1_1_1")])
 model.end()
index 4b55ce8b835a27faa478444502f540bd470a41d8..6e49003f206d1f5a7330c1fc497f0ec9a65caaa7 100644 (file)
     END_INIT() \
   public:
 
+//--------------------------------------------------------------------------------------
+#define INTERFACE_16(KIND, \
+                     N_0, AN_0, T_0, C_0, \
+                     N_1, AN_1, T_1, C_1, \
+                     N_2, AN_2, T_2, C_2, \
+                     N_3, AN_3, T_3, C_3, \
+                     N_4, AN_4, T_4, C_4, \
+                     N_5, AN_5, T_5, C_5, \
+                     N_6, AN_6, T_6, C_6, \
+                     N_7, AN_7, T_7, C_7, \
+                     N_8, AN_8, T_8, C_8, \
+                     N_9, AN_9, T_9, C_9, \
+                     N_10, AN_10, T_10, C_10, \
+                     N_11, AN_11, T_11, C_11, \
+                     N_12, AN_12, T_12, C_12, \
+                     N_13, AN_13, T_13, C_13, \
+                     N_14, AN_14, T_14, C_14, \
+                     N_15, AN_15, T_15, C_15) \
+  public: \
+    INTERFACE_COMMON(KIND) \
+    DEFINE_ATTRIBUTE(N_0, T_0, C_0) \
+    DEFINE_ATTRIBUTE(N_1, T_1, C_1) \
+    DEFINE_ATTRIBUTE(N_2, T_2, C_2) \
+    DEFINE_ATTRIBUTE(N_3, T_3, C_3) \
+    DEFINE_ATTRIBUTE(N_4, T_4, C_4) \
+    DEFINE_ATTRIBUTE(N_5, T_5, C_5) \
+    DEFINE_ATTRIBUTE(N_6, T_6, C_6) \
+    DEFINE_ATTRIBUTE(N_7, T_7, C_7) \
+    DEFINE_ATTRIBUTE(N_8, T_8, C_8) \
+    DEFINE_ATTRIBUTE(N_9, T_9, C_9) \
+    DEFINE_ATTRIBUTE(N_10, T_10, C_10) \
+    DEFINE_ATTRIBUTE(N_11, T_11, C_11) \
+    DEFINE_ATTRIBUTE(N_12, T_12, C_12) \
+    DEFINE_ATTRIBUTE(N_13, T_13, C_13) \
+    DEFINE_ATTRIBUTE(N_14, T_14, C_14) \
+    DEFINE_ATTRIBUTE(N_15, T_15, C_15) \
+  protected: \
+    START_INIT() \
+      SET_ATTRIBUTE(N_0, T_0, AN_0) \
+      SET_ATTRIBUTE(N_1, T_1, AN_1) \
+      SET_ATTRIBUTE(N_2, T_2, AN_2) \
+      SET_ATTRIBUTE(N_3, T_3, AN_3) \
+      SET_ATTRIBUTE(N_4, T_4, AN_4) \
+      SET_ATTRIBUTE(N_5, T_5, AN_5) \
+      SET_ATTRIBUTE(N_6, T_6, AN_6) \
+      SET_ATTRIBUTE(N_7, T_7, AN_7) \
+      SET_ATTRIBUTE(N_8, T_8, AN_8) \
+      SET_ATTRIBUTE(N_9, T_9, AN_9) \
+      SET_ATTRIBUTE(N_10, T_10, AN_10) \
+      SET_ATTRIBUTE(N_11, T_11, AN_11) \
+      SET_ATTRIBUTE(N_12, T_12, AN_12) \
+      SET_ATTRIBUTE(N_13, T_13, AN_13) \
+      SET_ATTRIBUTE(N_14, T_14, AN_14) \
+      SET_ATTRIBUTE(N_15, T_15, AN_15) \
+    END_INIT() \
+  public:
+
+//--------------------------------------------------------------------------------------
+#define INTERFACE_18(KIND, \
+                     N_0, AN_0, T_0, C_0, \
+                     N_1, AN_1, T_1, C_1, \
+                     N_2, AN_2, T_2, C_2, \
+                     N_3, AN_3, T_3, C_3, \
+                     N_4, AN_4, T_4, C_4, \
+                     N_5, AN_5, T_5, C_5, \
+                     N_6, AN_6, T_6, C_6, \
+                     N_7, AN_7, T_7, C_7, \
+                     N_8, AN_8, T_8, C_8, \
+                     N_9, AN_9, T_9, C_9, \
+                     N_10, AN_10, T_10, C_10, \
+                     N_11, AN_11, T_11, C_11, \
+                     N_12, AN_12, T_12, C_12, \
+                     N_13, AN_13, T_13, C_13, \
+                     N_14, AN_14, T_14, C_14, \
+                     N_15, AN_15, T_15, C_15, \
+                     N_16, AN_16, T_16, C_16, \
+                     N_17, AN_17, T_17, C_17) \
+  public: \
+    INTERFACE_COMMON(KIND) \
+    DEFINE_ATTRIBUTE(N_0, T_0, C_0) \
+    DEFINE_ATTRIBUTE(N_1, T_1, C_1) \
+    DEFINE_ATTRIBUTE(N_2, T_2, C_2) \
+    DEFINE_ATTRIBUTE(N_3, T_3, C_3) \
+    DEFINE_ATTRIBUTE(N_4, T_4, C_4) \
+    DEFINE_ATTRIBUTE(N_5, T_5, C_5) \
+    DEFINE_ATTRIBUTE(N_6, T_6, C_6) \
+    DEFINE_ATTRIBUTE(N_7, T_7, C_7) \
+    DEFINE_ATTRIBUTE(N_8, T_8, C_8) \
+    DEFINE_ATTRIBUTE(N_9, T_9, C_9) \
+    DEFINE_ATTRIBUTE(N_10, T_10, C_10) \
+    DEFINE_ATTRIBUTE(N_11, T_11, C_11) \
+    DEFINE_ATTRIBUTE(N_12, T_12, C_12) \
+    DEFINE_ATTRIBUTE(N_13, T_13, C_13) \
+    DEFINE_ATTRIBUTE(N_14, T_14, C_14) \
+    DEFINE_ATTRIBUTE(N_15, T_15, C_15) \
+    DEFINE_ATTRIBUTE(N_16, T_16, C_16) \
+    DEFINE_ATTRIBUTE(N_17, T_17, C_17) \
+  protected: \
+    START_INIT() \
+      SET_ATTRIBUTE(N_0, T_0, AN_0) \
+      SET_ATTRIBUTE(N_1, T_1, AN_1) \
+      SET_ATTRIBUTE(N_2, T_2, AN_2) \
+      SET_ATTRIBUTE(N_3, T_3, AN_3) \
+      SET_ATTRIBUTE(N_4, T_4, AN_4) \
+      SET_ATTRIBUTE(N_5, T_5, AN_5) \
+      SET_ATTRIBUTE(N_6, T_6, AN_6) \
+      SET_ATTRIBUTE(N_7, T_7, AN_7) \
+      SET_ATTRIBUTE(N_8, T_8, AN_8) \
+      SET_ATTRIBUTE(N_9, T_9, AN_9) \
+      SET_ATTRIBUTE(N_10, T_10, AN_10) \
+      SET_ATTRIBUTE(N_11, T_11, AN_11) \
+      SET_ATTRIBUTE(N_12, T_12, AN_12) \
+      SET_ATTRIBUTE(N_13, T_13, AN_13) \
+      SET_ATTRIBUTE(N_14, T_14, AN_14) \
+      SET_ATTRIBUTE(N_15, T_15, AN_15) \
+      SET_ATTRIBUTE(N_16, T_16, AN_16) \
+      SET_ATTRIBUTE(N_17, T_17, AN_17) \
+    END_INIT() \
+  public:
+
 //--------------------------------------------------------------------------------------
 #define INTERFACE_20(KIND, \
                      N_0, AN_0, T_0, C_0, \
     END_INIT() \
   public:
 
+//--------------------------------------------------------------------------------------
+#define INTERFACE_24(KIND, \
+                     N_0, AN_0, T_0, C_0, \
+                     N_1, AN_1, T_1, C_1, \
+                     N_2, AN_2, T_2, C_2, \
+                     N_3, AN_3, T_3, C_3, \
+                     N_4, AN_4, T_4, C_4, \
+                     N_5, AN_5, T_5, C_5, \
+                     N_6, AN_6, T_6, C_6, \
+                     N_7, AN_7, T_7, C_7, \
+                     N_8, AN_8, T_8, C_8, \
+                     N_9, AN_9, T_9, C_9, \
+                     N_10, AN_10, T_10, C_10, \
+                     N_11, AN_11, T_11, C_11, \
+                     N_12, AN_12, T_12, C_12, \
+                     N_13, AN_13, T_13, C_13, \
+                     N_14, AN_14, T_14, C_14, \
+                     N_15, AN_15, T_15, C_15, \
+                     N_16, AN_16, T_16, C_16, \
+                     N_17, AN_17, T_17, C_17, \
+                     N_18, AN_18, T_18, C_18, \
+                     N_19, AN_19, T_19, C_19, \
+                     N_20, AN_20, T_20, C_20, \
+                     N_21, AN_21, T_21, C_21, \
+                     N_22, AN_22, T_22, C_22, \
+                     N_23, AN_23, T_23, C_23) \
+  public: \
+    INTERFACE_COMMON(KIND) \
+    DEFINE_ATTRIBUTE(N_0, T_0, C_0) \
+    DEFINE_ATTRIBUTE(N_1, T_1, C_1) \
+    DEFINE_ATTRIBUTE(N_2, T_2, C_2) \
+    DEFINE_ATTRIBUTE(N_3, T_3, C_3) \
+    DEFINE_ATTRIBUTE(N_4, T_4, C_4) \
+    DEFINE_ATTRIBUTE(N_5, T_5, C_5) \
+    DEFINE_ATTRIBUTE(N_6, T_6, C_6) \
+    DEFINE_ATTRIBUTE(N_7, T_7, C_7) \
+    DEFINE_ATTRIBUTE(N_8, T_8, C_8) \
+    DEFINE_ATTRIBUTE(N_9, T_9, C_9) \
+    DEFINE_ATTRIBUTE(N_10, T_10, C_10) \
+    DEFINE_ATTRIBUTE(N_11, T_11, C_11) \
+    DEFINE_ATTRIBUTE(N_12, T_12, C_12) \
+    DEFINE_ATTRIBUTE(N_13, T_13, C_13) \
+    DEFINE_ATTRIBUTE(N_14, T_14, C_14) \
+    DEFINE_ATTRIBUTE(N_15, T_15, C_15) \
+    DEFINE_ATTRIBUTE(N_16, T_16, C_16) \
+    DEFINE_ATTRIBUTE(N_17, T_17, C_17) \
+    DEFINE_ATTRIBUTE(N_18, T_18, C_18) \
+    DEFINE_ATTRIBUTE(N_19, T_19, C_19) \
+    DEFINE_ATTRIBUTE(N_20, T_20, C_20) \
+    DEFINE_ATTRIBUTE(N_21, T_21, C_21) \
+    DEFINE_ATTRIBUTE(N_22, T_22, C_22) \
+    DEFINE_ATTRIBUTE(N_23, T_23, C_23) \
+  protected: \
+    START_INIT() \
+      SET_ATTRIBUTE(N_0, T_0, AN_0) \
+      SET_ATTRIBUTE(N_1, T_1, AN_1) \
+      SET_ATTRIBUTE(N_2, T_2, AN_2) \
+      SET_ATTRIBUTE(N_3, T_3, AN_3) \
+      SET_ATTRIBUTE(N_4, T_4, AN_4) \
+      SET_ATTRIBUTE(N_5, T_5, AN_5) \
+      SET_ATTRIBUTE(N_6, T_6, AN_6) \
+      SET_ATTRIBUTE(N_7, T_7, AN_7) \
+      SET_ATTRIBUTE(N_8, T_8, AN_8) \
+      SET_ATTRIBUTE(N_9, T_9, AN_9) \
+      SET_ATTRIBUTE(N_10, T_10, AN_10) \
+      SET_ATTRIBUTE(N_11, T_11, AN_11) \
+      SET_ATTRIBUTE(N_12, T_12, AN_12) \
+      SET_ATTRIBUTE(N_13, T_13, AN_13) \
+      SET_ATTRIBUTE(N_14, T_14, AN_14) \
+      SET_ATTRIBUTE(N_15, T_15, AN_15) \
+      SET_ATTRIBUTE(N_16, T_16, AN_16) \
+      SET_ATTRIBUTE(N_17, T_17, AN_17) \
+      SET_ATTRIBUTE(N_18, T_18, AN_18) \
+      SET_ATTRIBUTE(N_19, T_19, AN_19) \
+      SET_ATTRIBUTE(N_20, T_20, AN_20) \
+      SET_ATTRIBUTE(N_21, T_21, AN_21) \
+      SET_ATTRIBUTE(N_22, T_22, AN_22) \
+      SET_ATTRIBUTE(N_23, T_23, AN_23) \
+    END_INIT() \
+  public:
+
+//--------------------------------------------------------------------------------------
+#define INTERFACE_25(KIND, \
+                     N_0, AN_0, T_0, C_0, \
+                     N_1, AN_1, T_1, C_1, \
+                     N_2, AN_2, T_2, C_2, \
+                     N_3, AN_3, T_3, C_3, \
+                     N_4, AN_4, T_4, C_4, \
+                     N_5, AN_5, T_5, C_5, \
+                     N_6, AN_6, T_6, C_6, \
+                     N_7, AN_7, T_7, C_7, \
+                     N_8, AN_8, T_8, C_8, \
+                     N_9, AN_9, T_9, C_9, \
+                     N_10, AN_10, T_10, C_10, \
+                     N_11, AN_11, T_11, C_11, \
+                     N_12, AN_12, T_12, C_12, \
+                     N_13, AN_13, T_13, C_13, \
+                     N_14, AN_14, T_14, C_14, \
+                     N_15, AN_15, T_15, C_15, \
+                     N_16, AN_16, T_16, C_16, \
+                     N_17, AN_17, T_17, C_17, \
+                     N_18, AN_18, T_18, C_18, \
+                     N_19, AN_19, T_19, C_19, \
+                     N_20, AN_20, T_20, C_20, \
+                     N_21, AN_21, T_21, C_21, \
+                     N_22, AN_22, T_22, C_22, \
+                     N_23, AN_23, T_23, C_23, \
+                     N_24, AN_24, T_24, C_24) \
+  public: \
+    INTERFACE_COMMON(KIND) \
+    DEFINE_ATTRIBUTE(N_0, T_0, C_0) \
+    DEFINE_ATTRIBUTE(N_1, T_1, C_1) \
+    DEFINE_ATTRIBUTE(N_2, T_2, C_2) \
+    DEFINE_ATTRIBUTE(N_3, T_3, C_3) \
+    DEFINE_ATTRIBUTE(N_4, T_4, C_4) \
+    DEFINE_ATTRIBUTE(N_5, T_5, C_5) \
+    DEFINE_ATTRIBUTE(N_6, T_6, C_6) \
+    DEFINE_ATTRIBUTE(N_7, T_7, C_7) \
+    DEFINE_ATTRIBUTE(N_8, T_8, C_8) \
+    DEFINE_ATTRIBUTE(N_9, T_9, C_9) \
+    DEFINE_ATTRIBUTE(N_10, T_10, C_10) \
+    DEFINE_ATTRIBUTE(N_11, T_11, C_11) \
+    DEFINE_ATTRIBUTE(N_12, T_12, C_12) \
+    DEFINE_ATTRIBUTE(N_13, T_13, C_13) \
+    DEFINE_ATTRIBUTE(N_14, T_14, C_14) \
+    DEFINE_ATTRIBUTE(N_15, T_15, C_15) \
+    DEFINE_ATTRIBUTE(N_16, T_16, C_16) \
+    DEFINE_ATTRIBUTE(N_17, T_17, C_17) \
+    DEFINE_ATTRIBUTE(N_18, T_18, C_18) \
+    DEFINE_ATTRIBUTE(N_19, T_19, C_19) \
+    DEFINE_ATTRIBUTE(N_20, T_20, C_20) \
+    DEFINE_ATTRIBUTE(N_21, T_21, C_21) \
+    DEFINE_ATTRIBUTE(N_22, T_22, C_22) \
+    DEFINE_ATTRIBUTE(N_23, T_23, C_23) \
+    DEFINE_ATTRIBUTE(N_24, T_24, C_24) \
+  protected: \
+    START_INIT() \
+      SET_ATTRIBUTE(N_0, T_0, AN_0) \
+      SET_ATTRIBUTE(N_1, T_1, AN_1) \
+      SET_ATTRIBUTE(N_2, T_2, AN_2) \
+      SET_ATTRIBUTE(N_3, T_3, AN_3) \
+      SET_ATTRIBUTE(N_4, T_4, AN_4) \
+      SET_ATTRIBUTE(N_5, T_5, AN_5) \
+      SET_ATTRIBUTE(N_6, T_6, AN_6) \
+      SET_ATTRIBUTE(N_7, T_7, AN_7) \
+      SET_ATTRIBUTE(N_8, T_8, AN_8) \
+      SET_ATTRIBUTE(N_9, T_9, AN_9) \
+      SET_ATTRIBUTE(N_10, T_10, AN_10) \
+      SET_ATTRIBUTE(N_11, T_11, AN_11) \
+      SET_ATTRIBUTE(N_12, T_12, AN_12) \
+      SET_ATTRIBUTE(N_13, T_13, AN_13) \
+      SET_ATTRIBUTE(N_14, T_14, AN_14) \
+      SET_ATTRIBUTE(N_15, T_15, AN_15) \
+      SET_ATTRIBUTE(N_16, T_16, AN_16) \
+      SET_ATTRIBUTE(N_17, T_17, AN_17) \
+      SET_ATTRIBUTE(N_18, T_18, AN_18) \
+      SET_ATTRIBUTE(N_19, T_19, AN_19) \
+      SET_ATTRIBUTE(N_20, T_20, AN_20) \
+      SET_ATTRIBUTE(N_21, T_21, AN_21) \
+      SET_ATTRIBUTE(N_22, T_22, AN_22) \
+      SET_ATTRIBUTE(N_23, T_23, AN_23) \
+      SET_ATTRIBUTE(N_24, T_24, AN_24) \
+    END_INIT() \
+  public:
+
+
+//--------------------------------------------------------------------------------------
+#define INTERFACE_27(KIND, \
+                     N_0, AN_0, T_0, C_0, \
+                     N_1, AN_1, T_1, C_1, \
+                     N_2, AN_2, T_2, C_2, \
+                     N_3, AN_3, T_3, C_3, \
+                     N_4, AN_4, T_4, C_4, \
+                     N_5, AN_5, T_5, C_5, \
+                     N_6, AN_6, T_6, C_6, \
+                     N_7, AN_7, T_7, C_7, \
+                     N_8, AN_8, T_8, C_8, \
+                     N_9, AN_9, T_9, C_9, \
+                     N_10, AN_10, T_10, C_10, \
+                     N_11, AN_11, T_11, C_11, \
+                     N_12, AN_12, T_12, C_12, \
+                     N_13, AN_13, T_13, C_13, \
+                     N_14, AN_14, T_14, C_14, \
+                     N_15, AN_15, T_15, C_15, \
+                     N_16, AN_16, T_16, C_16, \
+                     N_17, AN_17, T_17, C_17, \
+                     N_18, AN_18, T_18, C_18, \
+                     N_19, AN_19, T_19, C_19, \
+                     N_20, AN_20, T_20, C_20, \
+                     N_21, AN_21, T_21, C_21, \
+                     N_22, AN_22, T_22, C_22, \
+                     N_23, AN_23, T_23, C_23, \
+                     N_24, AN_24, T_24, C_24, \
+                     N_25, AN_25, T_25, C_25, \
+                     N_26, AN_26, T_26, C_26) \
+  public: \
+    INTERFACE_COMMON(KIND) \
+    DEFINE_ATTRIBUTE(N_0, T_0, C_0) \
+    DEFINE_ATTRIBUTE(N_1, T_1, C_1) \
+    DEFINE_ATTRIBUTE(N_2, T_2, C_2) \
+    DEFINE_ATTRIBUTE(N_3, T_3, C_3) \
+    DEFINE_ATTRIBUTE(N_4, T_4, C_4) \
+    DEFINE_ATTRIBUTE(N_5, T_5, C_5) \
+    DEFINE_ATTRIBUTE(N_6, T_6, C_6) \
+    DEFINE_ATTRIBUTE(N_7, T_7, C_7) \
+    DEFINE_ATTRIBUTE(N_8, T_8, C_8) \
+    DEFINE_ATTRIBUTE(N_9, T_9, C_9) \
+    DEFINE_ATTRIBUTE(N_10, T_10, C_10) \
+    DEFINE_ATTRIBUTE(N_11, T_11, C_11) \
+    DEFINE_ATTRIBUTE(N_12, T_12, C_12) \
+    DEFINE_ATTRIBUTE(N_13, T_13, C_13) \
+    DEFINE_ATTRIBUTE(N_14, T_14, C_14) \
+    DEFINE_ATTRIBUTE(N_15, T_15, C_15) \
+    DEFINE_ATTRIBUTE(N_16, T_16, C_16) \
+    DEFINE_ATTRIBUTE(N_17, T_17, C_17) \
+    DEFINE_ATTRIBUTE(N_18, T_18, C_18) \
+    DEFINE_ATTRIBUTE(N_19, T_19, C_19) \
+    DEFINE_ATTRIBUTE(N_20, T_20, C_20) \
+    DEFINE_ATTRIBUTE(N_21, T_21, C_21) \
+    DEFINE_ATTRIBUTE(N_22, T_22, C_22) \
+    DEFINE_ATTRIBUTE(N_23, T_23, C_23) \
+    DEFINE_ATTRIBUTE(N_24, T_24, C_24) \
+    DEFINE_ATTRIBUTE(N_25, T_25, C_25) \
+    DEFINE_ATTRIBUTE(N_26, T_26, C_26) \
+  protected: \
+    START_INIT() \
+      SET_ATTRIBUTE(N_0, T_0, AN_0) \
+      SET_ATTRIBUTE(N_1, T_1, AN_1) \
+      SET_ATTRIBUTE(N_2, T_2, AN_2) \
+      SET_ATTRIBUTE(N_3, T_3, AN_3) \
+      SET_ATTRIBUTE(N_4, T_4, AN_4) \
+      SET_ATTRIBUTE(N_5, T_5, AN_5) \
+      SET_ATTRIBUTE(N_6, T_6, AN_6) \
+      SET_ATTRIBUTE(N_7, T_7, AN_7) \
+      SET_ATTRIBUTE(N_8, T_8, AN_8) \
+      SET_ATTRIBUTE(N_9, T_9, AN_9) \
+      SET_ATTRIBUTE(N_10, T_10, AN_10) \
+      SET_ATTRIBUTE(N_11, T_11, AN_11) \
+      SET_ATTRIBUTE(N_12, T_12, AN_12) \
+      SET_ATTRIBUTE(N_13, T_13, AN_13) \
+      SET_ATTRIBUTE(N_14, T_14, AN_14) \
+      SET_ATTRIBUTE(N_15, T_15, AN_15) \
+      SET_ATTRIBUTE(N_16, T_16, AN_16) \
+      SET_ATTRIBUTE(N_17, T_17, AN_17) \
+      SET_ATTRIBUTE(N_18, T_18, AN_18) \
+      SET_ATTRIBUTE(N_19, T_19, AN_19) \
+      SET_ATTRIBUTE(N_20, T_20, AN_20) \
+      SET_ATTRIBUTE(N_21, T_21, AN_21) \
+      SET_ATTRIBUTE(N_22, T_22, AN_22) \
+      SET_ATTRIBUTE(N_23, T_23, AN_23) \
+      SET_ATTRIBUTE(N_24, T_24, AN_24) \
+      SET_ATTRIBUTE(N_25, T_25, AN_25) \
+      SET_ATTRIBUTE(N_26, T_26, AN_26) \
+    END_INIT() \
+  public:
+
 //--------------------------------------------------------------------------------------
 #endif /* SRC_MODELHIGHAPI_MODELHIGHAPI_MACRO_H_ */
index 3e8fc7d4bce53a2b352f7f47d45bad5943ca46d8..4b1a7117d991496f04d0b66124ac8de356802aea 100644 (file)
@@ -101,6 +101,8 @@ SET(PROJECT_HEADERS
   ModuleBase_ActionIntParameter.h
   ModuleBase_ChoiceCtrl.h
   ModuleBase_WidgetNameEdit.h
+  ModuleBase_WidgetRadiobox.h
+  ModuleBase_WidgetPointInput.h
 )
 
 SET(PROJECT_MOC_HEADERS
@@ -148,6 +150,8 @@ SET(PROJECT_MOC_HEADERS
   ModuleBase_WidgetValidated.h
   ModuleBase_ChoiceCtrl.h
   ModuleBase_WidgetNameEdit.h
+  ModuleBase_WidgetRadiobox.h
+  ModuleBase_WidgetPointInput.h
 )
 
 SET(PROJECT_SOURCES
@@ -214,6 +218,8 @@ SET(PROJECT_SOURCES
   ModuleBase_Dialog.cpp
   ModuleBase_ChoiceCtrl.cpp
   ModuleBase_WidgetNameEdit.cpp
+  ModuleBase_WidgetRadiobox.cpp
+  ModuleBase_WidgetPointInput.cpp
 )
 
 SET(PROJECT_LIBRARIES
index 1944bc47ec2aa0b1e8953c9d9d07881e8588bb2c..9f784ef6e33a47d80acedf0cea680326f43d6fa8 100644 (file)
@@ -162,6 +162,7 @@ void ModuleBase_ParamSpinBox::setValue(double value)
 
 double ModuleBase_ParamSpinBox::value() const
 {
+  std::string aa = lineEdit()->text().toStdString();
   return lineEdit()->text().toDouble();
 }
 
index cb422bf9a684ddafbe5dcdf03dcc8c557d4d5d52..f6e120df3a94d27fa835b1d37cbd5012ca52afb2 100755 (executable)
@@ -26,6 +26,7 @@
 #include <ModelAPI_Tools.h>
 #include <ModelAPI_ResultConstruction.h>
 #include <ModelAPI_ResultCompSolid.h>
+#include <ModelAPI_AttributeIntArray.h>
 
 #include "ModuleBase_Tools.h"
 #include "ModuleBase_BRepOwner.h"
@@ -69,7 +70,12 @@ ModuleBase_ResultPrs::ModuleBase_ResultPrs(ResultPtr theResult)
   std::shared_ptr<GeomAPI_Shape> aShapePtr = ModelAPI_Tools::shape(theResult);
   TopoDS_Shape aShape = aShapePtr->impl<TopoDS_Shape>();
   Set(aShape);
+
+  // Set own free boundaries aspect in order to have free an unfree boundaries with different colors
   Handle(Prs3d_Drawer) aDrawer = Attributes();
+  Handle(Prs3d_LineAspect) aFreeBndAspect = new Prs3d_LineAspect(Quantity_NOC_GREEN, Aspect_TOL_SOLID, 1);
+  aDrawer->SetFreeBoundaryAspect(aFreeBndAspect);
+
   if (aDrawer->HasOwnPointAspect())
     aDrawer->PointAspect()->SetTypeOfMarker(Aspect_TOM_PLUS);
   else
@@ -85,6 +91,9 @@ ModuleBase_ResultPrs::ModuleBase_ResultPrs(ResultPtr theResult)
   myHiddenSubShapesDrawer->SetShadingAspect(aShadingAspect);
 
   ModuleBase_Tools::setPointBallHighlighting(this);
+
+  // Define colors for wireframe mode
+  setEdgesDefaultColor();
 }
 
 //********************************************************************
@@ -98,8 +107,40 @@ void ModuleBase_ResultPrs::SetColor (const Quantity_Color& theColor)
 {
   ViewerData_AISShape::SetColor(theColor);
   myHiddenSubShapesDrawer->ShadingAspect()->SetColor (theColor, myCurrentFacingModel);
+  setEdgesDefaultColor();
+}
+
+void ModuleBase_ResultPrs::setEdgesDefaultColor()
+{
+  AttributeIntArrayPtr aColorAttr = myResult->data()->intArray(ModelAPI_Result::COLOR_ID());
+  bool aHasColor = aColorAttr.get() && aColorAttr->isInitialized();
+
+  if (!aHasColor) {
+    Handle(Prs3d_Drawer) aDrawer = Attributes();
+    Handle(Prs3d_LineAspect) anAspect; // = aDrawer->LineAspect();
+    //anAspect->SetColor(Quantity_NOC_YELLOW);
+    //aDrawer->SetLineAspect(anAspect);
+
+    // - unfree boundaries color
+    anAspect = aDrawer->UnFreeBoundaryAspect();
+    anAspect->SetColor(Quantity_NOC_YELLOW);
+    aDrawer->SetUnFreeBoundaryAspect(anAspect);
+    aDrawer->SetUnFreeBoundaryDraw(true);
+
+    // - free boundaries color
+    anAspect = aDrawer->FreeBoundaryAspect();
+    anAspect->SetColor(Quantity_NOC_GREEN);
+    aDrawer->SetFreeBoundaryAspect(anAspect);
+    aDrawer->SetFreeBoundaryDraw(true);
+
+    // - standalone edges color
+    anAspect = aDrawer->WireAspect();
+    anAspect->SetColor(Quantity_NOC_RED);
+    aDrawer->SetWireAspect(anAspect);
+  }
 }
 
+
 //********************************************************************
 bool ModuleBase_ResultPrs::setSubShapeHidden(const NCollection_List<TopoDS_Shape>& theShapes)
 {
index 367d38232312888cf5c5d2e76df578cac2c79954..f22cfb1f85769a65bf861352c8d7e27dbc0ceee3 100644 (file)
@@ -141,6 +141,8 @@ private:
   void collectSubShapes(BRep_Builder& theBuilder, TopoDS_Shape& theCompound,
     const TopoDS_Shape& theShape, const NCollection_List<TopoDS_Shape>& theHiddenSubShapes);
 
+  void setEdgesDefaultColor();
+
 private:
   /// Reference to result object
   ResultPtr myResult;
index cc62794037c6db483da4dee52bb349a8ce604f64..80f8419d165714565bf6966bd8d4d97a06394f3d 100644 (file)
@@ -42,6 +42,7 @@
 #include <ModuleBase_WidgetConcealedObjects.h>
 #include <ModuleBase_WidgetLabel.h>
 #include <ModuleBase_WidgetToolbox.h>
+#include <ModuleBase_WidgetRadiobox.h>
 #include <ModuleBase_PageBase.h>
 #include <ModuleBase_PageGroupBox.h>
 #include <ModuleBase_WidgetOptionalBox.h>
@@ -49,6 +50,7 @@
 #include <ModuleBase_WidgetExprEditor.h>
 #include <ModuleBase_WidgetCreatorFactory.h>
 #include <ModuleBase_WidgetAction.h>
+#include <ModuleBase_WidgetPointInput.h>
 
 #include <ModelAPI_Validator.h>
 #include <ModelAPI_Session.h>
@@ -133,7 +135,7 @@ void ModuleBase_WidgetFactory::createWidget(ModuleBase_PageBase* thePage, bool a
             QString aCaseId = qs(myWidgetApi->getProperty(_ID));
             ModuleBase_PageBase* aPage = new ModuleBase_PageWidget(aWidget);
             createWidget(aPage);
-            if (aWdgType == WDG_SWITCH || aWdgType == WDG_TOOLBOX) {
+            if (aWdgType == WDG_SWITCH || aWdgType == WDG_TOOLBOX || aWdgType == WDG_RADIOBOX) {
               ModuleBase_PagedContainer* aContainer =
                 qobject_cast<ModuleBase_PagedContainer*>(aWidget);
 
@@ -330,6 +332,8 @@ ModuleBase_ModelWidget* ModuleBase_WidgetFactory::createWidgetByType(const std::
     result = new ModuleBase_WidgetConcealedObjects(theParent, myWidgetApi);
   } else if (theType == WDG_TOOLBOX) {
     result = new ModuleBase_WidgetToolbox(theParent, myWidgetApi);
+  } else if (theType == WDG_RADIOBOX) {
+    result = new ModuleBase_WidgetRadiobox(theParent, myWidgetApi);
   } else if (theType == WDG_SWITCH) {
     result = new ModuleBase_WidgetSwitch(theParent, myWidgetApi);
   } else if (theType == WDG_TOOLBOX_BOX || theType == WDG_SWITCH_CASE ||
@@ -338,6 +342,8 @@ ModuleBase_ModelWidget* ModuleBase_WidgetFactory::createWidgetByType(const std::
     result = NULL;
   } else if (theType == WDG_ACTION) {
     result = new ModuleBase_WidgetAction(theParent, myWidgetApi);
+  } else if (theType == WDG_POINT_INPUT) {
+    result = new ModuleBase_WidgetPointInput(theParent, myWorkshop, myWidgetApi);
   } else {
     result = myWorkshop->module()->createWidgetByType(theType, theParent, myWidgetApi);
     if (!result)
diff --git a/src/ModuleBase/ModuleBase_WidgetPointInput.cpp b/src/ModuleBase/ModuleBase_WidgetPointInput.cpp
new file mode 100644 (file)
index 0000000..1c41a1a
--- /dev/null
@@ -0,0 +1,160 @@
+// Copyright (C) 2014-2017  CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or
+// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+//
+
+#include "ModuleBase_WidgetPointInput.h"
+#include "ModuleBase_Tools.h"
+#include "ModuleBase_ParamSpinBox.h"
+#include "ModuleBase_ViewerPrs.h"
+
+#include <GeomAPI_Vertex.h>
+#include <GeomAPI_Pnt.h>
+
+#include <GeomDataAPI_Point.h>
+
+#include <Config_WidgetAPI.h>
+#include <Config_Keywords.h>
+
+#include <QFormLayout>
+#include <QLabel>
+
+ModuleBase_WidgetPointInput::ModuleBase_WidgetPointInput(QWidget* theParent, ModuleBase_IWorkshop* theWorkshop,
+  const Config_WidgetAPI* theData)
+  : ModuleBase_WidgetSelector(theParent, theWorkshop, theData)
+{
+  bool aAcceptVariables = theData->getBooleanAttribute(DOUBLE_WDG_ACCEPT_EXPRESSIONS, true);
+
+  QFormLayout* aMainlayout = new QFormLayout(this);
+  ModuleBase_Tools::adjustMargins(aMainlayout);
+
+  myXSpin = new ModuleBase_ParamSpinBox(this);
+  myXSpin->setAcceptVariables(aAcceptVariables);
+  myXSpin->setToolTip("X coordinate");
+  myXSpin->setValue(0);
+  QLabel* aXLbl = new QLabel(this);
+  aXLbl->setPixmap(QPixmap(":pictures/x_size.png"));
+  aMainlayout->addRow(aXLbl, myXSpin);
+
+  myYSpin = new ModuleBase_ParamSpinBox(this);
+  myYSpin->setAcceptVariables(aAcceptVariables);
+  myYSpin->setToolTip("Y coordinate");
+  myYSpin->setValue(0);
+  QLabel* aYLbl = new QLabel(this);
+  aYLbl->setPixmap(QPixmap(":pictures/y_size.png"));
+  aMainlayout->addRow(aYLbl, myYSpin);
+
+  myZSpin = new ModuleBase_ParamSpinBox(this);
+  myZSpin->setAcceptVariables(aAcceptVariables);
+  myZSpin->setToolTip("Z coordinate");
+  myZSpin->setValue(0);
+  QLabel* aZLbl = new QLabel(this);
+  aZLbl->setPixmap(QPixmap(":pictures/z_size.png"));
+  aMainlayout->addRow(aZLbl, myZSpin);
+}
+
+ModuleBase_WidgetPointInput::~ModuleBase_WidgetPointInput()
+{
+
+}
+
+
+//********************************************************************
+QList<QWidget*> ModuleBase_WidgetPointInput::getControls() const
+{
+  QList<QWidget*> aList;
+  aList.append(myXSpin);
+  aList.append(myYSpin);
+  aList.append(myZSpin);
+  return aList;
+}
+
+//********************************************************************
+bool ModuleBase_WidgetPointInput::storeValueCustom()
+{
+  AttributePointPtr aAttr = std::dynamic_pointer_cast<GeomDataAPI_Point>(attribute());
+  if (aAttr.get()) {
+    if (myXSpin->hasVariable() || myYSpin->hasVariable() || myZSpin->hasVariable()) {
+      aAttr->setText(myXSpin->text().toStdString(),
+        myYSpin->text().toStdString(), myZSpin->text().toStdString());
+    } else {
+      aAttr->setValue(myXSpin->value(), myYSpin->value(), myZSpin->value());
+    }
+    return true;
+  }
+  return false;
+}
+
+//********************************************************************
+bool ModuleBase_WidgetPointInput::restoreValueCustom()
+{
+  AttributePointPtr aAttr = std::dynamic_pointer_cast<GeomDataAPI_Point>(attribute());
+  if (aAttr.get()) {
+    std::string aXText = aAttr->textX();
+    if (aXText.empty()) {
+      myXSpin->setValue(aAttr->x());
+    } else {
+      myXSpin->setText(aXText.c_str());
+    }
+    std::string aYText = aAttr->textY();
+    if (aYText.empty()) {
+      myYSpin->setValue(aAttr->y());
+    } else {
+      myYSpin->setText(aYText.c_str());
+    }
+    std::string aZText = aAttr->textZ();
+    if (aZText.empty()) {
+      myZSpin->setValue(aAttr->z());
+    } else {
+      myZSpin->setText(aZText.c_str());
+    }
+    return true;
+  }
+  return false;
+}
+
+//********************************************************************
+void ModuleBase_WidgetPointInput::selectionModes(int& theModuleSelectionModes, QIntList& theModes)
+{
+  theModuleSelectionModes = -1;
+  theModes << TopAbs_VERTEX;
+}
+
+//********************************************************************
+QIntList ModuleBase_WidgetPointInput::shapeTypes() const
+{
+  QIntList aList;
+  aList << TopAbs_VERTEX;
+  return aList;
+}
+
+//********************************************************************
+bool ModuleBase_WidgetPointInput
+::setSelectionCustom(const std::shared_ptr<ModuleBase_ViewerPrs>& thePrs)
+{
+  GeomShapePtr aShape = thePrs->shape();
+  if (aShape->isVertex()) {
+    GeomVertexPtr aVertex(new GeomAPI_Vertex(aShape));
+    GeomPointPtr aPnt = aVertex->point();
+    myXSpin->setValue(aPnt->x());
+    myYSpin->setValue(aPnt->y());
+    myZSpin->setValue(aPnt->z());
+    return true;
+  }
+  return false;
+}
diff --git a/src/ModuleBase/ModuleBase_WidgetPointInput.h b/src/ModuleBase/ModuleBase_WidgetPointInput.h
new file mode 100644 (file)
index 0000000..e9cd0f3
--- /dev/null
@@ -0,0 +1,78 @@
+// Copyright (C) 2014-2017  CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or
+// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+//
+
+#ifndef ModuleBase_WidgetPointInput_H
+#define ModuleBase_WidgetPointInput_H
+
+#include "ModuleBase.h"
+#include "ModuleBase_WidgetSelector.h"
+
+class ModuleBase_ParamSpinBox;
+
+class MODULEBASE_EXPORT ModuleBase_WidgetPointInput : public ModuleBase_WidgetSelector
+{
+  Q_OBJECT
+public:
+  /// Constructor
+  /// \param theParent the parent object
+  /// \param theWorkshop a current workshop
+  /// \param theData the widget configuation. The attribute of the model widget is obtained from
+  ModuleBase_WidgetPointInput(QWidget* theParent, ModuleBase_IWorkshop* theWorkshop,
+    const Config_WidgetAPI* theData);
+
+  /// Destructor
+  virtual ~ModuleBase_WidgetPointInput();
+
+  /// Returns list of widget controls
+  /// \return a control list
+  virtual QList<QWidget*> getControls() const;
+
+  /// Saves the internal parameters to the given feature
+  /// \return True in success
+  virtual bool storeValueCustom();
+
+  /// Restore value from attribute data to the widget's control
+  virtual bool restoreValueCustom();
+
+  /// Defines if it is supposed that the widget should interact with the viewer.
+  virtual bool isViewerSelector() { return true; }
+
+  /// Fills given container with selection modes if the widget has it
+  /// \param [out] theModuleSelectionModes module additional modes, -1 means all default modes
+  /// \param [out] theModes a container of modes
+  virtual void selectionModes(int& theModuleSelectionModes, QIntList& theModes);
+
+  /// Fills the attribute with the value of the selected owner
+  /// \param thePrs a selected owner
+  virtual bool setSelectionCustom(const std::shared_ptr<ModuleBase_ViewerPrs>& thePrs);
+
+protected:
+  /// Retunrs a list of possible shape types
+  /// \return a list of shapes
+  virtual QIntList shapeTypes() const;
+
+protected:
+  ModuleBase_ParamSpinBox* myXSpin;
+  ModuleBase_ParamSpinBox* myYSpin;
+  ModuleBase_ParamSpinBox* myZSpin;
+};
+
+
+#endif
\ No newline at end of file
diff --git a/src/ModuleBase/ModuleBase_WidgetRadiobox.cpp b/src/ModuleBase/ModuleBase_WidgetRadiobox.cpp
new file mode 100644 (file)
index 0000000..cf93559
--- /dev/null
@@ -0,0 +1,85 @@
+// Copyright (C) 2014-2017  CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or
+// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+//
+
+#include <ModuleBase_WidgetRadiobox.h>
+#include <ModuleBase_PageBase.h>
+
+#include <QFormLayout>
+#include <QRadioButton>
+#include <QFrame>
+#include <QButtonGroup>
+
+
+ModuleBase_WidgetRadiobox::ModuleBase_WidgetRadiobox(QWidget* theParent,
+                                                     const Config_WidgetAPI* theData)
+  : ModuleBase_PagedContainer(theParent, theData)
+{
+  myLayout = new QFormLayout(this);
+  ModuleBase_Tools::adjustMargins(myLayout);
+  myGroup = new QButtonGroup(this);
+  myGroup->setExclusive(true);
+
+  connect(myGroup, SIGNAL(buttonToggled(int, bool)), SLOT(onPageChanged()));
+}
+
+ModuleBase_WidgetRadiobox::~ModuleBase_WidgetRadiobox()
+{
+}
+
+int ModuleBase_WidgetRadiobox::addPage(ModuleBase_PageBase* thePage,
+                                        const QString& theName,
+                                        const QString& theCaseId,
+                                        const QPixmap& theIcon)
+{
+  ModuleBase_PagedContainer::addPage(thePage, theName, theCaseId, theIcon);
+  QWidget* aWgt = new QWidget(this);
+  QVBoxLayout* aLay = new QVBoxLayout(aWgt);
+  aLay->setContentsMargins(0, 0, 0, 0);
+
+  QRadioButton* aButton = new QRadioButton(aWgt);
+  aButton->setToolTip(theName);
+  aLay->addStretch();
+  aLay->addWidget(aButton);
+  aLay->addStretch();
+
+  //QFrame* aFrame = dynamic_cast<QFrame*>(thePage);
+  QWidget* aPage = thePage->pageWidget();
+  myLayout->addRow(aWgt, aPage);
+  myGroup->addButton(aButton, myGroup->buttons().count());
+
+  bool isDefault = theCaseId.toStdString() == getDefaultValue();
+  aButton->setChecked(isDefault);
+  aPage->setEnabled(isDefault);
+  connect(aButton, SIGNAL(toggled(bool)), aPage, SLOT(setEnabled(bool)));
+
+  return myGroup->buttons().count();
+}
+
+int ModuleBase_WidgetRadiobox::currentPageIndex() const
+{
+  return myGroup->checkedId();
+}
+
+void ModuleBase_WidgetRadiobox::setCurrentPageIndex(int theIndex)
+{
+  bool isSignalsBlocked = myGroup->blockSignals(true);
+  myGroup->button(theIndex)->setChecked(true);
+  myGroup->blockSignals(isSignalsBlocked);
+}
diff --git a/src/ModuleBase/ModuleBase_WidgetRadiobox.h b/src/ModuleBase/ModuleBase_WidgetRadiobox.h
new file mode 100644 (file)
index 0000000..81713d8
--- /dev/null
@@ -0,0 +1,64 @@
+// Copyright (C) 2014-2017  CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or
+// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+//
+
+#ifndef MODULEBASE_WIDGETRADIOBOX_H_
+#define MODULEBASE_WIDGETRADIOBOX_H_
+
+#include <ModuleBase.h>
+#include <ModuleBase_PagedContainer.h>
+
+class QFormLayout;
+class QButtonGroup;
+class QRadioButton;
+
+class MODULEBASE_EXPORT ModuleBase_WidgetRadiobox : public ModuleBase_PagedContainer
+{
+  Q_OBJECT
+public:
+  /// Constructor
+  /// \param theParent the parent object
+  /// \param theData the widget configuration. The attribute of the model widget is obtained from
+  ModuleBase_WidgetRadiobox(QWidget* theParent, const Config_WidgetAPI* theData);
+  virtual ~ModuleBase_WidgetRadiobox();
+
+
+  /// Add a page to the widget
+  /// \param theWidget a page widget
+  /// \param theName a name of page
+  /// \param theCaseId an Id of the page
+  /// \param theIcon an icon of the page
+  virtual int addPage(ModuleBase_PageBase* theWidget,
+    const QString& theName,
+    const QString& theCaseId,
+    const QPixmap& theIcon);
+
+protected:
+  /// Implements ModuleBase_PagedContainer
+  virtual int currentPageIndex() const;
+
+  /// Implements ModuleBase_PagedContainer
+  virtual void setCurrentPageIndex(int);
+
+private:
+  QFormLayout* myLayout;
+  QButtonGroup* myGroup;
+};
+
+#endif
\ No newline at end of file
index 72be73b8ff01f17cdef47dc197fe801e445cf8da..9602b24c5cd27a3ffc41dbe4f301b94ae7fdfab3 100644 (file)
@@ -62,6 +62,7 @@ SET(PROJECT_HEADERS
     XGUI_ViewerProxy.h
     XGUI_Workshop.h
     XGUI_WorkshopListener.h
+       XGUI_InspectionPanel.h
 )
 
 SET(PROJECT_MOC_HEADERS
@@ -89,6 +90,7 @@ SET(PROJECT_MOC_HEADERS
     XGUI_ViewerProxy.h
     XGUI_Workshop.h
     XGUI_WorkshopListener.h
+       XGUI_InspectionPanel.h
 )
 
 # sources / moc wrappings
@@ -127,6 +129,7 @@ SET(PROJECT_SOURCES
     XGUI_ViewerProxy.cpp
     XGUI_Workshop.cpp
     XGUI_WorkshopListener.cpp
+       XGUI_InspectionPanel.cpp
 )
 
 SET(PROJECT_RESOURCES
diff --git a/src/XGUI/XGUI_InspectionPanel.cpp b/src/XGUI/XGUI_InspectionPanel.cpp
new file mode 100644 (file)
index 0000000..b89334e
--- /dev/null
@@ -0,0 +1,240 @@
+// Copyright (C) 2014-2017  CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or
+// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+//
+
+#include "XGUI_InspectionPanel.h"
+#include "XGUI_SelectionMgr.h"
+#include "XGUI_Selection.h"
+
+#include <QLayout>
+#include <QScrollArea>
+#include <QLabel>
+#include <QLineEdit>
+#include <QTableWidget>
+#include <QHeaderView>
+#include <QTextBrowser>
+
+XGUI_InspectionPanel::XGUI_InspectionPanel(QWidget* theParent, XGUI_SelectionMgr* theMgr)
+  : QDockWidget(theParent),
+  mySelectionMgr(theMgr)
+{
+  setWindowTitle(tr("Inspection Panel"));
+  setObjectName(INSPECTION_PANEL);
+  setStyleSheet("::title { position: relative; padding-left: 5px; text-align: left center }");
+
+  QScrollArea* aScrollArea = new QScrollArea(this);
+  setWidget(aScrollArea);
+
+  // Create an internal widget
+  QWidget* aMainWidget = new QWidget(aScrollArea);
+
+  QVBoxLayout* aMainLayout = new QVBoxLayout(aMainWidget);
+  aMainLayout->setContentsMargins(5, 5, 5, 5);
+
+  QWidget* aNameWgt = new QWidget(aMainWidget);
+  QHBoxLayout* aNameLayout = new QHBoxLayout(aNameWgt);
+  aNameLayout->setContentsMargins(0, 0, 0, 0);
+  aNameLayout->addWidget(new QLabel(tr("Object"), aNameWgt));
+  myNameEdt = new QLineEdit(aNameWgt);
+  myNameEdt->setReadOnly(true);
+  aNameLayout->addWidget(myNameEdt);
+
+  aMainLayout->addWidget(aNameWgt);
+
+  // Table with sub-shapes
+  mySubShapesTab = new QTableWidget(9, 2, aMainWidget);
+  mySubShapesTab->setFocusPolicy(Qt::NoFocus);
+  mySubShapesTab->verticalHeader()->hide();
+  QStringList aTitles;
+  aTitles << tr("Sub-shapes") << tr("Number");
+  mySubShapesTab->setHorizontalHeaderLabels(aTitles);
+
+  QStringList aSubShapes;
+  aSubShapes << "SHAPE" << "COMPOUND" << "COMPSOLID" <<
+    "SOLID" << "SHELL" << "FACE" << "WIRE" << "EDGE" << "VERTEX";
+  int i = 0;
+  foreach(QString aType, aSubShapes) {
+    QTableWidgetItem* aItem = new QTableWidgetItem(aType);
+    aItem->setFlags(Qt::ItemIsEnabled);
+    mySubShapesTab->setItem(i++, 0, aItem);
+  }
+  for (i = 0; i < 9; i++) {
+    QTableWidgetItem* aItem = new QTableWidgetItem("0");
+    aItem->setFlags(Qt::ItemIsEnabled);
+    aItem->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
+    mySubShapesTab->setItem(i, 1, aItem);
+  }
+  mySubShapesTab->setColumnWidth(0, 90);
+  mySubShapesTab->setColumnWidth(1, 70);
+
+  mySubShapesTab->setMaximumWidth(170);
+  mySubShapesTab->setMinimumHeight(300);
+
+  aMainLayout->addWidget(mySubShapesTab);
+
+  // Type of object
+  QWidget* aTypeWgt = new QWidget(aMainWidget);
+  QHBoxLayout* aTypeLayout = new QHBoxLayout(aTypeWgt);
+  aTypeLayout->setContentsMargins(0, 0, 0, 0);
+
+  aTypeLayout->addWidget(new QLabel(tr("Type:"), aTypeWgt));
+  myTypeLbl = new QLabel("No-type", aTypeWgt);
+  aTypeLayout->addWidget(myTypeLbl);
+
+  aMainLayout->addWidget(aTypeWgt);
+
+  myTypeParams = new QTextBrowser(aMainWidget);
+  myTypeParams->setMaximumWidth(170);
+  myTypeParams->setMaximumHeight(160);
+  myTypeParams->setReadOnly(true);
+  myTypeParams->setFocusPolicy(Qt::NoFocus);
+  myTypeParams->setFrameStyle(QFrame::NoFrame);
+  myTypeParams->viewport()->setBackgroundRole(QPalette::Window);
+
+  aMainLayout->addWidget(myTypeParams);
+
+  aScrollArea->setWidget(aMainWidget);
+
+  connect(mySelectionMgr, SIGNAL(selectionChanged()), SLOT(onSelectionChanged()));
+
+  // Test
+  setVertexType(0, 0, 0);
+}
+
+XGUI_InspectionPanel::~XGUI_InspectionPanel()
+{
+}
+
+void XGUI_InspectionPanel::setSubShapeValue(SudShape theId, int theVal)
+{
+  mySubShapesTab->item(theId, 1)->setText(QString::number(theVal));
+}
+
+void XGUI_InspectionPanel::onSelectionChanged()
+{
+  QObjectPtrList aObjects = mySelectionMgr->selection()->selectedObjects();
+  if (aObjects.count() > 0) {
+    ObjectPtr aObj = aObjects.first();
+    setName(aObj->data()->name().c_str());
+  }
+}
+
+void XGUI_InspectionPanel::setName(const QString& theName)
+{
+  myNameEdt->setText(theName);
+}
+
+#define TITLE(val) ("<b>" + val + "</b>")
+
+void XGUI_InspectionPanel::setCylinderType(double theX, double theY, double theZ,
+  double theDX, double theDY, double theDZ, double theRadius, double theHeight)
+{
+  myTypeLbl->setText(tr("Cylinder"));
+  QString aParams = TITLE(tr("Center")) +
+    "<br> X: " + QString::number(theX) +
+    "<br> Y: " + QString::number(theY) +
+    "<br> Z: " + QString::number(theZ) +
+    "<br>" + TITLE(tr("Axis")) +
+    "<br> DX: " + QString::number(theDX) +
+    "<br> DY: " + QString::number(theDY) +
+    "<br> DZ: " + QString::number(theDZ) +
+    "<br>" + TITLE(tr("Dimensions")) +
+    "<br>" + tr("Radius:") + QString::number(theRadius) +
+    "<br>" + tr("Height") + QString::number(theHeight);
+
+  myTypeParams->setText(aParams);
+}
+
+void XGUI_InspectionPanel::setSphereType(double theX, double theY, double theZ, double theRadius)
+{
+  myTypeLbl->setText(tr("Sphere"));
+  QString aParams = TITLE(tr("Center")) +
+    "<br> X: " + QString::number(theX) +
+    "<br> Y: " + QString::number(theY) +
+    "<br> Z: " + QString::number(theZ) +
+    "<br>" + TITLE(tr("Dimensions")) +
+    "<br>" + tr("Radius:") + QString::number(theRadius);
+  myTypeParams->setText(aParams);
+}
+
+void XGUI_InspectionPanel::setBoxType(double theX, double theY, double theZ,
+  double theXsize, double theYsize, double theZsize)
+{
+  myTypeLbl->setText(tr("Box"));
+  QString aParams = TITLE(tr("Position")) +
+    "<br> X: " + QString::number(theX) +
+    "<br> Y: " + QString::number(theY) +
+    "<br> Z: " + QString::number(theZ) +
+    "<br>" + TITLE(tr("Dimensions")) +
+    "<br>" + "Ax :" + QString::number(theXsize) +
+    "<br>" + "Ay :" + QString::number(theYsize) +
+    "<br>" + "Az :" + QString::number(theZsize);
+  myTypeParams->setText(aParams);
+}
+
+
+void XGUI_InspectionPanel::setRotatedBoxType(double theX, double theY, double theZ,
+  double theZaxisX, double theZaxisY, double theZaxisZ,
+  double theXaxisX, double theXaxisY, double theXaxisZ,
+  double theXsize, double theYsize, double theZsize)
+{
+  myTypeLbl->setText(tr("Box"));
+  QString aParams = TITLE(tr("Position")) +
+    "<br> X: " + QString::number(theX) +
+    "<br> Y: " + QString::number(theY) +
+    "<br> Z: " + QString::number(theZ) +
+    "<br>" + TITLE(tr("Z axis")) +
+    "<br> DX: " + QString::number(theZaxisX) +
+    "<br> DY: " + QString::number(theZaxisY) +
+    "<br> DZ: " + QString::number(theZaxisZ) +
+    "<br>" + TITLE(tr("X axis")) +
+    "<br> DX: " + QString::number(theXaxisX) +
+    "<br> DY: " + QString::number(theXaxisY) +
+    "<br> DZ: " + QString::number(theXaxisZ) +
+    "<br>" + TITLE(tr("Dimensions")) +
+    "<br>" + "Ax :" + QString::number(theXsize) +
+    "<br>" + "Ay :" + QString::number(theYsize) +
+    "<br>" + "Az :" + QString::number(theZsize);
+  myTypeParams->setText(aParams);
+}
+
+void XGUI_InspectionPanel::setPlaneType(double theX, double theY, double theZ,
+  double theDX, double theDY, double theDZ)
+{
+  myTypeLbl->setText(tr("Plane"));
+  QString aParams = TITLE(tr("Center")) +
+    "<br> X: " + QString::number(theX) +
+    "<br> Y: " + QString::number(theY) +
+    "<br> Z: " + QString::number(theZ) +
+    "<br>" + TITLE(tr("Normal")) +
+    "<br> DX: " + QString::number(theDX) +
+    "<br> DY: " + QString::number(theDY) +
+    "<br> DZ: " + QString::number(theDZ);
+  myTypeParams->setText(aParams);
+}
+
+void XGUI_InspectionPanel::setVertexType(double theX, double theY, double theZ)
+{
+  myTypeLbl->setText(tr("Vertex"));
+  QString aParams = TITLE(tr("Coordinates")) +
+    "<br> X: " + QString::number(theX) +
+    "<br> Y: " + QString::number(theY) +
+    "<br> Z: " + QString::number(theZ);
+  myTypeParams->setText(aParams);
+}
\ No newline at end of file
diff --git a/src/XGUI/XGUI_InspectionPanel.h b/src/XGUI/XGUI_InspectionPanel.h
new file mode 100644 (file)
index 0000000..27ea2a8
--- /dev/null
@@ -0,0 +1,95 @@
+// Copyright (C) 2014-2017  CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or
+// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+//
+
+#ifndef XGUI_INSPECTIONPANEL_H_
+#define XGUI_INSPECTIONPANEL_H_
+
+#include "XGUI.h"
+
+#include <QDockWidget>
+
+class XGUI_SelectionMgr;
+class QLineEdit;
+class QTableWidget;
+class QLabel;
+class QTextBrowser;
+
+/// Internal name of property panel widget
+const static char* INSPECTION_PANEL = "inspection_panel_dock";
+
+class XGUI_EXPORT XGUI_InspectionPanel : public QDockWidget
+{
+  Q_OBJECT
+public:
+  enum SudShape {
+    ShapeId,
+    CompoundId,
+    CompsolidId,
+    SolidId,
+    ShellId,
+    FaceId,
+    WireId,
+    EdgeId,
+    VertexId
+  };
+
+  /// Constructor
+  /// \param theParent is a parent of the property panel
+  /// \param theMgr operation manager
+  XGUI_InspectionPanel(QWidget* theParent, XGUI_SelectionMgr* theMgr);
+
+  virtual ~XGUI_InspectionPanel();
+
+  void setSubShapeValue(SudShape theId, int theVal);
+
+  void setName(const QString& theName);
+
+  // Set of type parameters
+  void setCylinderType(double theX, double theY, double theZ,
+    double theDX, double theDY, double theDZ, double theRadius, double theHeight);
+
+  void setSphereType(double theX, double theY, double theZ, double theRadius);
+
+  void setBoxType(double theX, double theY, double theZ,
+    double theXsize, double theYsize, double theZsize);
+
+  void setRotatedBoxType(double theX, double theY, double theZ,
+    double theZaxisX, double theZaxisY, double theZaxisZ,
+    double theXaxisX, double theXaxisY, double theXaxisZ,
+    double theXsize, double theYsize, double theZsize);
+
+  void setPlaneType(double theX, double theY, double theZ,
+    double theDX, double theDY, double theDZ);
+
+  void setVertexType(double theX, double theY, double theZ);
+
+private slots:
+  void onSelectionChanged();
+
+private:
+  XGUI_SelectionMgr* mySelectionMgr;
+
+  QLineEdit* myNameEdt;
+  QTableWidget* mySubShapesTab;
+  QLabel* myTypeLbl;
+  QTextBrowser* myTypeParams;
+};
+
+#endif
\ No newline at end of file
index 11117511b7ca027575bffbc06977141c18d49f3f..0a1b1570ca901a64d408103893edbf3050ec8f3b 100755 (executable)
@@ -50,6 +50,7 @@
 #include <XGUI_HistoryMenu.h>
 #include <XGUI_QtEvents.h>
 #include <XGUI_DataModel.h>
+#include <XGUI_InspectionPanel.h>
 
 #ifndef HAVE_SALOME
 #include <AppElements_Button.h>
@@ -174,6 +175,7 @@ XGUI_Workshop::XGUI_Workshop(XGUI_SalomeConnector* theConnector)
       myModule(NULL),
       mySalomeConnector(theConnector),
       myPropertyPanel(0),
+      myInspectionPanel(0),
       myFacesPanel(0),
       myObjectBrowser(0),
       myDisplayer(0)
@@ -1343,6 +1345,11 @@ void XGUI_Workshop::createDockWidgets()
                                 Qt::BottomDockWidgetArea);
   connect(myFacesPanel, SIGNAL(closed()), myFacesPanel, SLOT(onClosed()));
 
+  myInspectionPanel = new XGUI_InspectionPanel(aDesktop, mySelector);
+  myInspectionPanel->setAllowedAreas(Qt::LeftDockWidgetArea |
+    Qt::RightDockWidgetArea);
+  aDesktop->addDockWidget(Qt::RightDockWidgetArea, myInspectionPanel);
+
   aDesktop->addDockWidget(
 #ifdef HAVE_SALOME
     Qt::RightDockWidgetArea,
index 7495365b43824d14eb09af3ea719752d016a1df4..7af135fc8ba7c165fd1d0954cfee97b59a2cc42d 100755 (executable)
@@ -63,6 +63,7 @@ class XGUI_SelectionActivate;
 class XGUI_SelectionMgr;
 class XGUI_ViewerProxy;
 class XGUI_WorkshopListener;
+class XGUI_InspectionPanel;
 
 class ModuleBase_IModule;
 class ModuleBase_IViewer;
@@ -130,6 +131,9 @@ Q_OBJECT
   /// Returns property panel widget
   XGUI_PropertyPanel* propertyPanel() const { return myPropertyPanel; }
 
+  /// Returns property panel widget
+  XGUI_InspectionPanel* inspectionPanel() const { return myInspectionPanel; }
+
   /// Returns panel for hide object faces
   XGUI_FacesPanel* facesPanel() const { return myFacesPanel; }
 
@@ -480,10 +484,6 @@ private:
   /// \param theParent a parent of widget
   QDockWidget* createObjectBrowser(QWidget* theParent);
 
-  /// Create property panel widget
-  /// \param theParent a parent of widget
-  QDockWidget* createPropertyPanel(QWidget* theParent);
-
   // Creates Dock widgets: Object browser and Property panel
   void createDockWidgets();
 
@@ -528,6 +528,7 @@ private:
   QString myCurrentDir; ///< cached the last open directory
   QIntList myViewerSelMode; ///< selection modes set in the viewer
   Config_DataModelReader* myDataModelXMLReader; ///< XML reader of data model
+  XGUI_InspectionPanel* myInspectionPanel; ///< container of feature attributes widgets
 };
 
 #endif
index 69d673502c71530f1a8a63c2eb4b7871a8e297a2..c1f108aaac19e04e93a20db8c34a1f4a490ed033 100644 (file)
Binary files a/src/XGUI/pictures/z_size.png and b/src/XGUI/pictures/z_size.png differ