Hi all,

I started playing with ngcgui which seemed to fit very well for a 
project I have, however I noticed that cutter path compensation (g42, 
g41) is commented out, for example in qpocket.ngc. Even if one where to 
use the code as-is and compensate the pocket size by the cutter radius, 
the cutter path would not be complete as the center of the pocket will 
not be milled.

I enabled toolpath compensation, and of course got errors (the usual 
warning that it will gouge the part, etc.). In debugging the code I 
found a few things that cause problems:

- the stepover parameter seems weird.. maybe I just do not understand 
how it is supposed to work. It seemed that a stepover of 0.5 should give 
an overlap between passes of half the cutter diameter. That is not the 
case at all, I get passes vastly more spaced. I can get around this by 
using much smaller stepover values like 0.01 so I did not delve on this 
much further. If anyone know or can explain that behavior, that would be 
appreciated.

- The entry path is a quarter circle arc. However it is placed smack in 
the corner (using as a test a square pocket of 30mm side and 10mm 
diameter cutter). So the path goes along the end of one edge (of the 
first pocket cut), veers off to the other edge in a quarter circle. 
Obviously that brings the cutter lead-in path close to the first edge 
and will not work.

With a few tests and after reading the tool compensation page on 
linuxcnc.org, I figured we can just use as entry path a straight line 
going right toward the _middle_ of the first edge. Even with a very 
small pocket were the first outline cut is as a big as the cutter, this 
works. So that is my solution: remove the 2 pre-entry moves, move to the 
centroid of the pocket, then move straight toward the middle point of 
the first edge to cut.
This will probably cause issues if the edge is at an acute angle with 
the path between the centroid and the middle point, however that can be 
fixed by reordering the pocket corners (which is already sometimes 
necessary)

- at the end of milling one layer of the pocket (by zincr depth) the 
cutter is returned to the entry point before milling down for the next 
layer. Here a G1 move is used. I do not see the reason for this, so I 
replaced by a small lift by zincr, then G0 back to the initial point and 
G0 to the right z depth.

- again, at the end of milling one layer, the move back is to an entry 
point causing an error (going to gouge the part...). I tried to find a 
move that would bring back the cutter to the center without going  
outside the path already traced. My trick is to have 2 moves, one with 
cutter path compensation off, to end at the center of the pocket again. 
It works except for very small pockets relative to the cutter diameter. 
For example, with a 28mm square pocket and 10mm cutter it still works, 
but a smaller pocket will have the cutter hit the side of the pocket. I 
am still experimenting with this part and hope to find a solution. 
Nonetheless, I think a limit of a maximum cutter size a little below 1/3 
the pocket size is quite manageable.

I tested all this with sim axis-mm on linuxcnc 2.5.3.

I hope this can be used or will be useful to find a real fix to ngcgui, 
which I am starting to use and find quite useful with tool compensation 
turned on.

here are diffs with my changes applied:


diff --git a/nc_files/ngcgui_lib/qpocket.ngc 
b/nc_files/ngcgui_lib/qpocket.ngc
index d6e4841..82bd743 100644
--- a/nc_files/ngcgui_lib/qpocket.ngc
+++ b/nc_files/ngcgui_lib/qpocket.ngc
@@ -306,19 +306,41 @@ o<dir00>     else ;dir EQ 3 CCW (climb)
                 #<vx>     = [            #<r> * #<cos12>]
                 #<vy>     = [            #<r> * #<sin12>]
  o<dir00>     endif
-             g0  x #<prex1> y #<prey1> ;preentry 1
-             g0  x #<prex2> y #<prey2> ;preentry 2
+             g0 x #<xctr> y #<yctr>
  o<dir10>     if [#<dir> EQ 2] ; CW
-/              g42 ;cutter radius comp right of path
-               g2  x #<xentry> y #<yentry> i #<vx> j #<vy> ;arc entry
+              g42 ;cutter radius comp right of path
+             g1 x [ #<x1i> + [[#<x2i> - #<x1i>] / 2]] y [#<y1i> + 
[[#<y2i> - #<y1i>] / 2]]
  o<dir10>     else ;dir EQ 3 CCW
-/              g41 ;cutter radius comp left of path
-               g3  x #<xentry> y #<yentry> i #<vx> j #<vy> ;arc entry
+              g41 ;cutter radius comp left of path
+             g1 x [ #<x1i> + [[#<x2i> - #<x1i>] / 2]] y [#<y1i> + 
[[#<y2i> - #<y1i>] / 2]]
  o<dir10>     endif
               g1 z #<zstart> ;plunge to start height from zsafe
  o<pas1>    else
+
               ; depthpass GT 1: return to interior entry point
-             g1 x #<xentry> y #<yentry> z#<zlast> ; use zlast
+            g0 z [#<zlast> - #<zincr>]
+
+o<seq10>        if [#<seq> EQ 0]
+                  g0 x [#<x2i>] y [#<y2i>]
+o<seq10>        endif
+o<seq11>        if [#<seq> EQ 1]
+                  g0 x [#<x3i>] y [#<y3i>]
+o<seq11>        endif
+o<seq12>        if [#<seq> EQ 2]
+                  g0 x [#<x4i>] y [#<y4i>]
+o<seq12>        endif
+o<seq13>        if [#<seq> EQ 3]
+                  g0 x [#<x1i>] y [#<y1i>]
+o<seq13>        endif
+            g40
+            g0 x #<xctr> y [#<yctr>] z#<zlast> ; use zlast
+
+o<dir20>     if [#<dir> EQ 2] ; CW
+              g42 ;cutter radius comp right of path
+o<dir20>     else ;dir EQ 3 CCW
+              g41 ;cutter radius comp left of path
+o<dir20>     endif
+
  o<pas1>    endif

             ; outline loop (inner)
@@ -335,6 +357,7 @@ o<wh22>      endif

               #<seq> = [#<outlinepass> mod 4]
  o<wh23>      if [#<outlinepass> EQ 1]
+
                 ; move through smallest interior outline
                 g1 x #<x2i> y #<y2i> z#<zcurrent> ;ramp down to zcurrent
                    x #<x3i> y #<y3i>


------------------------------------------------------------------------------
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today.
http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
_______________________________________________
Emc-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/emc-developers

Reply via email to