Hi Budman,
I use a convoluted way of generating the G Code. Basically I use Solidworks to create my models and generate a dxf (ensuring that the scale is 1:1) of the profile (one each for the LH and RH views).
I import the dxf profiles one at a time into BOBCAD V21 and use BOBCAD to delete all detail except for the profile of the actual shape to be cut.
Using BOBCAD I put a point where I want X0 Z0 to be using my procedure in red below. This ensures that the profile to be cut is in the correct Cartesian quadrant.
Procedure for moving a known point to UCS origin X0 Y0 with Bobcad dxf files1. Open the dxf file in Bobcad.
2. View All to find the drawing.
3. Add a point to the position on the drawing that you want to end up as UCS X0 Y0.
4. Hover over this point and note on paper its exact X and Y coordinates. E.g. X127.574 Y29.236
5. Select all (I use Control A).
6. Select Change, Translate, By Coordinates.
7. Ensure that the end points are all selected as zero.
8. Into the start point for X, type in 127.574.
9. Into the start point for Y, type in 29.236.
10. Press OK. The drawing should have moved so that the desired new origin point is at X0 Y0.
11. Save the dxf file with the new origin.
I then use OneCNC to generate the code for OD Roughing and finishing. I am fortunate that I do some work for several companies that allow me to use their CAD/CAM software.
Threading is simple. I hand generate the code using the following lines of code:
(Select RH External Threading Insert Mounted On Boring Bar in Tool Block Hole 4)
(Tip to tip measurement between master tool and threading tool is 94.551mm, therefore X offset for threading tool is 2 x 94.551 = X189.1)
G52 X189.1 Z-7.25 (Temporary Offset Position for Threading Tool Tip)
G00 X14.5 (X Clearance for start of thread)
G00 Z3 (Z Clearance for Start of Thread)
G00 X12.7 (Go to Major Diameter Position)
G76 X11.1 Z-20 Q1 P1.27 J0.1 L0 H0.15 I29.5 K3 C2.5 B0.05 T0
G00 X20 Z50 (Retract away from job)
G52 X0 Z0 F1000 (Cancel Temporary Offset)
The above threading code, even though is written in metric (mm), actually generates a ½”UNF Thread. All I do if I want a different type of thread is to change the major diameter, minor diameter (X11.1), thread length (Z-20), and pitch (P1.27) (All expressed in mm). The meaning of the G76 line of code is described in the Mach3 Lathe manual and Rich’s excellent guide.
The Peck Spot Drill and Peck Drill Routines are, once again, hand written using Mick Grant’s excellent macros. All I need to do is copy and paste this from program to program and only change the parameters that need changing. Example below:
N1925 G94 (Set Rev/min Mode)
N1930 G97 S800 M3 (End Profile Routine Turn CSS off)
N1940 G99
N1950
N1960 (Spot Drill routine for Ø10 x 4.9mm Deep Hole)
N1970
N1980 (Using Mick Grant's M831 macro of 30Dec09)
N1990 G52 X51.654 Z-25 (Select Ø10 Spot Drill Offset Position X51.654 Z0)
N1200
N2050 G0 Z20
N2060 (Spot Drill Routine)
N2070 (Spot Drill 4.9mm Deep in 1.5mm Pecks with a "D" dwell of 250mS at bottom of hole and a "P" dwell of 500mS at the retract position)
N2080 ;M831 X0 Y0 Z-4.9 R1.5 Q1.5 W0.5 P0.5 D0.25 F90 I0 J0 L1
N2090 M831 P2080
N2100 G80
N2110 G90
N2120 G0 Z20 X111.654 (Rapid out and move to safe X position before moving to Drill Position)
N2130 (Peck Drill routine for Ø10.5 x 30mm Deep Hole)
N2140 (Using Mick Grant's M830 macro of 30Dec09)
N2150 G52 X111.654 Z0 (Select Ø10.5 Drill Offset Position X111.654 Z0)
N2160
N2180 G0 Z20
N2190 (Drill Routine)
N2200 (Drill 30mm Deep in 2.5mm Pecks fully retracting to Z1 with a "D" dwell of 250mS at bottom of hole and a "P" dwell of 500mS at the retract position)
N2210 ;M830 X0 Y0 Z-30.0 R1 Q2.5 W0.5 P0.5 D0.25 F90 I0 J0 L1
N2220 M830 P2210
N2230 G80
N2240 G90
N2250 G0 Z20 (Rapid out)
I then hand stitch the whole lot together in Notepad to complete the program using some basic templates that I have created or use a copy and paste method for changing similar programs that I have previously written.
The G52 Offsets Positions for each tool in the gang tool block were determined by calibrating the master tool X position by doing a light cut on scrap material, measuring the diameter of the cut and entering this into the X DRO Box. The positions of the Spot Drill and Drill were then easy to determine because I know the hole centres in the tool block. I had to use trial and error to get the threading tool offset correct and all this info now resides in an Excel Spreadsheet printed out on my wall so I never forget each offset.
Regards
Chrisjh