]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Fix the order of intersectors in selection names generation
authormpv <mpv@opencascade.com>
Thu, 25 Oct 2018 12:00:48 +0000 (15:00 +0300)
committermpv <mpv@opencascade.com>
Mon, 19 Nov 2018 08:45:52 +0000 (11:45 +0300)
src/FeaturesPlugin/Test/TestExtrusion.py
src/Selector/Selector_Selector.cpp

index 23494e923fdd9e23c872bdc93586b292eed55afd..158c60feb60d3c4be002b64078e0667badf93872 100644 (file)
@@ -85,24 +85,16 @@ aSession.finishOperation()
 #=========================================================================
 # Make extrusion on circle
 #=========================================================================
-# Build shape from sketcher results
-aCircleSketchResult = aCircleSketchFeature.firstResult()
-aCircleSketchEdges = modelAPI_ResultConstruction(aCircleSketchResult).shape()
-origin = geomDataAPI_Point(aCircleSketchFeature.attribute("Origin")).pnt()
-dirX = geomDataAPI_Dir(aCircleSketchFeature.attribute("DirX")).dir()
-norm = geomDataAPI_Dir(aCircleSketchFeature.attribute("Norm")).dir()
-aCircleSketchFaces = ShapeList()
-GeomAlgoAPI_SketchBuilder.createFaces(
-    origin, dirX, norm, aCircleSketchEdges, aCircleSketchFaces)
-assert (len(aCircleSketchFaces) > 0)
-assert (aCircleSketchFaces[0] is not None)
+# Build face from sketcher results
+aCircleSketchResult = modelAPI_ResultConstruction(aCircleSketchFeature.firstResult())
+assert (aCircleSketchResult.facesNum() > 0)
 # Create extrusion
 aSession.startOperation()
 anExtrusionFt = aPart.addFeature("Extrusion")
 assert (anExtrusionFt.getKind() == "Extrusion")
 # selection type FACE=4
 anExtrusionFt.selectionList("base").append(
-    aCircleSketchResult, aCircleSketchFaces[0])
+    aCircleSketchResult, aCircleSketchResult.face(0))
 anExtrusionFt.string("CreationMethod").setValue("BySizes")
 anExtrusionFt.real("to_size").setValue(50)
 anExtrusionFt.real("from_size").setValue(0)
@@ -147,8 +139,7 @@ aSession.startOperation()
 anExtrusionFt = aPart.addFeature("Extrusion")
 assert (anExtrusionFt.getKind() == "Extrusion")
 # selection type FACE=4
-anExtrusionFt.selectionList("base").append(
-    aCircleSketchResult, aCircleSketchFaces[0])
+anExtrusionFt.selectionList("base").append(aCircleSketchResult, aCircleSketchResult.face(0))
 anExtrusionFt.string("CreationMethod").setValue("ByPlanesAndOffsets")
 anExtrusionFt.real("to_size").setValue(0) #TODO: remove
 anExtrusionFt.real("from_size").setValue(0) #TODO: remove
@@ -213,20 +204,13 @@ aLineEEndPoint.setValue(0., -50.)
 aSession.finishOperation()
 
 # Extrude clamp
-aClampSketchResult = aClampSketchFeature.firstResult()
-aClampSketchEdges = modelAPI_ResultConstruction(aClampSketchResult).shape()
-origin = geomDataAPI_Point(aClampSketchFeature.attribute("Origin")).pnt()
-dirX = geomDataAPI_Dir(aClampSketchFeature.attribute("DirX")).dir()
-norm = geomDataAPI_Dir(aClampSketchFeature.attribute("Norm")).dir()
-aClampSketchFaces = ShapeList()
-GeomAlgoAPI_SketchBuilder.createFaces(
-    origin, dirX, norm, aClampSketchEdges, aClampSketchFaces)
+aClampSketchResult = modelAPI_ResultConstruction(aClampSketchFeature.firstResult())
 aSession.startOperation()
 aClampExtrusionFt = aPart.addFeature("Extrusion")
 assert (aClampExtrusionFt.getKind() == "Extrusion")
 # selection type FACE=4
 aClampExtrusionFt.selectionList("base").append(
-    aClampSketchResult, aClampSketchFaces[0])
+    aClampSketchResult, aClampSketchResult.face(0))
 aClampExtrusionFt.string("CreationMethod").setValue("BySizes")
 aClampExtrusionFt.real("to_size").setValue(70)
 aClampExtrusionFt.real("from_size").setValue(0)
@@ -245,8 +229,7 @@ aSession.startOperation()
 anExtrusionFt = aPart.addFeature("Extrusion")
 assert (anExtrusionFt.getKind() == "Extrusion")
 # selection type FACE=4
-anExtrusionFt.selectionList("base").append(
-    aCircleSketchResult, aCircleSketchFaces[0])
+anExtrusionFt.selectionList("base").append(aCircleSketchResult, aCircleSketchResult.face(0))
 anExtrusionFt.string("CreationMethod").setValue("ByPlanesAndOffsets")
 anExtrusionFt.real("to_size").setValue(0) #TODO: remove
 anExtrusionFt.real("from_size").setValue(0) #TODO: remove
index d4b1f2319dda33d32486ca82442853d911c44858..8fe3532efd234043835bc6c82b5a892427b0683e 100644 (file)
@@ -284,7 +284,7 @@ bool Selector_Selector::select(const TopoDS_Shape theContext, const TopoDS_Shape
     // try to find the shape of the higher level type in the context shape
     bool aFacesTried = false; // for identification of vertices, faces are tried, then edges
     TopoDS_ListOfShape aLastCommon; // to store the commons not good, but may be used for weak
-    TopTools_MapOfShape aLastIntersectors;
+    TopoDS_ListOfShape aLastIntersectors;
     while(aSelectionType != TopAbs_FACE || !aFacesTried) {
       if (aSelectionType == TopAbs_FACE) {
         if (theValue.ShapeType() != TopAbs_VERTEX)
@@ -311,7 +311,7 @@ bool Selector_Selector::select(const TopoDS_Shape theContext, const TopoDS_Shape
       if (aCommon.Extent() == 1 && aCommon.First().IsSame(theValue)) {
         // name the intersectors
         mySubSelList.clear();
-        TopTools_MapOfShape::Iterator anInt(anIntersectors);
+        TopoDS_ListOfShape::Iterator anInt(anIntList);
         for (; anInt.More(); anInt.Next()) {
           if (!selectBySubSelector(theContext, anInt.Value())) {
             break; // if some selector is failed, stop and search another solution
@@ -323,7 +323,7 @@ bool Selector_Selector::select(const TopoDS_Shape theContext, const TopoDS_Shape
           }
       } else if (aCommon.Extent() > 1 && aLastCommon.IsEmpty())  {
         aLastCommon = aCommon;
-        aLastIntersectors = anIntersectors;
+        aLastIntersectors = anIntList;
       }
     }
 
@@ -369,7 +369,7 @@ bool Selector_Selector::select(const TopoDS_Shape theContext, const TopoDS_Shape
       if (myWeakIndex != -1) {
         // name the intersectors
         mySubSelList.clear();
-        TopTools_MapOfShape::Iterator anInt(aLastIntersectors);
+        TopoDS_ListOfShape::Iterator anInt(aLastIntersectors);
         for (; anInt.More(); anInt.Next()) {
           if (!selectBySubSelector(theContext, anInt.Value())) {
             break; // if some selector is failed, stop and search another solution