From 6ec8ec10b21fda558fc01d9b18437c2c636534cb Mon Sep 17 00:00:00 2001 From: luz paz Date: Mon, 13 Sep 2021 08:10:20 -0400 Subject: [PATCH 1/5] Crowdin: Fixes to Mesh WB translations Closes https://github.com/FreeCAD/FreeCAD-translations/issues/54 Exposes Mesh -> 'Cutting' sub-menu --- src/Mod/Mesh/Gui/Workbench.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Mod/Mesh/Gui/Workbench.cpp b/src/Mod/Mesh/Gui/Workbench.cpp index 198a02fb73..822d6cdbfc 100644 --- a/src/Mod/Mesh/Gui/Workbench.cpp +++ b/src/Mod/Mesh/Gui/Workbench.cpp @@ -45,6 +45,7 @@ using namespace MeshGui; qApp->translate("Workbench", "Analyze"); qApp->translate("Workbench", "Boolean"); qApp->translate("Workbench", "&Meshes"); + qApp->translate("Workbench", "Cutting"); qApp->translate("Workbench", "Mesh tools"); #endif From d10ca34bf9ce7b56144f41cb65d42d3afd8b0751 Mon Sep 17 00:00:00 2001 From: luz paz Date: Mon, 13 Sep 2021 08:26:13 -0400 Subject: [PATCH 2/5] Mesh: remove superfluous whitespace + Improve readability of code --- src/Mod/MeshPart/Gui/MeshFlatteningCommand.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/Mod/MeshPart/Gui/MeshFlatteningCommand.py b/src/Mod/MeshPart/Gui/MeshFlatteningCommand.py index ed0d1aec6e..404278f1ad 100644 --- a/src/Mod/MeshPart/Gui/MeshFlatteningCommand.py +++ b/src/Mod/MeshPart/Gui/MeshFlatteningCommand.py @@ -19,7 +19,9 @@ class CreateFlatMesh(BaseCommand): """create flat wires from a meshed face""" def GetResources(self): - return {'Pixmap': 'MeshPart_CreateFlatMesh.svg', 'MenuText': 'Unwrap Mesh', 'ToolTip': 'find a flat representation of a mesh'} + return {'Pixmap': 'MeshPart_CreateFlatMesh.svg', + 'MenuText': 'Unwrap Mesh', + 'ToolTip': 'find a flat representation of a mesh'} def Activated(self): import numpy as np @@ -47,10 +49,12 @@ class CreateFlatMesh(BaseCommand): class CreateFlatFace(BaseCommand): """create a flat face from a single face only full faces are supported right now""" - + def GetResources(self): - return {'Pixmap': 'MeshPart_CreateFlatFace.svg', 'MenuText': 'Unwrap Face', 'ToolTip': 'find a flat representation of a mesh'} - + return {'Pixmap': 'MeshPart_CreateFlatFace.svg', + 'MenuText': 'Unwrap Face', + 'ToolTip': 'find a flat representation of a mesh'} + def Activated(self): import numpy as np import flatmesh @@ -74,12 +78,14 @@ class CreateFlatFace(BaseCommand): bs.setPole(u + 1, v + 1, App.Vector(poles[i])) i += 1 Part.show(bs.toShape()) - + def IsActive(self): assert(super(CreateFlatFace, self).IsActive()) assert(isinstance(Gui.Selection.getSelectionEx()[0].SubObjects[0], Part.Face)) return True + +# Test if pybind11 dependency is available try: import flatmesh Gui.addCommand('MeshPart_CreateFlatMesh', CreateFlatMesh()) From fe353c106651632ac6436c5545c8498f0718cd79 Mon Sep 17 00:00:00 2001 From: luz paz Date: Mon, 13 Sep 2021 08:22:02 -0400 Subject: [PATCH 3/5] Mesh: added license header to MeshFlatteningCommand.py --- src/Mod/MeshPart/Gui/MeshFlatteningCommand.py | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/Mod/MeshPart/Gui/MeshFlatteningCommand.py b/src/Mod/MeshPart/Gui/MeshFlatteningCommand.py index 404278f1ad..55ed1dbeaf 100644 --- a/src/Mod/MeshPart/Gui/MeshFlatteningCommand.py +++ b/src/Mod/MeshPart/Gui/MeshFlatteningCommand.py @@ -1,3 +1,26 @@ +#************************************************************************** +#* Copyright (c) * +#* * +#* This file is part of the FreeCAD CAx development system. * +#* * +#* This library is free software; you can redistribute it and/or * +#* modify it under the terms of the GNU Library General Public * +#* License as published by the Free Software Foundation; either * +#* version 2 of the License, or (at your option) any later version. * +#* * +#* This library is distributed in the hope that it will be useful, * +#* but WITHOUT ANY WARRANTY; without even the implied warranty of * +#* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * +#* GNU Library General Public License for more details. * +#* * +#* You should have received a copy of the GNU Library General Public * +#* License along with this library; see the file COPYING.LIB. If not, * +#* write to the Free Software Foundation, Inc., 59 Temple Place, * +#* Suite 330, Boston, MA 02111-1307, USA * +#* * +#**************************************************************************/ + + import Mesh import FreeCAD as App import FreeCADGui as Gui From 14fa4b95f1fab0f71681cb3879459a4c8016726d Mon Sep 17 00:00:00 2001 From: luz paz Date: Tue, 14 Sep 2021 17:32:47 -0400 Subject: [PATCH 4/5] Mesh: added attribution to @looooo in MeshFlatteningCommand.py --- src/Mod/MeshPart/Gui/MeshFlatteningCommand.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Mod/MeshPart/Gui/MeshFlatteningCommand.py b/src/Mod/MeshPart/Gui/MeshFlatteningCommand.py index 55ed1dbeaf..36031f524b 100644 --- a/src/Mod/MeshPart/Gui/MeshFlatteningCommand.py +++ b/src/Mod/MeshPart/Gui/MeshFlatteningCommand.py @@ -1,5 +1,5 @@ #************************************************************************** -#* Copyright (c) * +#* Copyright (c) 2017 Lorenz Lechner * #* * #* This file is part of the FreeCAD CAx development system. * #* * From 68348d5d1862cd6b9000738e901ff34a4dcbc5a1 Mon Sep 17 00:00:00 2001 From: luz paz Date: Wed, 20 Oct 2021 08:53:45 -0400 Subject: [PATCH 5/5] Mesh: Apply the translation function appropriately --- src/Mod/MeshPart/Gui/MeshFlatteningCommand.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/Mod/MeshPart/Gui/MeshFlatteningCommand.py b/src/Mod/MeshPart/Gui/MeshFlatteningCommand.py index 36031f524b..ff442d2d90 100644 --- a/src/Mod/MeshPart/Gui/MeshFlatteningCommand.py +++ b/src/Mod/MeshPart/Gui/MeshFlatteningCommand.py @@ -20,13 +20,14 @@ #* * #**************************************************************************/ - import Mesh import FreeCAD as App import FreeCADGui as Gui import Part import MeshPartGui +from PySide.QtCore import QT_TRANSLATE_NOOP # for translations + class BaseCommand(object): def __init__(self): pass @@ -43,8 +44,8 @@ class CreateFlatMesh(BaseCommand): def GetResources(self): return {'Pixmap': 'MeshPart_CreateFlatMesh.svg', - 'MenuText': 'Unwrap Mesh', - 'ToolTip': 'find a flat representation of a mesh'} + 'MenuText': QT_TRANSLATE_NOOP("MeshPart_FlatteningCommand", "Unwrap Mesh"), + 'ToolTip': QT_TRANSLATE_NOOP("MeshPart_FlatteningCommand", "Find a flat representation of a mesh.")} def Activated(self): import numpy as np @@ -75,8 +76,8 @@ class CreateFlatFace(BaseCommand): def GetResources(self): return {'Pixmap': 'MeshPart_CreateFlatFace.svg', - 'MenuText': 'Unwrap Face', - 'ToolTip': 'find a flat representation of a mesh'} + 'MenuText': QT_TRANSLATE_NOOP("MeshPart_FlatteningCommand", "Unwrap Face"), + 'ToolTip': QT_TRANSLATE_NOOP("MeshPart_FlatteningCommand", "Find a flat representation of a mesh.")} def Activated(self): import numpy as np