Please test also with G61
Citando bruno <[email protected]>:
> Hello,
>
> I wrote a quadrangle pocketing routine in G-Code which uses nurbs
> (G5.2). The motivation for this is that I dislike the current ngcgui
> routine (qpocket) for a couple reason. When qpocket cuts from one quad
> to another, "spiraling out", it actually cuts a scaled quad, then adds
> one edge where it slowly cuts toward the next scaled quad. That cut is
> really slow and is superfluous if the cut was really following a quad
> spiral instead. Second, and most important for me, the cut fully digs in
> on each corner (depending on the angle of the corner of course, but
> generally it is pretty big).
>
> So the width of cut goes from the overlap set for each pass, to almost
> the full endmill width. Maybe not important on a big mill, but I have a
> mini-mill and I like to try to cut at full depth if possible and with
> very small overlap, on many fast passes, it gives (I think ) better
> finish and wears the mill more evenly. (kind of like with adaptative
> clearing). So the way corners are cut is really a problem with qpocket.
>
> Here is the fruit of my experiments using nurbs, pasted below. The nurb
> weight are scaled with an exponential as the path comes closer to the
> final pocket shape, to (un)round the corners progressively. The function
> is parametrable.
>
> The preview looks great, however, when running it, I get a path that
> does not follow the previewed path ! And I see no reason for the massive
> divergence from the programmed path. See a screenshot here:
>
> http://imagebin.ca/v/1OCw5gNzXQBF
>
> http://ibin.co/1OCw5gNzXQBF
>
> notice how the purple path has "wobbles" in some sections, which go way
> aside the previewed path.
>
> I tested with the sim on linuxcnc 2.5.3
>
> At first sight it really seems to be a bug as the preview looks correct.
> Could anyone test this on their setup ? Is there an explanation for this ?
>
> Thanks !
> Bruno
>
>
> Here is the test program
>
> ;;;;;;;;;;;;;;;;;;;;;;
> ;
> #<mill_number> = 5
>
> ( some init )
> G21 (Unit in mm)
> G90 (Absolute distance mode)
> G64 P0.01 (Exact Path 0.001 tol.)
> G17
> G40 (Cancel diameter comp.)
> G49 (Cancel length comp.)
>
> G54
>
> G0 X0 Y0 Z0
>
> ( select endmill )
> T[#<mill_number> ] M6
> G43 ( enable tool length compensation )
> G0 Z5
>
> F300
> ;;;;;;;;;;;;;;;;;;;;;
>
> G0 X20 Y20
> G1 Y-20
> G1 X-20
> G1 Y20
> G1 X20
>
> G0 X40 Y40
> G0 Y-40
> G0 X-40
> G0 Y40
> G0 X40
>
> G0 X0 Y0
>
> ;;;;;;;;;;;;;;;;;;;;;;;;;
> ; parameters
> (coordinates of the corners are absolute)
> ( starting corner top right)
>
> #<x1> = 40
> #<y1> = 40
> #<x2> = 40
> #<y2> = -40
> #<x3> = -40
> #<y3> = -40
> #<x4> = -40
> #<y4> = 40
>
> #<z_safe> = 2
>
> ( defines how the nurb weight vary)
> #<initial_weight> = 0.1
> #<weight_mult> = 8
> #<weight_offset> = 2
>
> #<hole_radius> = 4
> #<pocket_depth> = 15
> ( z step for each turn when drilling down )
> #<z_step> = 1
> ( z step for each layer )
> #<z_stepover> = 8
> #<xy_stepover> = 5
> ;;;;;;;;;;;;;;;;;;;;;;;
>
> o<npocket4> call [#<x1>] [#<y1>] [#<x2>] [#<y2>] [#<x3>] [#<y3>] [#<x4>]
> [#<y4>] [#<z_safe>] [#<initial_weight>] [#<weight_mult>]
> [#<weight_offset>] [#<hole_radius>] [#<pocket_depth>] [#<z_step>]
> [#<z_stepover>] [#<xy_stepover>]
>
> M2
>
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
>
>
> the actual subroutine:
>
>
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> ; quadrangle pocket cutting path.
> ; author: Bruno Schwander
> ; 30 May 2014
> ; This code is under the Beerware-license:
> ; if you use this code and find it useful, buy me a beer sometimes.
> ; [email protected]
> ;
>
> ; parameters
> (coordinates of the corners are absolute)
> ( starting corner top right)
>
> o<npocket4> sub
>
> #<x1> = #1
> #<y1> = #2
> #<x2> = #3
> #<y2> = #4
> #<x3> = #5
> #<y3> = #6
> #<x4> = #7
> #<y4> = #8
>
> #<z_safe> = #9
>
> ( defines how the nurb weight vary)
> #<initial_weight> = #10
> #<weight_mult> = #11
> #<weight_offset> = #12
>
> #<hole_radius> = #13
> #<pocket_depth> = #14
> ( z step for each turn when drilling down )
> #<z_step> = #15
> ( z step for each layer )
> #<z_stepover> = #16
> #<xy_stepover> = #17
> ;;;;;;;;;;;;;;;;;;;;;;;
>
> #<tool_diameter> = #5410
>
> #<midx12> = [[#<x1> + #<x2>] / 2]
> #<midy12> = [[#<y1> + #<y2>] / 2]
> #<midx23> = [[#<x2> + #<x3>] / 2]
> #<midy23> = [[#<y2> + #<y3>] / 2]
> #<midx34> = [[#<x3> + #<x4>] / 2]
> #<midy34> = [[#<y3> + #<y4>] / 2]
> #<midx41> = [[#<x4> + #<x1>] / 2]
> #<midy41> = [[#<y4> + #<y1>] / 2]
>
> #<xcenter> = [[#<midx12> + #<midx34>] / 2]
> #<ycenter> = [[#<midy12> + #<midy34>] / 2]
>
> #<dim> = SQRT[ [[[#<x1> + #<x2>] / 2]**2] + [[[#<y1> + #<y2>] / 2]**2] ]
> #<xy_passes> = [ #<dim> / #<xy_stepover>]
> #<pocket_not_finished> = 1
>
> G90 (absolute mode)
>
> G0 X[#<xcenter>] Y[#<ycenter>]
> ;G42 (no tool diameter compensation with nurbs !!)
>
> o100 do
>
> #<weight> = [#<initial_weight>]
>
> (given pocket depth, find the actual z_stepover to do which can
> change if z_stepover is larger than what is left to pocket)
> o101 if [#<pocket_depth> GT #<z_stepover> ]
> #<z_stepdepth> = #<z_stepover>
> o101 else
> #<z_stepdepth> = #<pocket_depth>
> o101 endif
>
> G91
> G0 X-[ #<hole_radius> ]
> ( drill center hole of pocket )
> o102 while [ #<z_stepdepth> GE #<z_step> ]
> G2 Z-[#<z_step>] I[#<hole_radius>]
> #<z_stepdepth> = [#<z_stepdepth> - #<z_step>]
> #<pocket_depth> = [#<pocket_depth> - #<z_step>]
> o102 endwhile
>
>
> (must handle when z_step not a multiple of z_stepdepth)
> #<last_zstep> = [#<z_stepdepth> - [FIX[#<z_stepdepth> / #<z_step>]
> * #<z_step>] ]
> o103 if [#<last_zstep> GT 0]
> G2 Z-[#<last_zstep>] I[#<hole_radius>]
> #<pocket_depth> = [#<pocket_depth> - #<last_zstep>]
> o103 endif
>
> G2 I[ #<hole_radius> ] ( 1 turn flat to finish bottom of hole)
>
> G90
> #<offset> = #<hole_radius>
> #<scale> = [#<offset> / #<dim>]
>
> ; go to start
> G0 X[ [#<midx41> - #<xcenter>]* #<scale> + #<xcenter>] Y[
> [#<midy41> - #<ycenter>] * #<scale> + #<ycenter>]
>
> G5.2 X[[#<x1> - #<xcenter>] * #<scale> + #<xcenter>] Y[[#<y1> -
> #<ycenter>] * #<scale> + #<ycenter>] P[#<weight>] L3
> X[[#<midx12> - #<xcenter>] * #<scale> + #<xcenter>]
> Y[[#<midy12> - #<ycenter>] * #<scale> + #<ycenter>] P[#<weight>]
> G5.3
>
> #<pass_number> = 0
> #<mid_index> = 1
>
> o104 while [ [#<offset> ] LE #<dim> ]
> #<pass_number> = [#<pass_number> + 1]
> #<weight> = [#<initial_weight> + EXP[[[#<pass_number> /
> #<xy_passes>] * #<weight_mult>] - #<weight_offset>] ]
>
> #<offset> = [#<offset> + [0.25 * #<xy_stepover>]]
> #<scale> = [#<offset> / #<dim>]
>
> o300 if [ [#<offset> ] GT #<dim> ]
> o104 continue
> o300 endif
> G5.2 X[[#<x2> - #<xcenter>] * #<scale> + #<xcenter>] Y[[#<y2> -
> #<ycenter>] * #<scale> + #<ycenter>] P[#<weight>] L3
> X[[#<midx23> - #<xcenter>] * #<scale> + #<xcenter>]
> Y[[#<midy23> - #<ycenter>] * #<scale> + #<ycenter>] P[#<weight>]
> G5.3
> #<mid_index> = 2
>
> #<offset> = [#<offset> + [0.25 * #<xy_stepover>]]
> #<scale> = [#<offset> / #<dim>]
>
> o301 if [ [#<offset> ] GT #<dim> ]
> o104 continue
> o301 endif
> G5.2 X[[#<x3> - #<xcenter>] * #<scale> + #<xcenter>] Y[[#<y3> -
> #<ycenter>] * #<scale> + #<ycenter>] P[#<weight>] L3
> X[[#<midx34> - #<xcenter>] * #<scale> + #<xcenter>]
> Y[[#<midy34> - #<ycenter>] * #<scale> + #<ycenter>] P[#<weight>]
> G5.3
> #<mid_index> = 3
>
> #<offset> = [#<offset> + [0.25 * #<xy_stepover>]]
> #<scale> = [#<offset> / #<dim>]
> o302 if [ [#<offset> ] GT #<dim> ]
> o104 continue
> o302 endif
> G5.2 X[[#<x4> - #<xcenter>] * #<scale> + #<xcenter>] Y[[#<y4> -
> #<ycenter>] * #<scale> + #<ycenter>] P[#<weight>] L3
> X[[#<midx41> - #<xcenter>] * #<scale> + #<xcenter>]
> Y[[#<midy41> - #<ycenter>] * #<scale> + #<ycenter>] P[#<weight>]
> G5.3
> #<mid_index> = 4
>
> #<offset> = [#<offset> + [0.25 * #<xy_stepover>]]
> #<scale> = [#<offset> / #<dim>]
> o303 if [ [#<offset> ] GT #<dim> ]
> o104 continue
> o303 endif
> G5.2 X[[#<x1> - #<xcenter>] * #<scale> + #<xcenter>] Y[[#<y1> -
> #<ycenter>] * #<scale> + #<ycenter>] P[#<weight>] L3
> X[[#<midx12> - #<xcenter>] * #<scale> + #<xcenter>]
> Y[[#<midy12> - #<ycenter>] * #<scale> + #<ycenter>] P[#<weight>]
> G5.3
> #<mid_index> = 1
>
> o104 endwhile
>
>
> ; finish the corners
>
> ;
> ; finish pass all around
> ;
>
> o400 if [#<mid_index> EQ 1]
> G1 X[#<x2>] Y[#<y2>]
> G1 X[#<x3>] Y[#<y3>]
> G1 X[#<x4>] Y[#<y4>]
> G1 X[#<x1>] Y[#<y1>]
> G1 X[#<x2>] Y[#<y2>]
> o400 elseif [#<mid_index> EQ 2]
> G1 X[#<x3>] Y[#<y3>]
> G1 X[#<x4>] Y[#<y4>]
> G1 X[#<x1>] Y[#<y1>]
> G1 X[#<x2>] Y[#<y2>]
> G1 X[#<x3>] Y[#<y3>]
> o400 elseif [#<mid_index> EQ 3]
> G1 X[#<x4>] Y[#<y4>]
> G1 X[#<x1>] Y[#<y1>]
> G1 X[#<x2>] Y[#<y2>]
> G1 X[#<x3>] Y[#<y3>]
> G1 X[#<x4>] Y[#<y4>]
> o400 else ([#<mid_index> EQ 4])
> G1 X[#<x1>] Y[#<y1>]
> G1 X[#<x2>] Y[#<y2>]
> G1 X[#<x3>] Y[#<y3>]
> G1 X[#<x4>] Y[#<y4>]
> G1 X[#<x1>] Y[#<y1>]
> o400 endif
>
> ( move back to center )
> (#<current_z> = #5422 ) ( not possible to get position when cutter
> comp. on!)
> (G0 Z[#<current_z> + 1])
> G91
> G0 Z[#<z_safe>]
> G90
> G0 X[#<xcenter>] Y[#<ycenter>]
> G91
> G0 Z-[#<z_safe>]
> G90
> ([ #<current_z> ])
>
> o105 if [#<pocket_depth> LE 0]
> #<pocket_not_finished> = 0
> o105 endif
>
> o100 while [ #<pocket_not_finished> ]
>
> o<npocket4> endsub
>
>
>
>
>
> ------------------------------------------------------------------------------
> Time is money. Stop wasting it! Get your web API in 5 minutes.
> www.restlet.com/download[1]
> http://p.sf.net/sfu/restlet
> _______________________________________________
> Emc-developers mailing list
> [email protected]https://lists.sourceforge.net/lists/listinfo/emc-developers
Ligações:
---------
[1] http://www.restlet.com/download
------------------------------------------------------------------------------
Time is money. Stop wasting it! Get your web API in 5 minutes.
www.restlet.com/download
http://p.sf.net/sfu/restlet
_______________________________________________
Emc-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/emc-developers