Fem: Add command to clear mesh groups
This commit is contained in:
committed by
Chris Hennes
parent
b55dd47120
commit
9e065cdb7f
@@ -60,6 +60,7 @@
|
||||
<file>icons/FEM_FEMMesh2Mesh.svg</file>
|
||||
<file>icons/FEM_MeshBoundaryLayer.svg</file>
|
||||
<file>icons/FEM_MeshClear.svg</file>
|
||||
<file>icons/FEM_MeshClearGroups.svg</file>
|
||||
<file>icons/FEM_MeshDisplayInfo.svg</file>
|
||||
<file>icons/FEM_MeshGmshFromShape.svg</file>
|
||||
<file>icons/FEM_MeshGroup.svg</file>
|
||||
|
||||
@@ -0,0 +1,243 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
width="64px"
|
||||
height="64px"
|
||||
id="svg2860"
|
||||
version="1.1"
|
||||
sodipodi:docname="FEM_MeshClearGroups.svg"
|
||||
inkscape:version="1.4 (e7c3feb100, 2024-10-09)"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/">
|
||||
<sodipodi:namedview
|
||||
id="namedview1"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#000000"
|
||||
borderopacity="0.25"
|
||||
inkscape:showpageshadow="2"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pagecheckerboard="0"
|
||||
inkscape:deskcolor="#d1d1d1"
|
||||
inkscape:zoom="5.5625784"
|
||||
inkscape:cx="29.392844"
|
||||
inkscape:cy="23.460343"
|
||||
inkscape:window-width="1920"
|
||||
inkscape:window-height="1040"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="0"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="svg2860" />
|
||||
<defs
|
||||
id="defs2862">
|
||||
<linearGradient
|
||||
gradientTransform="translate(0,-4)"
|
||||
xlink:href="#linearGradient3767"
|
||||
id="linearGradient3773"
|
||||
x1="22.116516"
|
||||
y1="55.717518"
|
||||
x2="17.328547"
|
||||
y2="21.31134"
|
||||
gradientUnits="userSpaceOnUse" />
|
||||
<linearGradient
|
||||
id="linearGradient3767">
|
||||
<stop
|
||||
style="stop-color:#edd400;stop-opacity:1"
|
||||
offset="0"
|
||||
id="stop3769" />
|
||||
<stop
|
||||
style="stop-color:#fce94f;stop-opacity:1"
|
||||
offset="1"
|
||||
id="stop3771" />
|
||||
</linearGradient>
|
||||
<linearGradient
|
||||
gradientTransform="translate(0,-4)"
|
||||
xlink:href="#linearGradient3777"
|
||||
id="linearGradient3783"
|
||||
x1="53.896763"
|
||||
y1="51.179787"
|
||||
x2="47.502235"
|
||||
y2="21.83742"
|
||||
gradientUnits="userSpaceOnUse" />
|
||||
<linearGradient
|
||||
id="linearGradient3777">
|
||||
<stop
|
||||
style="stop-color:#c4a000;stop-opacity:1"
|
||||
offset="0"
|
||||
id="stop3779" />
|
||||
<stop
|
||||
style="stop-color:#edd400;stop-opacity:1"
|
||||
offset="1"
|
||||
id="stop3781" />
|
||||
</linearGradient>
|
||||
<linearGradient
|
||||
xlink:href="#linearGradient3891"
|
||||
id="linearGradient3897"
|
||||
x1="130.56519"
|
||||
y1="118.31313"
|
||||
x2="147.897"
|
||||
y2="157.05659"
|
||||
gradientUnits="userSpaceOnUse" />
|
||||
<linearGradient
|
||||
id="linearGradient3891">
|
||||
<stop
|
||||
style="stop-color:#a40000;stop-opacity:1"
|
||||
offset="0"
|
||||
id="stop3893" />
|
||||
<stop
|
||||
style="stop-color:#ef2929;stop-opacity:1"
|
||||
offset="1"
|
||||
id="stop3895" />
|
||||
</linearGradient>
|
||||
<linearGradient
|
||||
xlink:href="#linearGradient3891"
|
||||
id="linearGradient3905"
|
||||
x1="145.72011"
|
||||
y1="158.3524"
|
||||
x2="127.68171"
|
||||
y2="117.97237"
|
||||
gradientUnits="userSpaceOnUse" />
|
||||
</defs>
|
||||
<metadata
|
||||
id="metadata2865">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:creator>
|
||||
<cc:Agent>
|
||||
<dc:title>[bitacobir]</dc:title>
|
||||
</cc:Agent>
|
||||
</dc:creator>
|
||||
<dc:date>2020-03-16</dc:date>
|
||||
<dc:relation />
|
||||
<dc:publisher>
|
||||
<cc:Agent>
|
||||
<dc:title>FreeCAD</dc:title>
|
||||
</cc:Agent>
|
||||
</dc:publisher>
|
||||
<dc:identifier />
|
||||
<dc:rights>
|
||||
<cc:Agent>
|
||||
<dc:title>FreeCAD LGPL2+</dc:title>
|
||||
</cc:Agent>
|
||||
</dc:rights>
|
||||
<cc:license>https://www.gnu.org/copyleft/lesser.html</cc:license>
|
||||
<dc:contributor>
|
||||
<cc:Agent>
|
||||
<dc:title />
|
||||
</cc:Agent>
|
||||
</dc:contributor>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g
|
||||
id="layer1">
|
||||
<path
|
||||
style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||
d="m 55.818182,23.636364 c 0.242424,0 0.242424,0 0,0 z"
|
||||
id="path2422" />
|
||||
<path
|
||||
style="fill:#fce94f;stroke:#302b00;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-opacity:1"
|
||||
d="M 3,13 37,19 61,11 31,7 z"
|
||||
id="path2993" />
|
||||
<path
|
||||
style="fill:url(#linearGradient3783);fill-opacity:1;stroke:#302b00;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none"
|
||||
d="M 61,11 61,47 37,57 37,19 z"
|
||||
id="path2995" />
|
||||
<path
|
||||
id="path3825"
|
||||
d="M 3,13 37,19 37,57 3,51 z"
|
||||
style="fill:url(#linearGradient3773);fill-opacity:1;fill-rule:evenodd;stroke:#302b00;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
|
||||
<path
|
||||
style="fill:none;stroke:#fce94f;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||
d="m 5,15.42772 0.00867,33.919116 30.008671,5.268799 -0.0087,-33.933614 z"
|
||||
id="path3765" />
|
||||
<path
|
||||
style="fill:none;stroke:#edd400;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||
d="m 39.01243,20.433833 -0.01226,33.535301 20.001105,-8.300993 3.6e-4,-31.867363 z"
|
||||
id="path3775" />
|
||||
<path
|
||||
style="fill:none;stroke:#302b00;stroke-width:2;stroke-linecap:round;stroke-linejoin:miter;stroke-opacity:1"
|
||||
d="M 25,54 25,17"
|
||||
id="path3051" />
|
||||
<path
|
||||
style="fill:none;stroke:#302b00;stroke-width:2;stroke-linecap:round;stroke-linejoin:miter;stroke-opacity:1"
|
||||
d="M 13,52 13,15"
|
||||
id="path3051-3" />
|
||||
<path
|
||||
style="fill:none;stroke:#302b00;stroke-width:2;stroke-linecap:round;stroke-linejoin:miter;stroke-opacity:1"
|
||||
d="M 47,51.999998 47,16"
|
||||
id="path3051-6" />
|
||||
<path
|
||||
style="fill:none;stroke:#302b00;stroke-width:2;stroke-linecap:round;stroke-linejoin:miter;stroke-opacity:1"
|
||||
d="M 55,49.5 55,13"
|
||||
id="path3051-7" />
|
||||
<path
|
||||
style="fill:none;stroke:#302b00;stroke-width:2;stroke-linecap:round;stroke-linejoin:miter;stroke-opacity:1"
|
||||
d="M 24.363636,8.5909091 55,13"
|
||||
id="path3853" />
|
||||
<path
|
||||
style="fill:none;stroke:#302b00;stroke-width:2;stroke-linecap:round;stroke-linejoin:miter;stroke-opacity:1"
|
||||
d="M 13.75,10.875 47,16"
|
||||
id="path3873" />
|
||||
<path
|
||||
style="fill:none;stroke:#302b00;stroke-width:2;stroke-linecap:round;stroke-linejoin:miter;stroke-opacity:1"
|
||||
d="M 13.049334,14.759655 40.369369,8.1385643"
|
||||
id="path3875" />
|
||||
<path
|
||||
style="fill:none;stroke:#302b00;stroke-width:2;stroke-linecap:round;stroke-linejoin:miter;stroke-opacity:1"
|
||||
d="M 25.745115,16.848834 50.365288,9.5849195"
|
||||
id="path3875-3" />
|
||||
<path
|
||||
style="fill:none;stroke:#302b00;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||
d="m 3,25 34,6"
|
||||
id="path3895" />
|
||||
<path
|
||||
style="fill:none;stroke:#302b00;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||
d="m 3,39 34,6"
|
||||
id="path3895-5" />
|
||||
<path
|
||||
style="fill:none;stroke:#302b00;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||
d="M 37,45 61,35"
|
||||
id="path3915" />
|
||||
<path
|
||||
style="fill:none;stroke:#302b00;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||
d="M 37,31 61,23"
|
||||
id="path3915-6" />
|
||||
<path
|
||||
style="fill:none;stroke:#cc0000;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:6,6;stroke-dashoffset:0"
|
||||
d="M 37,45 55,37.46954 V 13 L 33.577955,9.9829446 13.049334,14.759655 13,40.691839 Z"
|
||||
id="path1" />
|
||||
<path
|
||||
style="fill:none;stroke:#ef2929;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:6,6;stroke-dashoffset:0"
|
||||
d="M 33.666016,12.013672 53,14.738281 v 21.398438 l -16.228516,6.791015 -21.767578,-3.908203 0.04102,-22.671875 z"
|
||||
id="path7" />
|
||||
<path
|
||||
style="fill:none;stroke:#cc0000;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:6,6;stroke-dashoffset:0"
|
||||
d="M 13.049334,14.759655 37,19 55,13"
|
||||
id="path2" />
|
||||
<path
|
||||
style="fill:none;stroke:#cc0000;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:6,6;stroke-dashoffset:0"
|
||||
d="M 37,19 V 45"
|
||||
id="path3" />
|
||||
<path
|
||||
style="fill:none;stroke:#cc0000;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:6,6;stroke-dashoffset:0"
|
||||
d="M 25,42.845919 25.02467,17.035734 44.522841,11.335565"
|
||||
id="path4" />
|
||||
<path
|
||||
style="fill:none;stroke:#cc0000;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:6,6;stroke-dashoffset:0"
|
||||
d="m 23.079783,12.371299 23.933616,3.706655 v 24.883978"
|
||||
id="path5" />
|
||||
<path
|
||||
style="fill:none;stroke:#cc0000;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:6,6;stroke-dashoffset:0"
|
||||
d="M 13.024667,26.790302 37,31 55,25.000909"
|
||||
id="path6" />
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 9.2 KiB |
@@ -89,6 +89,7 @@ void Workbench::setupContextMenu(const char* recipient, Gui::MenuItem* item) con
|
||||
StdWorkbench::setupContextMenu(recipient, item);
|
||||
*item << "Separator"
|
||||
<< "FEM_MeshClear"
|
||||
<< "FEM_MeshClearGroups"
|
||||
<< "FEM_MeshDisplayInfo";
|
||||
}
|
||||
|
||||
|
||||
@@ -725,6 +725,29 @@ class _MeshClear(CommandManager):
|
||||
FreeCAD.ActiveDocument.recompute()
|
||||
|
||||
|
||||
class _MeshClearGroups(CommandManager):
|
||||
"The FEM_MeshClearGroups command definition"
|
||||
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
self.menutext = Qt.QT_TRANSLATE_NOOP("FEM_MeshClearGroups", "Clear Mesh Groups")
|
||||
self.tooltip = Qt.QT_TRANSLATE_NOOP("FEM_MeshClearGroups", "Remove groups from FEM mesh")
|
||||
self.is_active = "with_femmesh"
|
||||
|
||||
def Activated(self):
|
||||
FreeCAD.ActiveDocument.openTransaction("ClearGroups FEM mesh")
|
||||
FreeCADGui.addModule("Fem")
|
||||
grps = "FreeCAD.ActiveDocument." + self.selobj.Name + ".FemMesh.Groups"
|
||||
remove_func = "FreeCAD.ActiveDocument." + self.selobj.Name + ".FemMesh.removeGroup"
|
||||
FreeCADGui.doCommand(f"tuple(map({remove_func}, {grps}))")
|
||||
FreeCAD.Console.PrintMessage(
|
||||
f"Groups cleared: Now {self.selobj.Name} has {self.selobj.FemMesh.GroupCount} groups\n"
|
||||
)
|
||||
FreeCAD.ActiveDocument.commitTransaction()
|
||||
FreeCADGui.Selection.clearSelection()
|
||||
FreeCAD.ActiveDocument.recompute()
|
||||
|
||||
|
||||
class _MeshDisplayInfo(CommandManager):
|
||||
"The FEM_MeshDisplayInfo command definition"
|
||||
|
||||
@@ -1233,6 +1256,7 @@ FreeCADGui.addCommand("FEM_MaterialSolid", _MaterialSolid())
|
||||
FreeCADGui.addCommand("FEM_FEMMesh2Mesh", _FEMMesh2Mesh())
|
||||
FreeCADGui.addCommand("FEM_MeshBoundaryLayer", _MeshBoundaryLayer())
|
||||
FreeCADGui.addCommand("FEM_MeshClear", _MeshClear())
|
||||
FreeCADGui.addCommand("FEM_MeshClearGroups", _MeshClearGroups())
|
||||
FreeCADGui.addCommand("FEM_MeshDisplayInfo", _MeshDisplayInfo())
|
||||
FreeCADGui.addCommand("FEM_MeshGmshFromShape", _MeshGmshFromShape())
|
||||
FreeCADGui.addCommand("FEM_MeshGroup", _MeshGroup())
|
||||
|
||||
Reference in New Issue
Block a user