Fixed bug in Pad where option TwoLengths was broken if Symmetric had been selected before

This commit is contained in:
jrheinlaender 2012-11-05 19:03:35 +04:30 committed by wmayer
parent 6cdd265ca1
commit b796b3af78

View File

@ -140,7 +140,7 @@ std::vector<TopoDS_Wire> SketchBased::getSketchWires() const {
return result;
}
// TODO: This code is taken from and duplicates code in Part2DObject::positionBySupport()
// Note: We cannot return a reference, because it will become Null.
// Not clear where, because we check for IsNull() here, but as soon as it is passed out of
@ -172,14 +172,14 @@ const TopoDS_Face SketchBased::getSupportFace() const {
return face;
}
Part::Feature* SketchBased::getSupport() const {
// get the support of the Sketch if any
App::DocumentObject* SupportLink = static_cast<Part::Part2DObject*>(Sketch.getValue())->Support.getValue();
Part::Feature* SupportObject = NULL;
if (SupportLink && SupportLink->getTypeId().isDerivedFrom(Part::Feature::getClassTypeId()))
SupportObject = static_cast<Part::Feature*>(SupportLink);
return SupportObject;
}
@ -197,7 +197,7 @@ const TopoDS_Shape& SketchBased::getSupportShape() const {
return result;
}
int SketchBased::getSketchAxisCount(void) const
{
Part::Part2DObject *sketch = static_cast<Part::Part2DObject*>(Sketch.getValue());
@ -484,12 +484,13 @@ void SketchBased::generatePrism(TopoDS_Shape& prism,
// Note: 1E6 created problems once...
Ltotal = 1E4;
if (midplane)
Loffset = -Ltotal/2;
else if (method == "TwoLengths") {
if (method == "TwoLengths") {
// midplane makes no sense here
Loffset = -L2;
Ltotal += L2;
}
} else if (midplane)
Loffset = -Ltotal/2;
TopoDS_Shape from = sketchshape;
if (method == "TwoLengths" || midplane) {