diff --git a/src/Mod/Part/App/FeaturePartSection.cpp b/src/Mod/Part/App/FeaturePartSection.cpp index 06f47c31bfcb..b50e43481c44 100644 --- a/src/Mod/Part/App/FeaturePartSection.cpp +++ b/src/Mod/Part/App/FeaturePartSection.cpp @@ -24,6 +24,7 @@ #include "PreCompiled.h" #ifndef _PreComp_ # include +# include #endif #include "FeaturePartSection.h" @@ -47,10 +48,12 @@ short Section::mustExecute() const return 0; } -BRepAlgoAPI_BooleanOperation *Section::makeOperation(const TopoDS_Shape& base, const TopoDS_Shape& tool) const +BRepAlgoAPI_BooleanOperation* Section::makeOperation(const TopoDS_Shape& base, const TopoDS_Shape& tool) const { // Let's call algorithm computing a section operation: - // return new BRepAlgoAPI_Section(base, tool); +#if OCC_VERSION_HEX < 0x060900 + return new BRepAlgoAPI_Section(base, tool); +#else bool approx = Approximation.getValue(); BRepAlgoAPI_Section* mkSection = new BRepAlgoAPI_Section(); mkSection->Init1(base); @@ -60,4 +63,5 @@ BRepAlgoAPI_BooleanOperation *Section::makeOperation(const TopoDS_Shape& base, c if (!mkSection->IsDone()) throw Base::RuntimeError("Section failed"); return mkSection; +#endif } diff --git a/src/Mod/Part/App/TopoShape.cpp b/src/Mod/Part/App/TopoShape.cpp index 7be315d84c2f..4f4da356a8c3 100644 --- a/src/Mod/Part/App/TopoShape.cpp +++ b/src/Mod/Part/App/TopoShape.cpp @@ -1637,29 +1637,36 @@ TopoDS_Shape TopoShape::oldFuse(TopoDS_Shape shape) const #endif } -TopoDS_Shape TopoShape::section(TopoDS_Shape shape, const Standard_Boolean approximate) const +TopoDS_Shape TopoShape::section(TopoDS_Shape shape, Standard_Boolean approximate) const { if (this->_Shape.IsNull()) Standard_Failure::Raise("Base shape is null"); if (shape.IsNull()) Standard_Failure::Raise("Tool shape is null"); +#if OCC_VERSION_HEX < 0x060900 + BRepAlgoAPI_Section mkSection(this->_Shape, shape); +#else BRepAlgoAPI_Section mkSection; mkSection.Init1(this->_Shape); mkSection.Init2(shape); mkSection.Approximation(approximate); mkSection.Build(); +#endif if (!mkSection.IsDone()) throw Base::RuntimeError("Section failed"); return mkSection.Shape(); } -TopoDS_Shape TopoShape::section(const std::vector& shapes, Standard_Real tolerance, const Standard_Boolean approximate) const +TopoDS_Shape TopoShape::section(const std::vector& shapes, + Standard_Real tolerance, + Standard_Boolean approximate) const { if (this->_Shape.IsNull()) Standard_Failure::Raise("Base shape is null"); #if OCC_VERSION_HEX < 0x060900 (void)shapes; (void)tolerance; + (void)approximate; throw Base::RuntimeError("Multi section is available only in OCC 6.9.0 and up."); #else BRepAlgoAPI_Section mkSection; diff --git a/src/Mod/Part/App/TopoShape.h b/src/Mod/Part/App/TopoShape.h index c4916a52261e..d6c5078045ed 100644 --- a/src/Mod/Part/App/TopoShape.h +++ b/src/Mod/Part/App/TopoShape.h @@ -165,8 +165,8 @@ class PartExport TopoShape : public Data::ComplexGeoData TopoDS_Shape fuse(TopoDS_Shape) const; TopoDS_Shape fuse(const std::vector&, Standard_Real tolerance = 0.0) const; TopoDS_Shape oldFuse(TopoDS_Shape) const; - TopoDS_Shape section(TopoDS_Shape, const Standard_Boolean approximate=Standard_False) const; - TopoDS_Shape section(const std::vector&, Standard_Real tolerance = 0.0, const Standard_Boolean approximate=Standard_False) const; + TopoDS_Shape section(TopoDS_Shape, Standard_Boolean approximate=Standard_False) const; + TopoDS_Shape section(const std::vector&, Standard_Real tolerance = 0.0, Standard_Boolean approximate=Standard_False) const; std::list slice(const Base::Vector3d&, double) const; TopoDS_Compound slices(const Base::Vector3d&, const std::vector&) const; /**