add Approximation option to TopoShape section

This commit is contained in:
tomate44
2018-06-10 17:51:12 +02:00
committed by wmayer
parent 8bc59f47ca
commit 9eaafad8a0
4 changed files with 23 additions and 13 deletions

View File

@@ -1637,17 +1637,23 @@ TopoDS_Shape TopoShape::oldFuse(TopoDS_Shape shape) const
#endif
}
TopoDS_Shape TopoShape::section(TopoDS_Shape shape) const
TopoDS_Shape TopoShape::section(TopoDS_Shape shape, const 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");
BRepAlgoAPI_Section mkSection(this->_Shape, shape);
BRepAlgoAPI_Section mkSection;
mkSection.Init1(this->_Shape);
mkSection.Init2(shape);
mkSection.Approximation(approximate);
mkSection.Build();
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
TopoDS_Shape TopoShape::section(const std::vector<TopoDS_Shape>& shapes, Standard_Real tolerance, const Standard_Boolean approximate) const
{
if (this->_Shape.IsNull())
Standard_Failure::Raise("Base shape is null");
@@ -1658,6 +1664,7 @@ TopoDS_Shape TopoShape::section(const std::vector<TopoDS_Shape>& shapes, Standar
#else
BRepAlgoAPI_Section mkSection;
mkSection.SetRunParallel(true);
mkSection.Approximation(approximate);
TopTools_ListOfShape shapeArguments,shapeTools;
shapeArguments.Append(this->_Shape);
for (std::vector<TopoDS_Shape>::const_iterator it = shapes.begin(); it != shapes.end(); ++it) {