this is a Phyton script for Generating plain G-code for pocketing to axis|
just put it into the nc_code folder(by right click and save to) and load it with axis as you woudt load a ngc
then follow the entry and hit "recalculate" then "write to axis"! Enjoy your path
G12 Circular Pocket Milling CW / G13 Circular Pocket Milling CCW (Group 00) These two G codes are used to mill circular shapes. They are different only in which direction of rotation is used. Both G codes use the default XY circular plane (G17) and imply the use of G42 (cutter compensation) for G12 and G41 for G13. These two G-codes are non-modal.
D Tool radius or diameter selection I Radius of first circle (or finish if no K) I value must be greater than Tool Radius, but less than K value. K Radius of finished circle (if specified) L Loop count for repeating deeper cuts Q Radius increment, or stepover (must be used with K) F feedrate in inches (mm) per minute Z Depth of cut or increment
NOTE: If no cutter compensation is desired, a D00 must be specified. If no D is specified in the G12/G13 block, the last commanded D value will be used, even if it was previously canceled with a G40.
The tool must be positioned at the center of the circle using X and Y. To remove all the material within the circle, use I and Q values less than the tool diameter and a K value equal to the circle radius. To cut a circle radius only, use an I value set to the radius and no K or Q value.
Example T1M06 G54 G00 G90 X0 Y0 (Move to center of G54) G43 Z0.1 H01 S2000 M03 G12 I1.5 F10. Z-1.2 D01 (Finish pocket clockwise) G0 Z0.1 G55 X0 Y0 (Move to center of G55) G12 I0.3 K1.5 Q0.3 F10. Z-1.2 D01 (Rough and finish clockwise) G0 Z0.1 G56 X0 Y0 (Move to center of G56) G13 I1.5 F10. Z-1.2 D01 (Finish pocket counterclockwise) G0 Z0.1 G57 X0 Y0 (Move to center of G57) G13 I0.3 K1.5 Q0.3 F10. Z-1.2 D01 (Rough and finish counterclockwise) G0 Z0.1 G28 M30
G77 Xn Yn Hn Zn Dn An Bn In Sn Kn Pn X = X center Y = Y center H = Start Height Z = Z depth D = Diameter A = Stepover B = Depth of Cut I = Rough Feed S = Finish Stock K = Finish Feed
?, then ramps into the work while circling outward. Once the tool reaches the pocket Diameter, the tool circles back toward the center until the pass is complete.
The Circular Pocket Cycle automatically compensates the tool’s diameter. The correct tool diameter must be activated before or within the CircPock? block.
NOTE: The program editor will allow the operator to write a block even if the positions keyed in are illogical. The control will stop a program and generate a message at an illogical block for safety. Test programs with Draw to find any illogical blocks.
When FinStock? is used, the CNC leaves the specified stock on the profile and depth for a finish pass. The profile is cut to the Diameter and ZDepth dimensions on the finish pass. If a negative FinStock? value is keyed in, CNC will leave the finish stock and not add a finish pass.
3. Fill in the CIRCULAR POCKET entry fields, labeled as follows:
XCenter X coordinate of the center. If no coordinate is entered, pocket is centered at present position (optional).
YCenter Y coordinate of the center. If no coordinate is entered, pocket is centered at present position (optional).
NOTE: It is recommended the desired absolute center coordinates be entered when possible.
ZDepth The absolute depth of the finished hole (value required). NOTE: ZDepth must be lower than StartHgt?.
Direction This setting allows the operator to choose between a clockwise (Cw) or counter clockwise (Ccw) direction. The setting is toggled by using the (+/-) key (selection required).
Stepover Width of cut. If no value is entered, CNC defaults to 70% of the active tool radius. Maximum stepover permitted is 70% of the active tool diameter (optional).
NOTE: The program editor will allow the operator to write a block containing a Stepover value greater than 70% of the active tool radius. Testing a program in the Draw Graphics Mode will reveal this type of error.
DepthCut? Depth the machine takes in a single pass. Defaults to a single ZDepth cut minus the finish stock if no position is entered (optional).
FinStock? Amount of stock left by the machine before the finish pass. Zero is assumed if no value is keyed in. If a negative value is keyed in, the CNC will leave the stock, but not make a finish pass (optional).
RoughFeed? Rough pass feedrate (optional).
FinFeed? Finish pass feedrate (optional).
Tool# Active tool (optional).
you can G41 D(tool) to the Final Circle!
(Circular Spiral Pocket) #1=3.000 (tooldiameter) #2=30.000 (Diameter) #4=15.000 (centerX) #5=15.000 (centerY) #6=-5.000 (Final Depth) #7=2.000 (safeZ) #8=1.35 (stepover R) #9=-2.000 (stepover Z) #10=100.00 (feedrateZ) #11=200.00 (feedrateXY) (calculate How many times into while) #20=FIX[[[#2-#1]/#8]/2] (Preamble) G17 (XY Plane) G21 (Metric) G90 (Absolute) G61 (Exact Path) (spiral) G0 X#4 Y#5 G0 Z#7 G1 Z0 F#10 (Move to Zero Z to start increment Z Cycle) O95 while [#6 lt 0] O97 If [#6 lt #9] G1 G91 Z#9 O97 else G1 G91 Z#6 O97 endif #6=[#6-#9] #30=#8 #31=1.0 #21=1 G1 G90 X[#4+#30] F#11 O10 while [#21 lt #20] G3 X[#4-[#21*#8]] I-[[#31*#8]] #31=[#31+0.5] #21=[#21+1] G3 X[#4+[#21*#8]] I[[#31*#8]] #31=[#31+0.5] O10 endwhile G3 X[#4-[#2/2.0]+[#1/2.0]] Y#5 I-[[[#4+[#21*#8]]-[#4-[#2/2.0]+[#1/2.0]]]/2.0] G3 I[[#2/2.0]-[#1/2.0]] G1 G90 X#4 Y#5 O95 endwhile G0 G90 Z#7 M5 M30
this is a Phyton script for Generating plain G-code for pocketing to axis just put it into the nc_code folder(by right click and save to) and load it with axis as you woudt load a ngc then follow the entry and hit "recalculate" then "write to axis"! Enjoy your path
upload:pocket_V1.py Screenshot :