+ Fix crash when editing the linear pattern feature, suppress some warnings in release mode

This commit is contained in:
wmayer
2014-03-31 14:42:55 +02:00
parent 00641c26a1
commit ded1996a73
3 changed files with 26 additions and 8 deletions

View File

@@ -40,6 +40,7 @@
#include "FeatureAdditive.h"
#include "FeatureSubtractive.h"
#include "FeatureMirrored.h"
#include "FeatureLinearPattern.h"
#include <Base/Console.h>
#include <Base/Exception.h>
@@ -78,10 +79,17 @@ App::DocumentObject* Transformed::getSupportObject() const
App::DocumentObject* Transformed::getSketchObject() const
{
std::vector<DocumentObject*> originals = Originals.getValues();
if (!originals.empty() && originals.front()->getTypeId().isDerivedFrom(PartDesign::SketchBased::getClassTypeId()))
if (!originals.empty() && originals.front()->getTypeId().isDerivedFrom(PartDesign::SketchBased::getClassTypeId())) {
return (static_cast<PartDesign::SketchBased*>(originals.front()))->getVerifiedSketch();
else
return NULL;
}
else if (this->getTypeId().isDerivedFrom(LinearPattern::getClassTypeId())) {
// if Originals is empty then try the linear pattern's Direction property
const LinearPattern* pattern = static_cast<const LinearPattern*>(this);
return pattern->Direction.getValue();
}
else {
return 0;
}
}
short Transformed::mustExecute() const
@@ -177,7 +185,9 @@ App::DocumentObjectExecReturn *Transformed::execute(void)
// Check for intersection with support
if (!Part::checkIntersection(support, mkTrf.Shape(), false, true)) {
#ifdef FC_DEBUG // do not write this in release mode because a message appears already in the task view
Base::Console().Warning("Transformed shape does not intersect support %s: Removed\n", (*o)->getNameInDocument());
#endif
nointersect_trsfms.insert(t);
} else {
v_transformations.push_back(t);