CAM: Fix finish passes by avoiding fuzzy in Area.cpp (#19525)
This commit is contained in:
@@ -74,6 +74,7 @@
|
||||
#include <Base/Exception.h>
|
||||
#include <Mod/Part/App/CrossSection.h>
|
||||
#include <Mod/Part/App/FaceMakerBullseye.h>
|
||||
#include <Mod/Part/App/FuzzyHelper.h>
|
||||
#include <Mod/Part/App/PartFeature.h>
|
||||
#include <Mod/CAM/App/PathSegmentWalker.h>
|
||||
#include <Mod/CAM/libarea/Area.h>
|
||||
@@ -1920,7 +1921,13 @@ std::vector<shared_ptr<Area>> Area::makeSections(PARAM_ARGS(PARAM_FARG, AREA_PAR
|
||||
showShape(xp.Current(), nullptr, "section_%u_shape", i);
|
||||
std::list<TopoDS_Wire> wires;
|
||||
Part::CrossSection section(a, b, c, xp.Current());
|
||||
wires = section.slice(-d);
|
||||
Part::FuzzyHelper::withBooleanFuzzy(.0, [&]() {
|
||||
// Workaround for https://github.com/FreeCAD/FreeCAD/issues/17748
|
||||
// needed to make finish pass work.
|
||||
// This fix might be better to move into Part::CrossSection but it is kept
|
||||
// here for now to be on the safe side.
|
||||
wires = section.slice(-d);
|
||||
});
|
||||
showShapes(wires, nullptr, "section_%u_wire", i);
|
||||
if (wires.empty()) {
|
||||
AREA_LOG("Section returns no wires");
|
||||
|
||||
@@ -27,12 +27,21 @@
|
||||
|
||||
using namespace Part;
|
||||
|
||||
double FuzzyHelper::BooleanFuzzy = 1.0;
|
||||
namespace {
|
||||
double BooleanFuzzy = 1.0;
|
||||
}
|
||||
|
||||
double FuzzyHelper::getBooleanFuzzy() {
|
||||
return BooleanFuzzy;
|
||||
}
|
||||
void FuzzyHelper::setBooleanFuzzy(const double fuzzy) {
|
||||
BooleanFuzzy = fuzzy;
|
||||
|
||||
void FuzzyHelper::setBooleanFuzzy(const double base) {
|
||||
BooleanFuzzy = base;
|
||||
}
|
||||
|
||||
void FuzzyHelper::withBooleanFuzzy(double base, std::function<void()> func) {
|
||||
double oldValue = getBooleanFuzzy();
|
||||
setBooleanFuzzy(base);
|
||||
func();
|
||||
setBooleanFuzzy(oldValue);
|
||||
}
|
||||
|
||||
@@ -26,22 +26,20 @@
|
||||
#define PART_FUZZYHELPER_H
|
||||
|
||||
#include <Mod/Part/PartGlobal.h>
|
||||
#include <functional>
|
||||
|
||||
namespace Part
|
||||
{
|
||||
|
||||
/**
|
||||
* @brief The FuzzyHelper class provides a static helper function to determine fuzzy value for a boolean operation
|
||||
* @brief The FuzzyHelper provides helper functions to determine fuzzy value for a boolean operation
|
||||
*/
|
||||
class PartExport FuzzyHelper
|
||||
namespace FuzzyHelper
|
||||
{
|
||||
public:
|
||||
static double getBooleanFuzzy();
|
||||
static void setBooleanFuzzy(const double base);
|
||||
private:
|
||||
static double BooleanFuzzy;
|
||||
};
|
||||
|
||||
double PartExport getBooleanFuzzy();
|
||||
void PartExport setBooleanFuzzy(double base);
|
||||
void PartExport withBooleanFuzzy(double base, std::function<void()> func);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user