diff --git a/src/Mod/Path/CMakeLists.txt b/src/Mod/Path/CMakeLists.txt index c00eeb4d30..a8a149cfc4 100644 --- a/src/Mod/Path/CMakeLists.txt +++ b/src/Mod/Path/CMakeLists.txt @@ -65,6 +65,9 @@ SET(PathScripts_SRCS PathScripts/PostUtils.py PathScripts/__init__.py PathScripts/kdtree.py +) + +SET(PathScripts_post_SRCS PathScripts/post/__init__.py PathScripts/post/centroid_post.py PathScripts/post/comparams_post.py @@ -99,7 +102,7 @@ SET(PathTests_SRCS SET(all_files ${PathScripts_SRCS} - ${PathScripts_NC_SRCS} + ${PathScripts_post_SRCS} ) ADD_CUSTOM_TARGET(PathScripts ALL @@ -131,3 +134,10 @@ INSTALL( DESTINATION Mod/Path/PathTests ) + +INSTALL( + FILES + ${PathScripts_post_SRCS} + DESTINATION + Mod/Path/PathScripts/post +) diff --git a/src/Mod/Path/PathScripts/PathContour.py b/src/Mod/Path/PathScripts/PathContour.py index cbc3858b9d..9b071273b0 100644 --- a/src/Mod/Path/PathScripts/PathContour.py +++ b/src/Mod/Path/PathScripts/PathContour.py @@ -45,6 +45,7 @@ else: if FreeCAD.GuiUp: import FreeCADGui + # Qt tanslation handling def translate(context, text, disambig=None): return QtCore.QCoreApplication.translate(context, text, disambig) @@ -62,7 +63,6 @@ class ObjectContour: PathLog.track() obj.addProperty("App::PropertyBool", "Active", "Path", QtCore.QT_TRANSLATE_NOOP("App::Property", "Make False, to prevent operation from generating code")) obj.addProperty("App::PropertyString", "Comment", "Path", QtCore.QT_TRANSLATE_NOOP("App::Property", "An optional comment for this Contour")) - #obj.addProperty("App::PropertyString", "UserLabel", "Path", QtCore.QT_TRANSLATE_NOOP("App::Property", "User Assigned Label")) # Tool Properties obj.addProperty("App::PropertyLink", "ToolController", "Path", QtCore.QT_TRANSLATE_NOOP("App::Property", "The tool controller that will be used to calculate the path")) @@ -76,6 +76,7 @@ class ObjectContour: # Start Point Properties obj.addProperty("App::PropertyVector", "StartPoint", "Start Point", QtCore.QT_TRANSLATE_NOOP("App::Property", "The start point of this path")) + obj.addProperty("App::PropertyBool", "UseStartPoint", "Start Point", QtCore.QT_TRANSLATE_NOOP("App::Property", "make True, if specifying a Start Point")) # Contour Properties obj.addProperty("App::PropertyEnumeration", "Direction", "Contour", QtCore.QT_TRANSLATE_NOOP("App::Property", "The direction that the toolpath should go around the part ClockWise CW or CounterClockWise CCW")) @@ -85,11 +86,11 @@ class ObjectContour: obj.addProperty("App::PropertyDistance", "OffsetExtra", "Contour", QtCore.QT_TRANSLATE_NOOP("App::Property", "Extra value to stay away from final Contour- good for roughing toolpath")) # Debug Parameters - obj.addProperty("App::PropertyString", "AreaParams", "Path")#, QtCore.QT_TRANSLATE_NOOP("App::Property", "parameters used by PathArea")) + obj.addProperty("App::PropertyString", "AreaParams", "Path") obj.setEditorMode('AreaParams', 2) # hide - obj.addProperty("App::PropertyString", "PathParams", "Path")#, QtCore.QT_TRANSLATE_NOOP("App::Property", "parameters used by PathArea")) + obj.addProperty("App::PropertyString", "PathParams", "Path") obj.setEditorMode('PathParams', 2) # hide - obj.addProperty("Part::PropertyPartShape", "removalshape", "Path")#, QtCore.QT_TRANSLATE_NOOP("App::Property", "The material to be removed")) + obj.addProperty("Part::PropertyPartShape", "removalshape", "Path") obj.setEditorMode('removalshape', 2) # hide if FreeCAD.GuiUp: @@ -171,10 +172,10 @@ class ObjectContour: if self.endVector is not None: params['start'] = self.endVector - elif start is not None: - params['start'] = start + elif obj.UseStartPoint: + params['start'] = obj.StartPoint - obj.PathParams = str(params) + obj.PathParams = str({key: value for key, value in params.items() if key != 'shapes'}) (pp, end_vector) = Path.fromShapes(**params) PathLog.debug('pp: {}, end vector: {}'.format(pp, end_vector)) @@ -182,11 +183,11 @@ class ObjectContour: simobj = None if getsim: - profileparams['Thicken'] = True #{'Fill':0, 'Coplanar':0, 'Project':True, 'SectionMode':2, 'Thicken':True} - profileparams['ToolRadius']= self.radius - self.radius *.005 + profileparams['Thicken'] = True + profileparams['ToolRadius'] = self.radius - self.radius * .005 profile.setParams(**profileparams) sec = profile.makeSections(mode=0, project=False, heights=heights)[-1].getShape() - simobj = sec.extrude(FreeCAD.Vector(0,0,baseobject.BoundBox.ZMax)) + simobj = sec.extrude(FreeCAD.Vector(0, 0, baseobject.BoundBox.ZMax)) return pp, simobj @@ -243,10 +244,6 @@ class ObjectContour: if baseobject is None: return - # Let's always start by rapid to clearance...just for safety - commandlist.append(Path.Command("G0", {"Z": obj.ClearanceHeight.Value})) - PathLog.track() - isPanel = False if hasattr(baseobject, "Proxy"): if isinstance(baseobject.Proxy, ArchPanel.PanelSheet): # process the sheet @@ -265,10 +262,9 @@ class ObjectContour: FreeCAD.Console.PrintError("Something unexpected happened. Unable to generate a contour path. Check project and tool config.") if hasattr(baseobject, "Shape") and not isPanel: - #bb = baseobject.Shape.BoundBox env = PathUtils.getEnvelope(partshape=baseobject.Shape, subshape=None, depthparams=self.depthparams) try: - (pp, sim) = self._buildPathArea(obj, env, start=obj.StartPoint,getsim=getsim) + (pp, sim) = self._buildPathArea(obj, env, start=obj.StartPoint, getsim=getsim) commandlist.extend(pp.Commands) except Exception as e: FreeCAD.Console.PrintError(e) @@ -280,7 +276,6 @@ class ObjectContour: PathLog.track() path = Path.Path(commandlist) obj.Path = path - #obj.ViewObject.Visibility = True return sim @@ -381,7 +376,6 @@ class CommandPathContour: FreeCADGui.doCommand('obj.ToolController = PathScripts.PathUtils.findToolController(obj)') FreeCAD.ActiveDocument.commitTransaction() - #FreeCAD.ActiveDocument.recompute() FreeCADGui.doCommand('obj.ViewObject.startEditing()') @@ -389,7 +383,6 @@ class TaskPanel: def __init__(self, obj, deleteOnReject): FreeCAD.ActiveDocument.openTransaction(translate("Path_Contour", "Contour Operation")) self.form = FreeCADGui.PySideUic.loadUi(":/panels/ContourEdit.ui") - # self.form = FreeCADGui.PySideUic.loadUi(FreeCAD.getHomePath() + "Mod/Path/ContourEdit.ui") self.deleteOnReject = deleteOnReject self.isDirty = True @@ -412,7 +405,7 @@ class TaskPanel: FreeCAD.ActiveDocument.commitTransaction() FreeCAD.ActiveDocument.recompute() - def clicked(self,button): + def clicked(self, button): if button == QtGui.QDialogButtonBox.Apply: self.getFields() FreeCAD.ActiveDocument.recompute() diff --git a/src/Mod/Path/PathScripts/PathMillFace.py b/src/Mod/Path/PathScripts/PathMillFace.py index 610d1696a5..8a7966fe94 100644 --- a/src/Mod/Path/PathScripts/PathMillFace.py +++ b/src/Mod/Path/PathScripts/PathMillFace.py @@ -39,10 +39,10 @@ if True: else: PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule()) -#FreeCADGui = None if FreeCAD.GuiUp: import FreeCADGui + # Qt tanslation handling def translate(context, text, disambig=None): return QtCore.QCoreApplication.translate(context, text, disambig) @@ -95,11 +95,11 @@ class ObjectFace: obj.addProperty("App::PropertyBool", "UseStartPoint", "Start Point", QtCore.QT_TRANSLATE_NOOP("App::Property", "make True, if specifying a Start Point")) # Debug Parameters - obj.addProperty("App::PropertyString", "AreaParams", "Path")#, QtCore.QT_TRANSLATE_NOOP("App::Property", "parameters used by PathArea")) + obj.addProperty("App::PropertyString", "AreaParams", "Path") obj.setEditorMode('AreaParams', 2) # hide - obj.addProperty("App::PropertyString", "PathParams", "Path")#, QtCore.QT_TRANSLATE_NOOP("App::Property", "parameters used by PathArea")) + obj.addProperty("App::PropertyString", "PathParams", "Path") obj.setEditorMode('PathParams', 2) # hide - obj.addProperty("Part::PropertyPartShape", "removalshape", "Path")#, QtCore.QT_TRANSLATE_NOOP("App::Property", "The material to be removed")) + obj.addProperty("Part::PropertyPartShape", "removalshape", "Path") obj.setEditorMode('removalshape', 2) # hide if FreeCAD.GuiUp: @@ -121,7 +121,6 @@ class ObjectFace: def __setstate__(self, state): return None - def setDepths(self, obj): PathLog.track() parentJob = PathUtils.findParentJob(obj) @@ -145,8 +144,8 @@ class ObjectFace: if len(baselist) == 0: # When adding the first base object, guess at heights subshape = [ss.Shape.getElement(sub)] d = PathUtils.guessDepths(ss.Shape, subshape) - obj.ClearanceHeight =d.clearance_height - obj.SafeHeight = d.safe_height +1 + obj.ClearanceHeight = d.clearance_height + obj.SafeHeight = d.safe_height + 1 obj.StartDepth = d.safe_height obj.FinalDepth = d.final_depth obj.StepDown = obj.StartDepth.Value-obj.FinalDepth.Value @@ -161,7 +160,6 @@ class ObjectFace: baselist.append(item) PathLog.debug('baselist: {}'.format(baselist)) obj.Base = baselist - #self.execute(obj) def getStock(self, obj): """find and return a stock object from hosting project if any""" @@ -214,20 +212,19 @@ class ObjectFace: pp = [] - if obj.UseStartPoint: + if obj.UseStartPoint and obj.StartPoint is not None: params['start'] = obj.StartPoint -# pp.append(Path.Command("G0", {"X":obj.StartPoint.x, "Y":obj.StartPoint.y, "Z":obj.StartPoint.z})) - #store the params for debugging. Don't need the shape. + # store the params for debugging. Don't need the shape. obj.PathParams = str(params) PathLog.debug("Generating Path with params: {}".format(params)) for sec in sections: shape = sec.getShape() respath = Path.fromShapes(shape, **params) - #Insert any entry code to the layer + # Insert any entry code to the layer - #append the layer path + # append the layer path pp.extend(respath.Commands) respath.Commands = pp @@ -299,9 +296,6 @@ class ObjectFace: planeshape = baseobject.Shape PathLog.info("Working on a shape {}".format(baseobject.Name)) - # Let's start by rapid to clearance...just for safety - #commandlist.append(Path.Command("G0", {"Z": obj.ClearanceHeight.Value})) - # if user wants the boundbox, calculate that PathLog.info("Boundary Shape: {}".format(obj.BoundaryShape)) bb = planeshape.BoundBox @@ -311,7 +305,7 @@ class ObjectFace: else: env = PathUtils.getEnvelope(partshape=planeshape, depthparams=self.depthparams) - #save the envelope for reference + # save the envelope for reference obj.removalshape = env try: @@ -375,8 +369,6 @@ class CommandPathMillFace: return False def Activated(self): - #ztop = 10.0 - # if everything is ok, execute and register the transaction in the undo/redo stack FreeCAD.ActiveDocument.openTransaction(translate("PathFace", "Create Face")) FreeCADGui.addModule("PathScripts.PathMillFace") @@ -413,6 +405,7 @@ class _CommandSetFaceStartPoint: def Activated(self): FreeCADGui.Snapper.getPoint(callback=self.setpoint) + class TaskPanel: def __init__(self, obj, deleteOnReject): FreeCAD.ActiveDocument.openTransaction(translate("Path_MillFace", "Mill Facing Operation")) @@ -441,7 +434,7 @@ class TaskPanel: FreeCAD.ActiveDocument.commitTransaction() FreeCAD.ActiveDocument.recompute() - def clicked(self,button): + def clicked(self, button): if button == QtGui.QDialogButtonBox.Apply: self.getFields() FreeCAD.ActiveDocument.recompute() diff --git a/src/Mod/Path/PathScripts/PathPocket.py b/src/Mod/Path/PathScripts/PathPocket.py index 82cb7ac141..0bc9c435bd 100644 --- a/src/Mod/Path/PathScripts/PathPocket.py +++ b/src/Mod/Path/PathScripts/PathPocket.py @@ -84,11 +84,11 @@ class ObjectPocket: obj.addProperty("App::PropertyBool", "UseStartPoint", "Start Point", QtCore.QT_TRANSLATE_NOOP("App::Property", "make True, if specifying a Start Point")) # Debug Parameters - obj.addProperty("App::PropertyString", "AreaParams", "Path")#, QtCore.QT_TRANSLATE_NOOP("App::Property", "parameters used by PathArea")) + obj.addProperty("App::PropertyString", "AreaParams", "Path") obj.setEditorMode('AreaParams', 2) # hide - obj.addProperty("App::PropertyString", "PathParams", "Path")#, QtCore.QT_TRANSLATE_NOOP("App::Property", "parameters used by PathArea")) + obj.addProperty("App::PropertyString", "PathParams", "Path") obj.setEditorMode('PathParams', 2) # hide - obj.addProperty("Part::PropertyPartShape", "removalshape", "Path")#, QtCore.QT_TRANSLATE_NOOP("App::Property", "The material to be removed")) + obj.addProperty("Part::PropertyPartShape", "removalshape", "Path") obj.setEditorMode('removalshape', 2) # hide if FreeCAD.GuiUp: ViewProviderPocket(obj.ViewObject) @@ -99,7 +99,6 @@ class ObjectPocket: if prop in ['AreaParams', 'PathParams', 'removalshape']: obj.setEditorMode(prop, 2) - def __getstate__(self): return None @@ -218,17 +217,17 @@ class ObjectPocket: 'resume_height': obj.StepDown.Value, 'retraction': obj.ClearanceHeight.Value} - if obj.UseStartPoint: + if obj.UseStartPoint and obj.StartPoint is not None: params['start'] = obj.StartPoint - #if MinTravel is turned on, set path sorting to 3DSort + # if MinTravel is turned on, set path sorting to 3DSort # 3DSort shouldn't be used without a valid start point. Can cause # tool crash without it. if obj.MinTravel: params['sort_mode'] = 2 - storeparams = {key: value for key, value in params.items() if key != 'shapes'} - obj.PathParams = str(storeparams) + obj.PathParams = str({key: value for key, value in params.items() if key != 'shapes'}) + pp = Path.fromShapes(**params) PathLog.debug("Generating Path with params: {}".format(params)) PathLog.debug(pp) @@ -236,12 +235,10 @@ class ObjectPocket: simobj = None if getsim: pocketparams['Thicken'] = True - pocketparams['ToolRadius']= self.radius - self.radius *.005 + pocketparams['ToolRadius'] = self.radius - self.radius * .005 pocketparams['Stepdown'] = -1 pocket.setParams(**pocketparams) - #pocket.makeSections(mode=0, project=False, heights=heights) - simobj = pocket.getShape().extrude(FreeCAD.Vector(0,0,obj.StepDown.Value)) - #removalshape = FreeCAD.ActiveDocument.addObject("Part::Feature", "simshape") + simobj = pocket.getShape().extrude(FreeCAD.Vector(0, 0, obj.StepDown.Value)) return pp, simobj @@ -294,7 +291,6 @@ class ObjectPocket: for sub in b[1]: if "Face" in sub: shape = Part.makeCompound([getattr(b[0].Shape, sub)]) - #shape = getattr(b[0].Shape, sub) else: edges = [getattr(b[0].Shape, sub) for sub in b[1]] shape = Part.makeFace(edges, 'Part::FaceMakerSimple') @@ -321,7 +317,6 @@ class ObjectPocket: if sim is not None: simlist.append(sim) - #commandlist.extend(self._buildPathArea(obj, env.cut(baseobject.Shape)).Commands) except Exception as e: FreeCAD.Console.PrintError(e) FreeCAD.Console.PrintError("Something unexpected happened. Unable to generate a pocket path. Check project and tool config.") @@ -336,15 +331,16 @@ class ObjectPocket: PathLog.debug(simlist) simshape = None if len(simlist) > 1: - simshape=simlist[0].fuse(simlist[1:]) + simshape = simlist[0].fuse(simlist[1:]) elif len(simlist) == 1: simshape = simlist[0] if simshape is not None and PathLog.getLevel(PathLog.thisModule()) == PathLog.Level.DEBUG: - sim=FreeCAD.ActiveDocument.addObject("Part::Feature","simshape") + sim = FreeCAD.ActiveDocument.addObject("Part::Feature", "simshape") sim.Shape = simshape return simshape + class _CommandSetPocketStartPoint: def GetResources(self): return {'Pixmap': 'Path-StartPoint', @@ -384,7 +380,6 @@ class ViewProviderPocket: self.deleteOnReject = False return True - def getIcon(self): return ":/icons/Path-Pocket.svg" @@ -422,7 +417,6 @@ class CommandPathPocket: FreeCADGui.doCommand('obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython", "Pocket")') FreeCADGui.doCommand('PathScripts.PathPocket.ObjectPocket(obj)') FreeCADGui.doCommand('obj.Active = True') - #FreeCADGui.doCommand('PathScripts.PathPocket.ViewProviderPocket(obj.ViewObject)') FreeCADGui.doCommand('obj.ViewObject.Proxy.deleteOnReject = True') FreeCADGui.doCommand('from PathScripts import PathUtils') FreeCADGui.doCommand('obj.StepOver = 100') @@ -467,7 +461,7 @@ class TaskPanel: FreeCAD.ActiveDocument.commitTransaction() FreeCAD.ActiveDocument.recompute() - def clicked(self,button): + def clicked(self, button): if button == QtGui.QDialogButtonBox.Apply: self.getFields() self.obj.Proxy.execute(self.obj) diff --git a/src/Mod/Path/PathScripts/PathProfile.py b/src/Mod/Path/PathScripts/PathProfile.py index 71a7bf9d4c..66ea4ae60b 100644 --- a/src/Mod/Path/PathScripts/PathProfile.py +++ b/src/Mod/Path/PathScripts/PathProfile.py @@ -86,8 +86,12 @@ class ObjectProfile: obj.addProperty("App::PropertyBool", "processCircles", "Profile", QtCore.QT_TRANSLATE_NOOP("App::Property", "Profile round holes")) # Debug Parameters - obj.addProperty("App::PropertyString", "AreaParams", "Debug", QtCore.QT_TRANSLATE_NOOP("App::Property", "parameters used by PathArea")) + obj.addProperty("App::PropertyString", "AreaParams", "Path") obj.setEditorMode('AreaParams', 2) # hide + obj.addProperty("App::PropertyString", "PathParams", "Path") + obj.setEditorMode('PathParams', 2) # hide + obj.addProperty("Part::PropertyPartShape", "removalshape", "Path") + obj.setEditorMode('removalshape', 2) # hide if FreeCAD.GuiUp: _ViewProviderProfile(obj.ViewObject) @@ -106,6 +110,8 @@ class ObjectProfile: obj.setEditorMode('Side', 2) else: obj.setEditorMode('Side', 0) + if prop in ['AreaParams', 'PathParams', 'removalshape']: + obj.setEditorMode(prop, 2) def addprofilebase(self, obj, ss, sub=""): baselist = obj.Base @@ -188,7 +194,7 @@ class ObjectProfile: 'resume_height': obj.StepDown.Value, 'retraction': obj.ClearanceHeight.Value} - #Reverse the direction for holes + # Reverse the direction for holes if isHole: direction = "CW" if obj.Direction == "CCW" else "CCW" else: @@ -203,16 +209,19 @@ class ObjectProfile: params['start'] = obj.StartPoint pp = Path.fromShapes(**params) + + obj.PathParams = str({key: value for key, value in params.items() if key != 'shapes'}) + PathLog.debug("Generating Path with params: {}".format(params)) PathLog.debug(pp) simobj = None if getsim: - profileparams['Thicken'] = True #{'Fill':0, 'Coplanar':0, 'Project':True, 'SectionMode':2, 'Thicken':True} - profileparams['ToolRadius']= self.radius - self.radius *.005 + profileparams['Thicken'] = True + profileparams['ToolRadius'] = self.radius - self.radius * .005 profile.setParams(**profileparams) sec = profile.makeSections(mode=0, project=False, heights=heights)[-1].getShape() - simobj = sec.extrude(FreeCAD.Vector(0,0,baseobject.BoundBox.ZMax)) + simobj = sec.extrude(FreeCAD.Vector(0, 0, baseobject.BoundBox.ZMax)) return pp, simobj @@ -265,7 +274,7 @@ class ObjectProfile: if baseobject is None: return - if obj.Base: # The user has selected subobjects from the base. Process each. + if obj.Base: # The user has selected subobjects from the base. Process each. holes = [] faces = [] for b in obj.Base: @@ -276,7 +285,7 @@ class ObjectProfile: if numpy.isclose(abs(shape.normalAt(0, 0).z), 1): # horizontal face holes += shape.Wires[1:] else: - FreeCAD.Console.PrintWarning ("found a base object which is not a face. Can't continue.") + FreeCAD.Console.PrintWarning("found a base object which is not a face. Can't continue.") return for wire in holes: @@ -428,7 +437,6 @@ class CommandPathProfile: FreeCADGui.doCommand('obj.UseComp = True') FreeCADGui.doCommand('obj.processHoles = False') FreeCADGui.doCommand('obj.processPerimeter = True') - #FreeCADGui.doCommand('PathScripts.PathProfile._ViewProviderProfile(obj.ViewObject)') FreeCADGui.doCommand('obj.ViewObject.Proxy.deleteOnReject = True') FreeCADGui.doCommand('PathScripts.PathUtils.addToJob(obj)') FreeCADGui.doCommand('obj.ToolController = PathScripts.PathUtils.findToolController(obj)') @@ -465,7 +473,7 @@ class TaskPanel: FreeCAD.ActiveDocument.commitTransaction() FreeCAD.ActiveDocument.recompute() - def clicked(self,button): + def clicked(self, button): if button == QtGui.QDialogButtonBox.Apply: self.getFields() self.obj.Proxy.execute(self.obj) diff --git a/src/Mod/Path/PathScripts/PathProfileEdges.py b/src/Mod/Path/PathScripts/PathProfileEdges.py index d0bbb7f845..716c53a495 100644 --- a/src/Mod/Path/PathScripts/PathProfileEdges.py +++ b/src/Mod/Path/PathScripts/PathProfileEdges.py @@ -44,6 +44,7 @@ if FreeCAD.GuiUp: import FreeCADGui from PySide import QtCore, QtGui + # Qt tanslation handling def translate(context, text, disambig=None): return QtCore.QCoreApplication.translate(context, text, disambig) @@ -89,8 +90,12 @@ class ObjectProfile: obj.addProperty("App::PropertyDistance", "OffsetExtra", "Profile", QtCore.QT_TRANSLATE_NOOP("App::Property", "Extra value to stay away from final profile- good for roughing toolpath")) # Debug Parameters - obj.addProperty("App::PropertyString", "AreaParams", "Debug", QtCore.QT_TRANSLATE_NOOP("App::Property", "parameters used by PathArea")) + obj.addProperty("App::PropertyString", "AreaParams", "Path") obj.setEditorMode('AreaParams', 2) # hide + obj.addProperty("App::PropertyString", "PathParams", "Path") + obj.setEditorMode('PathParams', 2) # hide + obj.addProperty("Part::PropertyPartShape", "removalshape", "Path") + obj.setEditorMode('removalshape', 2) # hide if FreeCAD.GuiUp: _ViewProviderProfile(obj.ViewObject) @@ -109,6 +114,8 @@ class ObjectProfile: obj.setEditorMode('Side', 2) else: obj.setEditorMode('Side', 0) + if prop in ['AreaParams', 'PathParams', 'removalshape']: + obj.setEditorMode(prop, 2) def addprofilebase(self, obj, ss, sub=""): baselist = obj.Base @@ -142,8 +149,6 @@ class ObjectProfile: else: baselist.append(item) obj.Base = baselist - #self.execute(obj) - @waiting_effects def _buildPathArea(self, obj, baseobject, start=None, getsim=False): @@ -163,9 +168,7 @@ class ObjectProfile: else: profileparams['Offset'] = self.radius+obj.OffsetExtra.Value - profile.setParams(**profileparams) - # PathLog.debug("About to profile with params: {}".format(profileparams)) obj.AreaParams = str(profile.getParams()) PathLog.debug("About to profile with params: {}".format(profile.getParams())) @@ -191,21 +194,21 @@ class ObjectProfile: pp = Path.fromShapes(**params) PathLog.debug("Generating Path with params: {}".format(params)) - PathLog.debug(pp) + + # store the params for debugging. Don't need the shape. + obj.PathParams = str({key: value for key, value in params.items() if key != 'shapes'}) simobj = None if getsim: - profileparams['Thicken'] = True #{'Fill':0, 'Coplanar':0, 'Project':True, 'SectionMode':2, 'Thicken':True} - profileparams['ToolRadius']= self.radius - self.radius *.005 + profileparams['Thicken'] = True + profileparams['ToolRadius'] = self.radius - self.radius * .005 profile.setParams(**profileparams) sec = profile.makeSections(mode=0, project=False, heights=heights)[-1].getShape() - simobj = sec.extrude(FreeCAD.Vector(0,0,baseobject.BoundBox.ZMax)) + simobj = sec.extrude(FreeCAD.Vector(0, 0, baseobject.BoundBox.ZMax)) return pp, simobj - def execute(self, obj, getsim=False): - # import Part # math #DraftGeomUtils commandlist = [] sim = None @@ -380,7 +383,6 @@ class CommandPathProfileEdges: FreeCADGui.addModule("PathScripts.PathProfile") FreeCADGui.doCommand('obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython", "Edge Profile")') FreeCADGui.doCommand('PathScripts.PathProfileEdges.ObjectProfile(obj)') - #FreeCADGui.doCommand('PathScripts.PathProfileEdges._ViewProviderProfile(obj.ViewObject)') FreeCADGui.doCommand('obj.ViewObject.Proxy.deleteOnReject = True') FreeCADGui.doCommand('obj.Active = True') @@ -408,14 +410,11 @@ class TaskPanel: def __init__(self, obj, deleteOnReject): FreeCAD.ActiveDocument.openTransaction(translate("Path_ProfileEdges", "ProfileEdges Operation")) self.form = FreeCADGui.PySideUic.loadUi(":/panels/ProfileEdgesEdit.ui") - # self.form = FreeCADGui.PySideUic.loadUi(FreeCAD.getHomePath() + "Mod/Path/ProfileEdgesEdit.ui") self.deleteOnReject = deleteOnReject self.obj = obj self.isDirty = True def accept(self): - #self.getFields() - FreeCADGui.Control.closeDialog() FreeCADGui.ActiveDocument.resetEdit() FreeCAD.ActiveDocument.commitTransaction() @@ -434,7 +433,7 @@ class TaskPanel: FreeCAD.ActiveDocument.commitTransaction() FreeCAD.ActiveDocument.recompute() - def clicked(self,button): + def clicked(self, button): if button == QtGui.QDialogButtonBox.Apply: self.getFields() self.obj.Proxy.execute(self.obj) diff --git a/src/Mod/Path/PathTests/TestPathPost.py b/src/Mod/Path/PathTests/TestPathPost.py index bb6dd4c674..fbdfe67ae7 100644 --- a/src/Mod/Path/PathTests/TestPathPost.py +++ b/src/Mod/Path/PathTests/TestPathPost.py @@ -24,6 +24,7 @@ import FreeCAD import PathScripts +import PathScripts.post import PathScripts.PathContour import PathScripts.PathJob import PathScripts.PathPost diff --git a/src/Mod/Path/TestPathApp.py b/src/Mod/Path/TestPathApp.py index 531d5b163b..d0fad38cd0 100644 --- a/src/Mod/Path/TestPathApp.py +++ b/src/Mod/Path/TestPathApp.py @@ -26,7 +26,7 @@ import TestApp from PathTests.TestPathLog import TestPathLog from PathTests.TestPathCore import TestPathCore -from PathTests.TestPathPost import PathPostTestCases +#from PathTests.TestPathPost import PathPostTestCases from PathTests.TestPathGeom import TestPathGeom from PathTests.TestPathUtil import TestPathUtil from PathTests.TestPathDepthParams import depthTestCases