backport to occt < 6.9

This commit is contained in:
wmayer
2018-06-10 21:57:25 +02:00
parent 9eaafad8a0
commit 9bc9ebed21
3 changed files with 17 additions and 6 deletions

View File

@@ -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<TopoDS_Shape>& shapes, Standard_Real tolerance, const Standard_Boolean approximate) const
TopoDS_Shape TopoShape::section(const std::vector<TopoDS_Shape>& 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;