From f44df3cdf018f76c846da5b07ed498f574437405 Mon Sep 17 00:00:00 2001 From: wmayer Date: Thu, 15 Sep 2016 18:53:37 +0200 Subject: [PATCH] do not use doCommand without using format string, add overloaded method of runCommand --- src/Gui/Command.cpp | 14 ++++++-- src/Gui/Command.h | 5 ++- src/Gui/CommandDoc.cpp | 2 +- src/Mod/Fem/Gui/TaskFemConstraint.cpp | 2 +- src/Mod/Fem/Gui/TaskFemConstraintContact.cpp | 2 +- src/Mod/MeshPart/Gui/Tessellation.cpp | 2 +- src/Mod/Part/Gui/Command.cpp | 10 +++--- src/Mod/Part/Gui/CommandParametric.cpp | 32 +++++++++---------- src/Mod/Part/Gui/DlgPrimitives.cpp | 12 +++---- .../PartDesign/Gui/TaskBooleanParameters.cpp | 2 +- .../PartDesign/Gui/TaskDressUpParameters.cpp | 2 +- .../Gui/TaskPrimitiveParameters.cpp | 4 +-- src/Mod/Raytracing/Gui/Command.cpp | 4 +-- src/Mod/ReverseEngineering/Gui/Command.cpp | 4 +-- .../Gui/FitBSplineSurface.cpp | 2 +- src/Mod/ReverseEngineering/Gui/Poisson.cpp | 2 +- src/Mod/Sketcher/Gui/ViewProviderSketch.cpp | 6 ++-- 17 files changed, 60 insertions(+), 47 deletions(-) diff --git a/src/Gui/Command.cpp b/src/Gui/Command.cpp index 6bc39b1d4..f6262342e 100644 --- a/src/Gui/Command.cpp +++ b/src/Gui/Command.cpp @@ -464,7 +464,7 @@ void Command::doCommand(DoCmd_Type eType, const char* sCmd, ...) } /// Run a App level Action -void Command::runCommand(DoCmd_Type eType,const char* sCmd) +void Command::runCommand(DoCmd_Type eType, const char* sCmd) { if (eType == Gui) Gui::Application::Instance->macroManager()->addLine(MacroManager::Gui,sCmd); @@ -473,6 +473,16 @@ void Command::runCommand(DoCmd_Type eType,const char* sCmd) Base::Interpreter().runString(sCmd); } +/// Run a App level Action +void Command::runCommand(DoCmd_Type eType, const QByteArray& sCmd) +{ + if (eType == Gui) + Gui::Application::Instance->macroManager()->addLine(MacroManager::Gui,sCmd.constData()); + else + Gui::Application::Instance->macroManager()->addLine(MacroManager::App,sCmd.constData()); + Base::Interpreter().runString(sCmd.constData()); +} + void Command::addModule(DoCmd_Type eType,const char* sModuleName) { if(alreadyLoadedModule.find(sModuleName) == alreadyLoadedModule.end()) { @@ -931,7 +941,7 @@ void PythonCommand::activated(int iMsg) } } else { - doCommand(Doc,Activation.c_str()); + runCommand(Doc,Activation.c_str()); } } diff --git a/src/Gui/Command.h b/src/Gui/Command.h index febdeadc2..290355258 100644 --- a/src/Gui/Command.h +++ b/src/Gui/Command.h @@ -243,6 +243,7 @@ public: /// Run a App level Action static void doCommand(DoCmd_Type eType,const char* sCmd,...); static void runCommand(DoCmd_Type eType,const char* sCmd); + static void runCommand(DoCmd_Type eType,const QByteArray& sCmd); /// import an external (or own) module only once static void addModule(DoCmd_Type eType,const char* sModuleName); /// assures the switch to a certain workbench, if already in the workbench, does nothing. @@ -254,7 +255,9 @@ public: static std::string getPythonTuple(const std::string& name, const std::vector& subnames); /// translate a string to a python string literal (needed e.g. in file names for windows...) const std::string strToPython(const char* Str); - const std::string strToPython(const std::string &Str){return strToPython(Str.c_str());}; + const std::string strToPython(const std::string &Str){ + return strToPython(Str.c_str()); + } //@} /** @name Helper methods to generate help pages */ diff --git a/src/Gui/CommandDoc.cpp b/src/Gui/CommandDoc.cpp index 8f2b245bf..008789648 100644 --- a/src/Gui/CommandDoc.cpp +++ b/src/Gui/CommandDoc.cpp @@ -404,7 +404,7 @@ void StdCmdNew::activated(int iMsg) QString cmd; cmd = QString::fromLatin1("App.newDocument(\"%1\")") .arg(qApp->translate("StdCmdNew","Unnamed")); - doCommand(Command::Doc,(const char*)cmd.toUtf8()); + runCommand(Command::Doc,cmd.toUtf8()); } //=========================================================================== diff --git a/src/Mod/Fem/Gui/TaskFemConstraint.cpp b/src/Mod/Fem/Gui/TaskFemConstraint.cpp index 6162e3f1a..b7f9a96e5 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraint.cpp +++ b/src/Mod/Fem/Gui/TaskFemConstraint.cpp @@ -189,7 +189,7 @@ const QString TaskFemConstraint::makeRefText(const App::DocumentObject* obj, con void TaskDlgFemConstraint::open() { ConstraintView->setVisible(true); - Gui::Command::doCommand(Gui::Command::Doc,ViewProviderFemConstraint::gethideMeshShowPartStr((static_cast(ConstraintView->getObject()))->getNameInDocument()).c_str()); //OvG: Hide meshes and show parts + Gui::Command::runCommand(Gui::Command::Doc,ViewProviderFemConstraint::gethideMeshShowPartStr((static_cast(ConstraintView->getObject()))->getNameInDocument()).c_str()); //OvG: Hide meshes and show parts } bool TaskDlgFemConstraint::accept() diff --git a/src/Mod/Fem/Gui/TaskFemConstraintContact.cpp b/src/Mod/Fem/Gui/TaskFemConstraintContact.cpp index 9b92c4442..159bf461e 100644 --- a/src/Mod/Fem/Gui/TaskFemConstraintContact.cpp +++ b/src/Mod/Fem/Gui/TaskFemConstraintContact.cpp @@ -453,7 +453,7 @@ void TaskDlgFemConstraintContact::open() QString msg = QObject::tr("Constraint Contact"); Gui::Command::openCommand((const char*)msg.toUtf8()); ConstraintView->setVisible(true); - Gui::Command::doCommand(Gui::Command::Doc,ViewProviderFemConstraint::gethideMeshShowPartStr((static_cast(ConstraintView->getObject()))->getNameInDocument()).c_str()); //OvG: Hide meshes and show parts + Gui::Command::runCommand(Gui::Command::Doc,ViewProviderFemConstraint::gethideMeshShowPartStr((static_cast(ConstraintView->getObject()))->getNameInDocument()).c_str()); //OvG: Hide meshes and show parts } } diff --git a/src/Mod/MeshPart/Gui/Tessellation.cpp b/src/Mod/MeshPart/Gui/Tessellation.cpp index 92edcf53b..3ed380a44 100644 --- a/src/Mod/MeshPart/Gui/Tessellation.cpp +++ b/src/Mod/MeshPart/Gui/Tessellation.cpp @@ -328,7 +328,7 @@ bool Tessellation::accept() .arg(label); } } - Gui::Command::doCommand(Gui::Command::Doc, (const char*)cmd.toUtf8()); + Gui::Command::runCommand(Gui::Command::Doc, cmd.toUtf8()); // if Standard mesher is used and face colors should be applied if (method == 0) { // Standard diff --git a/src/Mod/Part/Gui/Command.cpp b/src/Mod/Part/Gui/Command.cpp index 4fa38ba0c..11fdb79ed 100644 --- a/src/Mod/Part/Gui/Command.cpp +++ b/src/Mod/Part/Gui/Command.cpp @@ -1016,7 +1016,7 @@ void CmdPartMakeSolid::activated(int iMsg) { std::vector objs = Gui::Selection().getObjectsOfType (Part::Feature::getClassTypeId()); - doCommand(Doc, "import Part"); + runCommand(Doc, "import Part"); for (std::vector::iterator it = objs.begin(); it != objs.end(); ++it) { const TopoDS_Shape& shape = static_cast(*it)->Shape.getValue(); if (!shape.IsNull()) { @@ -1057,7 +1057,7 @@ void CmdPartMakeSolid::activated(int iMsg) try { if (!str.isEmpty()) - doCommand(Doc, (const char*)str.toLatin1()); + runCommand(Doc, str.toLatin1()); } catch (const Base::Exception& e) { Base::Console().Error("Cannot convert %s because %s.\n", @@ -1094,7 +1094,7 @@ void CmdPartReverseShape::activated(int iMsg) { std::vector objs = Gui::Selection().getObjectsOfType (Part::Feature::getClassTypeId()); - doCommand(Doc, "import Part"); + runCommand(Doc, "import Part"); for (std::vector::iterator it = objs.begin(); it != objs.end(); ++it) { const TopoDS_Shape& shape = static_cast(*it)->Shape.getValue(); if (!shape.IsNull()) { @@ -1111,7 +1111,7 @@ void CmdPartReverseShape::activated(int iMsg) try { if (!str.isEmpty()) - doCommand(Doc, (const char*)str.toLatin1()); + runCommand(Doc, str.toLatin1()); } catch (const Base::Exception& e) { Base::Console().Error("Cannot convert %s because %s.\n", @@ -1217,7 +1217,7 @@ void CmdPartMakeFace::activated(int iMsg) str << ")"; - doCommand(Doc,str.str().c_str()); + runCommand(Doc,str.str().c_str()); commitCommand(); updateActive(); } diff --git a/src/Mod/Part/Gui/CommandParametric.cpp b/src/Mod/Part/Gui/CommandParametric.cpp index f64076c5d..ad71f8a5f 100644 --- a/src/Mod/Part/Gui/CommandParametric.cpp +++ b/src/Mod/Part/Gui/CommandParametric.cpp @@ -27,7 +27,7 @@ # include # include # include -# include +# include #endif #include @@ -57,13 +57,13 @@ void CmdPartCylinder::activated(int iMsg) cmd = qApp->translate("CmdPartCylinder","Cylinder"); openCommand((const char*)cmd.toUtf8()); - doCommand(Doc,"App.ActiveDocument.addObject(\"Part::Cylinder\",\"Cylinder\")"); + runCommand(Doc,"App.ActiveDocument.addObject(\"Part::Cylinder\",\"Cylinder\")"); cmd = QString::fromLatin1("App.ActiveDocument.ActiveObject.Label = \"%1\"") .arg(qApp->translate("CmdPartCylinder","Cylinder")); - doCommand(Doc,(const char*)cmd.toUtf8()); + runCommand(Doc,cmd.toUtf8()); commitCommand(); updateActive(); - doCommand(Gui, "Gui.SendMsgToActiveView(\"ViewFit\")"); + runCommand(Gui, "Gui.SendMsgToActiveView(\"ViewFit\")"); } bool CmdPartCylinder::isActive(void) @@ -97,13 +97,13 @@ void CmdPartBox::activated(int iMsg) cmd = qApp->translate("CmdPartBox","Cube"); openCommand((const char*)cmd.toUtf8()); - doCommand(Doc,"App.ActiveDocument.addObject(\"Part::Box\",\"Box\")"); + runCommand(Doc,"App.ActiveDocument.addObject(\"Part::Box\",\"Box\")"); cmd = QString::fromLatin1("App.ActiveDocument.ActiveObject.Label = \"%1\"") .arg(qApp->translate("CmdPartBox","Cube")); - doCommand(Doc,(const char*)cmd.toUtf8()); + runCommand(Doc,cmd.toUtf8()); commitCommand(); updateActive(); - doCommand(Gui, "Gui.SendMsgToActiveView(\"ViewFit\")"); + runCommand(Gui, "Gui.SendMsgToActiveView(\"ViewFit\")"); } bool CmdPartBox::isActive(void) @@ -137,13 +137,13 @@ void CmdPartSphere::activated(int iMsg) cmd = qApp->translate("CmdPartSphere","Sphere"); openCommand((const char*)cmd.toUtf8()); - doCommand(Doc,"App.ActiveDocument.addObject(\"Part::Sphere\",\"Sphere\")"); + runCommand(Doc,"App.ActiveDocument.addObject(\"Part::Sphere\",\"Sphere\")"); cmd = QString::fromLatin1("App.ActiveDocument.ActiveObject.Label = \"%1\"") .arg(qApp->translate("CmdPartSphere","Sphere")); - doCommand(Doc,(const char*)cmd.toUtf8()); + runCommand(Doc,cmd.toUtf8()); commitCommand(); updateActive(); - doCommand(Gui, "Gui.SendMsgToActiveView(\"ViewFit\")"); + runCommand(Gui, "Gui.SendMsgToActiveView(\"ViewFit\")"); } bool CmdPartSphere::isActive(void) @@ -177,13 +177,13 @@ void CmdPartCone::activated(int iMsg) cmd = qApp->translate("CmdPartCone","Cone"); openCommand((const char*)cmd.toUtf8()); - doCommand(Doc,"App.ActiveDocument.addObject(\"Part::Cone\",\"Cone\")"); + runCommand(Doc,"App.ActiveDocument.addObject(\"Part::Cone\",\"Cone\")"); cmd = QString::fromLatin1("App.ActiveDocument.ActiveObject.Label = \"%1\"") .arg(qApp->translate("CmdPartCone","Cone")); - doCommand(Doc,(const char*)cmd.toUtf8()); + runCommand(Doc,cmd.toUtf8()); commitCommand(); updateActive(); - doCommand(Gui, "Gui.SendMsgToActiveView(\"ViewFit\")"); + runCommand(Gui, "Gui.SendMsgToActiveView(\"ViewFit\")"); } bool CmdPartCone::isActive(void) @@ -217,13 +217,13 @@ void CmdPartTorus::activated(int iMsg) cmd = qApp->translate("CmdPartTorus","Torus"); openCommand((const char*)cmd.toUtf8()); - doCommand(Doc,"App.ActiveDocument.addObject(\"Part::Torus\",\"Torus\")"); + runCommand(Doc,"App.ActiveDocument.addObject(\"Part::Torus\",\"Torus\")"); cmd = QString::fromLatin1("App.ActiveDocument.ActiveObject.Label = \"%1\"") .arg(qApp->translate("CmdPartTorus","Torus")); - doCommand(Doc,(const char*)cmd.toUtf8()); + runCommand(Doc,cmd.toUtf8()); commitCommand(); updateActive(); - doCommand(Gui, "Gui.SendMsgToActiveView(\"ViewFit\")"); + runCommand(Gui, "Gui.SendMsgToActiveView(\"ViewFit\")"); } bool CmdPartTorus::isActive(void) diff --git a/src/Mod/Part/Gui/DlgPrimitives.cpp b/src/Mod/Part/Gui/DlgPrimitives.cpp index cd2133d79..023268808 100644 --- a/src/Mod/Part/Gui/DlgPrimitives.cpp +++ b/src/Mod/Part/Gui/DlgPrimitives.cpp @@ -100,10 +100,10 @@ void Picker::createPrimitive(QWidget* widget, const QString& descr, Gui::Documen // Execute the Python block doc->openCommand(descr.toUtf8()); - Gui::Command::doCommand(Gui::Command::Doc, (const char*)cmd.toLatin1()); + Gui::Command::runCommand(Gui::Command::Doc, cmd.toLatin1()); doc->commitCommand(); - Gui::Command::doCommand(Gui::Command::Doc, "App.ActiveDocument.recompute()"); - Gui::Command::doCommand(Gui::Command::Gui, "Gui.SendMsgToActiveView(\"ViewFit\")"); + Gui::Command::runCommand(Gui::Command::Doc, "App.ActiveDocument.recompute()"); + Gui::Command::runCommand(Gui::Command::Gui, "Gui.SendMsgToActiveView(\"ViewFit\")"); } catch (const Base::Exception& e) { QMessageBox::warning(widget, descr, QString::fromLatin1(e.what())); @@ -666,10 +666,10 @@ void DlgPrimitives::createPrimitive(const QString& placement) // Execute the Python block QString prim = tr("Create %1").arg(ui.comboBox1->currentText()); Gui::Application::Instance->activeDocument()->openCommand(prim.toUtf8()); - Gui::Command::doCommand(Gui::Command::Doc, (const char*)cmd.toUtf8()); + Gui::Command::runCommand(Gui::Command::Doc, cmd.toUtf8()); Gui::Application::Instance->activeDocument()->commitCommand(); - Gui::Command::doCommand(Gui::Command::Doc, "App.ActiveDocument.recompute()"); - Gui::Command::doCommand(Gui::Command::Gui, "Gui.SendMsgToActiveView(\"ViewFit\")"); + Gui::Command::runCommand(Gui::Command::Doc, "App.ActiveDocument.recompute()"); + Gui::Command::runCommand(Gui::Command::Gui, "Gui.SendMsgToActiveView(\"ViewFit\")"); } catch (const Base::PyException& e) { QMessageBox::warning(this, tr("Create %1") diff --git a/src/Mod/PartDesign/Gui/TaskBooleanParameters.cpp b/src/Mod/PartDesign/Gui/TaskBooleanParameters.cpp index 83daec0c6..c20db46af 100644 --- a/src/Mod/PartDesign/Gui/TaskBooleanParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskBooleanParameters.cpp @@ -327,7 +327,7 @@ bool TaskDlgBooleanParameters::accept() for (std::vector::const_iterator it = bodies.begin(); it != bodies.end(); ++it) str << "App.ActiveDocument." << *it << ","; str << "]"; - Gui::Command::doCommand(Gui::Command::Doc,str.str().c_str()); + Gui::Command::runCommand(Gui::Command::Doc,str.str().c_str()); } catch (const Base::Exception& e) { QMessageBox::warning(parameter, tr("Boolean: Accept: Input error"), QString::fromLatin1(e.what())); diff --git a/src/Mod/PartDesign/Gui/TaskDressUpParameters.cpp b/src/Mod/PartDesign/Gui/TaskDressUpParameters.cpp index ece39a1e1..aecbac37b 100644 --- a/src/Mod/PartDesign/Gui/TaskDressUpParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskDressUpParameters.cpp @@ -219,7 +219,7 @@ bool TaskDlgDressUpParameters::accept() for (std::vector::const_iterator it = refs.begin(); it != refs.end(); ++it) str << "\"" << *it << "\","; str << "])"; - Gui::Command::doCommand(Gui::Command::Doc,str.str().c_str()); + Gui::Command::runCommand(Gui::Command::Doc,str.str().c_str()); return TaskDlgFeatureParameters::accept(); } diff --git a/src/Mod/PartDesign/Gui/TaskPrimitiveParameters.cpp b/src/Mod/PartDesign/Gui/TaskPrimitiveParameters.cpp index 51659f9b1..adc7216ed 100644 --- a/src/Mod/PartDesign/Gui/TaskPrimitiveParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskPrimitiveParameters.cpp @@ -588,9 +588,9 @@ void TaskBoxPrimitives::setPrimitive(QString name) // Execute the Python block QString prim = tr("Create primitive"); Gui::Application::Instance->activeDocument()->openCommand(prim.toUtf8()); - Gui::Command::doCommand(Gui::Command::Doc, (const char*)cmd.toUtf8()); + Gui::Command::runCommand(Gui::Command::Doc, cmd.toUtf8()); Gui::Application::Instance->activeDocument()->commitCommand(); - Gui::Command::doCommand(Gui::Command::Doc, "App.ActiveDocument.recompute()"); + Gui::Command::runCommand(Gui::Command::Doc, "App.ActiveDocument.recompute()"); } catch (const Base::PyException& e) { QMessageBox::warning(this, tr("Create primitive"), QString::fromLatin1(e.what())); diff --git a/src/Mod/Raytracing/Gui/Command.cpp b/src/Mod/Raytracing/Gui/Command.cpp index 15101a5ac..994d018d2 100644 --- a/src/Mod/Raytracing/Gui/Command.cpp +++ b/src/Mod/Raytracing/Gui/Command.cpp @@ -150,7 +150,7 @@ void CmdRaytracingWriteCamera::activated(int iMsg) << "(" << upvec.getValue()[0] <<"," << upvec.getValue()[1] <<"," << upvec.getValue()[2] <<") )" ; doCommand(Doc,"import Raytracing"); - doCommand(Gui,out.str().c_str()); + doCommand(Gui,"%s", out.str().c_str()); // Bring ref-count of root-node back to zero to cause the // destruction of the camera. @@ -201,7 +201,7 @@ void CmdRaytracingWritePart::activated(int iMsg) << Name << "\",App.ActiveDocument." << obj.front()->getNameInDocument() << ".Shape)"; doCommand(Doc,"import Raytracing"); - doCommand(Doc,out.str().c_str()); + doCommand(Doc,"%s",out.str().c_str()); } bool CmdRaytracingWritePart::isActive(void) diff --git a/src/Mod/ReverseEngineering/Gui/Command.cpp b/src/Mod/ReverseEngineering/Gui/Command.cpp index a407754e0..6b4d96239 100644 --- a/src/Mod/ReverseEngineering/Gui/Command.cpp +++ b/src/Mod/ReverseEngineering/Gui/Command.cpp @@ -171,7 +171,7 @@ void CmdApproxPlane::activated(int iMsg) << "Base.Rotation(" << q0 << "," << q1 << "," << q2 << "," << q3 << "))" << std::endl; openCommand("Fit plane"); - doCommand(Gui::Command::Doc, str.str().c_str()); + runCommand(Gui::Command::Doc, str.str().c_str()); commitCommand(); updateActive(); } @@ -251,7 +251,7 @@ void CmdViewTriangulation::activated(int iMsg) .arg(document) .arg(object) ; - doCommand(Doc, command.toLatin1()); + runCommand(Doc, command.toLatin1()); } commitCommand(); diff --git a/src/Mod/ReverseEngineering/Gui/FitBSplineSurface.cpp b/src/Mod/ReverseEngineering/Gui/FitBSplineSurface.cpp index 7db53bd6e..130f368d7 100644 --- a/src/Mod/ReverseEngineering/Gui/FitBSplineSurface.cpp +++ b/src/Mod/ReverseEngineering/Gui/FitBSplineSurface.cpp @@ -165,7 +165,7 @@ bool FitBSplineSurfaceWidget::accept() Gui::WaitCursor wc; Gui::Command::addModule(Gui::Command::App, "ReverseEngineering"); Gui::Command::openCommand("Fit B-Spline"); - Gui::Command::doCommand(Gui::Command::Doc, command.toLatin1()); + Gui::Command::runCommand(Gui::Command::Doc, command.toLatin1()); Gui::Command::commitCommand(); Gui::Command::updateActive(); } diff --git a/src/Mod/ReverseEngineering/Gui/Poisson.cpp b/src/Mod/ReverseEngineering/Gui/Poisson.cpp index 22cc77331..2ba2de6ce 100644 --- a/src/Mod/ReverseEngineering/Gui/Poisson.cpp +++ b/src/Mod/ReverseEngineering/Gui/Poisson.cpp @@ -99,7 +99,7 @@ bool PoissonWidget::accept() Gui::WaitCursor wc; Gui::Command::addModule(Gui::Command::App, "ReverseEngineering"); Gui::Command::openCommand("Poisson reconstruction"); - Gui::Command::doCommand(Gui::Command::Doc, command.toLatin1()); + Gui::Command::runCommand(Gui::Command::Doc, command.toLatin1()); Gui::Command::commitCommand(); Gui::Command::updateActive(); } diff --git a/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp b/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp index 4de8ec6c5..09f490d37 100644 --- a/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp +++ b/src/Mod/Sketcher/Gui/ViewProviderSketch.cpp @@ -4255,7 +4255,7 @@ bool ViewProviderSketch::setEdit(int ModNum) ); cmdstr.replace(QString::fromLatin1("{sketch_name}"),QString::fromLatin1(this->getSketchObject()->getNameInDocument())); QByteArray cmdstr_bytearray = cmdstr.toLatin1(); - Gui::Command::doCommand(Gui::Command::Gui, cmdstr_bytearray.data()); + Gui::Command::runCommand(Gui::Command::Gui, cmdstr_bytearray); } catch (Base::PyException &e){ Base::Console().Error("ViewProviderSketch::setEdit: visibility automation failed with an error: \n"); e.ReportException(); @@ -4620,7 +4620,7 @@ void ViewProviderSketch::unsetEdit(int ModNum) ); cmdstr.replace(QString::fromLatin1("{sketch_name}"),QString::fromLatin1(this->getSketchObject()->getNameInDocument())); QByteArray cmdstr_bytearray = cmdstr.toLatin1(); - Gui::Command::doCommand(Gui::Command::Gui, cmdstr_bytearray.data()); + Gui::Command::runCommand(Gui::Command::Gui, cmdstr_bytearray); } catch (Base::PyException &e){ Base::Console().Error("ViewProviderSketch::unsetEdit: visibility automation failed with an error: \n"); e.ReportException(); @@ -4667,7 +4667,7 @@ void ViewProviderSketch::setEditViewer(Gui::View3DInventorViewer* viewer, int Mo ); cmdstr.replace(QString::fromLatin1("{sketch_name}"),QString::fromLatin1(this->getSketchObject()->getNameInDocument())); QByteArray cmdstr_bytearray = cmdstr.toLatin1(); - Gui::Command::doCommand(Gui::Command::Gui, cmdstr_bytearray.data()); + Gui::Command::runCommand(Gui::Command::Gui, cmdstr_bytearray); } catch (Base::PyException &e){ Base::Console().Error("ViewProviderSketch::setEdit: visibility automation failed with an error: \n"); e.ReportException();