From 465de600077b9399294ffb6ab4857649a691304f Mon Sep 17 00:00:00 2001 From: Eric Trombly Date: Mon, 13 Jul 2020 20:57:36 -0500 Subject: [PATCH] don't generate gcode if op isn't valid. Don't plunge to start height if safe and clearance height are the same. --- src/Mod/Path/App/Area.cpp | 20 ++++++++++---------- src/Mod/Path/PathScripts/PathAreaOp.py | 2 +- src/Mod/Path/PathScripts/PathOp.py | 4 ---- 3 files changed, 11 insertions(+), 15 deletions(-) diff --git a/src/Mod/Path/App/Area.cpp b/src/Mod/Path/App/Area.cpp index b9e220c63f..3c809b6f7b 100644 --- a/src/Mod/Path/App/Area.cpp +++ b/src/Mod/Path/App/Area.cpp @@ -3217,6 +3217,9 @@ void Area::toPath(Toolpath &path, const std::list &shapes, wires = sortWires(shapes,_pstart!=0,&pstart,pend,&stepdown_hint, PARAM_REF(PARAM_FARG,AREA_PARAMS_ARC_PLANE), PARAM_FIELDS(PARAM_FARG,AREA_PARAMS_SORT)); + + if (wires.size() == 0) + return; short currentArcPlane = arc_plane; if (preamble) { @@ -3269,17 +3272,14 @@ void Area::toPath(Toolpath &path, const std::list &shapes, p = pstart; // rapid horizontal move to start point - if(fabs((p.*getter)()-retraction) > Precision::Confusion()) { - // check if last is equal to current, if it is change last so the initial G0 is still emitted - gp_Pnt tmpPlast = plast; - (tmpPlast.*setter)((p.*getter)()); - if(_pstart && p.IsEqual(tmpPlast, Precision::Confusion())){ - plast.SetCoord(10.0, 10.0, 10.0); - (plast.*setter)(retraction); - } - (p.*setter)(retraction); - addGCode(false,path,plast,p,"G0"); + gp_Pnt tmpPlast = plast; + (tmpPlast.*setter)((p.*getter)()); + if(_pstart && p.IsEqual(tmpPlast, Precision::Confusion())){ + plast.SetCoord(10.0, 10.0, 10.0); + (plast.*setter)(retraction); } + (p.*setter)(retraction); + addGCode(false,path,plast,p,"G0"); plast = p; diff --git a/src/Mod/Path/PathScripts/PathAreaOp.py b/src/Mod/Path/PathScripts/PathAreaOp.py index 067845c51d..66b0071d69 100644 --- a/src/Mod/Path/PathScripts/PathAreaOp.py +++ b/src/Mod/Path/PathScripts/PathAreaOp.py @@ -487,7 +487,7 @@ class ObjectOp(PathOp.ObjectOp): sims.append(sim) # Eif - if self.areaOpRetractTool(obj) and self.endVector is not None: + if self.areaOpRetractTool(obj) and self.endVector is not None and len(self.commandlist) > 1: self.endVector[2] = obj.ClearanceHeight.Value self.commandlist.append(Path.Command('G0', {'Z': obj.ClearanceHeight.Value, 'F': self.vertRapid})) diff --git a/src/Mod/Path/PathScripts/PathOp.py b/src/Mod/Path/PathScripts/PathOp.py index 6c21ea8c9a..376ab63667 100644 --- a/src/Mod/Path/PathScripts/PathOp.py +++ b/src/Mod/Path/PathScripts/PathOp.py @@ -514,10 +514,6 @@ class ObjectOp(object): result = self.opExecute(obj) # pylint: disable=assignment-from-no-return - if FeatureHeights & self.opFeatures(obj): - # Let's finish by rapid to clearance...just for safety - self.commandlist.append(Path.Command("G0", {"Z": obj.ClearanceHeight.Value})) - path = Path.Path(self.commandlist) obj.Path = path obj.CycleTime = self.getCycleTimeEstimate(obj)