Skip to content

Commit

Permalink
don't generate gcode if op isn't valid. Don't plunge to start height …
Browse files Browse the repository at this point in the history
…if safe and clearance height are the same.
  • Loading branch information
etrombly committed Jul 16, 2020
1 parent 04ef25d commit 465de60
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 15 deletions.
20 changes: 10 additions & 10 deletions src/Mod/Path/App/Area.cpp
Expand Up @@ -3217,6 +3217,9 @@ void Area::toPath(Toolpath &path, const std::list<TopoDS_Shape> &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) {
Expand Down Expand Up @@ -3269,17 +3272,14 @@ void Area::toPath(Toolpath &path, const std::list<TopoDS_Shape> &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;
Expand Down
2 changes: 1 addition & 1 deletion src/Mod/Path/PathScripts/PathAreaOp.py
Expand Up @@ -487,7 +487,7 @@ def opExecute(self, obj, getsim=False): # pylint: disable=arguments-differ
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}))

Expand Down
4 changes: 0 additions & 4 deletions src/Mod/Path/PathScripts/PathOp.py
Expand Up @@ -514,10 +514,6 @@ def execute(self, obj):

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)
Expand Down

0 comments on commit 465de60

Please sign in to comment.