diff --git a/src/Mod/Path/PathScripts/PathCircularHoleBase.py b/src/Mod/Path/PathScripts/PathCircularHoleBase.py index a9e6bf7e87..47628fcf30 100644 --- a/src/Mod/Path/PathScripts/PathCircularHoleBase.py +++ b/src/Mod/Path/PathScripts/PathCircularHoleBase.py @@ -133,8 +133,11 @@ class ObjectOp(PathOp.ObjectOp): 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' and hasattr(shape.Surface, 'Center'): - return FreeCAD.Vector(shape.Surface.Center.x, shape.Surface.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 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 @@ -158,8 +161,6 @@ class ObjectOp(PathOp.ObjectOp): return len(obj.Locations) != 0 return False - # if len(obj.Base) == 0 and not haveLocations(self, obj): - holes = [] for base, subs in obj.Base: @@ -231,9 +232,15 @@ class ObjectOp(PathOp.ObjectOp): f = shape.getElement(candidateFaceName) if PathUtils.isDrillable(shape, f, tooldiameter): PathLog.debug('face candidate: {} is drillable '.format(f)) - x = f.Surface.Center.x - y = f.Surface.Center.y - diameter = f.BoundBox.XLength + if hasattr(f.Surface, 'Center'): + x = f.Surface.Center.x + y = f.Surface.Center.y + diameter = f.BoundBox.XLength + else: + center = f.Edges[0].Curve.Center + x = center.x + y = center.y + diameter = f.Edges[0].Curve.Radius * 2 holelist.append({'featureName': candidateFaceName, 'feature': f, 'x': x, 'y': y, 'd': diameter, 'enabled': True}) features.append((baseobject, candidateFaceName)) PathLog.debug("Found hole feature %s.%s" % (baseobject.Label, candidateFaceName)) diff --git a/src/Mod/Path/PathScripts/PathDressupTagGui.py b/src/Mod/Path/PathScripts/PathDressupTagGui.py index 43fa3242ae..a896c4502b 100644 --- a/src/Mod/Path/PathScripts/PathDressupTagGui.py +++ b/src/Mod/Path/PathScripts/PathDressupTagGui.py @@ -233,7 +233,8 @@ class PathDressupTagTaskPanel: self.getPoint.getPoint(self.addNewTagAt) def editTagAt(self, point, obj): - if point and obj and (obj or point != FreeCAD.Vector()) and self.obj.Proxy.pointIsOnPath(self.obj, point): + PathLog.track(point, obj) + if point and self.obj.Proxy.pointIsOnPath(self.obj, point): tags = [] for i, (x, y, enabled) in enumerate(self.tags): if i == self.editItem: diff --git a/src/Mod/Path/PathScripts/PathGetPoint.py b/src/Mod/Path/PathScripts/PathGetPoint.py index a5c96a14ca..dc86fc1b1f 100644 --- a/src/Mod/Path/PathScripts/PathGetPoint.py +++ b/src/Mod/Path/PathScripts/PathGetPoint.py @@ -36,6 +36,7 @@ __url__ = "http://www.freecadweb.org" __doc__ = "Helper class to use FreeCADGUi.Snapper to let the user enter arbitray points while the task panel is active." PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule()) +#PathLog.track(PathLog.thisModule()) class TaskPanel: '''Use an instance of this class in another TaskPanel to invoke the snapper. @@ -180,6 +181,7 @@ class TaskPanel: self.formOrig.setFocus() if ok: + self.updatePoint(False) self.pointWhenDone(self.pt, self.obj) else: self.pointWhenDone(None, None) @@ -211,9 +213,9 @@ class TaskPanel: self.pointCbMove = None self.view = None - def updatePoint(self): + def updatePoint(self, usePoint = True): '''updatePoint() ... internal function - do not call.''' - if self.point: + if usePoint and self.point: self.pt = self.point else: x = FreeCAD.Units.Quantity(self.formPoint.globalX.text()).Value diff --git a/src/Mod/Path/PathScripts/PathOpGui.py b/src/Mod/Path/PathScripts/PathOpGui.py index 6d3c82c09d..91dad36e89 100644 --- a/src/Mod/Path/PathScripts/PathOpGui.py +++ b/src/Mod/Path/PathScripts/PathOpGui.py @@ -857,6 +857,7 @@ class TaskPanel(object): if len(sel) == 1 and sel[0].Object != self.obj: for page in self.featurePages: if hasattr(page, 'addBase'): + page.clearBase() page.addBaseGeometry(sel) self.panelSetFields() diff --git a/src/Mod/Path/PathScripts/PathUtils.py b/src/Mod/Path/PathScripts/PathUtils.py index fdcdd27b84..abd847493c 100644 --- a/src/Mod/Path/PathScripts/PathUtils.py +++ b/src/Mod/Path/PathScripts/PathUtils.py @@ -164,6 +164,14 @@ def isDrillable(obj, candidate, tooldiameter=None, includePartials=False): drillable = face.Surface.Radius >= tooldiameter/2 else: drillable = True + elif type(face.Surface) == Part.Plane and PathGeom.pointsCoincide(face.Surface.Axis, FreeCAD.Vector(0,0,1)): + if len(face.Edges) == 1 and type(face.Edges[0].Curve) == Part.Circle: + center = face.Edges[0].Curve.Center + if obj.isInside(center, 1e-6, False): + if tooldiameter is not None: + drillable = face.Edges[0].Curve.Radius >= tooldiameter/2 + else: + drillable = True else: for edge in candidate.Edges: if isinstance(edge.Curve, Part.Circle) and (includePartials or edge.isClosed()):