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

Fem: Make pipeline filters invisible if a new filter is added #13701

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/Mod/Fem/Gui/Command.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,18 +82,18 @@
}

// OvG: Visibility automation show parts and hide meshes on activation of a constraint
std::string gethideMeshShowPartStr(std::string showConstr = "")

Check warning on line 85 in src/Mod/Fem/Gui/Command.cpp

View workflow job for this annotation

GitHub Actions / Lint / Lint

the parameter 'showConstr' is copied for each invocation but only used as a const reference; consider making it a const reference [performance-unnecessary-value-param]
{
return "for amesh in App.activeDocument().Objects:\n\

Check warning on line 87 in src/Mod/Fem/Gui/Command.cpp

View workflow job for this annotation

GitHub Actions / Lint / Lint

Multi-line string ("...") found. This lint script doesn't do well with such strings, and may give bogus warnings. Use C++11 raw strings or concatenation instead. [readability/multiline_string] [5]
if \""

Check warning on line 88 in src/Mod/Fem/Gui/Command.cpp

View workflow job for this annotation

GitHub Actions / Lint / Lint

Multi-line string ("...") found. This lint script doesn't do well with such strings, and may give bogus warnings. Use C++11 raw strings or concatenation instead. [readability/multiline_string] [5]
+ showConstr + "\" == amesh.Name:\n\

Check warning on line 89 in src/Mod/Fem/Gui/Command.cpp

View workflow job for this annotation

GitHub Actions / Lint / Lint

Multi-line string ("...") found. This lint script doesn't do well with such strings, and may give bogus warnings. Use C++11 raw strings or concatenation instead. [readability/multiline_string] [5]
amesh.ViewObject.Visibility = True\n\
elif \"Mesh\" in amesh.TypeId:\n\
aparttoshow = amesh.Name.replace(\"_Mesh\",\"\")\n\
for apart in App.activeDocument().Objects:\n\
if aparttoshow == apart.Name:\n\
apart.ViewObject.Visibility = True\n\
amesh.ViewObject.Visibility = False\n";

Check warning on line 96 in src/Mod/Fem/Gui/Command.cpp

View workflow job for this annotation

GitHub Actions / Lint / Lint

Multi-line string ("...") found. This lint script doesn't do well with such strings, and may give bogus warnings. Use C++11 raw strings or concatenation instead. [readability/multiline_string] [5]
}


Expand Down Expand Up @@ -187,9 +187,9 @@
sPixmap = "FEM_ConstraintBearing";
}

void CmdFemConstraintBearing::activated(int)

Check warning on line 190 in src/Mod/Fem/Gui/Command.cpp

View workflow job for this annotation

GitHub Actions / Lint / Lint

