diff --git a/src/Mod/Path/PathScripts/PathCircularHoleBase.py b/src/Mod/Path/PathScripts/PathCircularHoleBase.py index fb122550ee..b56d576448 100644 --- a/src/Mod/Path/PathScripts/PathCircularHoleBase.py +++ b/src/Mod/Path/PathScripts/PathCircularHoleBase.py @@ -134,15 +134,20 @@ class ObjectOp(PathOp.ObjectOp): edge = self.getArchPanelEdge(obj, base, sub) return edge.BoundBox.XLength - shape = base.Shape.getElement(sub) - if shape.ShapeType == 'Vertex': - return 0 + try: + shape = base.Shape.getElement(sub) + if shape.ShapeType == 'Vertex': + return 0 - if shape.ShapeType == 'Edge' and type(shape.Curve) == Part.Circle: - return shape.Curve.Radius * 2 + if shape.ShapeType == 'Edge' and type(shape.Curve) == Part.Circle: + return shape.Curve.Radius * 2 - # for all other shapes the diameter is just the dimension in X - return shape.BoundBox.XLength + # for all other shapes the diameter is just the dimension in X + return shape.BoundBox.XLength + except Part.OCCError as e: + PathLog.error(e) + + return 0 def holePosition(self, obj, base, sub): '''holePosition(obj, base, sub) ... returns a Vector for the position defined by the given features. @@ -184,7 +189,6 @@ class ObjectOp(PathOp.ObjectOp): calculated and assigned. Do not overwrite, implement circularHoleExecute(obj, holes) instead.''' PathLog.track() - PathLog.debug("\nopExecute() in PathCircularHoleBase.py") holes = [] baseSubsTuples = [] @@ -364,6 +368,8 @@ class ObjectOp(PathOp.ObjectOp): pass # pylint: disable=unnecessary-pass def findAllHoles(self, obj): + '''findAllHoles(obj) ... find all holes of all base models and assign as features.''' + PathLog.track() if not self.getJob(obj): return features = [] diff --git a/src/Mod/Path/PathScripts/PathCircularHoleBaseGui.py b/src/Mod/Path/PathScripts/PathCircularHoleBaseGui.py index 6a971e387b..4e77c0001e 100644 --- a/src/Mod/Path/PathScripts/PathCircularHoleBaseGui.py +++ b/src/Mod/Path/PathScripts/PathCircularHoleBaseGui.py @@ -81,7 +81,8 @@ class TaskPanelHoleGeometryPage(PathOpGui.TaskPanelBaseGeometryPage): item.setData(self.DataObjectSub, sub) self.form.baseList.setItem(self.form.baseList.rowCount()-1, 0, item) - item = QtGui.QTableWidgetItem("{:.3f}".format(obj.Proxy.holeDiameter(obj, base, sub))) + dia = obj.Proxy.holeDiameter(obj, base, sub) + item = QtGui.QTableWidgetItem("{:.3f}".format(dia)) item.setData(self.DataFeatureName, name) item.setData(self.DataObject, base) item.setData(self.DataObjectSub, sub) diff --git a/src/Mod/Path/PathScripts/PathJobGui.py b/src/Mod/Path/PathScripts/PathJobGui.py index ce09925b27..11efdef192 100644 --- a/src/Mod/Path/PathScripts/PathJobGui.py +++ b/src/Mod/Path/PathScripts/PathJobGui.py @@ -114,15 +114,17 @@ class ViewProvider: self.switch = None self.taskPanel = None self.vobj = None - self.baseVisibility = None - self.stockVisibility = None + self.baseVisibility = {} + self.stockVisibility = False def attach(self, vobj): self.vobj = vobj self.obj = vobj.Object self.taskPanel = None - self.baseVisibility = None - self.stockVisibility = None + if not hasattr(self, 'baseVisibility'): + self.baseVisibility = {} + if not hasattr(self, 'stockVisibility'): + self.stockVisibility = False # setup the axis display at the origin self.switch = coin.SoSwitch()