diff --git a/src/Mod/Path/PathScripts/PathCircularHoleBase.py b/src/Mod/Path/PathScripts/PathCircularHoleBase.py index 3c8082d8e9e9..fb122550eeed 100644 --- a/src/Mod/Path/PathScripts/PathCircularHoleBase.py +++ b/src/Mod/Path/PathScripts/PathCircularHoleBase.py @@ -152,18 +152,21 @@ def holePosition(self, obj, base, sub): center = edge.Curve.Center return FreeCAD.Vector(center.x, center.y, 0) - shape = base.Shape.getElement(sub) - if shape.ShapeType == 'Vertex': - return FreeCAD.Vector(shape.X, shape.Y, 0) - - if shape.ShapeType == 'Edge' and hasattr(shape.Curve, 'Center'): - return FreeCAD.Vector(shape.Curve.Center.x, shape.Curve.Center.y, 0) - - if shape.ShapeType == 'Face': - if hasattr(shape.Surface, 'Center'): - return FreeCAD.Vector(shape.Surface.Center.x, shape.Surface.Center.y, 0) - if len(shape.Edges) == 1 and type(shape.Edges[0].Curve) == Part.Circle: - return shape.Edges[0].Curve.Center + try: + shape = base.Shape.getElement(sub) + if shape.ShapeType == 'Vertex': + return FreeCAD.Vector(shape.X, shape.Y, 0) + + if shape.ShapeType == 'Edge' and hasattr(shape.Curve, 'Center'): + return FreeCAD.Vector(shape.Curve.Center.x, shape.Curve.Center.y, 0) + + if shape.ShapeType == 'Face': + if hasattr(shape.Surface, 'Center'): + return FreeCAD.Vector(shape.Surface.Center.x, shape.Surface.Center.y, 0) + if len(shape.Edges) == 1 and type(shape.Edges[0].Curve) == Part.Circle: + return shape.Edges[0].Curve.Center + except Part.OCCError as e: + PathLog.error(e) PathLog.error(translate("Path", "Feature %s.%s cannot be processed as a circular hole - please remove from Base geometry list.") % (base.Label, sub)) return None diff --git a/src/Mod/Path/PathScripts/PathHelix.py b/src/Mod/Path/PathScripts/PathHelix.py index d1b607ee0c26..80717aed72cd 100644 --- a/src/Mod/Path/PathScripts/PathHelix.py +++ b/src/Mod/Path/PathScripts/PathHelix.py @@ -71,6 +71,10 @@ def initCircularHoleOperation(self, obj): obj.addProperty("App::PropertyEnumeration", "EnableRotation", "Rotation", QtCore.QT_TRANSLATE_NOOP("App::Property", "Enable rotation to gain access to pockets/areas not normal to Z axis.")) obj.EnableRotation = ['Off', 'A(x)', 'B(y)', 'A & B'] + def opOnDocumentRestored(self, obj): + if not hasattr(obj, 'StartRadius'): + obj.addProperty("App::PropertyLength", "StartRadius", "Helix Drill", translate("PathHelix", "Starting Radius")) + def circularHoleExecute(self, obj, holes): '''circularHoleExecute(obj, holes) ... generate helix commands for each hole in holes''' PathLog.track() diff --git a/src/Mod/Path/PathScripts/PathJobGui.py b/src/Mod/Path/PathScripts/PathJobGui.py index f0713595477d..ce09925b2770 100644 --- a/src/Mod/Path/PathScripts/PathJobGui.py +++ b/src/Mod/Path/PathScripts/PathJobGui.py @@ -121,6 +121,8 @@ def attach(self, vobj): self.vobj = vobj self.obj = vobj.Object self.taskPanel = None + self.baseVisibility = None + self.stockVisibility = None # setup the axis display at the origin self.switch = coin.SoSwitch() diff --git a/src/Mod/Path/PathScripts/PathOp.py b/src/Mod/Path/PathScripts/PathOp.py index ca519e514266..b2690df91054 100644 --- a/src/Mod/Path/PathScripts/PathOp.py +++ b/src/Mod/Path/PathScripts/PathOp.py @@ -23,6 +23,7 @@ # *************************************************************************** import FreeCAD +import Part import Path import PathScripts.PathGeom as PathGeom import PathScripts.PathLog as PathLog @@ -215,6 +216,10 @@ def onDocumentRestored(self, obj): if not hasattr(obj, 'OpStockZMax'): self.addOpValues(obj, ['stockz']) + if not hasattr(obj, 'EnableRotation'): + obj.addProperty("App::PropertyEnumeration", "EnableRotation", "Rotation", QtCore.QT_TRANSLATE_NOOP("App::Property", "Enable rotation to gain access to pockets/areas not normal to Z axis.")) + obj.EnableRotation = ['Off', 'A(x)', 'B(y)', 'A & B'] + self.setEditorModes(obj, features) self.opOnDocumentRestored(obj) @@ -393,9 +398,13 @@ def faceZmin(bb, fbb): bb = base.Shape.BoundBox zmax = max(zmax, bb.ZMax) for sub in sublist: - fbb = base.Shape.getElement(sub).BoundBox - zmin = max(zmin, faceZmin(bb, fbb)) - zmax = max(zmax, fbb.ZMax) + try: + fbb = base.Shape.getElement(sub).BoundBox + zmin = max(zmin, faceZmin(bb, fbb)) + zmax = max(zmax, fbb.ZMax) + except Part.OCCError as e: + PathLog.error(e) + else: # clearing with stock boundaries job = PathUtils.findParentJob(obj)