[PD] FeatureSketchBased: fix orthogonal check

- same fix as #7879
- also fix wording on an error message and improve a variable name
This commit is contained in:
Uwe
2022-12-04 04:57:22 +01:00
parent d33429c8af
commit d02871298a

View File

@@ -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);