+ fix possible crashes in mirror and polar pattern feature

This commit is contained in:
wmayer
2014-03-31 16:35:22 +02:00
parent ded1996a73
commit a690bcb79d
4 changed files with 33 additions and 12 deletions

View File

@@ -41,6 +41,7 @@
#include "FeatureSubtractive.h"
#include "FeatureMirrored.h"
#include "FeatureLinearPattern.h"
#include "FeaturePolarPattern.h"
#include <Base/Console.h>
#include <Base/Exception.h>
@@ -87,6 +88,16 @@ App::DocumentObject* Transformed::getSketchObject() const
const LinearPattern* pattern = static_cast<const LinearPattern*>(this);
return pattern->Direction.getValue();
}
else if (this->getTypeId().isDerivedFrom(PolarPattern::getClassTypeId())) {
// if Originals is empty then try the polar pattern's Axis property
const PolarPattern* pattern = static_cast<const PolarPattern*>(this);
return pattern->Axis.getValue();
}
else if (this->getTypeId().isDerivedFrom(Mirrored::getClassTypeId())) {
// if Originals is empty then try the mirror pattern's MirrorPlane property
const Mirrored* pattern = static_cast<const Mirrored*>(this);
return pattern->MirrorPlane.getValue();
}
else {
return 0;
}