PartDesign: allow making new ProfileBased feature using multiple faces
This commit is contained in:
@@ -1003,7 +1003,7 @@ unsigned validateSketches(std::vector<App::DocumentObject*>& sketches,
|
||||
void prepareProfileBased(PartDesign::Body *pcActiveBody, Gui::Command* cmd, const std::string& which,
|
||||
boost::function<void (Part::Feature*, App::DocumentObject*)> func)
|
||||
{
|
||||
auto base_worker = [=](App::DocumentObject* feature, std::string sub) {
|
||||
auto base_worker = [=](App::DocumentObject* feature, const std::vector<string> &subs) {
|
||||
|
||||
if (!feature || !feature->isDerivedFrom(Part::Feature::getClassTypeId()))
|
||||
return;
|
||||
@@ -1022,11 +1022,14 @@ 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())) {
|
||||
if (feature->isDerivedFrom(Part::Part2DObject::getClassTypeId()) || subs.empty()) {
|
||||
FCMD_OBJ_CMD(Feat,"Profile = " << objCmd);
|
||||
}
|
||||
else {
|
||||
FCMD_OBJ_CMD(Feat,"Profile = (" << objCmd << ", ['" << sub << "'])");
|
||||
std::ostringstream ss;
|
||||
for(auto &s : subs)
|
||||
ss << "'" << s << "',";
|
||||
FCMD_OBJ_CMD(Feat,"Profile = (" << objCmd << ", [" << ss.str() << "])");
|
||||
}
|
||||
|
||||
func(static_cast<Part::Feature*>(feature), Feat);
|
||||
@@ -1034,8 +1037,8 @@ void prepareProfileBased(PartDesign::Body *pcActiveBody, Gui::Command* cmd, cons
|
||||
|
||||
//if a profile is selected we can make our life easy and fast
|
||||
std::vector<Gui::SelectionObject> selection = cmd->getSelection().getSelectionEx();
|
||||
if (!selection.empty() && selection.front().hasSubNames()) {
|
||||
base_worker(selection.front().getObject(), selection.front().getSubNames().front());
|
||||
if (!selection.empty()) {
|
||||
base_worker(selection.front().getObject(), selection.front().getSubNames());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1069,7 +1072,7 @@ void prepareProfileBased(PartDesign::Body *pcActiveBody, Gui::Command* cmd, cons
|
||||
};
|
||||
|
||||
auto sketch_worker = [&, base_worker](std::vector<App::DocumentObject*> features) {
|
||||
base_worker(features.front(), "");
|
||||
base_worker(features.front(), {});
|
||||
};
|
||||
|
||||
//if there is a sketch selected which is from another body or part we need to bring up the
|
||||
|
||||
Reference in New Issue
Block a user