From 94787e8afa18f626ca772ecbb70b2e6e6810d057 Mon Sep 17 00:00:00 2001 From: Uwe Date: Mon, 12 Dec 2022 05:06:14 +0100 Subject: [PATCH] [PD] enable padding to touching planes - this patch is from @@FlachyJoe - as reported here: https://forum.freecadweb.org/viewtopic.php?p=646231#p646231 it was impossible to pad to a face which is touching the sketch despite is is no parallel to the extrusion Direction --- src/Mod/PartDesign/App/FeatureSketchBased.cpp | 23 +++++++++++-------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/Mod/PartDesign/App/FeatureSketchBased.cpp b/src/Mod/PartDesign/App/FeatureSketchBased.cpp index 10bdee2a6c..7f9c848764 100644 --- a/src/Mod/PartDesign/App/FeatureSketchBased.cpp +++ b/src/Mod/PartDesign/App/FeatureSketchBased.cpp @@ -520,18 +520,21 @@ void ProfileBased::getUpToFace(TopoDS_Face& upToFace, } } - // Check that the upToFace is not parallel to the extrusion direction + // Check that the upToFace is either not parallel to the extrusion direction + // and that upToFace is not too near BRepAdaptor_Surface upToFaceSurface(TopoDS::Face(upToFace)); - - if (upToFaceSurface.GetType() == GeomAbs_Plane) { - if (dir.IsNormal(upToFaceSurface.Plane().Axis().Direction(), Precision::Confusion())) - throw Base::ValueError("SketchBased: The UpTo-Face must not be parallel to the extrusion direction!"); - } - - // We must measure from sketchshape, not supportface, here BRepExtrema_DistShapeShape distSS(sketchshape, upToFace); - if (distSS.Value() < Precision::Confusion()) - throw Base::ValueError("SketchBased: The UpTo-Face is too close to the sketch"); + if (upToFaceSurface.GetType() == GeomAbs_Plane) { + // Check that the upToFace is not parallel to the extrusion direction + if (dir.IsNormal(upToFaceSurface.Plane().Axis().Direction(), Precision::Confusion())) + throw Base::ValueError( + "SketchBased: The UpTo-Face must not be parallel to the extrusion direction!"); + + // Check the distance if the upToFace is normal to the extrusion direction + if (dir.IsParallel(upToFaceSurface.Plane().Axis().Direction(), Precision::Confusion())) + if (distSS.Value() < Precision::Confusion()) + throw Base::ValueError("SketchBased: The UpTo-Face is too close to the sketch"); + } } void ProfileBased::addOffsetToFace(TopoDS_Face& upToFace, const gp_Dir& dir, double offset)