PD: If needed open another transaction for sketch creation

When creating a sketch in PartDesign a dialog is opened that gives the user the possibility to perform another action that may close the
active transaction. To make sure the creation of the sketch can be undone a new transaction must be opened.
This commit is contained in:
wmayer
2024-11-04 11:14:36 -06:00
committed by Chris Hennes
parent f2bf2a4bcc
commit 644f0bf48b
+6 -1
View File
@@ -618,8 +618,13 @@ private:
std::string FeatName = documentOfBody->getUniqueObjectName("Sketch");
std::string supportString = Gui::Command::getObjectCmd(plane,"(",",[''])");
App::Document* doc = partDesignBody->getDocument();
if (!doc->hasPendingTransaction()) {
doc->openTransaction(QT_TRANSLATE_NOOP("Command", "Create a new Sketch"));
}
FCMD_OBJ_CMD(partDesignBody,"newObject('Sketcher::SketchObject','" << FeatName << "')");
auto Feat = partDesignBody->getDocument()->getObject(FeatName.c_str());
auto Feat = doc->getObject(FeatName.c_str());
FCMD_OBJ_CMD(Feat,"AttachmentSupport = " << supportString);
FCMD_OBJ_CMD(Feat,"MapMode = '" << Attacher::AttachEngine::getModeName(Attacher::mmFlatFace)<<"'");
Gui::Command::updateActive(); // Make sure the AttachmentSupport's Placement property is updated