From 614e247dff3fd97659da98bdf2e0493302d281e5 Mon Sep 17 00:00:00 2001 From: wmayer Date: Thu, 16 Sep 2021 12:43:32 +0200 Subject: [PATCH] Part: support null shapes in boolean operations --- src/Mod/Part/App/TopoShape.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Mod/Part/App/TopoShape.cpp b/src/Mod/Part/App/TopoShape.cpp index a714012221..887a798be2 100644 --- a/src/Mod/Part/App/TopoShape.cpp +++ b/src/Mod/Part/App/TopoShape.cpp @@ -1812,9 +1812,9 @@ bool TopoShape::isClosed() const TopoDS_Shape TopoShape::cut(TopoDS_Shape shape) const { if (this->_Shape.IsNull()) - Standard_Failure::Raise("Base shape is null"); + return this->_Shape; if (shape.IsNull()) - Standard_Failure::Raise("Tool shape is null"); + return this->_Shape; BRepAlgoAPI_Cut mkCut(this->_Shape, shape); return makeShell(mkCut.Shape()); } @@ -1822,7 +1822,7 @@ TopoDS_Shape TopoShape::cut(TopoDS_Shape shape) const TopoDS_Shape TopoShape::cut(const std::vector& shapes, Standard_Real tolerance) const { if (this->_Shape.IsNull()) - Standard_Failure::Raise("Base shape is null"); + return this->_Shape; #if OCC_VERSION_HEX < 0x060900 (void)shapes; (void)tolerance; @@ -1858,9 +1858,9 @@ TopoDS_Shape TopoShape::cut(const std::vector& shapes, Standard_Re TopoDS_Shape TopoShape::common(TopoDS_Shape shape) const { if (this->_Shape.IsNull()) - Standard_Failure::Raise("Base shape is null"); + return this->_Shape; if (shape.IsNull()) - Standard_Failure::Raise("Tool shape is null"); + return shape; BRepAlgoAPI_Common mkCommon(this->_Shape, shape); return makeShell(mkCommon.Shape()); } @@ -1868,7 +1868,7 @@ TopoDS_Shape TopoShape::common(TopoDS_Shape shape) const TopoDS_Shape TopoShape::common(const std::vector& shapes, Standard_Real tolerance) const { if (this->_Shape.IsNull()) - Standard_Failure::Raise("Base shape is null"); + return this->_Shape; #if OCC_VERSION_HEX < 0x060900 (void)shapes; (void)tolerance; @@ -1904,9 +1904,9 @@ TopoDS_Shape TopoShape::common(const std::vector& shapes, Standard TopoDS_Shape TopoShape::fuse(TopoDS_Shape shape) const { if (this->_Shape.IsNull()) - Standard_Failure::Raise("Base shape is null"); + return shape; if (shape.IsNull()) - Standard_Failure::Raise("Tool shape is null"); + return this->_Shape; BRepAlgoAPI_Fuse mkFuse(this->_Shape, shape); return makeShell(mkFuse.Shape()); }