diff --git a/src/Mod/PartDesign/App/FeatureSketchBased.cpp b/src/Mod/PartDesign/App/FeatureSketchBased.cpp index 98f2dc1c77..560c92143b 100644 --- a/src/Mod/PartDesign/App/FeatureSketchBased.cpp +++ b/src/Mod/PartDesign/App/FeatureSketchBased.cpp @@ -522,20 +522,18 @@ void ProfileBased::getUpToFace(TopoDS_Face& upToFace, } } - // Check that the upToFace does not intersect the sketch face and - // is not parallel to the extrusion direction (for simplicity, supportface is used instead of sketchshape) - BRepAdaptor_Surface adapt1(TopoDS::Face(supportface)); - BRepAdaptor_Surface adapt2(TopoDS::Face(upToFace)); + // Check that the upToFace is not parallel to the extrusion direction + BRepAdaptor_Surface upToFaceSurface(TopoDS::Face(upToFace)); - if (adapt2.GetType() == GeomAbs_Plane) { - if (adapt1.Plane().Axis().IsNormal(adapt2.Plane().Axis(), Precision::Confusion())) - throw Base::ValueError("SketchBased: Up to face: Must not be parallel to extrusion direction!"); + 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: Up to face: Must not intersect sketch!"); + 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) @@ -543,8 +541,8 @@ void ProfileBased::addOffsetToFace(TopoDS_Face& upToFace, const gp_Dir& dir, dou // Move the face in the extrusion direction // TODO: For non-planar faces, we could consider offsetting the surface if (fabs(offset) > Precision::Confusion()) { - BRepAdaptor_Surface adapt2(TopoDS::Face(upToFace)); - if (adapt2.GetType() == GeomAbs_Plane) { + BRepAdaptor_Surface upToFaceSurface(TopoDS::Face(upToFace)); + if (upToFaceSurface.GetType() == GeomAbs_Plane) { gp_Trsf mov; mov.SetTranslation(offset * gp_Vec(dir)); TopLoc_Location loc(mov);