[Home]History of G74 - Peck Drilling/Face Grooving

LinuxCNCKnowledgeBase | RecentChanges | PageIndex | Preferences | LinuxCNC.org

Revision 9 . . June 30, 2015 7:52 pm by Kirk Wallace [Added parameter checking to first remap.py example, updated overall layout]
Revision 8 . . June 29, 2015 11:54 pm by Kirk Wallace [Added grooving to, and upgradedthe first remap.py (more pythonic looping) example]
Revision 7 . . (edit) June 29, 2015 8:07 am by Kirk Wallace [minor corrections]
Revision 6 . . June 29, 2015 7:55 am by Kirk Wallace [Added another remap.py version, updated the first version]
Revision 5 . . June 28, 2015 1:55 pm by Kirk Wallace [Added .ngc remap method ]
Revision 4 . . (edit) June 27, 2015 10:31 pm by Kirk Wallace [minor typo corrections]
Revision 3 . . (edit) June 27, 2015 10:30 pm by Kirk Wallace [minor typo corrections]
Revision 2 . . (edit) June 27, 2015 10:28 pm by Kirk Wallace [minor typo corrections]
Revision 1 . . June 27, 2015 6:46 pm by Kirk Wallace
  

Difference (from prior major revision) (no other diffs)

Removed: 24,27d23
So, far the parameters are:
:x = (not used)
:z = The z endpoint. The start point is from the previous move.
:k = The peck length. Pecks start from the Z start point. The last peck length is the distance between the z endpoint and the last full peck length.

Removed: 42d37
<span style="color: #007020; font-weight: bold">import</span> <span style="color: #0e84b5; font-weight: bold">sys</span>

Added: 65a61,62
<span style="color: #007020; font-weight: bold">if</span> z_end <span style="color: #666666">></span> z_start:
<span style="color: #007020; font-weight: bold">return</span> <span style="color: #4070a0">"G74 error - Z cannot be larger than the starting Z position"</span>

Added: 70a68,69
<span style="color: #007020; font-weight: bold">if</span> peck_length <span style="color: #666666"><</span> <span style="color: #40a070">0</span>:
<span style="color: #007020; font-weight: bold">return</span> <span style="color: #4070a0">"G74 error - K cannot be negative"</span>

Removed: 74,79d72
z_range <span style="color: #666666">=</span> z_end <span style="color: #666666">-</span> z_start
<span style="color: #007020; font-weight: bold">if</span> peck_length <span style="color: #666666">></span> <span style="color: #40a070">0</span>:
num_pecks <span style="color: #666666">=</span> <span style="color: #007020">int</span>(math<span style="color: #666666">.</span>fabs(z_range <span style="color: #666666">/</span> peck_length))
<span style="color: #007020; font-weight: bold">else</span>:
num_pecks <span style="color: #666666">=</span> <span style="color: #40a070">0</span>


Added: 86a80,85
z_range <span style="color: #666666">=</span> math<span style="color: #666666">.</span>fabs(z_end <span style="color: #666666">-</span> z_start) <span style="color: #666666">-</span> rounding_fudge <span style="color: #60a0b0; font-style: italic"># rounding_fudge prevents extra peck</span>
<span style="color: #007020; font-weight: bold">if</span> peck_length <span style="color: #666666">></span> <span style="color: #40a070">0</span>:
num_pecks <span style="color: #666666">=</span> <span style="color: #007020">int</span>(z_range <span style="color: #666666">/</span> peck_length)
<span style="color: #007020; font-weight: bold">else</span>:
num_pecks <span style="color: #666666">=</span> <span style="color: #40a070">0</span>


