From 1b1a34807695fda90e8d3a9f6fe4299e2436e33d Mon Sep 17 00:00:00 2001 From: J-Dunn Date: Thu, 11 Feb 2021 19:33:51 +0000 Subject: [PATCH 01/17] [PATH] fix conecutter core dumps fix improperly passed arguments, trigger assert() in OCL, which causes an ugly core dump. --- src/Mod/Path/PathScripts/PathSurfaceSupport.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Mod/Path/PathScripts/PathSurfaceSupport.py b/src/Mod/Path/PathScripts/PathSurfaceSupport.py index d082a6a282..d9a7c6fb94 100644 --- a/src/Mod/Path/PathScripts/PathSurfaceSupport.py +++ b/src/Mod/Path/PathScripts/PathSurfaceSupport.py @@ -2555,6 +2555,7 @@ class OCL_Tool(): if (self.diameter == -1.0 or self.cutEdgeHeight == -1.0): return self.tiltCutter = True + if self.cutEdgeHeight==0 : self.cutEdgeHeight = self.diameter/2 self.oclTool = self.ocl.BallCutter( self.diameter, self.cutEdgeHeight + self.lengthOffset @@ -2582,8 +2583,8 @@ class OCL_Tool(): return self.oclTool = self.ocl.ConeCutter( self.diameter, - self.cutEdgeAngle, - self.cutEdgeHeight + self.lengthOffset + self.cutEdgeAngle/2, + self.lengthOffset ) def _setToolMethod(self): From 61269c45c7364d2fc369e18266adddf5eff178b2 Mon Sep 17 00:00:00 2001 From: Roy-043 <70520633+Roy-043@users.noreply.github.com> Date: Thu, 11 Feb 2021 21:13:36 +0100 Subject: [PATCH 02/17] [Arch] Fix for ArchPipe: getProfile returned Shape instead of Wire Fix for ArchPipe: getProfile returned Shape instead of Wire --- src/Mod/Arch/ArchPipe.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Mod/Arch/ArchPipe.py b/src/Mod/Arch/ArchPipe.py index 8a11b08b1d..3364f1865f 100644 --- a/src/Mod/Arch/ArchPipe.py +++ b/src/Mod/Arch/ArchPipe.py @@ -311,7 +311,7 @@ class _ArchPipe(ArchComponent.Component): if not obj.Profile.Shape.Wires[0].isClosed(): FreeCAD.Console.PrintError(translate("Arch","The profile is not closed")+"\n") return - p = obj.Profile.Shape + p = obj.Profile.Shape.Wires[0] else: if obj.Diameter.Value == 0: return From a9f556d22d26ac2f57b06550b91fa8184bfa5a49 Mon Sep 17 00:00:00 2001 From: luz paz Date: Sat, 13 Feb 2021 12:19:15 -0500 Subject: [PATCH 03/17] Gui: Stylesheet fix applied to all shipped stylesheets [skip ci] Fixes #0004559 --- src/Gui/Stylesheets/Behave-dark.qss | 1 + src/Gui/Stylesheets/Dark-blue.qss | 1 + src/Gui/Stylesheets/Dark-contrast.qss | 1 + src/Gui/Stylesheets/Dark-green.qss | 1 + src/Gui/Stylesheets/Dark-orange.qss | 1 + src/Gui/Stylesheets/Darker-blue.qss | 1 + src/Gui/Stylesheets/Darker-green.qss | 1 + src/Gui/Stylesheets/Darker-orange.qss | 1 + src/Gui/Stylesheets/Light-blue.qss | 1 + src/Gui/Stylesheets/Light-green.qss | 1 + src/Gui/Stylesheets/Light-orange.qss | 1 + 11 files changed, 11 insertions(+) diff --git a/src/Gui/Stylesheets/Behave-dark.qss b/src/Gui/Stylesheets/Behave-dark.qss index ef98a3938b..d54d5e49b4 100644 --- a/src/Gui/Stylesheets/Behave-dark.qss +++ b/src/Gui/Stylesheets/Behave-dark.qss @@ -1909,6 +1909,7 @@ QToolBar > QPushButton:!checked { background-color: qlineargradient(spread:pad, x1:0, y1:0.3, x2:0, y2:1, stop:0 #232932, stop:1 #646464); border: 1px solid #232932; border-bottom-color: #434D5B; /* simulates shadow under the button */ + text-align: left; /* bug fix #4559 */ } QToolBar > QPushButton:checked:hover { diff --git a/src/Gui/Stylesheets/Dark-blue.qss b/src/Gui/Stylesheets/Dark-blue.qss index 87ad6355c6..22a21751af 100644 --- a/src/Gui/Stylesheets/Dark-blue.qss +++ b/src/Gui/Stylesheets/Dark-blue.qss @@ -1876,6 +1876,7 @@ QToolBar > QPushButton:!checked { background-color: qlineargradient(spread:pad, x1:0, y1:0.3, x2:0, y2:1, stop:0 #6e6e6e, stop:1 #646464); border: 1px solid #5a5a5a; border-bottom-color: #505050; /* simulates shadow under the button */ + text-align: left; /* bug fix #4559 */ } QToolBar > QPushButton:checked:hover { diff --git a/src/Gui/Stylesheets/Dark-contrast.qss b/src/Gui/Stylesheets/Dark-contrast.qss index d21f689d00..e73ce94ad4 100644 --- a/src/Gui/Stylesheets/Dark-contrast.qss +++ b/src/Gui/Stylesheets/Dark-contrast.qss @@ -1897,6 +1897,7 @@ QToolBar > QPushButton:!checked { background-color: qlineargradient(spread:pad, x1:0, y1:0.3, x2:0, y2:1, stop:0 #444444, stop:1 #3c3c3c); border: 1px solid #424242; border-bottom-color: #333333; /* simulates shadow under the button */ + text-align: left; /* bug fix #4559 */ } QToolBar > QPushButton:checked:hover { diff --git a/src/Gui/Stylesheets/Dark-green.qss b/src/Gui/Stylesheets/Dark-green.qss index 3807cb80e1..829e141ce1 100644 --- a/src/Gui/Stylesheets/Dark-green.qss +++ b/src/Gui/Stylesheets/Dark-green.qss @@ -1876,6 +1876,7 @@ QToolBar > QPushButton:!checked { background-color: qlineargradient(spread:pad, x1:0, y1:0.3, x2:0, y2:1, stop:0 #6e6e6e, stop:1 #646464); border: 1px solid #5a5a5a; border-bottom-color: #505050; /* simulates shadow under the button */ + text-align: left; /* bug fix #4559 */ } QToolBar > QPushButton:checked:hover { diff --git a/src/Gui/Stylesheets/Dark-orange.qss b/src/Gui/Stylesheets/Dark-orange.qss index e65ae40253..f36840ef99 100644 --- a/src/Gui/Stylesheets/Dark-orange.qss +++ b/src/Gui/Stylesheets/Dark-orange.qss @@ -1876,6 +1876,7 @@ QToolBar > QPushButton:!checked { background-color: qlineargradient(spread:pad, x1:0, y1:0.3, x2:0, y2:1, stop:0 #6e6e6e, stop:1 #646464); border: 1px solid #5a5a5a; border-bottom-color: #505050; /* simulates shadow under the button */ + text-align: left; /* bug fix #4559 */ } QToolBar > QPushButton:checked:hover { diff --git a/src/Gui/Stylesheets/Darker-blue.qss b/src/Gui/Stylesheets/Darker-blue.qss index ae994f8830..73cdd9a09a 100644 --- a/src/Gui/Stylesheets/Darker-blue.qss +++ b/src/Gui/Stylesheets/Darker-blue.qss @@ -1897,6 +1897,7 @@ QToolBar > QPushButton:!checked { background-color: qlineargradient(spread:pad, x1:0, y1:0.3, x2:0, y2:1, stop:0 #444444, stop:1 #3c3c3c); border: 1px solid #424242; border-bottom-color: #333333; /* simulates shadow under the button */ + text-align: left; /* bug fix #4559 */ } QToolBar > QPushButton:checked:hover { diff --git a/src/Gui/Stylesheets/Darker-green.qss b/src/Gui/Stylesheets/Darker-green.qss index 226a7e6b6b..f18adf34cd 100644 --- a/src/Gui/Stylesheets/Darker-green.qss +++ b/src/Gui/Stylesheets/Darker-green.qss @@ -1897,6 +1897,7 @@ QToolBar > QPushButton:!checked { background-color: qlineargradient(spread:pad, x1:0, y1:0.3, x2:0, y2:1, stop:0 #444444, stop:1 #3c3c3c); border: 1px solid #424242; border-bottom-color: #333333; /* simulates shadow under the button */ + text-align: left; /* bug fix #4559 */ } QToolBar > QPushButton:checked:hover { diff --git a/src/Gui/Stylesheets/Darker-orange.qss b/src/Gui/Stylesheets/Darker-orange.qss index 561cd71b00..316b908814 100644 --- a/src/Gui/Stylesheets/Darker-orange.qss +++ b/src/Gui/Stylesheets/Darker-orange.qss @@ -1897,6 +1897,7 @@ QToolBar > QPushButton:!checked { background-color: qlineargradient(spread:pad, x1:0, y1:0.3, x2:0, y2:1, stop:0 #444444, stop:1 #3c3c3c); border: 1px solid #424242; border-bottom-color: #333333; /* simulates shadow under the button */ + text-align: left; /* bug fix #4559 */ } QToolBar > QPushButton:checked:hover { diff --git a/src/Gui/Stylesheets/Light-blue.qss b/src/Gui/Stylesheets/Light-blue.qss index a9597bdbf4..18e4bef37f 100644 --- a/src/Gui/Stylesheets/Light-blue.qss +++ b/src/Gui/Stylesheets/Light-blue.qss @@ -1877,6 +1877,7 @@ QToolBar > QPushButton:!checked { background-color: qlineargradient(spread:pad, x1:0, y1:0.3, x2:0, y2:1, stop:0 #f5f5f5, stop:1 #e6e6e6); border: 1px solid #d2d2d2; border-bottom-color: #c3c3c3; /* simulates shadow under the button */ + text-align: left; /* bug fix #4559 */ } QToolBar > QPushButton:checked:hover { diff --git a/src/Gui/Stylesheets/Light-green.qss b/src/Gui/Stylesheets/Light-green.qss index 752ee5eb39..ef63811bc9 100644 --- a/src/Gui/Stylesheets/Light-green.qss +++ b/src/Gui/Stylesheets/Light-green.qss @@ -1877,6 +1877,7 @@ QToolBar > QPushButton:!checked { background-color: qlineargradient(spread:pad, x1:0, y1:0.3, x2:0, y2:1, stop:0 #f5f5f5, stop:1 #e6e6e6); border: 1px solid #d2d2d2; border-bottom-color: #c3c3c3; /* simulates shadow under the button */ + text-align: left; /* bug fix #4559 */ } QToolBar > QPushButton:checked:hover { diff --git a/src/Gui/Stylesheets/Light-orange.qss b/src/Gui/Stylesheets/Light-orange.qss index fe0bae0176..2503a85cd7 100644 --- a/src/Gui/Stylesheets/Light-orange.qss +++ b/src/Gui/Stylesheets/Light-orange.qss @@ -1877,6 +1877,7 @@ QToolBar > QPushButton:!checked { background-color: qlineargradient(spread:pad, x1:0, y1:0.3, x2:0, y2:1, stop:0 #f5f5f5, stop:1 #e6e6e6); border: 1px solid #d2d2d2; border-bottom-color: #c3c3c3; /* simulates shadow under the button */ + text-align: left; /* bug fix #4559 */ } QToolBar > QPushButton:checked:hover { From f521d8ca6b7229c3ee61a0f98c27eb39104741f8 Mon Sep 17 00:00:00 2001 From: paul lee Date: Sun, 14 Feb 2021 03:13:36 +0800 Subject: [PATCH 04/17] [ArchSectionPlane] Fix Swing Symbol for Windows(Doors) Link in ArchView/TechDraw Forum Discussion : [ Link in Arch/BIM -- 4 ] Link of Door : Swing Not Shown in ArchView/TechDraw - https://forum.freecadweb.org/viewtopic.php?f=23&t=55526 --- src/Mod/Arch/ArchSectionPlane.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/Mod/Arch/ArchSectionPlane.py b/src/Mod/Arch/ArchSectionPlane.py index 9aa8818b2e..b38354a6eb 100644 --- a/src/Mod/Arch/ArchSectionPlane.py +++ b/src/Mod/Arch/ArchSectionPlane.py @@ -379,7 +379,7 @@ def getSVG(source, drafts.append(o) elif not o.isDerivedFrom("App::DocumentObjectGroup"): nonspaces.append(o) - if Draft.getType(o) == "Window": + if Draft.getType(o.getLinkedObject()) == "Window": # To support Link of Windows(Doors) windows.append(o) objs = nonspaces @@ -580,11 +580,12 @@ def getSVG(source, if windows: sh = [] for w in windows: - if not hasattr(w.Proxy,"sshapes"): - w.Proxy.execute(w) - if hasattr(w.Proxy,"sshapes"): - if w.Proxy.sshapes and (w.Name in cutwindows): - c = Part.makeCompound(w.Proxy.sshapes) + wlo = w.getLinkedObject() # To support Link of Windows(Doors) + if not hasattr(wlo.Proxy,"sshapes"): + wlo.Proxy.execute(wlo) + if hasattr(wlo.Proxy,"sshapes"): + if wlo.Proxy.sshapes and (w.Name in cutwindows): + c = Part.makeCompound(wlo.Proxy.sshapes) c.Placement = w.Placement sh.append(c) # buggy for now... From 6d3ff49aba23c818eec2d9eb0961a84658947754 Mon Sep 17 00:00:00 2001 From: Markus Lampert Date: Sat, 6 Feb 2021 18:48:24 -0800 Subject: [PATCH 05/17] Added 'Advanced' preferences page, moved warning suppression there and experimental feature support. --- src/Mod/Path/CMakeLists.txt | 1 + src/Mod/Path/Gui/DlgSettingsPathColor.cpp | 6 - src/Mod/Path/Gui/DlgSettingsPathColor.ui | 75 +------ src/Mod/Path/Gui/Resources/Path.qrc | 1 + .../Gui/Resources/preferences/Advanced.ui | 185 ++++++++++++++++++ src/Mod/Path/InitGui.py | 3 + src/Mod/Path/PathScripts/PathPreferences.py | 10 +- .../PathScripts/PathPreferencesAdvanced.py | 60 ++++++ 8 files changed, 260 insertions(+), 81 deletions(-) create mode 100644 src/Mod/Path/Gui/Resources/preferences/Advanced.ui create mode 100644 src/Mod/Path/PathScripts/PathPreferencesAdvanced.py diff --git a/src/Mod/Path/CMakeLists.txt b/src/Mod/Path/CMakeLists.txt index 1e1c4e305c..e3b763ff8b 100644 --- a/src/Mod/Path/CMakeLists.txt +++ b/src/Mod/Path/CMakeLists.txt @@ -84,6 +84,7 @@ SET(PathScripts_SRCS PathScripts/PathPost.py PathScripts/PathPostProcessor.py PathScripts/PathPreferences.py + PathScripts/PathPreferencesAdvanced.py PathScripts/PathPreferencesPathDressup.py PathScripts/PathPreferencesPathJob.py PathScripts/PathProbe.py diff --git a/src/Mod/Path/Gui/DlgSettingsPathColor.cpp b/src/Mod/Path/Gui/DlgSettingsPathColor.cpp index ed1e365af5..d2db05acb2 100644 --- a/src/Mod/Path/Gui/DlgSettingsPathColor.cpp +++ b/src/Mod/Path/Gui/DlgSettingsPathColor.cpp @@ -67,9 +67,6 @@ void DlgSettingsPathColor::saveSettings() ui->DefaultBBoxNormalColor->onSave(); ui->DefaultSelectionStyle->onSave(); ui->DefaultTaskPanelLayout->onSave(); - ui->WarningSuppressAllSpeeds->onSave(); - ui->WarningSuppressRapidSpeeds->onSave(); - ui->WarningSuppressSelectionMode->onSave(); } void DlgSettingsPathColor::loadSettings() @@ -86,9 +83,6 @@ void DlgSettingsPathColor::loadSettings() ui->DefaultBBoxNormalColor->onRestore(); ui->DefaultSelectionStyle->onRestore(); ui->DefaultTaskPanelLayout->onRestore(); - ui->WarningSuppressAllSpeeds->onRestore(); - ui->WarningSuppressRapidSpeeds->onRestore(); - ui->WarningSuppressSelectionMode->onRestore(); } /** diff --git a/src/Mod/Path/Gui/DlgSettingsPathColor.ui b/src/Mod/Path/Gui/DlgSettingsPathColor.ui index f3d7e8aa1f..8ade3a7cb3 100644 --- a/src/Mod/Path/Gui/DlgSettingsPathColor.ui +++ b/src/Mod/Path/Gui/DlgSettingsPathColor.ui @@ -7,7 +7,7 @@ 0 0 512 - 691 + 573 @@ -436,7 +436,7 @@ - + Qt::Vertical @@ -449,72 +449,6 @@ - - - - Warnings - - - - - - Suppress all warnings about setting speed rates for accurate cycle time calculation - - - Suppress all missing speeds warning - - - true - - - WarningSuppressAllSpeeds - - - Mod/Path - - - - - - - Suppress warning about setting the rapid speed rates for accurate cycle time calculation. Ignored if all speed warnings are already suppressed. - - - Suppress missing rapid speeds warning - - - true - - - WarningSuppressRapidSpeeds - - - Mod/Path - - - - - - - Suppress warning whenever a Path selection mode is activated - - - Suppress selection mode warning - - - true - - - WarningSuppressSelectionMode - - - Mod/Path - - - - - - @@ -538,11 +472,6 @@ QComboBox
Gui/PrefWidgets.h
- - Gui::PrefCheckBox - QCheckBox -
Gui/PrefWidgets.h
-
DefaultNormalPathColor diff --git a/src/Mod/Path/Gui/Resources/Path.qrc b/src/Mod/Path/Gui/Resources/Path.qrc index 832f74f868..309906a1b1 100644 --- a/src/Mod/Path/Gui/Resources/Path.qrc +++ b/src/Mod/Path/Gui/Resources/Path.qrc @@ -132,6 +132,7 @@ panels/ToolLibraryEditor.ui panels/TaskPathSimulator.ui panels/ZCorrectEdit.ui + preferences/Advanced.ui preferences/PathDressupHoldingTags.ui preferences/PathJob.ui translations/Path_af.qm diff --git a/src/Mod/Path/Gui/Resources/preferences/Advanced.ui b/src/Mod/Path/Gui/Resources/preferences/Advanced.ui new file mode 100644 index 0000000000..cadeb072ce --- /dev/null +++ b/src/Mod/Path/Gui/Resources/preferences/Advanced.ui @@ -0,0 +1,185 @@ + + + PathGui::DlgSettingsPathColor + + + + 0 + 0 + 512 + 691 + + + + Advanced + + + + + + Warnings + + + + + + Suppress all warnings about setting speed rates for accurate cycle time calculation + + + Suppress all missing speeds warning + + + true + + + WarningSuppressAllSpeeds + + + Mod/Path + + + + + + + Suppress warning about setting the rapid speed rates for accurate cycle time calculation. Ignored if all speed warnings are already suppressed. + + + Suppress missing rapid speeds warning + + + true + + + WarningSuppressRapidSpeeds + + + Mod/Path + + + + + + + Suppress warning whenever a Path selection mode is activated + + + Suppress selection mode warning + + + true + + + WarningSuppressSelectionMode + + + Mod/Path + + + + + + + + + + + 0 + 0 + + + + Experimental Features + + + + + + + 0 + 0 + + + + Qt::ScrollBarAlwaysOff + + + Qt::ScrollBarAlwaysOff + + + QAbstractScrollArea::AdjustToContents + + + true + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Sans'; font-size:16pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">This will enable some operations and commands which are not fully tested or are otherwise not deemed to be ready for prime time.</p> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Some of these features require additional libraries to be installed in order to function correctly:<br /> * opencamlib<br /> * asciidoctor</p> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">While enabling these features has no impact on the functionality of other features and operations but might have an impact on the stability of FreeCAD itself.</p></body></html> + + + + + + + Enable Experimental Features + + + EnableExperimentalFeatures + + + Mod/Path + + + + + + + Suppress warning if openCAMlib cannot be found + + + Suppress openCAMlib warning + + + true + + + WarningSuppressOpenCamLib + + + Mod/Path + + + + + + + + + + Qt::Vertical + + + + 20 + 217 + + + + + + + + + Gui::PrefCheckBox + QCheckBox +
Gui/PrefWidgets.h
+
+
+ + +
diff --git a/src/Mod/Path/InitGui.py b/src/Mod/Path/InitGui.py index 20e35d8590..97402ea074 100644 --- a/src/Mod/Path/InitGui.py +++ b/src/Mod/Path/InitGui.py @@ -164,6 +164,9 @@ class PathWorkbench (Workbench): if curveAccuracy: Path.Area.setDefaultParams(Accuracy=curveAccuracy) + # keep this one the last entry in the preferences + import PathScripts.PathPreferencesAdvanced as PathPreferencesAdvanced + FreeCADGui.addPreferencePage(PathPreferencesAdvanced.AdvancedPreferencesPage, "Path") Log('Loading Path workbench... done\n') def GetClassName(self): diff --git a/src/Mod/Path/PathScripts/PathPreferences.py b/src/Mod/Path/PathScripts/PathPreferences.py index a1c1e58fc5..cb67d0d7a8 100644 --- a/src/Mod/Path/PathScripts/PathPreferences.py +++ b/src/Mod/Path/PathScripts/PathPreferences.py @@ -251,8 +251,8 @@ def suppressAllSpeedsWarning(): return preferences().GetBool(WarningSuppressAllSpeeds, True) -def suppressRapidSpeedsWarning(): - return suppressAllSpeedsWarning() or preferences().GetBool(WarningSuppressRapidSpeeds, True) +def suppressRapidSpeedsWarning(user=True): + return (user and suppressAllSpeedsWarning()) or preferences().GetBool(WarningSuppressRapidSpeeds, True) def suppressSelectionModeWarning(): @@ -262,6 +262,12 @@ def suppressSelectionModeWarning(): def suppressOpenCamLibWarning(): return preferences().GetBool(WarningSuppressOpenCamLib, True) +def setPreferencesAdvanced(experimental, warnSpeeds, warnRapids, warnModes, warnOCL): + preferences().SetBool(EnableExperimentalFeatures, experimental) + preferences().SetBool(WarningSuppressAllSpeeds, warnSpeeds) + preferences().SetBool(WarningSuppressRapidSpeeds, warnRapids) + preferences().SetBool(WarningSuppressSelectionMode, warnModes) + preferences().SetBool(WarningSuppressOpenCamLib, warnOCL) def lastFileToolLibrary(): filename = preferences().GetString(LastFileToolLibrary) diff --git a/src/Mod/Path/PathScripts/PathPreferencesAdvanced.py b/src/Mod/Path/PathScripts/PathPreferencesAdvanced.py new file mode 100644 index 0000000000..49679aa1bd --- /dev/null +++ b/src/Mod/Path/PathScripts/PathPreferencesAdvanced.py @@ -0,0 +1,60 @@ +# -*- coding: utf-8 -*- +# *************************************************************************** +# * Copyright (c) 2021 sliptonic * +# * * +# * This program is free software; you can redistribute it and/or modify * +# * it under the terms of the GNU Lesser General Public License (LGPL) * +# * as published by the Free Software Foundation; either version 2 of * +# * the License, or (at your option) any later version. * +# * for detail see the LICENCE text file. * +# * * +# * This program 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 program; if not, write to the Free Software * +# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * +# * USA * +# * * +# *************************************************************************** + +import FreeCADGui +import PathScripts.PathPreferences as PathPreferences +import PySide + +# Qt translation handling +def translate(context, text, disambig=None): + return PySide.QtCore.QCoreApplication.translate(context, text, disambig) + +class AdvancedPreferencesPage: + def __init__(self, parent=None): + self.form = FreeCADGui.PySideUic.loadUi(':preferences/Advanced.ui') + self.form.WarningSuppressAllSpeeds.stateChanged.connect(self.updateSelection) + self.form.EnableExperimentalFeatures.stateChanged.connect(self.updateSelection) + + def saveSettings(self): + PathPreferences.setPreferencesAdvanced( + self.form.EnableExperimentalFeatures.isChecked(), + self.form.WarningSuppressAllSpeeds.isChecked(), + self.form.WarningSuppressRapidSpeeds.isChecked(), + self.form.WarningSuppressSelectionMode.isChecked(), + self.form.WarningSuppressOpenCamLib.isChecked()) + + def loadSettings(self): + self.form.WarningSuppressAllSpeeds.setChecked(PathPreferences.suppressAllSpeedsWarning()) + self.form.WarningSuppressRapidSpeeds.setChecked(PathPreferences.suppressRapidSpeedsWarning(False)) + self.form.WarningSuppressSelectionMode.setChecked(PathPreferences.suppressSelectionModeWarning()) + self.form.EnableExperimentalFeatures.setChecked(PathPreferences.experimentalFeaturesEnabled()) + self.form.WarningSuppressOpenCamLib.setChecked(PathPreferences.suppressOpenCamLibWarning()) + self.updateSelection() + + def updateSelection(self, state=None): + self.form.WarningSuppressOpenCamLib.setEnabled(self.form.EnableExperimentalFeatures.isChecked()) + if self.form.WarningSuppressAllSpeeds.isChecked(): + self.form.WarningSuppressRapidSpeeds.setChecked(True) + self.form.WarningSuppressRapidSpeeds.setEnabled(False) + else: + self.form.WarningSuppressRapidSpeeds.setEnabled(True) + From 6af42fa158c058aa4d2eb694193c6e9165906760 Mon Sep 17 00:00:00 2001 From: Markus Lampert Date: Sat, 13 Feb 2021 16:02:39 -0800 Subject: [PATCH 06/17] Split OCL and experimental features to allow enabling independently. --- .../Path/Gui/Resources/preferences/Advanced.ui | 17 ++++++++--------- src/Mod/Path/InitGui.py | 1 + src/Mod/Path/PathScripts/PathPreferences.py | 9 +++++++-- .../Path/PathScripts/PathPreferencesAdvanced.py | 8 ++++---- 4 files changed, 20 insertions(+), 15 deletions(-) diff --git a/src/Mod/Path/Gui/Resources/preferences/Advanced.ui b/src/Mod/Path/Gui/Resources/preferences/Advanced.ui index cadeb072ce..c26cc9f0ae 100644 --- a/src/Mod/Path/Gui/Resources/preferences/Advanced.ui +++ b/src/Mod/Path/Gui/Resources/preferences/Advanced.ui @@ -89,7 +89,7 @@
- Experimental Features + Open CAMlib @@ -117,26 +117,25 @@ <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } </style></head><body style=" font-family:'Sans'; font-size:16pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">This will enable some operations and commands which are not fully tested or are otherwise not deemed to be ready for prime time.</p> -<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Some of these features require additional libraries to be installed in order to function correctly:<br /> * opencamlib<br /> * asciidoctor</p> -<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">While enabling these features has no impact on the functionality of other features and operations but might have an impact on the stability of FreeCAD itself.</p></body></html> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">If openCAMlib is installed with its python interface it can be used by some additional 3d operations.</p> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Changing this value requires a restart of FreeCAD to take effect.</p></body></html> - + - Enable Experimental Features + Enable OCL dependent features - EnableExperimentalFeatures + EnableAdvancedOCLFeatures Mod/Path - - + + Suppress warning if openCAMlib cannot be found diff --git a/src/Mod/Path/InitGui.py b/src/Mod/Path/InitGui.py index 97402ea074..9fa7ce6e61 100644 --- a/src/Mod/Path/InitGui.py +++ b/src/Mod/Path/InitGui.py @@ -121,6 +121,7 @@ class PathWorkbench (Workbench): extracmdlist.extend(["Path_Area", "Path_Area_Workplane"]) specialcmdlist.append('Path_Thread_Milling') + if PathPreferences.advancedOCLFeaturesEnabled(): try: import ocl # pylint: disable=unused-variable from PathScripts import PathSurfaceGui diff --git a/src/Mod/Path/PathScripts/PathPreferences.py b/src/Mod/Path/PathScripts/PathPreferences.py index cb67d0d7a8..a880219641 100644 --- a/src/Mod/Path/PathScripts/PathPreferences.py +++ b/src/Mod/Path/PathScripts/PathPreferences.py @@ -62,6 +62,7 @@ WarningSuppressAllSpeeds = "WarningSuppressAllSpeeds" WarningSuppressSelectionMode = "WarningSuppressSelectionMode" WarningSuppressOpenCamLib = "WarningSuppressOpenCamLib" EnableExperimentalFeatures = "EnableExperimentalFeatures" +EnableAdvancedOCLFeatures = "EnableAdvancedOCLFeatures" def preferences(): @@ -243,6 +244,10 @@ def setDefaultTaskPanelLayout(style): preferences().SetInt(DefaultTaskPanelLayout, style) +def advancedOCLFeaturesEnabled(): + return preferences().GetBool(EnableAdvancedOCLFeatures, False) + + def experimentalFeaturesEnabled(): return preferences().GetBool(EnableExperimentalFeatures, False) @@ -262,8 +267,8 @@ def suppressSelectionModeWarning(): def suppressOpenCamLibWarning(): return preferences().GetBool(WarningSuppressOpenCamLib, True) -def setPreferencesAdvanced(experimental, warnSpeeds, warnRapids, warnModes, warnOCL): - preferences().SetBool(EnableExperimentalFeatures, experimental) +def setPreferencesAdvanced(ocl, warnSpeeds, warnRapids, warnModes, warnOCL): + preferences().SetBool(EnableAdvancedOCLFeatures, ocl) preferences().SetBool(WarningSuppressAllSpeeds, warnSpeeds) preferences().SetBool(WarningSuppressRapidSpeeds, warnRapids) preferences().SetBool(WarningSuppressSelectionMode, warnModes) diff --git a/src/Mod/Path/PathScripts/PathPreferencesAdvanced.py b/src/Mod/Path/PathScripts/PathPreferencesAdvanced.py index 49679aa1bd..5b9151587b 100644 --- a/src/Mod/Path/PathScripts/PathPreferencesAdvanced.py +++ b/src/Mod/Path/PathScripts/PathPreferencesAdvanced.py @@ -32,11 +32,11 @@ class AdvancedPreferencesPage: def __init__(self, parent=None): self.form = FreeCADGui.PySideUic.loadUi(':preferences/Advanced.ui') self.form.WarningSuppressAllSpeeds.stateChanged.connect(self.updateSelection) - self.form.EnableExperimentalFeatures.stateChanged.connect(self.updateSelection) + self.form.EnableAdvancedOCLFeatures.stateChanged.connect(self.updateSelection) def saveSettings(self): PathPreferences.setPreferencesAdvanced( - self.form.EnableExperimentalFeatures.isChecked(), + self.form.EnableAdvancedOCLFeatures.isChecked(), self.form.WarningSuppressAllSpeeds.isChecked(), self.form.WarningSuppressRapidSpeeds.isChecked(), self.form.WarningSuppressSelectionMode.isChecked(), @@ -46,12 +46,12 @@ class AdvancedPreferencesPage: self.form.WarningSuppressAllSpeeds.setChecked(PathPreferences.suppressAllSpeedsWarning()) self.form.WarningSuppressRapidSpeeds.setChecked(PathPreferences.suppressRapidSpeedsWarning(False)) self.form.WarningSuppressSelectionMode.setChecked(PathPreferences.suppressSelectionModeWarning()) - self.form.EnableExperimentalFeatures.setChecked(PathPreferences.experimentalFeaturesEnabled()) + self.form.EnableAdvancedOCLFeatures.setChecked(PathPreferences.advancedOCLFeaturesEnabled()) self.form.WarningSuppressOpenCamLib.setChecked(PathPreferences.suppressOpenCamLibWarning()) self.updateSelection() def updateSelection(self, state=None): - self.form.WarningSuppressOpenCamLib.setEnabled(self.form.EnableExperimentalFeatures.isChecked()) + self.form.WarningSuppressOpenCamLib.setEnabled(self.form.EnableAdvancedOCLFeatures.isChecked()) if self.form.WarningSuppressAllSpeeds.isChecked(): self.form.WarningSuppressRapidSpeeds.setChecked(True) self.form.WarningSuppressRapidSpeeds.setEnabled(False) From 74f39db3dbc3778ce4a8c71d95d00e50a1557bea Mon Sep 17 00:00:00 2001 From: wmayer Date: Mon, 15 Feb 2021 14:54:12 +0100 Subject: [PATCH 07/17] Main: [skip ci] set new year --- src/Main/MainCmd.cpp | 2 +- src/Main/MainGui.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Main/MainCmd.cpp b/src/Main/MainCmd.cpp index e59b734a39..4a11233ab5 100644 --- a/src/Main/MainCmd.cpp +++ b/src/Main/MainCmd.cpp @@ -53,7 +53,7 @@ using Base::Console; using App::Application; -const char sBanner[] = "(c) Juergen Riegel, Werner Mayer, Yorik van Havre and others 2001-2020\n"\ +const char sBanner[] = "(c) Juergen Riegel, Werner Mayer, Yorik van Havre and others 2001-2021\n"\ "FreeCAD is free and open-source software licensed under the terms of LGPL2+ license.\n"\ "FreeCAD wouldn't be possible without FreeCAD community.\n"\ " ##### #### ### #### \n" \ diff --git a/src/Main/MainGui.cpp b/src/Main/MainGui.cpp index 411d39ddcc..c9aa650d84 100644 --- a/src/Main/MainGui.cpp +++ b/src/Main/MainGui.cpp @@ -59,7 +59,7 @@ void PrintInitHelp(void); -const char sBanner[] = "\xc2\xa9 Juergen Riegel, Werner Mayer, Yorik van Havre and others 2001-2020\n"\ +const char sBanner[] = "\xc2\xa9 Juergen Riegel, Werner Mayer, Yorik van Havre and others 2001-2021\n"\ "FreeCAD is free and open-source software licensed under the terms of LGPL2+ license.\n"\ "FreeCAD wouldn't be possible without FreeCAD community.\n"\ " ##### #### ### #### \n" \ From 335cc13d48245f45a9be3479dbc05732e2df1ad9 Mon Sep 17 00:00:00 2001 From: Yorik van Havre Date: Mon, 15 Feb 2021 15:50:45 +0100 Subject: [PATCH 08/17] Draft: Applied patch from nahshon - fixes misc errors from translation fixes --- src/Mod/Draft/draftguitools/gui_beziers.py | 2 -- src/Mod/Draft/draftguitools/gui_groups.py | 6 ++---- src/Mod/Draft/draftguitools/gui_shape2dview.py | 2 -- src/Mod/Draft/draftguitools/gui_shapestrings.py | 2 -- src/Mod/Draft/draftguitools/gui_snaps.py | 1 - src/Mod/Draft/draftguitools/gui_subelements.py | 2 -- 6 files changed, 2 insertions(+), 13 deletions(-) diff --git a/src/Mod/Draft/draftguitools/gui_beziers.py b/src/Mod/Draft/draftguitools/gui_beziers.py index 6dd84d1ec2..278809002a 100644 --- a/src/Mod/Draft/draftguitools/gui_beziers.py +++ b/src/Mod/Draft/draftguitools/gui_beziers.py @@ -235,8 +235,6 @@ class CubicBezCurve(gui_lines.Line): def GetResources(self): """Set icon, menu and tooltip.""" - _menu = "" - _tip = () return {'Pixmap': 'Draft_CubicBezCurve', # 'Accel': "B, Z", diff --git a/src/Mod/Draft/draftguitools/gui_groups.py b/src/Mod/Draft/draftguitools/gui_groups.py index e8e95ab582..705b920f96 100644 --- a/src/Mod/Draft/draftguitools/gui_groups.py +++ b/src/Mod/Draft/draftguitools/gui_groups.py @@ -163,10 +163,8 @@ class SelectGroup(gui_base.GuiCommandNeedsSelection): d = {'Pixmap': 'Draft_SelectGroup', 'MenuText': QT_TRANSLATE_NOOP("Draft_SelectGroup","Select group"), - 'ToolTip': QT_TRANSLATE_NOOP("Draft_SelectGroup","If the selection is a group, it selects all objects that are inside this group, " - "including those in nested sub-groups.\n\nIf the selection is a simple object " - "inside a group, it will select the \"brother\" objects, that is,\nthose that are " - "at the same level as this object, including the upper group that contains them all.")} + 'ToolTip': QT_TRANSLATE_NOOP("Draft_SelectGroup","If the selection is a group, it selects all objects that are inside this group, including those in nested sub-groups.\n\nIf the selection is a simple object inside a group, it will select the \"brother\" objects, that is,\nthose that are at the same level as this object, including the upper group that contains them all.")} + return d def Activated(self): diff --git a/src/Mod/Draft/draftguitools/gui_shape2dview.py b/src/Mod/Draft/draftguitools/gui_shape2dview.py index 292e0d9614..52ea98e5bb 100644 --- a/src/Mod/Draft/draftguitools/gui_shape2dview.py +++ b/src/Mod/Draft/draftguitools/gui_shape2dview.py @@ -54,8 +54,6 @@ class Shape2DView(gui_base_original.Modifier): def GetResources(self): """Set icon, menu and tooltip.""" - _menu = "" - _tip = () return {'Pixmap': 'Draft_2DShapeView', 'MenuText': QT_TRANSLATE_NOOP("Draft_Shape2DView", "Shape 2D view"), diff --git a/src/Mod/Draft/draftguitools/gui_shapestrings.py b/src/Mod/Draft/draftguitools/gui_shapestrings.py index 813bc85920..cea9b85855 100644 --- a/src/Mod/Draft/draftguitools/gui_shapestrings.py +++ b/src/Mod/Draft/draftguitools/gui_shapestrings.py @@ -62,8 +62,6 @@ class ShapeString(gui_base_original.Creator): def GetResources(self): """Set icon, menu and tooltip.""" - _menu = "" - _tip = () d = {'Pixmap': 'Draft_ShapeString', 'Accel': "S, S", diff --git a/src/Mod/Draft/draftguitools/gui_snaps.py b/src/Mod/Draft/draftguitools/gui_snaps.py index ccffaef8a6..2496965202 100644 --- a/src/Mod/Draft/draftguitools/gui_snaps.py +++ b/src/Mod/Draft/draftguitools/gui_snaps.py @@ -567,7 +567,6 @@ class ShowSnapBar(gui_base.GuiCommandSimplest): def GetResources(self): """Set icon, menu and tooltip.""" - _tip = "" return {'Pixmap': 'Draft_Snap', 'MenuText': QT_TRANSLATE_NOOP("Draft_ShowSnapBar","Show snap toolbar"), diff --git a/src/Mod/Draft/draftguitools/gui_subelements.py b/src/Mod/Draft/draftguitools/gui_subelements.py index 711de64753..554b3e0588 100644 --- a/src/Mod/Draft/draftguitools/gui_subelements.py +++ b/src/Mod/Draft/draftguitools/gui_subelements.py @@ -54,8 +54,6 @@ class SubelementHighlight(gui_base_original.Modifier): def GetResources(self): """Set icon, menu and tooltip.""" - _menu = "" - _tip = () return {'Pixmap': 'Draft_SubelementHighlight', 'Accel': "H, S", From b44075912a0dd54deb30c80a82bec2f5c94ba8bf Mon Sep 17 00:00:00 2001 From: Bernd Hahnebach Date: Mon, 15 Feb 2021 14:30:04 +0100 Subject: [PATCH 09/17] Arch: add BIM_Classification command before make use of it --- src/Mod/Arch/ArchComponent.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Mod/Arch/ArchComponent.py b/src/Mod/Arch/ArchComponent.py index 6207ca7db6..46a4fdbed7 100644 --- a/src/Mod/Arch/ArchComponent.py +++ b/src/Mod/Arch/ArchComponent.py @@ -1726,6 +1726,8 @@ class ComponentTaskPanel: self.classButton.hide() else: import os + # the BIM_Classification command needs to be added before it can be used + FreeCADGui.activateWorkbench("BIMWorkbench") self.classButton.setIcon(QtGui.QIcon(os.path.join(os.path.dirname(BimClassification.__file__),"icons","BIM_Classification.svg"))) QtCore.QObject.connect(self.addButton, QtCore.SIGNAL("clicked()"), self.addElement) From d4b35f13f41b34cd3176257f341907aa0acf8549 Mon Sep 17 00:00:00 2001 From: Bernd Hahnebach Date: Mon, 15 Feb 2021 16:12:32 +0100 Subject: [PATCH 10/17] FEM: material task panel, fix edition of Poisson Ratio --- src/Mod/Fem/femtaskpanels/task_material_common.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/Mod/Fem/femtaskpanels/task_material_common.py b/src/Mod/Fem/femtaskpanels/task_material_common.py index cffc1be22c..b4a77c2f8d 100644 --- a/src/Mod/Fem/femtaskpanels/task_material_common.py +++ b/src/Mod/Fem/femtaskpanels/task_material_common.py @@ -518,13 +518,21 @@ class _TaskPanel: def update_material_property(self, input_field, matProperty, qUnit, variation=0.001): # this update property works for all Gui::InputField widgets - value = Units.Quantity(input_field.text()).getValueAs(qUnit) - old_value = Units.Quantity(self.material[matProperty]).getValueAs(qUnit) + if qUnit != "": + value = Units.Quantity(input_field.text()).getValueAs(qUnit) + old_value = Units.Quantity(self.material[matProperty]).getValueAs(qUnit) + else: + # for example PoissonRatio + value = float(input_field.text()) + old_value = float(self.material[matProperty]) if value: if not (1 - variation < float(old_value) / value < 1 + variation): material = self.material # unicode() is an alias to str for py3 - material[matProperty] = unicode(value) + " " + qUnit + if qUnit != "": + material[matProperty] = unicode(value) + " " + qUnit + else: + material[matProperty] = unicode(value) self.material = material if self.has_transient_mat is False: self.add_transient_material() From 17b1dc1ae82801c34ae9c2fd6be9fc5d3481c649 Mon Sep 17 00:00:00 2001 From: Bernd Hahnebach Date: Mon, 15 Feb 2021 16:10:26 +0100 Subject: [PATCH 11/17] FEM: code formatting, pep8 --- src/Mod/Fem/femtaskpanels/task_mesh_gmsh.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Mod/Fem/femtaskpanels/task_mesh_gmsh.py b/src/Mod/Fem/femtaskpanels/task_mesh_gmsh.py index c2158db04f..05ec8e8d3e 100644 --- a/src/Mod/Fem/femtaskpanels/task_mesh_gmsh.py +++ b/src/Mod/Fem/femtaskpanels/task_mesh_gmsh.py @@ -207,7 +207,7 @@ class _TaskPanel: "Unexpected error when creating mesh: {}\n" .format(sys.exc_info()[0]) ) - error = sys.exc_info()[0].strip(); + error = sys.exc_info()[0].strip() if error: FreeCAD.Console.PrintMessage("Gmsh had warnings ...\n") FreeCAD.Console.PrintMessage("{}\n".format(error)) From 86f148175fd1a55ca5aa94cb519ec5bdcc85e433 Mon Sep 17 00:00:00 2001 From: David Osterberg Date: Mon, 15 Feb 2021 14:33:36 +0100 Subject: [PATCH 12/17] PartDesign: Improve Helix parameter proposals The previous initial proposed parameters could cause self intersection when the user switches axis --- src/Mod/PartDesign/App/FeatureHelix.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Mod/PartDesign/App/FeatureHelix.cpp b/src/Mod/PartDesign/App/FeatureHelix.cpp index 8b13651589..327f6581ae 100644 --- a/src/Mod/PartDesign/App/FeatureHelix.cpp +++ b/src/Mod/PartDesign/App/FeatureHelix.cpp @@ -504,7 +504,12 @@ double Helix::safePitch() void Helix::proposeParameters(bool force) { if (force || !HasBeenEdited.getValue()) { - double pitch = 1.1*safePitch(); + TopoDS_Shape sketchshape = getVerifiedFace(); + Bnd_Box bb; + BRepBndLib::Add(sketchshape, bb); + bb.SetGap(0.0); + double pitch = 1.1 * sqrt(bb.SquareExtent()); + Pitch.setValue(pitch); Height.setValue(pitch*3.0); HasBeenEdited.setValue(1); From 60c634c275925e74744e2604e1cf7a71981e8a2e Mon Sep 17 00:00:00 2001 From: David Osterberg Date: Mon, 15 Feb 2021 17:46:58 +0100 Subject: [PATCH 13/17] PartDesign: Subtractive Loft. Raise error when base is null. Previously Subtractive loft would create a shape if there is no base object. This is because the code is shared with Additive Loft, where that is the right thing to do. Now we check for this, and return error if there is nothing to subtract from. --- src/Mod/PartDesign/App/FeatureLoft.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Mod/PartDesign/App/FeatureLoft.cpp b/src/Mod/PartDesign/App/FeatureLoft.cpp index aa22c8c4a0..f1d0c62158 100644 --- a/src/Mod/PartDesign/App/FeatureLoft.cpp +++ b/src/Mod/PartDesign/App/FeatureLoft.cpp @@ -179,6 +179,9 @@ App::DocumentObjectExecReturn *Loft::execute(void) AddSubShape.setValue(result); if(base.IsNull()) { + if (getAddSubType() == FeatureAddSub::Subtractive) + return new App::DocumentObjectExecReturn("Loft: There is nothing to subtract from\n"); + Shape.setValue(getSolid(result)); return App::DocumentObject::StdReturn; } From 8f893430b934457da0a9667d8d5000f756d2d85f Mon Sep 17 00:00:00 2001 From: Syres916 <46537884+Syres916@users.noreply.github.com> Date: Mon, 15 Feb 2021 15:22:31 +0000 Subject: [PATCH 14/17] [Start] Enable hyperlink for installed Addons as per discussion https://forum.freecadweb.org/viewtopic.php?f=8&t=55623 --- src/Mod/Start/StartPage/StartPage.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Mod/Start/StartPage/StartPage.js b/src/Mod/Start/StartPage/StartPage.js index ad906f89e9..5c4c290fff 100644 --- a/src/Mod/Start/StartPage/StartPage.js +++ b/src/Mod/Start/StartPage/StartPage.js @@ -85,7 +85,7 @@ function printAddons(data) { if (wblist.indexOf(data.data[i].name.toLowerCase()) == -1) { html.push('
  • ', data.data[i].name, '
  • '); } else { - html.push('
  • ', data.data[i].name, ' 
  • '); + html.push('
  • ', data.data[i].name, ' 
  • '); } } } From 81b56126405a3793db2ff0695f94ab436a2a99da Mon Sep 17 00:00:00 2001 From: Syres916 <46537884+Syres916@users.noreply.github.com> Date: Mon, 15 Feb 2021 17:21:18 +0000 Subject: [PATCH 15/17] Added missing as per review --- src/Mod/Start/StartPage/StartPage.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Mod/Start/StartPage/StartPage.js b/src/Mod/Start/StartPage/StartPage.js index 5c4c290fff..df015a43e6 100644 --- a/src/Mod/Start/StartPage/StartPage.js +++ b/src/Mod/Start/StartPage/StartPage.js @@ -85,7 +85,7 @@ function printAddons(data) { if (wblist.indexOf(data.data[i].name.toLowerCase()) == -1) { html.push('
  • ', data.data[i].name, '
  • '); } else { - html.push('
  • ', data.data[i].name, ' 
  • '); + html.push('
  • ', data.data[i].name, ' 
  • '); } } } From 0342e6360dc745ffe23a47dce7c160a2305e292c Mon Sep 17 00:00:00 2001 From: Markus Lampert Date: Mon, 15 Feb 2021 11:52:02 -0800 Subject: [PATCH 16/17] Removed obsolete preference api --- src/Mod/Path/InitGui.py | 2 +- src/Mod/Path/PathScripts/PathPreferences.py | 4 ---- src/Mod/Path/PathScripts/PathToolController.py | 2 +- src/Mod/Path/PathScripts/PathToolLibraryEditor.py | 2 +- src/Mod/Path/PathTests/TestPathToolController.py | 4 ++-- 5 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/Mod/Path/InitGui.py b/src/Mod/Path/InitGui.py index 9fa7ce6e61..9933dac5e8 100644 --- a/src/Mod/Path/InitGui.py +++ b/src/Mod/Path/InitGui.py @@ -102,7 +102,7 @@ class PathWorkbench (Workbench): specialcmdlist = [] - if PathPreferences.toolsReallyUseLegacyTools(): + if PathPreferences.toolsUseLegacyTools(): toolcmdlist.append("Path_ToolLibraryEdit") toolbitcmdlist = [] else: diff --git a/src/Mod/Path/PathScripts/PathPreferences.py b/src/Mod/Path/PathScripts/PathPreferences.py index a880219641..ff07fc1cbb 100644 --- a/src/Mod/Path/PathScripts/PathPreferences.py +++ b/src/Mod/Path/PathScripts/PathPreferences.py @@ -162,10 +162,6 @@ def toolsUseLegacyTools(): return preferences().GetBool(UseLegacyTools, False) -def toolsReallyUseLegacyTools(): - return toolsUseLegacyTools() - - def toolsStoreAbsolutePaths(): return preferences().GetBool(UseAbsoluteToolPaths, False) diff --git a/src/Mod/Path/PathScripts/PathToolController.py b/src/Mod/Path/PathScripts/PathToolController.py index 3f8405ccd3..9dbf185a54 100644 --- a/src/Mod/Path/PathScripts/PathToolController.py +++ b/src/Mod/Path/PathScripts/PathToolController.py @@ -226,7 +226,7 @@ class ToolController: def Create(name='TC: Default Tool', tool=None, toolNumber=1, assignViewProvider=True): - legacyTool = PathPreferences.toolsReallyUseLegacyTools() if tool is None else isinstance(tool, Path.Tool) + legacyTool = PathPreferences.toolsUseLegacyTools() if tool is None else isinstance(tool, Path.Tool) PathLog.track(tool, toolNumber, legacyTool) diff --git a/src/Mod/Path/PathScripts/PathToolLibraryEditor.py b/src/Mod/Path/PathScripts/PathToolLibraryEditor.py index dd37954687..da2bae994e 100644 --- a/src/Mod/Path/PathScripts/PathToolLibraryEditor.py +++ b/src/Mod/Path/PathScripts/PathToolLibraryEditor.py @@ -439,7 +439,7 @@ class CommandToolLibraryEdit(): pass def edit(self, job=None, cb=None): - if PathPreferences.toolsReallyUseLegacyTools(): + if PathPreferences.toolsUseLegacyTools(): editor = EditorPanel(job, cb) editor.setupUi() editor.form.exec_() diff --git a/src/Mod/Path/PathTests/TestPathToolController.py b/src/Mod/Path/PathTests/TestPathToolController.py index 5f8bff716c..67d2507ec6 100644 --- a/src/Mod/Path/PathTests/TestPathToolController.py +++ b/src/Mod/Path/PathTests/TestPathToolController.py @@ -37,7 +37,7 @@ class TestPathToolController(PathTestBase): FreeCAD.closeDocument(self.doc.Name) def createTool(self, name='t1', diameter=1.75): - if PathPreferences.toolsReallyUseLegacyTools(): + if PathPreferences.toolsUseLegacyTools(): return Path.Tool(name=name, diameter=diameter) attrs = {'shape': None, 'name': name, 'parameter': {'Diameter': diameter}, 'attribute': []} return PathToolBit.Factory.CreateFromAttrs(attrs, name) @@ -68,7 +68,7 @@ class TestPathToolController(PathTestBase): self.assertEqual(attrs['hrapid'], '28.0 mm/s') self.assertEqual(attrs['dir'], 'Reverse') self.assertEqual(attrs['speed'], 12000) - if PathPreferences.toolsReallyUseLegacyTools(): + if PathPreferences.toolsUseLegacyTools(): self.assertEqual(attrs['tool'], t.templateAttrs()) else: self.assertEqual(attrs['tool'], t.Proxy.templateAttrs(t)) From b3c11f5cd288a5913393caec9bf2cea2d3a3cb29 Mon Sep 17 00:00:00 2001 From: Markus Lampert Date: Mon, 15 Feb 2021 12:18:49 -0800 Subject: [PATCH 17/17] Fixed TC creation from templates if legacy tools are enabled. --- .../Path/PathScripts/PathToolController.py | 69 ++++++++----------- 1 file changed, 28 insertions(+), 41 deletions(-) diff --git a/src/Mod/Path/PathScripts/PathToolController.py b/src/Mod/Path/PathScripts/PathToolController.py index 9dbf185a54..0a7633208d 100644 --- a/src/Mod/Path/PathScripts/PathToolController.py +++ b/src/Mod/Path/PathScripts/PathToolController.py @@ -60,35 +60,23 @@ class ToolControllerTemplate: class ToolController: - def __init__(self, obj, cTool=False): - PathLog.track('tool: {}'.format(cTool)) + def __init__(self, obj, legacyTool=False, createTool=True): + PathLog.track('tool: {}'.format(legacyTool)) - obj.addProperty("App::PropertyIntegerConstraint", "ToolNumber", - "Tool", QtCore.QT_TRANSLATE_NOOP("PathToolController", - "The active tool")) + obj.addProperty("App::PropertyIntegerConstraint", "ToolNumber", "Tool", QtCore.QT_TRANSLATE_NOOP("PathToolController", "The active tool")) obj.ToolNumber = (0, 0, 10000, 1) - self.ensureUseLegacyTool(obj, cTool) - obj.addProperty("App::PropertyFloat", "SpindleSpeed", "Tool", - QtCore.QT_TRANSLATE_NOOP("PathToolController", - "The speed of the cutting spindle in RPM")) - obj.addProperty("App::PropertyEnumeration", "SpindleDir", "Tool", - QtCore.QT_TRANSLATE_NOOP("PathToolController", - "Direction of spindle rotation")) + obj.addProperty("App::PropertyFloat", "SpindleSpeed", "Tool", QtCore.QT_TRANSLATE_NOOP("PathToolController", "The speed of the cutting spindle in RPM")) + obj.addProperty("App::PropertyEnumeration", "SpindleDir", "Tool", QtCore.QT_TRANSLATE_NOOP("PathToolController", "Direction of spindle rotation")) obj.SpindleDir = ['Forward', 'Reverse'] - obj.addProperty("App::PropertySpeed", "VertFeed", "Feed", - QtCore.QT_TRANSLATE_NOOP("PathToolController", - "Feed rate for vertical moves in Z")) - obj.addProperty("App::PropertySpeed", "HorizFeed", "Feed", - QtCore.QT_TRANSLATE_NOOP("PathToolController", - "Feed rate for horizontal moves")) - obj.addProperty("App::PropertySpeed", "VertRapid", "Rapid", - QtCore.QT_TRANSLATE_NOOP("PathToolController", - "Rapid rate for vertical moves in Z")) - obj.addProperty("App::PropertySpeed", "HorizRapid", "Rapid", - QtCore.QT_TRANSLATE_NOOP("PathToolController", - "Rapid rate for horizontal moves")) + obj.addProperty("App::PropertySpeed", "VertFeed", "Feed", QtCore.QT_TRANSLATE_NOOP("PathToolController", "Feed rate for vertical moves in Z")) + obj.addProperty("App::PropertySpeed", "HorizFeed", "Feed", QtCore.QT_TRANSLATE_NOOP("PathToolController", "Feed rate for horizontal moves")) + obj.addProperty("App::PropertySpeed", "VertRapid", "Rapid", QtCore.QT_TRANSLATE_NOOP("PathToolController", "Rapid rate for vertical moves in Z")) + obj.addProperty("App::PropertySpeed", "HorizRapid", "Rapid", QtCore.QT_TRANSLATE_NOOP("PathToolController", "Rapid rate for horizontal moves")) obj.setEditorMode('Placement', 2) + if createTool: + self.ensureUseLegacyTool(obj, legacyTool) + def onDocumentRestored(self, obj): obj.setEditorMode('Placement', 2) @@ -225,32 +213,31 @@ class ToolController: obj.addProperty("App::PropertyLink", "Tool", "Base", QtCore.QT_TRANSLATE_NOOP("PathToolController", "The tool used by this controller")) -def Create(name='TC: Default Tool', tool=None, toolNumber=1, assignViewProvider=True): +def Create(name='TC: Default Tool', tool=None, toolNumber=1, assignViewProvider=True, assignTool=True): legacyTool = PathPreferences.toolsUseLegacyTools() if tool is None else isinstance(tool, Path.Tool) PathLog.track(tool, toolNumber, legacyTool) obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython", name) obj.Label = name - obj.Proxy = ToolController(obj, legacyTool) + obj.Proxy = ToolController(obj, legacyTool, assignTool) if FreeCAD.GuiUp and assignViewProvider: ViewProvider(obj.ViewObject) - if tool is None: - if legacyTool: - tool = Path.Tool() - tool.Diameter = 5.0 - tool.Name = "Default Tool" - tool.CuttingEdgeHeight = 15.0 - tool.ToolType = "EndMill" - tool.Material = "HighSpeedSteel" - else: - tool = PathToolBit.Factory.Create() - if tool.ViewObject: - tool.ViewObject.Visibility = False - - if tool: + if assignTool: + if not tool: + if legacyTool: + tool = Path.Tool() + tool.Diameter = 5.0 + tool.Name = "Default Tool" + tool.CuttingEdgeHeight = 15.0 + tool.ToolType = "EndMill" + tool.Material = "HighSpeedSteel" + else: + tool = PathToolBit.Factory.Create() + if tool.ViewObject: + tool.ViewObject.Visibility = False obj.Tool = tool obj.ToolNumber = toolNumber return obj @@ -261,7 +248,7 @@ def FromTemplate(template, assignViewProvider=True): PathLog.track() name = template.get(ToolControllerTemplate.Name, ToolControllerTemplate.Label) - obj = Create(name, tool=False, assignViewProvider=True) + obj = Create(name, assignViewProvider=True, assignTool=False) obj.Proxy.setFromTemplate(obj, template) return obj