PD: Increase the tolerance to check for planar surfaces
The default tolerance to check for a planar B-spline surface is 1.0e-7 which might be too strict in some cases. Therefore the tolerance is increased to 2.0e-7. This fixes issue 21242
This commit is contained in:
@@ -1377,7 +1377,7 @@ AttachEngine3D::_calculateAttachedPlacement(const std::vector<App::DocumentObjec
|
||||
else {
|
||||
TopLoc_Location loc;
|
||||
Handle(Geom_Surface) surf = BRep_Tool::Surface(face, loc);
|
||||
GeomLib_IsPlanarSurface check(surf);
|
||||
GeomLib_IsPlanarSurface check(surf, precision);
|
||||
if (check.IsPlanar()) {
|
||||
plane = check.Plan();
|
||||
}
|
||||
@@ -2095,11 +2095,17 @@ Base::Placement AttachEnginePlane::_calculateAttachedPlacement(
|
||||
//reuse Attacher3d
|
||||
Base::Placement plm;
|
||||
AttachEngine3D attacher3D;
|
||||
attacher3D.precision = precision;
|
||||
attacher3D.setUp(*this);
|
||||
plm = attacher3D._calculateAttachedPlacement(objs,subs,origPlacement);
|
||||
return plm;
|
||||
}
|
||||
|
||||
double AttachEnginePlane::planarPrecision()
|
||||
{
|
||||
return 2.0e-7; // NOLINT
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
|
||||
TYPESYSTEM_SOURCE(Attacher::AttachEngineLine, Attacher::AttachEngine)
|
||||
|
||||
@@ -391,6 +391,7 @@ public: //members
|
||||
bool mapReverse = false;
|
||||
double attachParameter = 0.0;
|
||||
double surfU = 0.0, surfV = 0.0;
|
||||
double precision = 1.0e-7;
|
||||
Base::Placement attachmentOffset;
|
||||
|
||||
/**
|
||||
@@ -489,6 +490,7 @@ public:
|
||||
const std::vector<App::DocumentObject*> &objs,
|
||||
const std::vector<std::string> &subs,
|
||||
const Base::Placement &origPlacement) const override;
|
||||
static double planarPrecision();
|
||||
};
|
||||
|
||||
//attacher specialized for datum lines
|
||||
|
||||
@@ -60,7 +60,9 @@ PROPERTY_SOURCE_WITH_EXTENSIONS(Part::Part2DObject, Part::Feature)
|
||||
Part2DObject::Part2DObject()
|
||||
{
|
||||
AttachExtension::initExtension(this);
|
||||
this->setAttacher(new Attacher::AttachEnginePlane);
|
||||
auto engine = new Attacher::AttachEnginePlane;
|
||||
engine->precision = Attacher::AttachEnginePlane::planarPrecision();
|
||||
this->setAttacher(engine);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -141,7 +141,7 @@ public:
|
||||
throw WrongSupportException();
|
||||
}
|
||||
|
||||
if (!subshape.isPlanar()) {
|
||||
if (!subshape.isPlanar(Attacher::AttachEnginePlane::planarPrecision())) {
|
||||
throw SupportNotPlanarException();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user