Skip to content

Commit

Permalink
PD: If needed open another transaction for sketch creation
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
wwmayer committed Nov 2, 2024
1 parent 400d5c4 commit 5ea04e7
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Mod/PartDesign/Gui/SketchWorkflow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -618,8 +618,13 @@ class SketchRequestSelection
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
Expand Down

0 comments on commit 5ea04e7

Please sign in to comment.