Sketcher: error message when trying to increase the degree of not-a-bspline fixes #3471
This commit is contained in:
@@ -452,6 +452,8 @@ void CmdSketcherIncreaseDegree::activated(int iMsg)
|
||||
Sketcher::SketchObject* Obj = static_cast<Sketcher::SketchObject*>(selection[0].getObject());
|
||||
|
||||
openCommand("Increase degree");
|
||||
|
||||
bool ignored=false;
|
||||
|
||||
for (unsigned int i=0; i<SubNames.size(); i++ ) {
|
||||
// only handle edges
|
||||
@@ -459,18 +461,31 @@ void CmdSketcherIncreaseDegree::activated(int iMsg)
|
||||
|
||||
int GeoId = std::atoi(SubNames[i].substr(4,4000).c_str()) - 1;
|
||||
|
||||
Gui::Command::doCommand(
|
||||
Doc,"App.ActiveDocument.%s.increaseBSplineDegree(%d) ",
|
||||
selection[0].getFeatName(),GeoId);
|
||||
|
||||
// add new control points
|
||||
Gui::Command::doCommand(Gui::Command::Doc,
|
||||
"App.ActiveDocument.%s.exposeInternalGeometry(%d)",
|
||||
selection[0].getFeatName(),
|
||||
GeoId);
|
||||
const Part::Geometry * geo = Obj->getGeometry(GeoId);
|
||||
|
||||
if (geo->getTypeId() == Part::GeomBSplineCurve::getClassTypeId()) {
|
||||
|
||||
Gui::Command::doCommand(
|
||||
Doc,"App.ActiveDocument.%s.increaseBSplineDegree(%d) ",
|
||||
selection[0].getFeatName(),GeoId);
|
||||
|
||||
// add new control points
|
||||
Gui::Command::doCommand(Gui::Command::Doc,
|
||||
"App.ActiveDocument.%s.exposeInternalGeometry(%d)",
|
||||
selection[0].getFeatName(),
|
||||
GeoId);
|
||||
}
|
||||
else {
|
||||
ignored=true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(ignored) {
|
||||
QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Wrong selection"),
|
||||
QObject::tr("At least one of the selected objects was not a B-Spline and was ignored."));
|
||||
}
|
||||
|
||||
commitCommand();
|
||||
|
||||
tryAutoRecomputeIfNotSolve(Obj);
|
||||
|
||||
Reference in New Issue
Block a user