1

**Mach4 General Discussion / Re: 3+2 or 5 axis support**

« **on:**September 20, 2015, 04:53:49 PM »

Thanks TP!

Here's a little G-Code from HSMWorks with our current post-processor to first drill an oblique hole in a cube and then to mill it with a 3mm cutter:

%102

(T01 D=10 CR=0 - DRILL 10MM)

(T02 D=3 CR=0 - END MILL 3MM)

N10 M10 M41

N11 G90 G94 G17

N12 G00 G52 Z207

N13 M152

N14 G00 G52 X400 Y180

N15 G54

(Drill)

N16 M09

N17 G52 M06 T01

N18 D01

N19 G54

N20 M40 S500 M03

N21 M152

N22 G00 G52 Z207

N23 G52 X400 Y180

N24 G01 B65.905 C243.435 F3000

N25 U=0 V=0 W=0 B=65.905 M150

N26 G54

N27 M08

N28 G00 X5.863 Y7.849 Z-0.33

N29 G17

N30 G00 Z5

N31 Z1.614

N32 G01 Z-16.33 F333

N33 G00 Z5

N34 Z-0.33

N35 M152

N37 G00 G52 Z207

N38 M152

N39 G52 X400 Y180

N40 G54

(Mill Pocket)

N41 M09

N42 M01

N43 G52 M06 T02

N44 D02

N45 G54

N46 M40 S500 M03

N47 M152

N48 G00 G52 Z207

N49 G52 X400 Y180

N50 G01 B65.905 C243.435 F3000

N51 U=0 V=0 W=0 B=65.905 M150

N52 G54

N53 M08

N54 G00 X5.398 Y11.318 Z15

N55 G00 Z5

N56 G01 Z1 F333

N57 Z-16.33

N58 G17 G03 X5.398 Y11.318 I5.863 J7.849 F1000

N59 G00 X5.398 Y11.318 Z15

N60 M152

N62 M09

N63 M152

N64 G00 G52 Z207

N65 G52 X400 Y180

N66 G01 B0 C0 F3000

N67 G54

N68 M152

N69 G00 G52 Z207

N70 G00 G52 X400 Y180

N71 M02

Line 24 and 25 is where it gets interesting: In N24 it tilts the tool around the Y-axis (=B) by 65.905° and rotates the table by 243.435°. In N25 it then tilts the "programming plane" by 65.905°, with the coordinate system center at 0/0/0 of the part coordinate system. Then it moves to the hole center and starts drilling with different Z depths. Now while this is trivial, it gets more challenging to mill pockets at an oblique angle with correct cutter length and radius compensation. This is from line 50 on, but the code is simple, the CNC does all the compensation calculation.

As HSMWorks includes a Mach3 Post, for comparison the Mach3 output below. As one can see, when it shall mill the round hole it doesn't do it with a G02 / G03, but with little straight segments. Is this the intended way to go, and does Mach3/4 compensate for the mill radius that way? If so it's better than I was afraid it is, in order to improve surface quality and accuracy we should just be able to use G2/G3, which may be a limitation of the Post I have.

Thanks for commenting if length and radius compensation work and wheter G2/G3 can be used on tilted planes,

Frank

(102)

(MACH3 POST)

(T1 D=10. CR=0. - DRILL 10MM)

(T2 D=3. CR=0. - END MILL 3MM)

G90 G94 G91.1 G40 G49 G17

G21

G28 G91 Z0.

G90

(DRILL)

M5

M9

T1 M6

S5000 M3

G54

G0 B-65.905 C243.435

M8

G0 G43 X6.085 Y-5.382 Z-5.487 H1

X3.909 Y-9.733 Z-3.311

G98 G81 X12.617 Y7.682 Z-12.019 R1.614 F333.

G80

X6.085 Y-5.382 Z-5.487

G28 G91 Z0.

G90

(MILL)

M5

M9

M1

T2 M6

S5000 M3

B-65.905 C243.435

M8

G0 G43 X3.014 Y-19.28 Z1.196 H2

X7.096 Y-11.115 Z-2.886

G1 X8.729 Y-7.849 Z-4.519 F333.

X15.804 Y6.301 Z-11.594

X15.812 Y6.403 Z-11.383 F1000.

