Skip to content

Commit

Permalink
[PD] enable padding to touching planes
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
donovaly committed Dec 12, 2022
1 parent 2f575a3 commit 94787e8
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions src/Mod/PartDesign/App/FeatureSketchBased.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));

BRepExtrema_DistShapeShape distSS(sketchshape, upToFace);
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!");
}
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");
// 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)
Expand Down

0 comments on commit 94787e8

Please sign in to comment.