+ Fix crash when editing the linear pattern feature, suppress some warnings in release mode
This commit is contained in:
parent
fabe39b976
commit
aaeba38e78
|
@ -1386,7 +1386,9 @@ bool Document::_recomputeFeature(DocumentObject* Feat)
|
|||
else {
|
||||
returnCode->Which = Feat;
|
||||
_RecomputeLog.push_back(returnCode);
|
||||
#ifdef FC_DEBUG
|
||||
Base::Console().Error("%s\n",returnCode->Why.c_str());
|
||||
#endif
|
||||
Feat->setError();
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -406,6 +406,7 @@ TaskDlgLinearPatternParameters::TaskDlgLinearPatternParameters(ViewProviderLinea
|
|||
|
||||
Content.push_back(parameter);
|
||||
}
|
||||
|
||||
//==== calls from the TaskView ===============================================================
|
||||
|
||||
bool TaskDlgLinearPatternParameters::accept()
|
||||
|
@ -421,14 +422,19 @@ bool TaskDlgLinearPatternParameters::accept()
|
|||
TaskLinearPatternParameters* linearpatternParameter = static_cast<TaskLinearPatternParameters*>(parameter);
|
||||
std::string direction = linearpatternParameter->getDirection();
|
||||
if (!direction.empty()) {
|
||||
QString buf = QString::fromUtf8("(App.ActiveDocument.%1,[\"%2\"])");
|
||||
App::DocumentObject* sketch = 0;
|
||||
if (direction == "H_Axis" || direction == "V_Axis" ||
|
||||
(direction.size() > 4 && direction.substr(0,4) == "Axis"))
|
||||
buf = buf.arg(QString::fromUtf8(linearpatternParameter->getSketchObject()->getNameInDocument()));
|
||||
sketch = linearpatternParameter->getSketchObject();
|
||||
else
|
||||
buf = buf.arg(QString::fromUtf8(linearpatternParameter->getSupportObject()->getNameInDocument()));
|
||||
buf = buf.arg(QString::fromUtf8(direction.c_str()));
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.Direction = %s", name.c_str(), buf.toStdString().c_str());
|
||||
sketch = linearpatternParameter->getSupportObject();
|
||||
|
||||
QString buf = QString::fromUtf8("(App.ActiveDocument.%1,[\"%2\"])");
|
||||
if (sketch) {
|
||||
buf = buf.arg(QString::fromLatin1(sketch->getNameInDocument()));
|
||||
buf = buf.arg(QString::fromUtf8(direction.c_str()));
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.Direction = %s", name.c_str(), buf.toStdString().c_str());
|
||||
}
|
||||
} else
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.Direction = None", name.c_str());
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.Reversed = %u",name.c_str(),linearpatternParameter->getReverse());
|
||||
|
|
Loading…
Reference in New Issue
Block a user