all parameters should be named in a function [readability-named-parameter]
{
Fem::FemAnalysis* Analysis;

Check warning on line 192 in src/Mod/Fem/Gui/Command.cpp

View workflow job for this annotation

GitHub Actions / Lint / Lint

variable 'Analysis' is not initialized [cppcoreguidelines-init-variables]

if (getConstraintPrerequisits(&Analysis)) {
return;
Expand All @@ -198,20 +198,20 @@
std::string FeatName = getUniqueObjectName("ConstraintBearing");

openCommand(QT_TRANSLATE_NOOP("Command", "Make bearing constraint"));
doCommand(Doc,

Check warning on line 201 in src/Mod/Fem/Gui/Command.cpp

View workflow job for this annotation

GitHub Actions / Lint / Lint

do not call c-style vararg functions [cppcoreguidelines-pro-type-vararg]
"App.activeDocument().addObject(\"Fem::ConstraintBearing\",\"%s\")",
FeatName.c_str());
doCommand(Doc,

Check warning on line 204 in src/Mod/Fem/Gui/Command.cpp

View workflow job for this annotation

GitHub Actions / Lint / Lint

do not call c-style vararg functions [cppcoreguidelines-pro-type-vararg]
"App.activeDocument().%s.addObject(App.activeDocument().%s)",
Analysis->getNameInDocument(),
FeatName.c_str());

// OvG: Hide meshes and show parts
doCommand(Doc, "%s", gethideMeshShowPartStr(FeatName).c_str());

Check warning on line 210 in src/Mod/Fem/Gui/Command.cpp

View workflow job for this annotation

GitHub Actions / Lint / Lint

do not call c-style vararg functions [cppcoreguidelines-pro-type-vararg]

updateActive();

doCommand(Gui, "Gui.activeDocument().setEdit('%s')", FeatName.c_str());

Check warning on line 214 in src/Mod/Fem/Gui/Command.cpp

View workflow job for this annotation

GitHub Actions / Lint / Lint

do not call c-style vararg functions [cppcoreguidelines-pro-type-vararg]
}

bool CmdFemConstraintBearing::isActive()
Expand Down Expand Up @@ -1666,6 +1666,14 @@
cmd->doCommand(Gui::Command::Doc,
"__list__ = App.ActiveDocument.%s.Filter",
pipeline->getNameInDocument());
cmd->doCommand(Gui::Command::Doc,
"App.ActiveDocument.%s.ViewObject.Visibility = False",
pipeline->getNameInDocument());

std::ostringstream oss;
oss << "for _ in __list__:\n";
oss << " _.ViewObject.Visibility = False";
cmd->doCommand(Gui::Command::Doc, oss.str().c_str());
cmd->doCommand(Gui::Command::Doc, "__list__.append(App.ActiveDocument.%s)", FeatName.c_str());
cmd->doCommand(Gui::Command::Doc,
"App.ActiveDocument.%s.Filter = __list__",
Expand Down Expand Up @@ -1722,7 +1730,7 @@
.toStdString();

std::ostringstream oss;
oss << "t=t_coords[len(t_coords)-1]\n\

Check warning on line 1733 in src/Mod/Fem/Gui/Command.cpp

View workflow job for this annotation

GitHub Actions / Lint / Lint

Multi-line string ("...") found. This lint script doesn't do well with such strings, and may give bogus warnings. Use C++11 raw strings or concatenation instead. [readability/multiline_string] [5]
for i in range(len(t_coords)):\n\
dum = t_coords[i]\n\
t_coords[i] = dum - t_coords[len(t_coords)-1]*0.5\n\
Expand Down Expand Up @@ -1751,8 +1759,8 @@
from PySide import QtCore\n\
import numpy as np\n\
from matplotlib import pyplot as plt\n\
plt.figure(\""

Check warning on line 1762 in src/Mod/Fem/Gui/Command.cpp

View workflow job for this annotation

GitHub Actions / Lint / Lint

Multi-line string ("...") found. This lint script doesn't do well with such strings, and may give bogus warnings. Use C++11 raw strings or concatenation instead. [readability/multiline_string] [5]
<< titleLabel << "\")\n\

Check warning on line 1763 in src/Mod/Fem/Gui/Command.cpp

View workflow job for this annotation

GitHub Actions / Lint / Lint

Multi-line string ("...") found. This lint script doesn't do well with such strings, and may give bogus warnings. Use C++11 raw strings or concatenation instead. [readability/multiline_string] [5]
plt.plot(t_coords, membrane, \"k--\")\n\
plt.plot(t_coords, mb, \"b*-\")\n\
plt.plot(t_coords, peak, \"r-x\")\n\
Expand All @@ -1772,10 +1780,10 @@
FreeCAD.Console.PrintError('Total stress max = ')\n\
FreeCAD.Console.PrintError([str(round(peak[len(t_coords)-1],2))])\n\
plt.ioff()\n\
plt.legend([\""

Check warning on line 1783 in src/Mod/Fem/Gui/Command.cpp

View workflow job for this annotation

GitHub Actions / Lint / Lint

Multi-line string ("...") found. This lint script doesn't do well with such strings, and may give bogus warnings. Use C++11 raw strings or concatenation instead. [readability/multiline_string] [5]
<< legendEntryA << "\", \"" << legendEntryB << "\", \"" << legendEntryC
<< "\"], loc = \"best\")\n\

Check warning on line 1785 in src/Mod/Fem/Gui/Command.cpp

View workflow job for this annotation

GitHub Actions / Lint / Lint

Multi-line string ("...") found. This lint script doesn't do well with such strings, and may give bogus warnings. Use C++11 raw strings or concatenation instead. [readability/multiline_string] [5]
plt.xlabel(\""

Check warning on line 1786 in src/Mod/Fem/Gui/Command.cpp

View workflow job for this annotation

GitHub Actions / Lint / Lint

Multi-line string ("...") found. This lint script doesn't do well with such strings, and may give bogus warnings. Use C++11 raw strings or concatenation instead. [readability/multiline_string] [5]
<< xAxisLabel << "\")\n\
plt.ylabel(\""
<< yAxisLabel << "\")\n\
Expand Down