diff --git a/src/Mod/Draft/DraftGui.py b/src/Mod/Draft/DraftGui.py index aa09b61dbf..1dfc605f99 100644 --- a/src/Mod/Draft/DraftGui.py +++ b/src/Mod/Draft/DraftGui.py @@ -435,7 +435,10 @@ class DraftToolBar: if hide: button.hide() if icon: - button.setIcon(QtGui.QIcon.fromTheme(icon, QtGui.QIcon(':/icons/'+icon+'.svg'))) + if icon.endswith(".svg"): + button.setIcon(QtGui.QIcon(icon)) + else: + button.setIcon(QtGui.QIcon.fromTheme(icon, QtGui.QIcon(':/icons/'+icon+'.svg'))) #button.setIconSize(QtCore.QSize(isize, isize)) if checkable: button.setCheckable(True) @@ -772,9 +775,10 @@ class DraftToolBar: self.widthButton = self._spinbox("widthButton", self.bottomtray, val=self.linewidth,hide=False,size=(bsize * 2,bsize)) self.widthButton.setSuffix("px") self.fontsizeButton = self._spinbox("fontsizeButton",self.bottomtray, val=self.fontsize,vmax=999, hide=False,double=True,size=(bsize * 4,bsize)) - self.applyButton = self._pushbutton("applyButton", self.toptray, hide=False, icon='Draft_Apply',square=True) - self.autoGroupButton = self._pushbutton("autoGroup",self.bottomtray,icon="Draft_AutoGroup_off",hide=False,width=120) + self.autoGroupButton = self._pushbutton("autoGroup",self.bottomtray,icon=":/icons/button_invalid.svg",hide=False,width=120) self.autoGroupButton.setText("None") + self.autoGroupButton.setFlat(True) + self.applyButton = self._pushbutton("applyButton", self.toptray, hide=False, icon='Draft_Apply',square=True) QtCore.QObject.connect(self.wplabel,QtCore.SIGNAL("pressed()"),self.selectplane) QtCore.QObject.connect(self.colorButton,QtCore.SIGNAL("pressed()"),self.getcol) @@ -2022,15 +2026,21 @@ class DraftToolBar: def selectplane(self): FreeCADGui.runCommand("Draft_SelectPlane") - def popupMenu(self,mlist): + def popupMenu(self,llist,ilist=None): "pops up a menu filled with the given list" self.groupmenu = QtGui.QMenu() - for i in mlist: - self.groupmenu.addAction(i) + for i,l in enumerate(llist): + if ilist: + self.groupmenu.addAction(ilist[i],l) + else: + self.groupmenu.addAction(l) pos = FreeCADGui.getMainWindow().cursor().pos() self.groupmenu.popup(pos) QtCore.QObject.connect(self.groupmenu,QtCore.SIGNAL("triggered(QAction *)"),self.popupTriggered) + def getIcon(self,iconpath): + return QtGui.QIcon(iconpath) + def popupTriggered(self,action): self.sourceCmd.proceed(str(action.text())) @@ -2093,7 +2103,7 @@ class DraftToolBar: self.autogroup = None self.autoGroupButton.setText("None") self.autoGroupButton.setIcon(QtGui.QIcon.fromTheme('Draft_AutoGroup_off', - QtGui.QIcon(':/icons/Draft_AutoGroup_off.svg'))) + QtGui.QIcon(':/icons/button_invalid.svg'))) self.autoGroupButton.setToolTip(translate("draft", "Autogroup off")) self.autoGroupButton.setDown(False) else: @@ -2101,15 +2111,14 @@ class DraftToolBar: if obj: self.autogroup = value self.autoGroupButton.setText(obj.Label) - self.autoGroupButton.setIcon(QtGui.QIcon.fromTheme('Draft_AutoGroup_on', - QtGui.QIcon(':/icons/Draft_AutoGroup_on.svg'))) + self.autoGroupButton.setIcon(obj.ViewObject.Icon) self.autoGroupButton.setToolTip(translate("draft", "Autogroup: ")+obj.Label) self.autoGroupButton.setDown(False) else: self.autogroup = None self.autoGroupButton.setText("None") self.autoGroupButton.setIcon(QtGui.QIcon.fromTheme('Draft_AutoGroup_off', - QtGui.QIcon(':/icons/Draft_AutoGroup_off.svg'))) + QtGui.QIcon(':/icons/button_invalid.svg'))) self.autoGroupButton.setToolTip(translate("draft", "Autogroup off")) self.autoGroupButton.setDown(False) diff --git a/src/Mod/Draft/DraftLayer.py b/src/Mod/Draft/DraftLayer.py index abc6fd42c5..268df6f591 100644 --- a/src/Mod/Draft/DraftLayer.py +++ b/src/Mod/Draft/DraftLayer.py @@ -277,6 +277,20 @@ class ViewProviderLayer: parent.Group = g FreeCAD.ActiveDocument.recompute() + def setupContextMenu(self,vobj,menu): + + from PySide import QtCore,QtGui + action1 = QtGui.QAction(QtGui.QIcon(":/icons/button_right.svg"),translate("draft","Activate this layer"),menu) + action1.triggered.connect(self.activate) + menu.addAction(action1) + + def activate(self): + + if hasattr(self,"Object"): + FreeCADGui.Selection.clearSelection() + FreeCADGui.Selection.addSelection(self.Object) + FreeCADGui.runCommand("Draft_AutoGroup") + class LayerContainer: @@ -289,7 +303,9 @@ class LayerContainer: def execute(self,obj): - return + g = obj.Group + g.sort(key=lambda o: o.Label) + obj.Group = g def __getstate__(self): diff --git a/src/Mod/Draft/DraftTools.py b/src/Mod/Draft/DraftTools.py index 0d563237cd..c1a0ad2ca6 100644 --- a/src/Mod/Draft/DraftTools.py +++ b/src/Mod/Draft/DraftTools.py @@ -5303,20 +5303,26 @@ class SetAutoGroup(): self.ui = FreeCADGui.draftToolBar s = FreeCADGui.Selection.getSelection() if len(s) == 1: - if s[0].isDerivedFrom("App::DocumentObjectGroup") or (Draft.getType(s[0]) in ["Site","Building","Floor"]): + if (Draft.getType(s[0]) == "Layer") or \ + ( FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/BIM").GetBool("AutogroupAddGroups",False) and \ + (s[0].isDerivedFrom("App::DocumentObjectGroup") or (Draft.getType(s[0]) in ["Site","Building","Floor","BuildingPart",]))): self.ui.setAutoGroup(s[0].Name) return self.groups = ["None"] - gn = Draft.getGroupNames() + gn = [o.Name for o in FreeCAD.ActiveDocument.Objects if Draft.getType(o) == "Layer"] + if FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/BIM").GetBool("AutogroupAddGroups",False): + gn.extend(Draft.getGroupNames()) if gn: self.groups.extend(gn) self.labels = ["None"] + self.icons = [self.ui.getIcon(":/icons/button_invalid.svg")] for g in gn: o = FreeCAD.ActiveDocument.getObject(g) if o: self.labels.append(o.Label) + self.icons.append(o.ViewObject.Icon) self.ui.sourceCmd = self - self.ui.popupMenu(self.labels) + self.ui.popupMenu(self.labels,self.icons) def proceed(self,labelname): self.ui.sourceCmd = None diff --git a/src/Mod/Draft/Resources/ui/preferences-draft.ui b/src/Mod/Draft/Resources/ui/preferences-draft.ui index 8967cc26dc..99af017bb8 100755 --- a/src/Mod/Draft/Resources/ui/preferences-draft.ui +++ b/src/Mod/Draft/Resources/ui/preferences-draft.ui @@ -7,7 +7,7 @@ 0 0 486 - 758 + 781 @@ -17,16 +17,7 @@ 6 - - 9 - - - 9 - - - 9 - - + 9 @@ -373,6 +364,25 @@ Values with differences below this value will be treated as same. This value wil + + + + If this option is checked, the layers drop-down list will also show groups, allowing you to automatically add objects to groups too. + + + Show groups in layers list drop-down button + + + false + + + AutogroupAddGroups + + + Mod/Draft + + + @@ -442,7 +452,7 @@ Values with differences below this value will be treated as same. This value wil This is the default color for objects being drawn while in construction mode. - + 44 125 @@ -505,14 +515,14 @@ Values with differences below this value will be treated as same. This value wil - - false + + inCommandShortcutRelative Mod/Draft - - inCommandShortcutRelative + + false @@ -555,14 +565,14 @@ Values with differences below this value will be treated as same. This value wil - - false + + inCommandShortcutContinue Mod/Draft - - inCommandShortcutContinue + + false @@ -605,14 +615,14 @@ Values with differences below this value will be treated as same. This value wil - - false + + inCommandShortcutClose Mod/Draft - - inCommandShortcutClose + + false @@ -657,14 +667,14 @@ Values with differences below this value will be treated as same. This value wil - - false + + inCommandShortcutCopy Mod/Draft - - inCommandShortcutCopy + + false @@ -705,14 +715,14 @@ Values with differences below this value will be treated as same. This value wil - - false + + inCommandShortcutSubelementMode Mod/Draft - - inCommandShortcutSubelementMode + + false @@ -753,14 +763,14 @@ Values with differences below this value will be treated as same. This value wil - - false + + inCommandShortcutFill Mod/Draft - - inCommandShortcutFill + + false @@ -805,14 +815,14 @@ Values with differences below this value will be treated as same. This value wil - - false + + inCommandShortcutExit Mod/Draft - - inCommandShortcutExit + + false @@ -853,14 +863,14 @@ Values with differences below this value will be treated as same. This value wil - - false + + inCommandShortcutSelectEdge Mod/Draft - - inCommandShortcutSelectEdge + + false @@ -901,14 +911,14 @@ Values with differences below this value will be treated as same. This value wil - - false + + inCommandShortcutAddHold Mod/Draft - - inCommandShortcutAddHold + + false @@ -953,14 +963,14 @@ Values with differences below this value will be treated as same. This value wil - - false + + inCommandShortcutLength Mod/Draft - - inCommandShortcutLength + + false @@ -1001,14 +1011,14 @@ Values with differences below this value will be treated as same. This value wil - - false + + inCommandShortcutWipe Mod/Draft - - inCommandShortcutWipe + + false @@ -1049,14 +1059,14 @@ Values with differences below this value will be treated as same. This value wil - - false + + inCommandShortcutSetWP Mod/Draft - - inCommandShortcutSetWP + + false @@ -1101,14 +1111,14 @@ Values with differences below this value will be treated as same. This value wil - - false + + inCommandShortcutCycleSnap Mod/Draft - - inCommandShortcutCycleSnap + + false @@ -1159,14 +1169,14 @@ Values with differences below this value will be treated as same. This value wil - - false + + inCommandShortcutSnap Mod/Draft - - inCommandShortcutSnap + + false @@ -1207,14 +1217,14 @@ Values with differences below this value will be treated as same. This value wil - - false + + inCommandShortcutIncreaseRadius Mod/Draft - - inCommandShortcutIncreaseRadius + + false @@ -1255,14 +1265,14 @@ Values with differences below this value will be treated as same. This value wil - - false + + inCommandShortcutDecreaseRadius Mod/Draft - - inCommandShortcutDecreaseRadius + + false @@ -1307,14 +1317,14 @@ Values with differences below this value will be treated as same. This value wil - - false + + inCommandShortcutRestrictX Mod/Draft - - inCommandShortcutRestrictX + + false @@ -1355,14 +1365,14 @@ Values with differences below this value will be treated as same. This value wil - - false + + inCommandShortcutRestrictY Mod/Draft - - inCommandShortcutRestrictY + + false @@ -1403,14 +1413,14 @@ Values with differences below this value will be treated as same. This value wil - - false + + RestrictZ Mod/Draft - - RestrictZ + + false @@ -1439,11 +1449,21 @@ Values with differences below this value will be treated as same. This value wil qPixmapFromMimeSource + + Gui::ColorButton + QPushButton +
Gui/Widgets.h
+
Gui::PrefSpinBox QSpinBox
Gui/PrefWidgets.h
+ + Gui::PrefColorButton + Gui::ColorButton +
Gui/PrefWidgets.h
+
Gui::PrefCheckBox QCheckBox @@ -1454,26 +1474,16 @@ Values with differences below this value will be treated as same. This value wil QComboBox
Gui/PrefWidgets.h
- - Gui::PrefDoubleSpinBox - QDoubleSpinBox -
Gui/PrefWidgets.h
-
- - Gui::ColorButton - QPushButton -
Gui/Widgets.h
-
- - Gui::PrefColorButton - Gui::ColorButton -
Gui/PrefWidgets.h
-
Gui::PrefLineEdit QLineEdit
Gui/PrefWidgets.h
+ + Gui::PrefDoubleSpinBox + QDoubleSpinBox +
Gui/PrefWidgets.h
+
diff --git a/src/Mod/Draft/Resources/ui/preferences-draftvisual.ui b/src/Mod/Draft/Resources/ui/preferences-draftvisual.ui index 8a3e4e7c2d..e7424daadf 100644 --- a/src/Mod/Draft/Resources/ui/preferences-draftvisual.ui +++ b/src/Mod/Draft/Resources/ui/preferences-draftvisual.ui @@ -6,8 +6,8 @@ 0 0 - 532 - 484 + 531 + 552
@@ -26,90 +26,6 @@ Visual Settings - - - - - - Default line color - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - The default color for new objects - - - - 0 - 0 - 0 - - - - color - - - Mod/Draft - - - - - - - - - - - Default line width - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - The default linewidth for new objects - - - 2 - - - linewidth - - - Mod/Draft - - - - - diff --git a/src/Mod/Fem/TestFem.py b/src/Mod/Fem/TestFem.py index c2412f51f5..e110cf37d6 100644 --- a/src/Mod/Fem/TestFem.py +++ b/src/Mod/Fem/TestFem.py @@ -37,11 +37,25 @@ from femtest.testresult import TestResult from femtest.testccxtools import TestCcxTools from femtest.testsolverframework import TestSolverFrameWork +# dummy usage to get flake8 and lgtm quiet +False if TestFemCommon.__name__ else True +False if TestObjectCreate.__name__ else True +False if TestObjectType.__name__ else True +False if TestMaterialUnits.__name__ else True +False if TestMeshCommon.__name__ else True +False if TestMeshEleTetra10.__name__ else True +False if TestMeshEleTetra10.__name__ else True +False if TestResult.__name__ else True +False if TestCcxTools.__name__ else True +False if TestSolverFrameWork.__name__ else True + # For more information on how to run a specific test class or a test method see -# file src/Mod/Test/__init__ and forum https://forum.freecadweb.org/viewtopic.php?f=10&t=22190#p175546 +# file src/Mod/Test/__init__ +# forum https://forum.freecadweb.org/viewtopic.php?f=10&t=22190#p175546 -# It may be useful to temporary comment FreeCAD.closeDocument(self.doc_name) in tearDown method to not close the document +# It may be useful to temporary comment FreeCAD.closeDocument(self.doc_name) +# in tearDown method to not close the document ''' @@ -60,8 +74,9 @@ Test.runTestsFromClass(femtest.testcommon.TestFemCommon) # method import unittest -mytest = unittest.TestLoader().loadTestsFromName("femtest.testcommon.TestFemCommon.test_pyimport_all_FEM_modules") -unittest.TextTestRunner().run(mytest) +thetest = "femtest.testcommon.TestFemCommon.test_pyimport_all_FEM_modules" +alltest = unittest.TestLoader().loadTestsFromName(thetest) +unittest.TextTestRunner().run(alltest) # examples from shell in build dir: @@ -96,7 +111,8 @@ unittest.TextTestRunner().run(mytest) ./bin/FreeCAD --run-test "femtest.testcommon.TestFemCommon.test_pyimport_all_FEM_modules" # unit test command to run a specific FEM unit test to copy for fast tests :-) -# to get all command to start FreeCAD from build dir on Linux and run FEM unit test this could be used +# to get all commands to start FreeCAD from build dir on Linux +# and run FEM unit test this could be used: from femtest.utilstest import get_fem_test_defs as gf gf() @@ -133,7 +149,8 @@ gf() ./bin/FreeCADCmd --run-test "femtest.testsolverframework.TestSolverFrameWork.test_solver_framework" -# to get all command to start FreeCAD from build dir on Linux and run FEM unit test this could be used +# to get all command to start FreeCAD from build dir on Linux +# and run FEM unit test this could be used: from femtest.utilstest import get_fem_test_defs as gf gf('in') @@ -234,12 +251,13 @@ unittest.TextTestRunner().run(unittest.TestLoader().loadTestsFromName("femtest.t # open files from FEM test suite source code # be careful on updating these files, they contain the original results! # TODO update files, because some of them have non-existing FEM object classes -doc = FreeCAD.open(FreeCAD.ConfigGet("AppHomePath") + 'Mod/Fem/femtest/testfiles/ccx/cube.FCStd') -doc = FreeCAD.open(FreeCAD.ConfigGet("AppHomePath") + 'Mod/Fem/femtest/testfiles/ccx/cube_frequency.FCStd') -doc = FreeCAD.open(FreeCAD.ConfigGet("AppHomePath") + 'Mod/Fem/femtest/testfiles/ccx/cube_static.FCStd') -doc = FreeCAD.open(FreeCAD.ConfigGet("AppHomePath") + 'Mod/Fem/femtest/testfiles/ccx/Flow1D_thermomech.FCStd') -doc = FreeCAD.open(FreeCAD.ConfigGet("AppHomePath") + 'Mod/Fem/femtest/testfiles/ccx/multimat.FCStd') -doc = FreeCAD.open(FreeCAD.ConfigGet("AppHomePath") + 'Mod/Fem/femtest/testfiles/ccx/spine_thermomech.FCStd') +app_home = FreeCAD.ConfigGet("AppHomePath") +doc = FreeCAD.open(app_home + 'Mod/Fem/femtest/testfiles/ccx/cube.FCStd') +doc = FreeCAD.open(app_home + 'Mod/Fem/femtest/testfiles/ccx/cube_frequency.FCStd') +doc = FreeCAD.open(app_home + 'Mod/Fem/femtest/testfiles/ccx/cube_static.FCStd') +doc = FreeCAD.open(app_home + 'Mod/Fem/femtest/testfiles/ccx/Flow1D_thermomech.FCStd') +doc = FreeCAD.open(app_home + 'Mod/Fem/femtest/testfiles/ccx/multimat.FCStd') +doc = FreeCAD.open(app_home + 'Mod/Fem/femtest/testfiles/ccx/spine_thermomech.FCStd') # open files generated from test suite import femtest.utilstest as ut @@ -252,10 +270,11 @@ doc = ut.multimat() doc = ut.spine_thermomech() # load std FEM example files -doc = FreeCAD.open(FreeCAD.ConfigGet("AppHomePath") + 'data/examples/FemCalculixCantilever2D.FCStd') -doc = FreeCAD.open(FreeCAD.ConfigGet("AppHomePath") + 'data/examples/FemCalculixCantilever3D.FCStd') -doc = FreeCAD.open(FreeCAD.ConfigGet("AppHomePath") + 'data/examples/FemCalculixCantilever3D_newSolver.FCStd') -doc = FreeCAD.open(FreeCAD.ConfigGet("AppHomePath") + 'data/examples/Fem.FCStd') -doc = FreeCAD.open(FreeCAD.ConfigGet("AppHomePath") + 'data/examples/Fem2.FCStd') +app_home = FreeCAD.ConfigGet("AppHomePath") +doc = FreeCAD.open(app_home + 'data/examples/FemCalculixCantilever2D.FCStd') +doc = FreeCAD.open(app_home + 'data/examples/FemCalculixCantilever3D.FCStd') +doc = FreeCAD.open(app_home + 'data/examples/FemCalculixCantilever3D_newSolver.FCStd') +doc = FreeCAD.open(app_home + 'data/examples/Fem.FCStd') +doc = FreeCAD.open(app_home + 'data/examples/Fem2.FCStd') ''' diff --git a/src/Mod/Path/PathScripts/PathProfileFaces.py b/src/Mod/Path/PathScripts/PathProfileFaces.py index 341c37e80f..69e7840e17 100644 --- a/src/Mod/Path/PathScripts/PathProfileFaces.py +++ b/src/Mod/Path/PathScripts/PathProfileFaces.py @@ -46,8 +46,8 @@ __url__ = "http://www.freecadweb.org" __doc__ = "Path Profile operation based on faces." __contributors__ = "russ4262 (Russell Johnson)" __created__ = "2014" -__scriptVersion__ = "2h testing" -__lastModified__ = "2019-06-18 22:36 CST" +__scriptVersion__ = "2i testing" +__lastModified__ = "2019-06-29 23:05 CST" LOGLEVEL = False @@ -94,12 +94,21 @@ class ObjectProfile(PathProfileBase.ObjectProfile): if not hasattr(obj, 'AttemptInverseAngle'): obj.addProperty('App::PropertyBool', 'AttemptInverseAngle', 'Rotation', QtCore.QT_TRANSLATE_NOOP('App::Property', 'Attempt the inverse angle for face access if original rotation fails.')) + if not hasattr(obj, 'HandleMultipleFeatures'): + obj.addProperty('App::PropertyEnumeration', 'HandleMultipleFeatures', 'Profile', QtCore.QT_TRANSLATE_NOOP('PathPocket', 'Choose how to process multiple Base Geometry features.')) + obj.HandleMultipleFeatures = ['Collectively', 'Individually'] + self.baseObject().initAreaOp(obj) + def opOnDocumentRestored(self, obj): + '''opOnDocumentRestored(obj) ... adds the properties if they doesn't exist.''' + # self.initAreaOp(obj) + pass + def areaOpShapes(self, obj): '''areaOpShapes(obj) ... returns envelope for all base shapes or wires for Arch.Panels.''' PathLog.track() - PathLog.debug("----- areaOpShapes() in PathProfileFaces.py") + PathLog.info("----- areaOpShapes() in PathProfileFaces.py") if obj.UseComp: self.commandlist.append(Path.Command("(Compensated Tool Path. Diameter: " + str(self.radius * 2) + ")")) @@ -108,7 +117,6 @@ class ObjectProfile(PathProfileBase.ObjectProfile): shapes = [] self.profileshape = [] - finalDepths = [] startDepths = [] faceDepths = [] @@ -140,8 +148,6 @@ class ObjectProfile(PathProfileBase.ObjectProfile): else: msg = translate("Path", "Consider toggling the 'InverseAngle' property and recomputing.") PathLog.error(msg) - # title = translate("Path", 'Rotation Warning') - # self.guiMessage(title, msg, False) else: PathLog.debug("Face appears to be oriented correctly.") @@ -154,17 +160,11 @@ class ObjectProfile(PathProfileBase.ObjectProfile): tag = base.Name + '_' + axis + str(angle).replace('.', '_') stock = PathUtils.findParentJob(obj).Stock tup = base, sub, tag, angle, axis, stock - # Eif allTuples.append(tup) - # Eif - # Efor - # Efor if subCount > 1: msg = translate('Path', "Multiple faces in Base Geometry.") + " " msg += translate('Path', "Depth settings will be applied to all faces.") PathLog.warning(msg) - # title = translate("Path", "Depth Warning") - # self.guiMessage(title, msg) (Tags, Grps) = self.sortTuplesByIndex(allTuples, 2) # return (TagList, GroupList) subList = [] for o in range(0, len(Tags)): @@ -175,7 +175,7 @@ class ObjectProfile(PathProfileBase.ObjectProfile): baseSubsTuples.append(pair) # Efor else: - PathLog.info(translate("Path", "EnableRotation property is 'Off'.")) + PathLog.debug(translate("Path", "EnableRotation property is 'Off'.")) stock = PathUtils.findParentJob(obj).Stock for (base, subList) in obj.Base: baseSubsTuples.append((base, subList, 0.0, 'X', stock)) @@ -205,9 +205,6 @@ class ObjectProfile(PathProfileBase.ObjectProfile): # Raise FinalDepth to lowest face in list on Inside profile ops finDep = obj.FinalDepth.Value - if obj.Side == 'Inside': - finDep = min(faceDepths) - finalDepths.append(finDep) strDep = obj.StartDepth.Value if strDep > stock.Shape.BoundBox.ZMax: @@ -239,46 +236,37 @@ class ObjectProfile(PathProfileBase.ObjectProfile): self.profileshape.append(profileshape) if obj.processPerimeter: - PathLog.track() - try: - env = PathUtils.getEnvelope(base.Shape, subshape=profileshape, depthparams=self.depthparams) - except Exception: - # PathUtils.getEnvelope() failed to return an object. - PathLog.error(translate('Path', 'Unable to create path for face(s).')) - else: - # shapes.append((env, False)) - tup = env, False, 'pathProfileFaces', angle, axis, strDep, finDep - shapes.append(tup) - else: - for shape in faces: - finalDep = finDep - # Recalculate depthparams - if obj.Side == 'Inside': - if finalDep < shape.BoundBox.ZMin: - custDepthparams = PathUtils.depth_params( - clearance_height=obj.ClearanceHeight.Value, - safe_height=obj.SafeHeight.Value, - start_depth=strDep, # obj.StartDepth.Value, - step_down=obj.StepDown.Value, - z_finish_step=finish_step, - final_depth=shape.BoundBox.ZMin, # obj.FinalDepth.Value, - user_depths=None) - env = PathUtils.getEnvelope(base.Shape, subshape=shape, depthparams=custDepthparams) - finalDep = shape.BoundBox.ZMin - else: - env = PathUtils.getEnvelope(base.Shape, subshape=shape, depthparams=self.depthparams) + if obj.HandleMultipleFeatures == 'Collectively': + PathLog.track() + try: + env = PathUtils.getEnvelope(base.Shape, subshape=profileshape, depthparams=self.depthparams) + except Exception: + # PathUtils.getEnvelope() failed to return an object. + PathLog.error(translate('Path', 'Unable to create path for face(s).')) else: - env = PathUtils.getEnvelope(base.Shape, subshape=shape, depthparams=self.depthparams) - tup = env, False, 'pathProfileFaces', angle, axis, strDep, finalDep - shapes.append(tup) - # Eif + # shapes.append((env, False)) + tup = env, False, 'pathProfileFaces', angle, axis, strDep, finDep + shapes.append(tup) + elif obj.HandleMultipleFeatures == 'Individually': + for shape in faces: + finalDep = obj.FinalDepth.Value + custDepthparams = self.depthparams + if obj.Side == 'Inside': + if finalDep < shape.BoundBox.ZMin: + # Recalculate depthparams + finalDep = shape.BoundBox.ZMin + custDepthparams = PathUtils.depth_params( + clearance_height=obj.ClearanceHeight.Value, + safe_height=obj.SafeHeight.Value, + start_depth=strDep, # obj.StartDepth.Value, + step_down=obj.StepDown.Value, + z_finish_step=finish_step, + final_depth=finalDep, # obj.FinalDepth.Value, + user_depths=None) + env = PathUtils.getEnvelope(base.Shape, subshape=shape, depthparams=custDepthparams) + tup = env, False, 'pathProfileFaces', angle, axis, strDep, finalDep + shapes.append(tup) - # adjust Start/Final Depths as needed - # Raise existing Final Depth to level of lowest profile face - if obj.Side == 'Inside': - finalDepth = min(finalDepths) - if obj.FinalDepth.Value < finalDepth: - obj.FinalDepth.Value = finalDepth # Lower high Start Depth to top of Stock startDepth = max(startDepths) if obj.StartDepth.Value > startDepth: @@ -324,9 +312,7 @@ class ObjectProfile(PathProfileBase.ObjectProfile): obj.InverseAngle = False obj.AttemptInverseAngle = True obj.B_AxisErrorOverride = False - - # def checkDepths(self, obj, shape): - # return (strDept, finDep) + obj.HandleMultipleFeatures = 'Collectively' def SetupProperties(): @@ -338,6 +324,7 @@ def SetupProperties(): setup.append("InverseAngle") setup.append("B_AxisErrorOverride") setup.append("AttemptInverseAngle") + setup.append("HandleMultipleFeatures") return setup