]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Merge branch 'master' of newgeom:newgeom.git
authorsbh <sergey.belash@opencascade.com>
Fri, 12 Sep 2014 07:09:40 +0000 (11:09 +0400)
committersbh <sergey.belash@opencascade.com>
Fri, 12 Sep 2014 07:09:40 +0000 (11:09 +0400)
src/GeomAPI/GeomAPI_AISObject.cpp
src/GeomAlgoAPI/GeomAlgoAPI_Extrusion.cpp
src/GeomAlgoAPI/GeomAlgoAPI_SketchBuilder.cpp

index e79cc9fe3ec60d4eb42102d7a82bb09185f97f88..7f068f0f9cd15267c9f23be3e9026b86c3b1b22b 100644 (file)
@@ -144,6 +144,7 @@ void GeomAPI_AISObject::createRadius(boost::shared_ptr<GeomAPI_Circ> theCircle,
     anAspect->MakeArrows3d(Standard_False);
     anAspect->MakeText3d(false);
     anAspect->TextAspect()->SetHeight(CONSTRAINT_TEXT_HEIGHT);
+    anAspect->ArrowAspect()->SetLength(theRadius / 5.);
     anAspect->MakeTextShaded(false);
     aDimAIS->DimensionAspect()->MakeUnitsDisplayed(false);
     aDimAIS->SetDimensionAspect(anAspect);
index b7e4753079617b402eb64d7b99418b5e34968f43..a236fc8bb00135cd62e014ec1236d88b2e83b9c2 100644 (file)
@@ -10,6 +10,7 @@
 #include <Geom_Plane.hxx>
 #include <Geom_Surface.hxx>
 #include <TopExp_Explorer.hxx>
+#include <BRep_Builder.hxx>
 
 #include <Precision.hxx>
 const double tolerance = Precision::Angular();
@@ -38,6 +39,9 @@ boost::shared_ptr<GeomAPI_Shape> GeomAlgoAPI_Extrusion::makeExtrusion(
 
   const TopoDS_Shape& aShape = theShape->impl<TopoDS_Shape>();
   TopExp_Explorer aFaceExp(aShape, TopAbs_FACE);
+  TopoDS_Compound aFaces; // use only faces from the shape: make compound for this
+  BRep_Builder aBuilder;
+  aBuilder.MakeCompound(aFaces);
   for (; aFaceExp.More(); aFaceExp.Next()) {
     const TopoDS_Face& aFace = (const TopoDS_Face&) aFaceExp.Current();
     Handle(Geom_Plane) aPlane = Handle(Geom_Plane)::DownCast(BRep_Tool::Surface(aFace));
@@ -50,10 +54,15 @@ boost::shared_ptr<GeomAPI_Shape> GeomAlgoAPI_Extrusion::makeExtrusion(
       isFirstNorm = false;
     } else if (!aShapeNormal.IsEqual(aNormal, tolerance))  // non-planar shapes is not supported for extrusion yet
       return boost::shared_ptr<GeomAPI_Shape>();
+    aBuilder.Add(aFaces, aFace);
   }
+  if (aFaces.IsNull())
+    return boost::shared_ptr<GeomAPI_Shape>();
 
   boost::shared_ptr<GeomAPI_Dir> aDir(
       new GeomAPI_Dir(aShapeNormal.X(), aShapeNormal.Y(), aShapeNormal.Z()));
 
-  return GeomAlgoAPI_Extrusion::makeExtrusion(theShape, aDir, theSize);
+  boost::shared_ptr<GeomAPI_Shape> aFacesShape(new (GeomAPI_Shape));
+  aFacesShape->setImpl(new TopoDS_Shape(aFaces));
+  return GeomAlgoAPI_Extrusion::makeExtrusion(aFacesShape, aDir, theSize);
 }
index ed3bf8fec901edecef4e221c3a9f8b6c55a4a515..edff6f1a43832d9d90b3ac0832c0493eb6f13298 100644 (file)
@@ -196,7 +196,7 @@ void GeomAlgoAPI_SketchBuilder::createFaces(
             aProcEdges.pop_back();
           } while (aCurVertex != aProcVertexes.back());
           aCurDir = aCN.Reversed();
-          aCurNorm = aNorm.Reversed();
+          //aCurNorm = aNorm.Reversed();
           continue;
         }
       }
