diff --git a/src/Mod/PartDesign/Gui/CommandBody.cpp b/src/Mod/PartDesign/Gui/CommandBody.cpp index 3be347b2c3..65014d6960 100644 --- a/src/Mod/PartDesign/Gui/CommandBody.cpp +++ b/src/Mod/PartDesign/Gui/CommandBody.cpp @@ -189,41 +189,45 @@ void CmdPartDesignBody::activated(int iMsg) openCommand(QT_TRANSLATE_NOOP("Command", "Add a Body")); std::string bodyName = getUniqueObjectName("Body"); + const char* bodyString = bodyName.c_str(); // add the Body feature itself, and make it active - doCommand(Doc,"App.activeDocument().addObject('PartDesign::Body','%s')", bodyName.c_str()); + doCommand(Doc,"App.activeDocument().addObject('PartDesign::Body','%s')", bodyString); + // set Label for i18n/L10N + QByteArray labelByteArray = QObject::tr("Body").toUtf8(); + doCommand(Doc,"App.ActiveDocument.getObject('%s').Label = '%s'", bodyString, labelByteArray.constData()); if (baseFeature) { if (partOfBaseFeature){ - //withdraw base feature from Part, otherwise visibility mandess results + //withdraw base feature from Part, otherwise visibility madness results doCommand(Doc,"App.activeDocument().%s.removeObject(App.activeDocument().%s)", partOfBaseFeature->getNameInDocument(), baseFeature->getNameInDocument()); } if (addtogroup) { doCommand(Doc,"App.activeDocument().%s.Group = [App.activeDocument().%s]", - bodyName.c_str(), baseFeature->getNameInDocument()); + bodyString, baseFeature->getNameInDocument()); } else { doCommand(Doc,"App.activeDocument().%s.BaseFeature = App.activeDocument().%s", - bodyName.c_str(), baseFeature->getNameInDocument()); + bodyString, baseFeature->getNameInDocument()); } } addModule(Gui,"PartDesignGui"); // import the Gui module only once a session doCommand(Gui::Command::Gui, "Gui.activateView('Gui::View3DInventor', True)\n" "Gui.activeView().setActiveObject('%s', App.activeDocument().%s)", - PDBODYKEY, bodyName.c_str()); + PDBODYKEY, bodyString); // Make the "Create sketch" prompt appear in the task panel doCommand(Gui,"Gui.Selection.clearSelection()"); - doCommand(Gui,"Gui.Selection.addSelection(App.ActiveDocument.%s)", bodyName.c_str()); + doCommand(Gui,"Gui.Selection.addSelection(App.ActiveDocument.%s)", bodyString); if (actPart) { doCommand(Doc,"App.activeDocument().%s.addObject(App.ActiveDocument.%s)", - actPart->getNameInDocument(), bodyName.c_str()); + actPart->getNameInDocument(), bodyString); } // check if a proxy object has been created for the base feature inside the body if (baseFeature) { PartDesign::Body* body = dynamic_cast - (baseFeature->getDocument()->getObject(bodyName.c_str())); + (baseFeature->getDocument()->getObject(bodyString)); if (body) { std::vector links = body->Group.getValues(); for (auto it : links) {