[Part Design] allow for preselecting loft sections and pipe spines prior to invoking command
This commit is contained in:
@@ -1004,7 +1004,39 @@ void prepareProfileBased(PartDesign::Body *pcActiveBody, Gui::Command* cmd, cons
|
||||
for (auto &s : subs)
|
||||
ss << "'" << s << "',";
|
||||
FCMD_OBJ_CMD(Feat,"Profile = (" << objCmd << ", [" << ss.str() << "])");
|
||||
}
|
||||
}
|
||||
|
||||
//for additive and subtractive lofts allow the user to preselect the sections
|
||||
if (which.compare("AdditiveLoft") == 0 || which.compare("SubtractiveLoft") == 0){
|
||||
std::vector<Gui::SelectionObject> selection = cmd->getSelection().getSelectionEx();
|
||||
if (selection.size()>1){ //treat additional selected objects as sections
|
||||
for (std::vector<Gui::SelectionObject>::size_type ii = 1; ii != selection.size(); ii++){
|
||||
if (selection[ii].getObject()->isDerivedFrom(Part::Part2DObject::getClassTypeId())){
|
||||
auto objCmdSection = Gui::Command::getObjectCmd(selection[ii].getObject());
|
||||
FCMD_OBJ_CMD(Feat,"Sections += [" << objCmdSection << "]");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// for additive and subtractive pipes allow the user to preselect the spines
|
||||
if (which.compare("AdditivePipe") == 0 || which.compare("SubtractivePipe") == 0){
|
||||
std::vector<Gui::SelectionObject> selection = cmd->getSelection().getSelectionEx();
|
||||
if (selection.size()==2){ //treat additional selected object as spine
|
||||
std::vector <string> subnames = selection[1].getSubNames();
|
||||
auto objCmdSpine = Gui::Command::getObjectCmd(selection[1].getObject());
|
||||
if(selection[1].getObject()->isDerivedFrom(Part::Part2DObject::getClassTypeId()) && subnames.empty()){
|
||||
FCMD_OBJ_CMD(Feat,"Spine = " << objCmdSpine);
|
||||
} else {
|
||||
std::ostringstream ss;
|
||||
for(auto &s : subnames){
|
||||
if(s.find("Edge") != std::string::npos)
|
||||
ss << "'" << s << "',";
|
||||
}
|
||||
FCMD_OBJ_CMD(Feat,"Spine = (" << objCmdSpine << ", [" << ss.str() << "])");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func(static_cast<Part::Feature*>(feature), Feat);
|
||||
};
|
||||
|
||||
@@ -108,6 +108,9 @@ TaskLoftParameters::TaskLoftParameters(ViewProviderLoft *LoftView,bool /*newObj*
|
||||
item->setData(Qt::UserRole, QByteArray(obj->getNameInDocument()));
|
||||
ui->listWidgetReferences->addItem(item);
|
||||
}
|
||||
if (loft->Sections.getValues().size()>0){
|
||||
static_cast<ViewProviderLoft*>(vp)->makeTemporaryVisible(true);
|
||||
}
|
||||
|
||||
// activate and de-activate dialog elements as appropriate
|
||||
for (QWidget* child : proxy->findChildren<QWidget*>())
|
||||
|
||||
@@ -112,7 +112,9 @@ TaskPipeParameters::TaskPipeParameters(ViewProviderPipe *PipeView, bool /*newObj
|
||||
std::vector<std::string> strings = pipe->Spine.getSubValues();
|
||||
for (std::vector<std::string>::const_iterator it = strings.begin(); it != strings.end(); ++it)
|
||||
ui->listWidgetReferences->addItem(QString::fromStdString(*it));
|
||||
|
||||
if(strings.size()>0){
|
||||
static_cast<ViewProviderPipe*>(vp)->makeTemporaryVisible(true);
|
||||
}
|
||||
ui->comboBoxTransition->setCurrentIndex(pipe->Transition.getValue());
|
||||
|
||||
updateUI();
|
||||
@@ -132,7 +134,9 @@ TaskPipeParameters::~TaskPipeParameters()
|
||||
svp->setVisible(spineShow);
|
||||
spineShow = false;
|
||||
}
|
||||
|
||||
//setting visibility to true is needed when preselecting profile and path prior to invoking sweep
|
||||
std::string pipeName = pipe->getNameInDocument();
|
||||
Gui::Command::doCommand(Gui::Command::Gui,"App.ActiveDocument.%s.ViewObject.Visibility=True",pipeName.c_str());
|
||||
static_cast<ViewProviderPipe*>(vp)->highlightReferences(false, false);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user