@@ -229,27 +229,16 @@ void GeomAlgoAPI_SketchBuilder::createFaces(
       std::list<TopoDS_Edge>::iterator aCopyELoop = anEdgeIter;
       removeWasteEdges(aVertIter, anEdgeIter, aProcVertexes.end(), aProcEdges.end(), aMapVE);
 
-      // revert the list of remaining edges
-      std::list<TopoDS_Vertex> aRemainVertexes;
-      for (; aVertIter != aProcVertexes.end(); aVertIter++)
-        aRemainVertexes.push_front(*aVertIter);
-      std::list<TopoDS_Edge> aRemainEdges;
-      for (; anEdgeIter != aProcEdges.end(); anEdgeIter++)
-        aRemainEdges.push_front(*anEdgeIter);
-      // remove edges and vertexes used in the loop and add remaining ones
-      aProcVertexes.erase(aCopyVLoop, aProcVertexes.end());
-      aProcVertexes.insert(aProcVertexes.end(), aRemainVertexes.begin(), aRemainVertexes.end());
-      aProcEdges.erase(aCopyELoop, aProcEdges.end());
-      aProcEdges.insert(aProcEdges.end(), aRemainEdges.begin(), aRemainEdges.end());
-
       // Recalculate current vertex and current direction
-      if (!aProcVertexes.empty()) {
-        aNextVertex = aProcVertexes.back();
-        if (!aProcEdges.empty())
-          aNextDir = getOuterEdgeDirection(aProcEdges.back(), aNextVertex);
-        else
-          aNextDir = aDirY;
+      aProcEdges.clear();
+      aProcVertexes.clear();
+      if (aMapVE.Extent() > 0)
+      {
+        aNextVertex = findStartVertex(aMapVE, aDirX, aDirY);
+        aProcVertexes.push_back(aNextVertex);
       }
+      aNextDir = aDirY.Reversed();
+      aCurNorm = aNorm.Reversed();
     }
 
     // if next vertex connected only to alone edge, this is a part of wire (not a closed loop),
@@ -344,7 +333,8 @@ void GeomAlgoAPI_SketchBuilder::fixIntersections(
       for (; aVert2.More(); aVert2.Next()) {
         const TopoDS_Vertex& aV = (const TopoDS_Vertex&)aVert2.Current();
         aClassifier.Perform(aF1, BRep_Tool::Pnt(aV), tolerance);
-        if (aClassifier.State() != TopAbs_IN && aClassifier.State() != TopAbs_ON)
+        TopAbs_State aState = aClassifier.State();
+        if (aState != TopAbs_IN && aState != TopAbs_ON)
           break;
       }
       if (aVert2.More()) {  // second shape is not inside first, change the shapes order and repeat comparision
@@ -354,29 +344,42 @@ void GeomAlgoAPI_SketchBuilder::fixIntersections(
         for (; aVert1.More(); aVert1.Next()) {
           const TopoDS_Vertex& aV = (const TopoDS_Vertex&)aVert2.Current();
           aClassifier.Perform(aF2, BRep_Tool::Pnt(aV), tolerance);
-          if (aClassifier.State() != TopAbs_IN && aClassifier.State() != TopAbs_ON)
+          TopAbs_State aState = aClassifier.State();
+          if (aState != TopAbs_IN && aState != TopAbs_ON)
             break;
         }
         if (!aVert1.More()) {  // first shape should be cut from the second
           BRepAlgoAPI_Cut aCut((*anIter2)->impl<TopoDS_Shape>(), (*anIter1)->impl<TopoDS_Shape>());
           aCut.Build();
           TopExp_Explorer anExp(aCut.Shape(), TopAbs_FACE);
-          (*anIter2)->setImpl(new TopoDS_Shape(anExp.Current()));
+          bool isFirstFace = true;
           for (anExp.Next(); anExp.More(); anExp.Next()) {
-            boost::shared_ptr<GeomAPI_Shape> aShape(new GeomAPI_Shape);
-            aShape->setImpl(new TopoDS_Shape(anExp.Current()));
-            theFaces.push_back(aShape);
+            if (anExp.Current().ShapeType() != TopAbs_FACE) continue;
+            if (isFirstFace) {
+              (*anIter2)->setImpl(new TopoDS_Shape(anExp.Current()));
+              isFirstFace = false;
+            } else {
+              boost::shared_ptr<GeomAPI_Shape> aShape(new GeomAPI_Shape);
+              aShape->setImpl(new TopoDS_Shape(anExp.Current()));
+              theFaces.push_back(aShape);
+            }
           }
         }
       } else {  // second shape should be cut from the first
         BRepAlgoAPI_Cut aCut((*anIter1)->impl<TopoDS_Shape>(), (*anIter2)->impl<TopoDS_Shape>());
         aCut.Build();
         TopExp_Explorer anExp(aCut.Shape(), TopAbs_FACE);
-        (*anIter1)->setImpl(new TopoDS_Shape(anExp.Current()));
+        bool isFirstFace = true;
         for (anExp.Next(); anExp.More(); anExp.Next()) {
-          boost::shared_ptr<GeomAPI_Shape> aShape(new GeomAPI_Shape);
-          aShape->setImpl(new TopoDS_Shape(anExp.Current()));
-          theFaces.push_back(aShape);
+          if (anExp.Current().ShapeType() != TopAbs_FACE) continue;
+          if (isFirstFace) {
+            (*anIter1)->setImpl(new TopoDS_Shape(anExp.Current()));
+            isFirstFace = false;
+          } else {
+            boost::shared_ptr<GeomAPI_Shape> aShape(new GeomAPI_Shape);
+            aShape->setImpl(new TopoDS_Shape(anExp.Current()));
+            theFaces.push_back(aShape);
+          }
         }
       }
     }