diff --git a/src/Mod/PartDesign/Gui/Command.cpp b/src/Mod/PartDesign/Gui/Command.cpp index d776531367..4c7bb81106 100644 --- a/src/Mod/PartDesign/Gui/Command.cpp +++ b/src/Mod/PartDesign/Gui/Command.cpp @@ -1003,7 +1003,7 @@ unsigned validateSketches(std::vector& sketches, void prepareProfileBased(PartDesign::Body *pcActiveBody, Gui::Command* cmd, const std::string& which, boost::function func) { - auto base_worker = [=](App::DocumentObject* feature, std::string sub) { + auto base_worker = [=](App::DocumentObject* feature, const std::vector &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(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 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 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