From ca05f86f6eea16cae481b1865a54023c6009ccdc Mon Sep 17 00:00:00 2001 From: Abdullah Tahiri Date: Thu, 16 Feb 2017 22:57:33 +0100 Subject: [PATCH] Sketcher: Convert to NURBS toolbar via python to enable undo --- .../Sketcher/Gui/CommandSketcherBSpline.cpp | 26 ++++++++++++------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/src/Mod/Sketcher/Gui/CommandSketcherBSpline.cpp b/src/Mod/Sketcher/Gui/CommandSketcherBSpline.cpp index 1154d0552..27b6a5031 100644 --- a/src/Mod/Sketcher/Gui/CommandSketcherBSpline.cpp +++ b/src/Mod/Sketcher/Gui/CommandSketcherBSpline.cpp @@ -316,37 +316,43 @@ CmdSketcherConvertToNURB::CmdSketcherConvertToNURB() void CmdSketcherConvertToNURB::activated(int iMsg) { Q_UNUSED(iMsg); - + // get the selection std::vector selection = getSelection().getSelectionEx(); - + // only one sketch with its subelements are allowed to be selected if (selection.size() != 1) { return; } - + // get the needed lists and objects const std::vector &SubNames = selection[0].getSubNames(); Sketcher::SketchObject* Obj = static_cast(selection[0].getObject()); - + + openCommand("IncreaseBSplineDegree"); + for (unsigned int i=0; i 4 && SubNames[i].substr(0,4) == "Edge") { - + 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"); bool autoRecompute = hGrp->GetBool("AutoRecompute",false); - + if (autoRecompute) Gui::Command::updateActive(); else Obj->solve(); - + } bool CmdSketcherConvertToNURB::isActive(void)