[PD] Allow sketch point profile in selection-based loft workflow
This commit is contained in:
@@ -1004,18 +1004,32 @@ void prepareProfileBased(PartDesign::Body *pcActiveBody, Gui::Command* cmd, cons
|
||||
auto Feat = pcActiveBody->getDocument()->getObject(FeatName.c_str());
|
||||
|
||||
auto objCmd = Gui::Command::getObjectCmd(feature);
|
||||
if (feature->isDerivedFrom(Part::Part2DObject::getClassTypeId()) || subs.empty()) {
|
||||
FCMD_OBJ_CMD(Feat,"Profile = " << objCmd);
|
||||
}
|
||||
else {
|
||||
std::ostringstream ss;
|
||||
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
|
||||
auto runProfileCmd =
|
||||
[=]() {
|
||||
FCMD_OBJ_CMD(Feat,"Profile = " << objCmd);
|
||||
};
|
||||
|
||||
auto runProfileCmdWithSubs =
|
||||
[=]() {
|
||||
std::ostringstream ss;
|
||||
for (auto &s : subs)
|
||||
ss << "'" << s << "',";
|
||||
FCMD_OBJ_CMD(Feat,"Profile = (" << objCmd << ", [" << ss.str() << "])");
|
||||
};
|
||||
|
||||
if (which.compare("AdditiveLoft") == 0 || which.compare("SubtractiveLoft") == 0) {
|
||||
// for additive and subtractive lofts set subvalues even for sketches
|
||||
// when a vertex is first selected
|
||||
auto subName = subs.empty() ? "" : subs.front();
|
||||
|
||||
if (feature->isDerivedFrom(Part::Part2DObject::getClassTypeId()) &&
|
||||
!(subName.size() > 6 && subName.substr(0,6) == "Vertex"))
|
||||
runProfileCmd();
|
||||
else
|
||||
runProfileCmdWithSubs();
|
||||
|
||||
// for additive and subtractive lofts allow the user to preselect the sections
|
||||
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++) {
|
||||
@@ -1028,6 +1042,12 @@ void prepareProfileBased(PartDesign::Body *pcActiveBody, Gui::Command* cmd, cons
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (feature->isDerivedFrom(Part::Part2DObject::getClassTypeId()) || subs.empty())
|
||||
runProfileCmd();
|
||||
else
|
||||
runProfileCmdWithSubs();
|
||||
}
|
||||
|
||||
// for additive and subtractive pipes allow the user to preselect the spines
|
||||
if (which.compare("AdditivePipe") == 0 || which.compare("SubtractivePipe") == 0) {
|
||||
|
||||
@@ -105,6 +105,7 @@ TaskLoftParameters::TaskLoftParameters(ViewProviderLoft *LoftView, bool /*newObj
|
||||
if (profile) {
|
||||
Gui::Application::Instance->showViewProvider(profile);
|
||||
|
||||
// TODO: if it is a single vertex of a sketch, use that subshape's name
|
||||
QString label = make2DLabel(profile, loft->Profile.getSubValues());
|
||||
ui->profileBaseEdit->setText(label);
|
||||
}
|
||||
@@ -112,6 +113,7 @@ TaskLoftParameters::TaskLoftParameters(ViewProviderLoft *LoftView, bool /*newObj
|
||||
for (auto &subSet : loft->Sections.getSubListValues()) {
|
||||
Gui::Application::Instance->showViewProvider(subSet.first);
|
||||
|
||||
// TODO: if it is a single vertex of a sketch, use that subshape's name
|
||||
QString label = make2DLabel(subSet.first, subSet.second);
|
||||
QListWidgetItem* item = new QListWidgetItem();
|
||||
item->setText(label);
|
||||
@@ -152,6 +154,7 @@ void TaskLoftParameters::onSelectionChanged(const Gui::SelectionChanges& msg)
|
||||
App::Document* document = App::GetApplication().getDocument(msg.pDocName);
|
||||
App::DocumentObject* object = document ? document->getObject(msg.pObjectName) : nullptr;
|
||||
if (object) {
|
||||
// TODO: if it is a single vertex of a sketch, use that subshape's name
|
||||
QString label = make2DLabel(object, {msg.pSubName});
|
||||
if (selectionMode == refProfile) {
|
||||
ui->profileBaseEdit->setText(label);
|
||||
|
||||
Reference in New Issue
Block a user