G40, G41, G42: Tool Radius Offset
Overview
- Modifies tool path to the left (G41) or the right (G42) of the motion direction by the specified offset amount.
- G41/G42 G-code does not perform motion, it just enables the Tool Radius Offset state and updates the Active Offsets table.
- The offset amount is set by specifying the P value or specifying the Tool D number and reading the diameter and diameter wear values from the Tool data Table.
Command Format
- Syntax:
- G40
- No parameters
- If enabled, this disables the active radius offset (if enabled)
- G41 P... or G41 D...
- Offset applied to the left of the motion direction
- P - specifies the offset to apply to the left
- D - specifies the tool to use to apply an automatic offset based on the tool's configured parameters
- G42 P... orG42 D...
- Offset applied to the right of the motion direction
- P - specifies the offset to apply to the right
- D - specifies the tool to use to apply an automatic offset based on the tool's configured parameters
- G40
- Examples:
- G41 P5- Left offset by 5 units
- G42 D4- Right offset by Tool #4 radius.
- G40 - Tool Radius Offset OFF.
Details
- Tool Radius offset is calculated and applied on the XY plane for the system
- While parsing and decoding a motion block, if the Tool Radius Offset state is active, the offset vectors are being pre-calculated at the segment start and segment end positions:
- For linear segments, both offset vectors are perpendicular to the segment direction vector and parallel to the active plane.
- For Arcs, offset vectors are parallel to the center-start and center-end vectors projected onto the active plane.
- Offset vector length is equal to the offset amount.
- Before inserting a motion block into the Block list we are evaluating if any blending segments are required:
- No blending segments for the inside bends
- If “Round-The-Arc” option is enabled, a blending arc is inserted between previous segment end perpendicular offset position and current segment start perpendicular offset position with a radius equal to the offset amount.
- If “Round-The-Arc” option is disabled:
- Linear segments are extended to the intersection point.
- If “Round-The-Arc” option is disabled:
- Arcs are extended by adding a tangent segment at the arc start or end.
- Outside angles of more than 90 degrees will have an additional blending segment inserted. The original segments are extended by the offset amount (d), and the blending segment is inserted in between.
- One more “Offset Startup” option affects the behavior of the very first and the very last segment of Cutter Radius Compensation functionality.
- If the option is disabled, the offset is not applied during the very first or last segment and the motion is calculated to the perpendicular offset position of the next segment
- If the option is enabled - the offset is applied during the very first (and last) segment and the motion is calculated to the end perpendicular offset position of the first segment and the appropriate blending rules applied later. If “Round-The-Arc” option is not enabled, a short linear segment is added after the first segment and before the last segment to extend them to the intersection points (similar to tangent arc extension segments), See Example image #3.
- After completing the parsing / decoding, using CutterRadiusCompensation function to step through the blocklist and implement calculated offsets, calculate intersection points and blending segment data. Recalculates and updates Modal Current and Target positions with the newly calculated positions.
Examples
- The following examples display the actual programmed part program with both calculated toolpaths offset to the left (G41) and to the right (g42) of motion direction
- “Round-The-Arc” = 0; “StartupOffset” = 0:
- “Round-The-Arc” = 1; “StartupOffset” = 0:
- “Round-The-Arc” = 0; “StartupOffset” = 1:
- “Round-The-Arc” = 1; “StartupOffset” = 1:
- One more “Offset Startup” option affects the behavior of the very first and the very last segment of Cutter Radius Compensation functionality.
Limitations & Tips
- Intersection of the cutter and the offset toolpath does not generally occur
- However, the applied tool radius offset is evaluated using the nearby neighbor points. Thus, intersection can occur later on in the file.
- Many CAD and CAM tools offer a curve offset feature which can apply better optimizations to the tool path than are available at the G-Code/CNC level where this path information of the original drawing is lost.
- For more complex geometries, this can often provide better results.
- These same cases also commonly have smaller points that will not have optimal results with the G-Code applied tool radius compensation
- The general recommendation is to use tool radius compensation when the minimum segment length exceeds the tool radius being compensated for. Tight angles may warrant larger segments.
See Also:
- System parameters -Parameter Table
- Work Offsets -G10: Set work and tool offsets
- Coordinate System Overview -Coordinate Systems