X15.805 Y6.51 Z-11.176

X15.784 Y6.622 Z-10.972

X15.748 Y6.74 Z-10.772

X15.699 Y6.861 Z-10.579

X15.636 Y6.986 Z-10.391

X15.56 Y7.115 Z-10.211

X15.47 Y7.245 Z-10.039

X15.368 Y7.378 Z-9.876

X15.253 Y7.512 Z-9.723

X15.126 Y7.647 Z-9.579

X14.989 Y7.782 Z-9.447

X14.84 Y7.917 Z-9.326

X14.682 Y8.05 Z-9.217

X14.515 Y8.182 Z-9.121

X14.339 Y8.312 Z-9.037

X14.155 Y8.439 Z-8.967

X13.965 Y8.562 Z-8.911

X13.768 Y8.682 Z-8.868

X13.567 Y8.797 Z-8.84

X13.361 Y8.907 Z-8.825

X13.152 Y9.011

X12.94 Y9.11 Z-8.839

X12.727 Y9.202 Z-8.868

X12.514 Y9.288 Z-8.91

X12.301 Y9.366 Z-8.967

X12.089 Y9.437 Z-9.037

X11.88 Y9.5 Z-9.12

X11.674 Y9.555 Z-9.216

X11.472 Y9.602 Z-9.325

X11.275 Y9.64 Z-9.446

X11.084 Y9.669 Z-9.578

X10.901 Y9.689 Z-9.721

X10.724 Y9.701 Z-9.875

X10.557 Y9.703 Z-10.038

X10.398 Y9.696 Z-10.209

X10.25 Y9.681 Z-10.389

X10.111 Y9.656 Z-10.577

X9.985 Y9.623 Z-10.77

X9.869 Y9.581 Z-10.969

X9.767 Y9.53 Z-11.173

X9.677 Y9.471 Z-11.381

X9.6 Y9.404 Z-11.592

X9.536 Y9.33 Z-11.804

X9.486 Y9.248 Z-12.017

X9.45 Y9.159 Z-12.231

X9.429 Y9.064 Z-12.443

X9.421 Y8.962 Z-12.654

X9.428 Y8.855 Z-12.862

X9.449 Y8.743 Z-13.066

X9.485 Y8.625 Z-13.265

X9.534 Y8.504 Z-13.459

X9.597 Y8.379 Z-13.646

X9.673 Y8.25 Z-13.826

X9.763 Y8.12 Z-13.998

X9.866 Y7.987 Z-14.161

X9.98 Y7.853 Z-14.314

X10.107 Y7.718 Z-14.458

X10.244 Y7.583 Z-14.59

X10.393 Y7.448 Z-14.711

X10.551 Y7.315 Z-14.82

X10.718 Y7.183 Z-14.916

X10.894 Y7.053 Z-15.

X11.078 Y6.926 Z-15.07

X11.268 Y6.803 Z-15.126

X11.465 Y6.683 Z-15.169

X11.666 Y6.568 Z-15.197

X11.872 Y6.458 Z-15.212

X12.081 Y6.353

X12.293 Y6.255 Z-15.198

X12.506 Y6.162 Z-15.169

X12.719 Y6.077 Z-15.127

X12.932 Y5.998 Z-15.071

X13.144 Y5.928 Z-15.001

X13.353 Y5.865 Z-14.917

X13.559 Y5.81 Z-14.821

X13.761 Y5.763 Z-14.712

X13.958 Y5.725 Z-14.592

X14.149 Y5.696 Z-14.459

X14.332 Y5.676 Z-14.316

X14.509 Y5.664 Z-14.163

X14.676 Y5.662 Z-14.

X14.835 Y5.669 Z-13.828

X14.984 Y5.684 Z-13.648

X15.122 Y5.709 Z-13.461

X15.248 Y5.742 Z-13.267

X15.364 Y5.784 Z-13.068

X15.466 Y5.835 Z-12.864

X15.557 Y5.894 Z-12.656

X15.634 Y5.96 Z-12.446

X15.697 Y6.035 Z-12.233

X15.747 Y6.117 Z-12.02

X15.783 Y6.206 Z-11.806

X15.804 Y6.301 Z-11.594

G0 X3.014 Y-19.28 Z1.196

M9

