Part: Restore parametric refine function

This commit is contained in:
wmayer
2020-02-02 20:48:02 +01:00
parent ba5e50ada9
commit 2a396025c2

View File

@@ -364,7 +364,39 @@ CmdPartRefineShape::CmdPartRefineShape()
void CmdPartRefineShape::activated(int iMsg)
{
Q_UNUSED(iMsg);
_copyShape("Refined copy",true,false,true);
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Part");
bool parametric = hGrp->GetBool("ParametricRefine", true);
if (parametric) {
Gui::WaitCursor wc;
Base::Type partid = Base::Type::fromName("Part::Feature");
std::vector<App::DocumentObject*> objs = Gui::Selection().getObjectsOfType(partid);
openCommand("Refine shape");
std::for_each(objs.begin(), objs.end(), [](App::DocumentObject* obj) {
try {
doCommand(Doc,"App.ActiveDocument.addObject('Part::Refine','%s').Source="
"App.ActiveDocument.%s\n"
"App.ActiveDocument.ActiveObject.Label="
"App.ActiveDocument.%s.Label\n"
"Gui.ActiveDocument.%s.hide()\n",
obj->getNameInDocument(),
obj->getNameInDocument(),
obj->getNameInDocument(),
obj->getNameInDocument());
copyVisual("ActiveObject", "ShapeColor", obj->getNameInDocument());
copyVisual("ActiveObject", "LineColor", obj->getNameInDocument());
copyVisual("ActiveObject", "PointColor", obj->getNameInDocument());
}
catch (const Base::Exception& e) {
Base::Console().Warning("%s: %s\n", obj->Label.getValue(), e.what());
}
});
commitCommand();
updateActive();
}
else {
_copyShape("Refined copy",true,false,true);
}
}
bool CmdPartRefineShape::isActive(void)