backport to occt < 6.9
This commit is contained in:
@@ -24,6 +24,7 @@
|
||||
#include "PreCompiled.h"
|
||||
#ifndef _PreComp_
|
||||
# include <BRepAlgoAPI_Section.hxx>
|
||||
# include <Standard_Version.hxx>
|
||||
#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
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -165,8 +165,8 @@ public:
|
||||
TopoDS_Shape fuse(TopoDS_Shape) const;
|
||||
TopoDS_Shape fuse(const std::vector<TopoDS_Shape>&, 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<TopoDS_Shape>&, 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<TopoDS_Shape>&, Standard_Real tolerance = 0.0, Standard_Boolean approximate=Standard_False) const;
|
||||
std::list<TopoDS_Wire> slice(const Base::Vector3d&, double) const;
|
||||
TopoDS_Compound slices(const Base::Vector3d&, const std::vector<double>&) const;
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user