]> SALOME platform Git repositories - modules/geom.git/commitdiff
Salome HOME
PAL13411: EDF285: Error while importing ellipses.py. Fix regresion of Boolean operati...
authorjfa <jfa@opencascade.com>
Thu, 7 Sep 2006 08:59:04 +0000 (08:59 +0000)
committerjfa <jfa@opencascade.com>
Thu, 7 Sep 2006 08:59:04 +0000 (08:59 +0000)
src/GEOMImpl/GEOMImpl_BooleanDriver.cxx
src/GEOMImpl/GEOMImpl_ShapeDriver.cxx

index 08e52e11efdc0e4db88ba235104ffe9cc740ed2e..2f0c9e140e23aa1285f81c2149e22344d65812ae 100644 (file)
@@ -134,8 +134,20 @@ Standard_Integer GEOMImpl_BooleanDriver::Execute(TFunction_Logbook& log) const
         }
       }
 
-      if (isCompound)
-        aShape = GEOMImpl_GlueDriver::GlueFaces(C, Precision::Confusion());
+      if (isCompound) {
+        TopTools_ListOfShape listShapeC;
+        AddSimpleShapes(C, listShapeC);
+        TopTools_ListIteratorOfListOfShape itSubC (listShapeC);
+        bool isOnlySolids = true;
+        for (; itSubC.More(); itSubC.Next()) {
+          TopoDS_Shape aValueC = itSubC.Value();
+          if (aValueC.ShapeType() != TopAbs_SOLID) isOnlySolids = false;
+        }
+        if (isOnlySolids)
+          aShape = GEOMImpl_GlueDriver::GlueFaces(C, Precision::Confusion());
+        else
+          aShape = C;
+      }
     }
 
     // perform CUT operation
@@ -169,8 +181,20 @@ Standard_Integer GEOMImpl_BooleanDriver::Execute(TFunction_Logbook& log) const
           aShape = aCut;
       }
 
-      if (isCompound)
-        aShape = GEOMImpl_GlueDriver::GlueFaces(C, Precision::Confusion());
+      if (isCompound) {
+        TopTools_ListOfShape listShapeC;
+        AddSimpleShapes(C, listShapeC);
+        TopTools_ListIteratorOfListOfShape itSubC (listShapeC);
+        bool isOnlySolids = true;
+        for (; itSubC.More(); itSubC.Next()) {
+          TopoDS_Shape aValueC = itSubC.Value();
+          if (aValueC.ShapeType() != TopAbs_SOLID) isOnlySolids = false;
+        }
+        if (isOnlySolids)
+          aShape = GEOMImpl_GlueDriver::GlueFaces(C, Precision::Confusion());
+        else
+          aShape = C;
+      }
     }
 
     // perform FUSE operation
index b533e7bff126f49fe0dcc4b363bfe118b82a4a09..019ad172b60e5c8db016fa2b2dec9e2ca67c850c 100644 (file)
@@ -155,26 +155,32 @@ Standard_Integer GEOMImpl_ShapeDriver::Execute(TFunction_Logbook& log) const
       }
       aShape = aFW->WireAPIMake();
     }
-
   }
   else if (aType == FACE_WIRE) {
     Handle(GEOM_Function) aRefBase = aCI.GetBase();
     TopoDS_Shape aShapeBase = aRefBase->GetValue();
-    if (aShapeBase.IsNull() || aShapeBase.ShapeType() != TopAbs_WIRE) {
+    if (aShapeBase.IsNull()) Standard_NullObject::Raise("Argument Shape is null");
+    TopoDS_Wire W;
+    if (aShapeBase.ShapeType() == TopAbs_WIRE) {
+      W = TopoDS::Wire(aShapeBase);
+    }
+    else if (aShapeBase.ShapeType() == TopAbs_EDGE && aShapeBase.Closed()) {
+      BRepBuilderAPI_MakeWire MW;
+      MW.Add(TopoDS::Edge(aShapeBase));
+      if (!MW.IsDone()) {
+        Standard_ConstructionError::Raise("Wire construction failed");
+      }
+      //W = TopoDS::Wire(aShapeBase);
+      W = MW;
+    }
+    else {
       Standard_NullObject::Raise
-        ("Shape for face construction is null or not a wire");
+        ("Shape for face construction is neither a wire nor a closed edge");
     }
-    TopoDS_Wire W = TopoDS::Wire(aShapeBase);
-    //BRepBuilderAPI_MakeFace MF (W, aCI.GetIsPlanar());
-    //if (!MF.IsDone()) {
-    //  Standard_ConstructionError::Raise("Face construction failed");
-    //}
-    //aShape = MF.Shape();
     GEOMImpl_Block6Explorer::MakeFace(W, aCI.GetIsPlanar(), aShape);
     if (aShape.IsNull()) {
       Standard_ConstructionError::Raise("Face construction failed");
     }
-
   }
   else if (aType == FACE_WIRES) {
     Handle(TColStd_HSequenceOfTransient) aShapes = aCI.GetShapes();
@@ -192,11 +198,6 @@ Standard_Integer GEOMImpl_ShapeDriver::Execute(TFunction_Logbook& log) const
     TopoDS_Wire W = TopoDS::Wire(aWire);
 
     // basic face
-    //BRepBuilderAPI_MakeFace MF (W, aCI.GetIsPlanar());
-    //if (!MF.IsDone()) {
-    //  Standard_ConstructionError::Raise("Face construction failed");
-    //}
-    //TopoDS_Shape FFace = MF.Shape();
     TopoDS_Shape FFace;
     GEOMImpl_Block6Explorer::MakeFace(W, aCI.GetIsPlanar(), FFace);
     if (FFace.IsNull()) {