harmonize creation of linear pattern inside a multi transform to direction creation of linear pattern
This commit is contained in:
@@ -1673,7 +1673,9 @@ void prepareTransformed(Gui::Command* cmd, const std::string& which,
|
||||
}
|
||||
str << "]";
|
||||
|
||||
Gui::Command::openCommand((std::string("Make ") + which + " feature").c_str());
|
||||
std::string msg("Make ");
|
||||
msg += which;
|
||||
Gui::Command::openCommand(msg.c_str());
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.activeDocument().%s.newObject(\"PartDesign::%s\",\"%s\")",
|
||||
PartDesignGui::getBody(false)->getNameInDocument(), which.c_str(), FeatName.c_str());
|
||||
// FIXME: There seems to be kind of a race condition here, leading to sporadic errors like
|
||||
|
||||
@@ -199,7 +199,8 @@ void TaskLinearPatternParameters::updateUI()
|
||||
|
||||
if (dirLinks.setCurrentLink(pcLinearPattern->Direction) == -1){
|
||||
//failed to set current, because the link isn't in the list yet
|
||||
dirLinks.addLink(pcLinearPattern->Direction, getRefStr(pcLinearPattern->Direction.getValue(),pcLinearPattern->Direction.getSubValues()));
|
||||
dirLinks.addLink(pcLinearPattern->Direction, getRefStr(pcLinearPattern->Direction.getValue(),
|
||||
pcLinearPattern->Direction.getSubValues()));
|
||||
dirLinks.setCurrentLink(pcLinearPattern->Direction);
|
||||
}
|
||||
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
#include "Utils.h"
|
||||
#include <App/Application.h>
|
||||
#include <App/Document.h>
|
||||
#include <App/Origin.h>
|
||||
#include <Gui/Application.h>
|
||||
#include <Gui/Document.h>
|
||||
#include <Gui/BitmapFactory.h>
|
||||
@@ -281,17 +282,30 @@ void TaskMultiTransformParameters::onTransformAddMirrored()
|
||||
|
||||
void TaskMultiTransformParameters::onTransformAddLinearPattern()
|
||||
{
|
||||
// See CmdPartDesignLinearPattern
|
||||
//
|
||||
closeSubTask();
|
||||
std::string newFeatName = TransformedView->getObject()->getDocument()->getUniqueObjectName("LinearPattern");
|
||||
|
||||
Gui::Command::openCommand("LinearPattern");
|
||||
Gui::Command::openCommand("Make LinearPattern");
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.activeDocument().%s.newObject(\"PartDesign::LinearPattern\",\"%s\")",
|
||||
PartDesignGui::getBody(false)->getNameInDocument(), newFeatName.c_str());
|
||||
//Gui::Command::updateActive();
|
||||
App::DocumentObject* sketch = getSketchObject();
|
||||
if (sketch)
|
||||
if (sketch) {
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.activeDocument().%s.Direction = (App.activeDocument().%s, [\"H_Axis\"])",
|
||||
newFeatName.c_str(), sketch->getNameInDocument());
|
||||
}
|
||||
else {
|
||||
// set Direction value before filling up the combo box to avoid creating an empty item
|
||||
// inside updateUI()
|
||||
PartDesign::Body* body = static_cast<PartDesign::Body*>(Part::BodyBase::findBodyOf(getObject()));
|
||||
if (body) {
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.activeDocument().%s.Direction = (App.activeDocument().%s, [\"\"])",
|
||||
newFeatName.c_str(), body->getOrigin()->getX()->getNameInDocument());
|
||||
}
|
||||
}
|
||||
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.activeDocument().%s.Length = 100", newFeatName.c_str());
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.activeDocument().%s.Occurrences = 2", newFeatName.c_str());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user