Attacher: use getModeName() instead of eMapModeStrings[]
getModeName() does range checking. eMapModeStrings[] will crash if out of range.
This commit is contained in:
@@ -423,7 +423,7 @@ void CmdPartDesignNewSketch::activated(int iMsg)
|
||||
openCommand("Create a Sketch on Face");
|
||||
doCommand(Doc,"App.activeDocument().addObject('Sketcher::SketchObject','%s')",FeatName.c_str());
|
||||
doCommand(Doc,"App.activeDocument().%s.Support = %s",FeatName.c_str(),supportString.c_str());
|
||||
doCommand(Doc,"App.activeDocument().%s.MapMode = '%s'",FeatName.c_str(),Attacher::AttachEngine::eMapModeStrings[Attacher::mmFlatFace]);
|
||||
doCommand(Doc,"App.activeDocument().%s.MapMode = '%s'",FeatName.c_str(),Attacher::AttachEngine::getModeName(Attacher::mmFlatFace).c_str());
|
||||
doCommand(Doc,"App.activeDocument().%s.addFeature(App.activeDocument().%s)",
|
||||
pcActiveBody->getNameInDocument(), FeatName.c_str());
|
||||
doCommand(Gui,"App.activeDocument().recompute()"); // recompute the sketch placement based on its support
|
||||
@@ -511,7 +511,7 @@ void CmdPartDesignNewSketch::activated(int iMsg)
|
||||
Gui::Command::openCommand("Create a new Sketch");
|
||||
Gui::Command::doCommand(Doc,"App.activeDocument().addObject('Sketcher::SketchObject','%s')",FeatName.c_str());
|
||||
Gui::Command::doCommand(Doc,"App.activeDocument().%s.Support = %s",FeatName.c_str(),supportString.c_str());
|
||||
Gui::Command::doCommand(Doc,"App.activeDocument().%s.MapMode = '%s'",FeatName.c_str(),Attacher::AttachEngine::eMapModeStrings[Attacher::mmFlatFace]);
|
||||
Gui::Command::doCommand(Doc,"App.activeDocument().%s.MapMode = '%s'",FeatName.c_str(),Attacher::AttachEngine::getModeName(Attacher::mmFlatFace).c_str());
|
||||
Gui::Command::updateActive(); // Make sure the Support's Placement property is updated
|
||||
Gui::Command::doCommand(Doc,"App.activeDocument().%s.addFeature(App.activeDocument().%s)",
|
||||
pcActiveBody->getNameInDocument(), FeatName.c_str());
|
||||
|
||||
@@ -951,7 +951,7 @@ bool TaskDlgDatumParameters::accept()
|
||||
//here it is assumed that the support was already assigned, it just outputs a dummy Python command to the console
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.Support = %s", name.c_str(), pcDatum->Support.getPyReprString().c_str());
|
||||
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.MapMode = '%s'", name.c_str(), AttachEngine::eMapModeStrings[parameter->getActiveMapMode()]);
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.MapMode = '%s'", name.c_str(), AttachEngine::getModeName(parameter->getActiveMapMode()).c_str());
|
||||
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.recompute()");
|
||||
if (!DatumView->getObject()->isValid())
|
||||
|
||||
@@ -196,7 +196,7 @@ void fixSketchSupport (Sketcher::SketchObject* sketch)
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.activeDocument().%s.MapReversed = %s",
|
||||
sketch->getNameInDocument(), reverseSketch ? "True" : "False");
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.activeDocument().%s.MapMode = '%s'",
|
||||
sketch->getNameInDocument(), Attacher::AttachEngine::eMapModeStrings[Attacher::mmFlatFace]);
|
||||
sketch->getNameInDocument(), Attacher::AttachEngine::getModeName(Attacher::mmFlatFace).c_str());
|
||||
|
||||
} else {
|
||||
// Offset to base plane
|
||||
@@ -213,7 +213,7 @@ void fixSketchSupport (Sketcher::SketchObject* sketch)
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.activeDocument().%s.Support = %s",
|
||||
Datum.c_str(), refStr.toStdString().c_str());
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.activeDocument().%s.MapMode = '%s'",
|
||||
Datum.c_str(), AttachEngine::eMapModeStrings[Attacher::mmFlatFace]);
|
||||
Datum.c_str(), AttachEngine::getModeName(Attacher::mmFlatFace).c_str());
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.activeDocument().%s.superPlacement.Base.z = %f",
|
||||
Datum.c_str(), offset);
|
||||
Gui::Command::doCommand(Gui::Command::Doc,
|
||||
@@ -225,7 +225,7 @@ void fixSketchSupport (Sketcher::SketchObject* sketch)
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.activeDocument().%s.MapReversed = %s",
|
||||
sketch->getNameInDocument(), reverseSketch ? "True" : "False");
|
||||
Gui::Command::doCommand(Gui::Command::Doc,"App.activeDocument().%s.MapMode = '%s'",
|
||||
sketch->getNameInDocument(),Attacher::AttachEngine::eMapModeStrings[Attacher::mmFlatFace]);
|
||||
sketch->getNameInDocument(),Attacher::AttachEngine::getModeName(Attacher::mmFlatFace).c_str());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user