add Approximation option to FeaturePartSection

This commit is contained in:
tomate44
2018-06-10 17:49:32 +02:00
committed by wmayer
parent eadf9af1d7
commit 8bc59f47ca
2 changed files with 22 additions and 2 deletions

View File

@@ -37,10 +37,27 @@ PROPERTY_SOURCE(Part::Section, Part::Boolean)
Section::Section(void)
{
ADD_PROPERTY_TYPE(Approximation,(false),"Section",App::Prop_None,"Approximate the output edges");
}
BRepAlgoAPI_BooleanOperation* Section::makeOperation(const TopoDS_Shape& base, const TopoDS_Shape& tool) const
short Section::mustExecute() const
{
if (Approximation.isTouched())
return 1;
return 0;
}
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);
// return new BRepAlgoAPI_Section(base, tool);
bool approx = Approximation.getValue();
BRepAlgoAPI_Section* mkSection = new BRepAlgoAPI_Section();
mkSection->Init1(base);
mkSection->Init2(tool);
mkSection->Approximation(approx);
mkSection->Build();
if (!mkSection->IsDone())
throw Base::RuntimeError("Section failed");
return mkSection;
}

View File

@@ -38,9 +38,12 @@ class Section : public Boolean
public:
Section();
App::PropertyBool Approximation;
/** @name methods override Feature */
//@{
/// recalculate the Feature
short mustExecute() const;
protected:
BRepAlgoAPI_BooleanOperation* makeOperation(const TopoDS_Shape&, const TopoDS_Shape&) const;
//@}