diff --git a/src/Mod/Path/PathScripts/PathCircularHoleBase.py b/src/Mod/Path/PathScripts/PathCircularHoleBase.py index fc64918fed..3edef6d19b 100644 --- a/src/Mod/Path/PathScripts/PathCircularHoleBase.py +++ b/src/Mod/Path/PathScripts/PathCircularHoleBase.py @@ -39,16 +39,19 @@ __author__ = "sliptonic (Brad Collette)" __url__ = "http://www.freecadweb.org" __doc__ = "Base class an implementation for operations on circular holes." + # Qt tanslation handling def translate(context, text, disambig=None): return QtCore.QCoreApplication.translate(context, text, disambig) + if False: PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule()) PathLog.trackModule(PathLog.thisModule()) else: PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule()) + class ObjectOp(PathOp.ObjectOp): '''Base class for proxy objects of all operations on circular holes.''' @@ -155,23 +158,7 @@ class ObjectOp(PathOp.ObjectOp): return len(obj.Locations) != 0 return False - if len(obj.Base) == 0 and not haveLocations(self, obj): - features = [] - if self.baseIsArchPanel(obj, self.baseobject): - holeshapes = self.baseobject.Proxy.getHoles(self.baseobject, transform=True) - tooldiameter = obj.ToolController.Proxy.getTool(obj.ToolController).Diameter - for holeNr, hole in enumerate(holeshapes): - PathLog.debug('Entering new HoleShape') - for wireNr, wire in enumerate(hole.Wires): - PathLog.debug('Entering new Wire') - for edgeNr, edge in enumerate(wire.Edges): - if PathUtils.isDrillable(self.baseobject, edge, tooldiameter): - PathLog.debug('Found drillable hole edges: {}'.format(edge)) - features.append((self.baseobject, "%d.%d.%d" % (holeNr, wireNr, edgeNr))) - else: - features = self.findHoles(obj, self.baseobject) - obj.Base = features - obj.Disabled = [] + # if len(obj.Base) == 0 and not haveLocations(self, obj): holes = [] @@ -195,6 +182,24 @@ class ObjectOp(PathOp.ObjectOp): Must be overwritten by subclasses.''' pass + def findAllHoles(self, obj): + features = [] + if self.baseIsArchPanel(obj, self.baseobject): + holeshapes = self.baseobject.Proxy.getHoles(self.baseobject, transform=True) + tooldiameter = obj.ToolController.Proxy.getTool(obj.ToolController).Diameter + for holeNr, hole in enumerate(holeshapes): + PathLog.debug('Entering new HoleShape') + for wireNr, wire in enumerate(hole.Wires): + PathLog.debug('Entering new Wire') + for edgeNr, edge in enumerate(wire.Edges): + if PathUtils.isDrillable(self.baseobject, edge, tooldiameter): + PathLog.debug('Found drillable hole edges: {}'.format(edge)) + features.append((self.baseobject, "%d.%d.%d" % (holeNr, wireNr, edgeNr))) + else: + features = self.findHoles(obj, self.baseobject) + obj.Base = features + obj.Disabled = [] + def findHoles(self, obj, baseobject): '''findHoles(obj, baseobject) ... inspect baseobject and identify all features that resemble a straight cricular hole.''' shape = baseobject.Shape diff --git a/src/Mod/Path/PathScripts/PathCircularHoleBaseGui.py b/src/Mod/Path/PathScripts/PathCircularHoleBaseGui.py index c733218056..234463e546 100644 --- a/src/Mod/Path/PathScripts/PathCircularHoleBaseGui.py +++ b/src/Mod/Path/PathScripts/PathCircularHoleBaseGui.py @@ -165,6 +165,7 @@ class TaskPanelHoleGeometryPage(PathOpGui.TaskPanelBaseGeometryPage): '''resetBase() ... push button callback''' self.obj.Base = [] self.obj.Disabled = [] + self.obj.Proxy.findAllHoles(self.obj) self.obj.Proxy.execute(self.obj) FreeCAD.ActiveDocument.recompute() @@ -180,4 +181,3 @@ class TaskPanelOpPage(PathOpGui.TaskPanelPage): def taskPanelBaseGeometryPage(self, obj, features): '''taskPanelBaseGeometryPage(obj, features) ... Return circular hole specific page controller for Base Geometry.''' return TaskPanelHoleGeometryPage(obj, features) - diff --git a/src/Mod/Path/PathScripts/PathDrilling.py b/src/Mod/Path/PathScripts/PathDrilling.py index 4015032df6..b1ac92a481 100644 --- a/src/Mod/Path/PathScripts/PathDrilling.py +++ b/src/Mod/Path/PathScripts/PathDrilling.py @@ -124,4 +124,5 @@ def Create(name): '''Create(name) ... Creates and returns a Drilling operation.''' obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython", name) proxy = ObjectDrilling(obj) + proxy.findAllHoles(obj) return obj diff --git a/src/Mod/Path/PathScripts/PathHelix.py b/src/Mod/Path/PathScripts/PathHelix.py index 3809caa22a..d2295d991f 100644 --- a/src/Mod/Path/PathScripts/PathHelix.py +++ b/src/Mod/Path/PathScripts/PathHelix.py @@ -45,7 +45,7 @@ class ObjectHelix(PathCircularHoleBase.ObjectOp): def circularHoleFeatures(self, obj): '''circularHoleFeatures(obj) ... enable features supported by Helix.''' - return PathOp.FeatureStepDown | PathOp.FeatureBaseEdges | PathOp.FeatureBaseFaces | PathOp.FeatureBasePanels + return PathOp.FeatureStepDown | PathOp.FeatureBaseEdges | PathOp.FeatureBaseFaces | PathOp.FeatureBasePanels def initCircularHoleOperation(self, obj): '''initCircularHoleOperation(obj) ... create helix specific properties.''' @@ -197,4 +197,5 @@ def Create(name): '''Create(name) ... Creates and returns a Helix operation.''' obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython", name) proxy = ObjectHelix(obj) + proxy.findAllHoles(obj) return obj