diff --git a/src/Mod/Path/App/PathSegmentWalker.cpp b/src/Mod/Path/App/PathSegmentWalker.cpp index bbb171419b..b87aa34bbd 100644 --- a/src/Mod/Path/App/PathSegmentWalker.cpp +++ b/src/Mod/Path/App/PathSegmentWalker.cpp @@ -327,7 +327,12 @@ void PathSegmentWalker::walk(PathSegmentVisitor &cb, const Base::Vector3d &start } Base::Vector3d p3(next); - p3.*pz = last.*pz; + if (retract_mode == 99) // G81,G83 need to account for G99 and retract to R only + p3.*pz = p2.*pz; + else + p3.*pz = last.*pz; + + Base::Vector3d p3r = compensateRotation(p3, nrot, rotCenter); plist.push_back(p1r); @@ -353,6 +358,10 @@ void PathSegmentWalker::walk(PathSegmentVisitor &cb, const Base::Vector3d &start pz = &Base::Vector3d::y; } else if(name=="G19") { pz = &Base::Vector3d::x; + } else if(name=="G98") { + retract_mode = 98; + } else if(name=="G99") { + retract_mode = 99; } } } diff --git a/src/Mod/Path/App/PathSegmentWalker.h b/src/Mod/Path/App/PathSegmentWalker.h index 987969a22c..4da7668319 100644 --- a/src/Mod/Path/App/PathSegmentWalker.h +++ b/src/Mod/Path/App/PathSegmentWalker.h @@ -52,7 +52,7 @@ class PathExport PathSegmentVisitor }; /** - * PathSegmentWalker processes a path a splits all movement commands into straight segments and calls the + * PathSegmentWalker processes a path and splits all movement commands into straight segments and calls the * appropriate member of the provided PathSegmentVisitor. * All non-movement commands are processed accordingly if they affect the movement commands. */ @@ -66,6 +66,7 @@ public: private: const Toolpath &tp; + int retract_mode; };