G28 G91 Z0.

B0. C0.

G90 G53 X0. Y0.

M30

Here's a little G-Code from HSMWorks with our current post-processor to first drill an oblique hole in a cube and then to mill it with a 3mm cutter:

%102

(T01 D=10 CR=0 - DRILL 10MM)

(T02 D=3 CR=0 - END MILL 3MM)

N10 M10 M41

N11 G90 G94 G17

N12 G00 G52 Z207

N13 M152

N14 G00 G52 X400 Y180

N15 G54

(Drill)

N16 M09

N17 G52 M06 T01

N18 D01

N19 G54

N20 M40 S500 M03

N21 M152

N22 G00 G52 Z207

N23 G52 X400 Y180

N24 G01 B65.905 C243.435 F3000

N25 U=0 V=0 W=0 B=65.905 M150

N26 G54

N27 M08

N28 G00 X5.863 Y7.849 Z-0.33

N29 G17

N30 G00 Z5

N31 Z1.614

N32 G01 Z-16.33 F333

N33 G00 Z5

N34 Z-0.33

N35 M152

N37 G00 G52 Z207

N38 M152

N39 G52 X400 Y180

N40 G54

(Mill Pocket)

N41 M09

N42 M01

N43 G52 M06 T02

N44 D02

N45 G54

N46 M40 S500 M03

N47 M152

N48 G00 G52 Z207

N49 G52 X400 Y180

N50 G01 B65.905 C243.435 F3000

N51 U=0 V=0 W=0 B=65.905 M150

N52 G54

N53 M08

N54 G00 X5.398 Y11.318 Z15

N55 G00 Z5

N56 G01 Z1 F333

N57 Z-16.33

N58 G17 G03 X5.398 Y11.318 I5.863 J7.849 F1000

N59 G00 X5.398 Y11.318 Z15

N60 M152

N62 M09

N63 M152

N64 G00 G52 Z207

N65 G52 X400 Y180

N66 G01 B0 C0 F3000

N67 G54

N68 M152

N69 G00 G52 Z207

N70 G00 G52 X400 Y180

N71 M02

Line 24 and 25 is where it gets interesting: In N24 it tilts the tool around the Y-axis (=B) by 65.905° and rotates the table by 243.435°. In N25 it then tilts the "programming plane" by 65.905°, with the coordinate system center at 0/0/0 of the part coordinate system. Then it moves to the hole center and starts drilling with different Z depths. Now while this is trivial, it gets more challenging to mill pockets at an oblique angle with correct cutter length and radius compensation. This is from line 50 on, but the code is simple, the CNC does all the compensation calculation.

As HSMWorks includes a Mach3 Post, for comparison the Mach3 output below. As one can see, when it shall mill the round hole it doesn't do it with a G02 / G03, but with little straight segments. Is this the intended way to go, and does Mach3/4 compensate for the mill radius that way? If so it's better than I was afraid it is, in order to improve surface quality and accuracy we should just be able to use G2/G3, which may be a limitation of the Post I have.

Thanks for commenting if length and radius compensation work and wheter G2/G3 can be used on tilted planes,

Frank

(102)

(MACH3 POST)

(T1 D=10. CR=0. - DRILL 10MM)

(T2 D=3. CR=0. - END MILL 3MM)

G90 G94 G91.1 G40 G49 G17

G21

G28 G91 Z0.

G90

(DRILL)

M5

M9

T1 M6

S5000 M3

G54

G0 B-65.905 C243.435

M8

G0 G43 X6.085 Y-5.382 Z-5.487 H1

X3.909 Y-9.733 Z-3.311

G98 G81 X12.617 Y7.682 Z-12.019 R1.614 F333.

G80

X6.085 Y-5.382 Z-5.487

G28 G91 Z0.

G90

(MILL)

M5

M9

M1

T2 M6

S5000 M3

B-65.905 C243.435

M8

G0 G43 X3.014 Y-19.28 Z1.196 H2

X7.096 Y-11.115 Z-2.886

G1 X8.729 Y-7.849 Z-4.519 F333.

X15.804 Y6.301 Z-11.594

X15.812 Y6.403 Z-11.383 F1000.

X15.805 Y6.51 Z-11.176

X15.784 Y6.622 Z-10.972

