Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0002533 Fix: Don't start PartDesign loft if no active body in document #211

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions src/Mod/PartDesign/Gui/Command.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1122,6 +1122,20 @@ CmdPartDesignAdditiveLoft::CmdPartDesignAdditiveLoft()

void CmdPartDesignAdditiveLoft::activated(int iMsg)
{
App::Document *doc = getDocument();
PartDesign::Body *pcActiveBody = PartDesignGui::getBody(
/*messageIfNot = */ PartDesignGui::assureModernWorkflow(doc));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The loft (and sweep) are not available in legacy workflow, hence they should only work with bodies, never without and hence never in legacyworkflow. hence it is better to remove the workflow query and always set messageIfnot to true.


// No PartDesign feature without Body past FreeCAD 0.13
if (!pcActiveBody) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Loft (as well as sweep and some others) are not available in the legacy part design, hence this workaround should not be used and the function should return directly.

// Call normal loft command for old workflow
if (PartDesignGui::isLegacyWorkflow(doc)) {
Gui::CommandManager &rcCmdMgr = Gui::Application::Instance->commandManager();
rcCmdMgr.runCommandByName("Part_Loft");
}
return;
}

Gui::Command* cmd = this;
auto worker = [cmd](Part::Feature* sketch, std::string FeatName) {

Expand Down Expand Up @@ -1162,6 +1176,20 @@ CmdPartDesignSubtractiveLoft::CmdPartDesignSubtractiveLoft()

void CmdPartDesignSubtractiveLoft::activated(int iMsg)
{
App::Document *doc = getDocument();
PartDesign::Body *pcActiveBody = PartDesignGui::getBody(
/*messageIfNot = */ PartDesignGui::assureModernWorkflow(doc));

// No PartDesign feature without Body past FreeCAD 0.13
if (!pcActiveBody) {
// Call normal loft command for old workflow
if (PartDesignGui::isLegacyWorkflow(doc)) {
Gui::CommandManager &rcCmdMgr = Gui::Application::Instance->commandManager();
rcCmdMgr.runCommandByName("Part_Loft");
}
return;
}

Gui::Command* cmd = this;
auto worker = [cmd](Part::Feature* sketch, std::string FeatName) {

Expand Down