Sketcher: Convert to NURBS toolbar via python to enable undo
This commit is contained in:
parent
0531411df6
commit
ca05f86f6e
|
@ -316,37 +316,43 @@ CmdSketcherConvertToNURB::CmdSketcherConvertToNURB()
|
||||||
void CmdSketcherConvertToNURB::activated(int iMsg)
|
void CmdSketcherConvertToNURB::activated(int iMsg)
|
||||||
{
|
{
|
||||||
Q_UNUSED(iMsg);
|
Q_UNUSED(iMsg);
|
||||||
|
|
||||||
// get the selection
|
// get the selection
|
||||||
std::vector<Gui::SelectionObject> selection = getSelection().getSelectionEx();
|
std::vector<Gui::SelectionObject> selection = getSelection().getSelectionEx();
|
||||||
|
|
||||||
// only one sketch with its subelements are allowed to be selected
|
// only one sketch with its subelements are allowed to be selected
|
||||||
if (selection.size() != 1) {
|
if (selection.size() != 1) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// get the needed lists and objects
|
// get the needed lists and objects
|
||||||
const std::vector<std::string> &SubNames = selection[0].getSubNames();
|
const std::vector<std::string> &SubNames = selection[0].getSubNames();
|
||||||
Sketcher::SketchObject* Obj = static_cast<Sketcher::SketchObject*>(selection[0].getObject());
|
Sketcher::SketchObject* Obj = static_cast<Sketcher::SketchObject*>(selection[0].getObject());
|
||||||
|
|
||||||
|
openCommand("IncreaseBSplineDegree");
|
||||||
|
|
||||||
for (unsigned int i=0; i<SubNames.size(); i++ ) {
|
for (unsigned int i=0; i<SubNames.size(); i++ ) {
|
||||||
// only handle edges
|
// only handle edges
|
||||||
if (SubNames[i].size() > 4 && SubNames[i].substr(0,4) == "Edge") {
|
if (SubNames[i].size() > 4 && SubNames[i].substr(0,4) == "Edge") {
|
||||||
|
|
||||||
int GeoId = std::atoi(SubNames[i].substr(4,4000).c_str()) - 1;
|
int GeoId = std::atoi(SubNames[i].substr(4,4000).c_str()) - 1;
|
||||||
|
|
||||||
Obj->ConvertToNURBS(GeoId);
|
Gui::Command::doCommand(
|
||||||
|
Doc,"App.ActiveDocument.%s.ConvertToNURBS(%d) ",
|
||||||
|
selection[0].getFeatName(),GeoId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
commitCommand();
|
||||||
|
|
||||||
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Sketcher");
|
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Sketcher");
|
||||||
bool autoRecompute = hGrp->GetBool("AutoRecompute",false);
|
bool autoRecompute = hGrp->GetBool("AutoRecompute",false);
|
||||||
|
|
||||||
if (autoRecompute)
|
if (autoRecompute)
|
||||||
Gui::Command::updateActive();
|
Gui::Command::updateActive();
|
||||||
else
|
else
|
||||||
Obj->solve();
|
Obj->solve();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CmdSketcherConvertToNURB::isActive(void)
|
bool CmdSketcherConvertToNURB::isActive(void)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user