X15.748 Y6.74 Z-10.772

X15.699 Y6.861 Z-10.579

X15.636 Y6.986 Z-10.391

X15.56 Y7.115 Z-10.211

X15.47 Y7.245 Z-10.039

X15.368 Y7.378 Z-9.876

X15.253 Y7.512 Z-9.723

X15.126 Y7.647 Z-9.579

X14.989 Y7.782 Z-9.447

X14.84 Y7.917 Z-9.326

X14.682 Y8.05 Z-9.217

X14.515 Y8.182 Z-9.121

X14.339 Y8.312 Z-9.037

X14.155 Y8.439 Z-8.967

X13.965 Y8.562 Z-8.911

X13.768 Y8.682 Z-8.868

X13.567 Y8.797 Z-8.84

X13.361 Y8.907 Z-8.825

X13.152 Y9.011

X12.94 Y9.11 Z-8.839

X12.727 Y9.202 Z-8.868

X12.514 Y9.288 Z-8.91

X12.301 Y9.366 Z-8.967

X12.089 Y9.437 Z-9.037

X11.88 Y9.5 Z-9.12

X11.674 Y9.555 Z-9.216

X11.472 Y9.602 Z-9.325

X11.275 Y9.64 Z-9.446

X11.084 Y9.669 Z-9.578

X10.901 Y9.689 Z-9.721

X10.724 Y9.701 Z-9.875

X10.557 Y9.703 Z-10.038

X10.398 Y9.696 Z-10.209

X10.25 Y9.681 Z-10.389

X10.111 Y9.656 Z-10.577

X9.985 Y9.623 Z-10.77

X9.869 Y9.581 Z-10.969

X9.767 Y9.53 Z-11.173

X9.677 Y9.471 Z-11.381

X9.6 Y9.404 Z-11.592

X9.536 Y9.33 Z-11.804

X9.486 Y9.248 Z-12.017

X9.45 Y9.159 Z-12.231

X9.429 Y9.064 Z-12.443

X9.421 Y8.962 Z-12.654

X9.428 Y8.855 Z-12.862

X9.449 Y8.743 Z-13.066

X9.485 Y8.625 Z-13.265

X9.534 Y8.504 Z-13.459

X9.597 Y8.379 Z-13.646

X9.673 Y8.25 Z-13.826

X9.763 Y8.12 Z-13.998

X9.866 Y7.987 Z-14.161

X9.98 Y7.853 Z-14.314

X10.107 Y7.718 Z-14.458

X10.244 Y7.583 Z-14.59

X10.393 Y7.448 Z-14.711

X10.551 Y7.315 Z-14.82

X10.718 Y7.183 Z-14.916

X10.894 Y7.053 Z-15.

X11.078 Y6.926 Z-15.07

X11.268 Y6.803 Z-15.126

X11.465 Y6.683 Z-15.169

X11.666 Y6.568 Z-15.197

X11.872 Y6.458 Z-15.212

X12.081 Y6.353

X12.293 Y6.255 Z-15.198

X12.506 Y6.162 Z-15.169

X12.719 Y6.077 Z-15.127

X12.932 Y5.998 Z-15.071

X13.144 Y5.928 Z-15.001

X13.353 Y5.865 Z-14.917

X13.559 Y5.81 Z-14.821

X13.761 Y5.763 Z-14.712

X13.958 Y5.725 Z-14.592

X14.149 Y5.696 Z-14.459

X14.332 Y5.676 Z-14.316

X14.509 Y5.664 Z-14.163

X14.676 Y5.662 Z-14.

X14.835 Y5.669 Z-13.828

X14.984 Y5.684 Z-13.648

X15.122 Y5.709 Z-13.461

X15.248 Y5.742 Z-13.267

X15.364 Y5.784 Z-13.068

X15.466 Y5.835 Z-12.864

X15.557 Y5.894 Z-12.656

X15.634 Y5.96 Z-12.446

X15.697 Y6.035 Z-12.233

X15.747 Y6.117 Z-12.02

X15.783 Y6.206 Z-11.806

X15.804 Y6.301 Z-11.594

G0 X3.014 Y-19.28 Z1.196

M9

G28 G91 Z0.

B0. C0.

G90 G53 X0. Y0.

M30