From: jfa Date: Thu, 7 Sep 2006 08:59:04 +0000 (+0000) Subject: PAL13411: EDF285: Error while importing ellipses.py. Fix regresion of Boolean operati... X-Git-Tag: V3_2_2~2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=d8af99d938c8c123469b32585c9cccc5b4a60d8e;p=modules%2Fgeom.git PAL13411: EDF285: Error while importing ellipses.py. Fix regresion of Boolean operations on case of non-3d arguments. --- diff --git a/src/GEOMImpl/GEOMImpl_BooleanDriver.cxx b/src/GEOMImpl/GEOMImpl_BooleanDriver.cxx index 08e52e11e..2f0c9e140 100644 --- a/src/GEOMImpl/GEOMImpl_BooleanDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_BooleanDriver.cxx @@ -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 diff --git a/src/GEOMImpl/GEOMImpl_ShapeDriver.cxx b/src/GEOMImpl/GEOMImpl_ShapeDriver.cxx index b533e7bff..019ad172b 100644 --- a/src/GEOMImpl/GEOMImpl_ShapeDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_ShapeDriver.cxx @@ -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()) {