Added: 106a106,107
<span style="color: #007020">self</span><span style="color: #666666">.</span>execute(<span style="color: #4070a0">"G0 Z </span><span style="color: #70a0d0; font-style: italic">%s</span><span style="color: #4070a0">"</span> <span style="color: #666666">%</span> z_start)


Removed: 110d110
</pre></div>

Changed: 113c113
The G74 routine above relies on an initial move to a starting position. This position is captured and used for x_start and z_start. The x and z words in the G74 command are used for x_end and z_end. If x_start and x_end are equal, this invokes a plunge with chip break routine, otherwise a grooving routine is invoked. Since Python can round off floating point numbers, a "close enough" algorithm is use to test x_start and x_end equality. A check for peck_length > 0 is used to prevent a divide by zero error in the num_pecks calculation. Apparently, the x position parameter 5420 does not follow the lathe diameter mode, so we need to check for it and adjust x values. This needs testing, so beware. I need to add checks for valid x, z, and k values, such as, the z parameter value must be less than the z start position, k can not be negative. Remap has a feature that flags whether a parameter is optional or required, which I have not addressed yet.
The G74 routine above relies on an initial move to a starting position. This position is captured and used for x_start and z_start. The X and Z words in the G74 command are used for x_end and z_end. If x_start and x_end are equal, this invokes a plunge with chip break routine, otherwise a grooving routine is invoked. Since Python can round off floating point numbers, a "close enough" algorithm is use to test x_start and x_end equality. A check for peck_length > 0 is used to prevent a divide by zero error in the num_pecks calculation. Apparently, the x position parameter 5420 does not follow the lathe diameter mode, so we need to check for it and adjust x values. This needs testing, so beware. The z_range is adjusted a tiny bit so that an extra peck doesn't get added to the end. The peck algorithm counts the number of full pecks in z-range then adds a final z position of z_end. If the peck length fits evenly in z_range, the last full peck will happen to be at z_end, which we don't need because it's added later.

Added: 115a116,190

Parameters are:
:X = Optional. Leaving X off or setting it equal to the start position invokes a face plunge with chip break routine, usually used for drilling or face plunge grooving. For grooving, this is the end X position. The X start position is were the tool was just before invoking G74. Grooving will need a tool that can cut on its side. Care is needed in limiting the area of the side cut by limiting the K peck depth value. The X value will need to be adjusted by the cutter width to get the desired groove width. In other words: groove width = (x_end - x_start) + cutter width.
:Z = Required. Z is the Z endpoint, or hole or face groove depth. The start position is were the tool was just before invoking G74.
:K = Required. The peck length. Pecks start from the Z start position. The last peck length is the distance between the z endpoint and the last full peck length.
<html>
<table>
<tr>
<td><img src="http://wiki.linuxcnc.org/uploads/Screenshot_G74_Peck_Drill-1.png"></td>
<td>
<!-- HTML generated using hilite.me --><div style="background: #f0f0f0; overflow:auto;width:auto;border:solid gray;border-width:.1em .1em .1em .8em;padding:.2em .6em;"><pre style="margin: 0; line-height: 125%">(G74 Peck Drilling Example)
G7 (Dia<span style="color: #666666">.</span> Mode)
G18 (XZ Plane)
G90 (Absolute Distance Mode)
G40 (Turn Cutter Compensation Off)
G21 (units <span style="color: #007020; font-weight: bold">in</span> inches)
G54 (Work Offset)

G30 Z <span style="color: #60a0b0; font-style: italic">#5422 (Park Tool)</span>
T <span style="color: #40a070">0707</span>

S <span style="color: #40a070">500</span> (RPM)

M8 (Coolant ON)
M3 (Spindle ON, Forward)

G0 X <span style="color: #40a070">0.000</span>
G0 Z <span style="color: #40a070">25.000</span>
G74 Z <span style="color: #40a070">0.000</span> K <span style="color: #40a070">8</span> F <span style="color: #40a070">200</span>

M9 (Coolant OFF)
M5 (Spindle OFF)
G30 Z <span style="color: #60a0b0; font-style: italic">#5422 (Park Tool)</span>

M30 (End of Program)
</pre></div>

</td>
<td><p>   </p></td>
<td><img src="http://wiki.linuxcnc.org/uploads/Screenshot_G74_Face_Groove-1.png"></td>
<td>
<!-- HTML generated using hilite.me --><div style="background: #f0f0f0; overflow:auto;width:auto;border:solid gray;border-width:.1em .1em .1em .8em;padding:.2em .6em;"><pre style="margin: 0; line-height: 125%">(G74 Grooving Example)
G7 (Dia<span style="color: #666666">.</span> Mode)
G18 (XZ Plane)
G90 (Absolute Distance Mode)
G40 (Turn Cutter Compensation Off)
G21 (units <span style="color: #007020; font-weight: bold">in</span> inches)
G54 (Work Offset)

G30 Z <span style="color: #60a0b0; font-style: italic">#5422 (Park Tool)</span>
T <span style="color: #40a070">0707</span>

S <span style="color: #40a070">500</span> (RPM)

M8 (Coolant ON)
M3 (Spindle ON, Forward)

G0 X <span style="color: #40a070">10.000</span>
G0 Z <span style="color: #40a070">20.000</span>
G74 X <span style="color: #40a070">25.000</span> Z <span style="color: #40a070">10.000</span> K <span style="color: #40a070">3</span> F <span style="color: #40a070">200</span>

M9 (Coolant OFF)
M5 (Spindle OFF)
G30 Z <span style="color: #60a0b0; font-style: italic">#5422 (Park Tool)</span>

M30 (End of Program)
</pre></div>

</td>
</tr>
<tr>
<td colspan=3>Peck Drill Example</td>
<td colspan=2>Grooving Example</td>
</tr> </table>
</html>

Removed: 217d291
<span style="color: #60a0b0; font-style: italic">#"""</span>

Removed: 225,235d298
<span style="color: #60a0b0; font-style: italic">#"""</span>

<span style="color: #4070a0; font-style: italic">"""</span>
<span style="color: #4070a0; font-style: italic"> z_target = z_start - ((i + 1) * peck_length)</span>
<span style="color: #4070a0; font-style: italic"> self.execute("G1 Z %s" % z_target)</span>
<span style="color: #4070a0; font-style: italic"> z_backoff = z_target + backoff_length</span>
<span style="color: #4070a0; font-style: italic"> self.execute("G0 Z %s" % z_backoff)</span>

<span style="color: #4070a0; font-style: italic"> self.execute("G1 Z %s" % z_end)</span>
<span style="color: #4070a0; font-style: italic"> self.execute("G0 Z %s" % z_start)</span>
<span style="color: #4070a0; font-style: italic"> #"""</span>

Removed: 241,242d303


There are two sets of motion command blocks. One block uses g-code commands which get interpreted and converted to lower level machine commands. The other uses the low level commands directly. Remove the # in front of the begging #""" to comment the block of code out, or add # to the beginning """ to comment the block in.

LinuxCNCKnowledgeBase | RecentChanges | PageIndex | Preferences | LinuxCNC.org
Search:
Published under a Creative Commons License