PD: 0004759: Bad error message when creating pad with 0 length

This commit is contained in:
wmayer
2021-12-07 10:09:11 +01:00
parent 242531b1c2
commit c1289a0d6f

View File

@@ -593,8 +593,10 @@ void ProfileBased::generatePrism(TopoDS_Shape& prism,
Loffset = -0.5 * (L2 + L);
else
Loffset = -L2;
} else if (midplane)
}
else if (midplane) {
Loffset = -Ltotal/2;
}
TopoDS_Shape from = sketchshape;
if (method == "TwoLengths" || midplane) {
@@ -602,8 +604,17 @@ void ProfileBased::generatePrism(TopoDS_Shape& prism,
mov.SetTranslation(Loffset * gp_Vec(dir));
TopLoc_Location loc(mov);
from = sketchshape.Moved(loc);
} else if (reversed)
}
else if (reversed) {
Ltotal *= -1.0;
}
if (fabs(Ltotal) < Precision::Confusion()) {
if (addSubType == Type::Additive)
throw Base::ValueError("Cannot create a pad with a height of zero.");
else
throw Base::ValueError("Cannot create a pocket with a depth of zero.");
}
// Its better not to use BRepFeat_MakePrism here even if we have a support because the
// resulting shape creates problems with Pocket