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 { 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" \ 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) 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 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... 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", 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() 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)) 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); 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; } 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..c26cc9f0ae --- /dev/null +++ b/src/Mod/Path/Gui/Resources/preferences/Advanced.ui @@ -0,0 +1,184 @@ + + + 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 + + + + Open CAMlib + + + + + + + 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;">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 OCL dependent features + + + EnableAdvancedOCLFeatures + + + 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..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: @@ -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 @@ -164,6 +165,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..ff07fc1cbb 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(): @@ -161,10 +162,6 @@ def toolsUseLegacyTools(): return preferences().GetBool(UseLegacyTools, False) -def toolsReallyUseLegacyTools(): - return toolsUseLegacyTools() - - def toolsStoreAbsolutePaths(): return preferences().GetBool(UseAbsoluteToolPaths, False) @@ -243,6 +240,10 @@ def setDefaultTaskPanelLayout(style): preferences().SetInt(DefaultTaskPanelLayout, style) +def advancedOCLFeaturesEnabled(): + return preferences().GetBool(EnableAdvancedOCLFeatures, False) + + def experimentalFeaturesEnabled(): return preferences().GetBool(EnableExperimentalFeatures, False) @@ -251,8 +252,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 +263,12 @@ def suppressSelectionModeWarning(): def suppressOpenCamLibWarning(): return preferences().GetBool(WarningSuppressOpenCamLib, True) +def setPreferencesAdvanced(ocl, warnSpeeds, warnRapids, warnModes, warnOCL): + preferences().SetBool(EnableAdvancedOCLFeatures, ocl) + 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..5b9151587b --- /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.EnableAdvancedOCLFeatures.stateChanged.connect(self.updateSelection) + + def saveSettings(self): + PathPreferences.setPreferencesAdvanced( + self.form.EnableAdvancedOCLFeatures.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.EnableAdvancedOCLFeatures.setChecked(PathPreferences.advancedOCLFeaturesEnabled()) + self.form.WarningSuppressOpenCamLib.setChecked(PathPreferences.suppressOpenCamLibWarning()) + self.updateSelection() + + def updateSelection(self, state=None): + self.form.WarningSuppressOpenCamLib.setEnabled(self.form.EnableAdvancedOCLFeatures.isChecked()) + if self.form.WarningSuppressAllSpeeds.isChecked(): + self.form.WarningSuppressRapidSpeeds.setChecked(True) + self.form.WarningSuppressRapidSpeeds.setEnabled(False) + else: + self.form.WarningSuppressRapidSpeeds.setEnabled(True) + 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): diff --git a/src/Mod/Path/PathScripts/PathToolController.py b/src/Mod/Path/PathScripts/PathToolController.py index 3f8405ccd3..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): - legacyTool = PathPreferences.toolsReallyUseLegacyTools() if tool is None else isinstance(tool, Path.Tool) +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 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)) diff --git a/src/Mod/Start/StartPage/StartPage.js b/src/Mod/Start/StartPage/StartPage.js index ad906f89e9..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, ' 
  • '); } } }