2
# ***************************************************************************
3
# * Copyright (c) 2022 sliptonic <shopinthewoods@gmail.com> *
4
# * Copyright (c) 2022-2023 Larry Woestman <LarryWoestman2@gmail.com> *
6
# * This program is free software; you can redistribute it and/or modify *
7
# * it under the terms of the GNU Lesser General Public License (LGPL) *
8
# * as published by the Free Software Foundation; either version 2 of *
9
# * the License, or (at your option) any later version. *
10
# * for detail see the LICENCE text file. *
12
# * This program is distributed in the hope that it will be useful, *
13
# * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15
# * GNU Library General Public License for more details. *
17
# * You should have received a copy of the GNU Library General Public *
18
# * License along with this program; if not, write to the Free Software *
19
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
22
# ***************************************************************************
27
import Tests.PathTestUtils as PathTestUtils
28
from Path.Post.scripts import refactored_test_post as postprocessor
31
Path.Log.setLevel(Path.Log.Level.DEBUG, Path.Log.thisModule())
32
Path.Log.trackModule(Path.Log.thisModule())
35
class TestRefactoredTestPostGCodes(PathTestUtils.PathTestBase):
36
"""Test the refactored_test_post.py postprocessor G codes."""
42
This method is called upon instantiation of this test class. Add code
43
and objects here that are needed for the duration of the test() methods
44
in this class. In other words, set up the 'global' test environment
45
here; use the `setUp()` method to set up a 'local' test environment.
46
This method does not have access to the class `self` reference, but it
47
is able to call static methods within this same class.
49
# Open existing FreeCAD document with test geometry
50
FreeCAD.newDocument("Unnamed")
53
def tearDownClass(cls):
56
This method is called prior to destruction of this test class. Add
57
code and objects here that cleanup the test environment after the
58
test() methods in this class have been executed. This method does
59
not have access to the class `self` reference. This method is able
60
to call static methods within this same class.
62
# Close geometry document without saving
63
FreeCAD.closeDocument(FreeCAD.ActiveDocument.Name)
65
# Setup and tear down methods called before and after each unit test
70
This method is called prior to each `test()` method. Add code and
71
objects here that are needed for multiple `test()` methods.
73
self.doc = FreeCAD.ActiveDocument
74
self.con = FreeCAD.Console
75
self.docobj = FreeCAD.ActiveDocument.addObject("Path::Feature", "testpath")
77
# Re-initialize all of the values before doing a test.
79
postprocessor.UNITS = "G21"
80
postprocessor.init_values(postprocessor.global_values)
85
This method is called after each test() method. Add cleanup instructions here.
86
Such cleanup instructions will likely undo those in the setUp() method.
88
FreeCAD.ActiveDocument.removeObject("testpath")
90
def single_compare(self, path, expected, args, debug=False):
91
"""Perform a test with a single comparison."""
93
self.docobj.Path = Path.Path(path)
94
postables = [self.docobj]
95
gcode = postprocessor.export(postables, "-", args)
97
print(f"--------{nl}{gcode}--------{nl}")
98
self.assertEqual(gcode, expected)
100
def compare_third_line(self, path_string, expected, args, debug=False):
101
"""Perform a test with a single comparison to the third line of the output."""
104
self.docobj.Path = Path.Path([Path.Command(path_string)])
106
self.docobj.Path = Path.Path([])
107
postables = [self.docobj]
108
gcode = postprocessor.export(postables, "-", args)
110
print(f"--------{nl}{gcode}--------{nl}")
111
self.assertEqual(gcode.splitlines()[2], expected)
113
#############################################################################
115
# The tests are organized into groups:
117
# 00000 - 00099 tests that don't fit any other category
118
# 00100 - 09999 tests for all of the various arguments/options
119
# 10000 - 19999 tests for the various G codes at 10000 + 10 * g_code_value
120
# 20000 - 29999 tests for the various M codes at 20000 + 10 * m_code_value
122
#############################################################################
125
"""Test G0 command Generation."""
126
self.compare_third_line(
127
"G0 X10 Y20 Z30 A40 B50 C60 U70 V80 W90",
128
("G0 X10.000 Y20.000 Z30.000 A40.000 B50.000 C60.000 " "U70.000 V80.000 W90.000"),
131
self.compare_third_line(
132
"G00 X10 Y20 Z30 A40 B50 C60 U70 V80 W90",
133
("G00 X10.000 Y20.000 Z30.000 A40.000 B50.000 C60.000 " "U70.000 V80.000 W90.000"),
137
#############################################################################
140
"""Test G1 command Generation."""
141
self.compare_third_line(
142
"G1 X10 Y20 Z30 A40 B50 C60 U70 V80 W90 F1.23456",
144
"G1 X10.000 Y20.000 Z30.000 A40.000 B50.000 C60.000 "
145
"U70.000 V80.000 W90.000 F74.074"
149
self.compare_third_line(
150
"G01 X10 Y20 Z30 A40 B50 C60 U70 V80 W90 F1.23456",
152
"G01 X10.000 Y20.000 Z30.000 A40.000 B50.000 C60.000 "
153
"U70.000 V80.000 W90.000 F74.074"
157
# Test argument order
158
self.compare_third_line(
159
"G1 F1.23456 Z30 V80 C60 W90 X10 B50 U70 Y20 A40",
161
"G1 X10.000 Y20.000 Z30.000 A40.000 B50.000 C60.000 "
162
"U70.000 V80.000 W90.000 F74.074"
166
self.compare_third_line(
167
"G1 X10 Y20 Z30 A40 B50 C60 U70 V80 W90 F1.23456",
169
"G1 X0.3937 Y0.7874 Z1.1811 A1.5748 B1.9685 C2.3622 "
170
"U2.7559 V3.1496 W3.5433 F2.9163"
175
#############################################################################
178
"""Test G2 command Generation."""
180
self.compare_third_line(
181
"G2 X10 Y20 Z30 I40 J50 P60 F1.23456",
182
"G2 X10.000 Y20.000 Z30.000 I40.000 J50.000 P60 F74.074",
185
self.compare_third_line(
186
"G02 X10 Y20 Z30 I40 J50 P60 F1.23456",
187
"G02 X10.000 Y20.000 Z30.000 I40.000 J50.000 P60 F74.074",
190
self.compare_third_line(
191
"G2 X10 Y20 Z30 R40 P60 F1.23456",
192
"G2 X10.000 Y20.000 Z30.000 R40.000 P60 F74.074",
195
self.compare_third_line(
196
"G2 X10 Y20 Z30 I40 J50 P60 F1.23456",
197
"G2 X0.3937 Y0.7874 Z1.1811 I1.5748 J1.9685 P60 F2.9163",
200
self.compare_third_line(
201
"G2 X10 Y20 Z30 R40 P60 F1.23456",
202
"G2 X0.3937 Y0.7874 Z1.1811 R1.5748 P60 F2.9163",
206
#############################################################################
209
"""Test G3 command Generation."""
210
self.compare_third_line(
211
"G3 X10 Y20 Z30 I40 J50 P60 F1.23456",
212
"G3 X10.000 Y20.000 Z30.000 I40.000 J50.000 P60 F74.074",
215
self.compare_third_line(
216
"G03 X10 Y20 Z30 I40 J50 P60 F1.23456",
217
"G03 X10.000 Y20.000 Z30.000 I40.000 J50.000 P60 F74.074",
220
self.compare_third_line(
221
"G3 X10 Y20 Z30 R40 P60 F1.23456",
222
"G3 X10.000 Y20.000 Z30.000 R40.000 P60 F74.074",
225
self.compare_third_line(
226
"G3 X10 Y20 Z30 I40 J50 P60 F1.23456",
227
"G3 X0.3937 Y0.7874 Z1.1811 I1.5748 J1.9685 P60 F2.9163",
230
self.compare_third_line(
231
"G3 X10 Y20 Z30 R40 P60 F1.23456",
232
"G3 X0.3937 Y0.7874 Z1.1811 R1.5748 P60 F2.9163",
236
#############################################################################
239
"""Test G4 command Generation."""
240
# Should some sort of "precision" be applied to the P parameter?
241
# The code as currently written does not do so intentionally.
242
# The P parameter indicates "time to wait" where a 0.001 would
243
# be a millisecond wait, so more than 3 or 4 digits of precision
245
self.compare_third_line("G4 P1.23456", "G4 P1.23456", "")
246
self.compare_third_line("G04 P1.23456", "G04 P1.23456", "")
247
self.compare_third_line("G4 P1.23456", "G4 P1.23456", "--inches")
249
#############################################################################
252
"""Test G7 command Generation."""
253
self.compare_third_line("G7", "G7", "")
255
#############################################################################
258
"""Test G8 command Generation."""
259
self.compare_third_line("G8", "G8", "")
261
#############################################################################
264
"""Test G10 command Generation."""
265
self.compare_third_line("G10 L1 P2 Z1.23456", "G10 L1 Z1.235 P2", "")
266
self.compare_third_line(
267
"G10 L1 P2 R1.23456 I2.34567 J3.456789 Q3",
268
"G10 L1 I2.346 J3.457 R1.235 P2 Q3",
271
self.compare_third_line(
272
"G10 L2 P3 X1.23456 Y2.34567 Z3.456789",
273
"G10 L2 X1.235 Y2.346 Z3.457 P3",
276
self.compare_third_line("G10 L2 P0 X0 Y0 Z0", "G10 L2 X0.000 Y0.000 Z0.000 P0", "")
277
self.compare_third_line(
278
"G10 L10 P1 X1.23456 Y2.34567 Z3.456789",
279
"G10 L10 X1.235 Y2.346 Z3.457 P1",
282
self.compare_third_line(
283
"G10 L10 P2 R1.23456 I2.34567 J3.456789 Q3",
284
"G10 L10 I2.346 J3.457 R1.235 P2 Q3",
287
self.compare_third_line(
288
"G10 L11 P1 X1.23456 Y2.34567 Z3.456789",
289
"G10 L11 X1.235 Y2.346 Z3.457 P1",
292
self.compare_third_line(
293
"G10 L11 P2 R1.23456 I2.34567 J3.456789 Q3",
294
"G10 L11 I2.346 J3.457 R1.235 P2 Q3",
297
self.compare_third_line(
298
"G10 L20 P9 X1.23456 Y2.34567 Z3.456789",
299
"G10 L20 X1.235 Y2.346 Z3.457 P9",
303
#############################################################################
306
"""Test G17 command Generation."""
307
self.compare_third_line("G17", "G17", "")
309
#############################################################################
312
"""Test G17.1 command Generation."""
313
self.compare_third_line("G17.1", "G17.1", "")
315
#############################################################################
318
"""Test G18 command Generation."""
319
self.compare_third_line("G18", "G18", "")
321
#############################################################################
324
"""Test G18.1 command Generation."""
325
self.compare_third_line("G18.1", "G18.1", "")
327
#############################################################################
330
"""Test G19 command Generation."""
331
self.compare_third_line("G19", "G19", "")
333
#############################################################################
336
"""Test G19.1 command Generation."""
337
self.compare_third_line("G19.1", "G19.1", "")
339
#############################################################################
342
"""Test G20 command Generation."""
343
self.compare_third_line("G20", "G20", "")
345
#############################################################################
348
"""Test G21 command Generation."""
349
self.compare_third_line("G21", "G21", "")
351
#############################################################################
354
"""Test G28 command Generation."""
355
self.compare_third_line("G28", "G28", "")
356
self.compare_third_line(
357
"G28 X10 Y20 Z30 A40 B50 C60 U70 V80 W90",
358
("G28 X10.000 Y20.000 Z30.000 A40.000 B50.000 C60.000 " "U70.000 V80.000 W90.000"),
362
#############################################################################
365
"""Test G28.1 command Generation."""
366
self.compare_third_line("G28.1", "G28.1", "")
368
#############################################################################
371
"""Test G30 command Generation."""
372
self.compare_third_line("G30", "G30", "")
373
self.compare_third_line(
374
"G30 X10 Y20 Z30 A40 B50 C60 U70 V80 W90",
375
("G30 X10.000 Y20.000 Z30.000 A40.000 B50.000 C60.000 " "U70.000 V80.000 W90.000"),
379
#############################################################################
382
"""Test G38.2 command Generation."""
383
self.compare_third_line(
384
"G38.2 X10 Y20 Z30 A40 B50 C60 U70 V80 W90 F123",
386
"G38.2 X10.000 Y20.000 Z30.000 A40.000 B50.000 C60.000 "
387
"U70.000 V80.000 W90.000 F7380.000"
392
#############################################################################
395
"""Test G38.3 command Generation."""
396
self.compare_third_line(
397
"G38.3 X10 Y20 Z30 A40 B50 C60 U70 V80 W90 F123",
399
"G38.3 X10.000 Y20.000 Z30.000 A40.000 B50.000 C60.000 "
400
"U70.000 V80.000 W90.000 F7380.000"
405
#############################################################################
408
"""Test G38.4 command Generation."""
409
self.compare_third_line(
410
"G38.4 X10 Y20 Z30 A40 B50 C60 U70 V80 W90 F123",
412
"G38.4 X10.000 Y20.000 Z30.000 A40.000 B50.000 C60.000 "
413
"U70.000 V80.000 W90.000 F7380.000"
418
#############################################################################
421
"""Test G38.5 command Generation."""
422
self.compare_third_line(
423
"G38.5 X10 Y20 Z30 A40 B50 C60 U70 V80 W90 F123",
425
"G38.5 X10.000 Y20.000 Z30.000 A40.000 B50.000 C60.000 "
426
"U70.000 V80.000 W90.000 F7380.000"
431
#############################################################################
434
"""Test G30.1 command Generation."""
435
self.compare_third_line("G30.1", "G30.1", "")
437
#############################################################################
440
"""Test G40 command Generation."""
441
self.compare_third_line("G40", "G40", "")
442
self.compare_third_line("G40", "G40", "--inches")
444
#############################################################################
447
"""Test G41 command Generation."""
448
self.compare_third_line("G41 D1.23456", "G41 D1", "")
449
self.compare_third_line("G41 D0", "G41 D0", "")
450
self.compare_third_line("G41 D1.23456", "G41 D1", "--inches")
452
#############################################################################
455
"""Test G41.1 command Generation."""
456
self.compare_third_line("G41.1 D1.23456 L3", "G41.1 D1.235 L3", "")
457
self.compare_third_line("G41.1 D1.23456 L3", "G41.1 D0.0486 L3", "--inches")
459
#############################################################################
462
"""Test G42 command Generation."""
463
self.compare_third_line("G42 D1.23456", "G42 D1", "")
464
self.compare_third_line("G42 D0", "G42 D0", "")
465
self.compare_third_line("G42 D1.23456", "G42 D1", "--inches")
467
#############################################################################
470
"""Test G42.1 command Generation."""
471
self.compare_third_line("G42.1 D1.23456 L3", "G42.1 D1.235 L3", "")
472
self.compare_third_line("G42.1 D1.23456 L3", "G42.1 D0.0486 L3", "--inches")
474
#############################################################################
477
"""Test G43 command Generation."""
478
self.compare_third_line("G43", "G43", "")
479
self.compare_third_line("G43 H1.23456", "G43 H1", "")
480
self.compare_third_line("G43 H0", "G43 H0", "")
481
self.compare_third_line("G43 H1.23456", "G43 H1", "--inches")
483
#############################################################################
486
"""Test G43.1 command Generation."""
487
self.compare_third_line(
489
"G43.1 X1.234567 Y2.345678 Z3.456789 A4.567891 B5.678912 C6.789123 "
490
"U7.891234 V8.912345 W9.123456"
492
"G43.1 X1.235 Y2.346 Z3.457 A4.568 B5.679 C6.789 U7.891 V8.912 W9.123",
495
self.compare_third_line(
497
"G43.1 X1.234567 Y2.345678 Z3.456789 A4.567891 B5.678912 C6.789123 "
498
"U7.891234 V8.912345 W9.123456"
500
("G43.1 X0.0486 Y0.0923 Z0.1361 A0.1798 B0.2236 C0.2673 " "U0.3107 V0.3509 W0.3592"),
504
#############################################################################
507
"""Test G43.2 command Generation."""
508
self.compare_third_line("G43.2 H1.23456", "G43.2 H1", "")
510
#############################################################################
513
"""Test G49 command Generation."""
514
self.compare_third_line("G49", "G49", "")
516
#############################################################################
519
"""Test G52 command Generation."""
524
"G52 X1.234567 Y2.345678 Z3.456789 A4.567891 B5.678912 "
525
"C6.789123 U7.891234 V8.912345 W9.123456"
528
Path.Command("G52 X0 Y0.0 Z0.00 A0.000 B0.0000 C0.00000 U0.000000 V0 W0"),
532
G52 X1.235 Y2.346 Z3.457 A4.568 B5.679 C6.789 U7.891 V8.912 W9.123
533
G52 X0.000 Y0.000 Z0.000 A0.000 B0.000 C0.000 U0.000 V0.000 W0.000
541
"G52 X1.234567 Y2.345678 Z3.456789 A4.567891 B5.678912 "
542
"C6.789123 U7.891234 V8.912345 W9.123456"
545
Path.Command("G52 X0 Y0.0 Z0.00 A0.000 B0.0000 C0.00000 U0.000000 V0 W0"),
549
G52 X0.0486 Y0.0923 Z0.1361 A0.1798 B0.2236 C0.2673 U0.3107 V0.3509 W0.3592
550
G52 X0.0000 Y0.0000 Z0.0000 A0.0000 B0.0000 C0.0000 U0.0000 V0.0000 W0.0000
555
#############################################################################
557
# def test10530(self):
558
# """Test G53 command Generation."""
560
# # G53 is handled differently in different gcode interpreters.
561
# # It always means "absolute machine coordinates", but it is
562
# # used like G0 in Centroid and Mach4, and used in front of
563
# # G0 or G1 on the same line in Fanuc, Grbl, LinuxCNC, and Tormach.
564
# # It is not modal in any gcode interpreter I currently know about.
565
# # The current FreeCAD code treats G53 as modal (like G54-G59.9).
566
# # The current refactored postprocessor code does not
567
# # handle having two G-commands on the same line.
569
# c = Path.Command("G53 G0 X10 Y20 Z30 A40 B50 C60 U70 V80 W90")
571
# self.docobj.Path = Path.Path([c])
572
# postables = [self.docobj]
576
# G53 G0 X10.000 Y20.000 Z30.000 A40.000 B50.000 C60.000 U70.000 V80.000 W90.000
579
# gcode = postprocessor.export(postables, "-", args)
580
# print("--------\n" + gcode + "--------\n")
581
# self.assertEqual(gcode, expected)
583
#############################################################################
586
"""Test G54 command Generation."""
587
self.compare_third_line("G54", "G54", "")
589
#############################################################################
592
"""Test G54.1 command Generation."""
594
# Some gcode interpreters use G54.1 P- to select additional
595
# work coordinate systems.
597
self.compare_third_line("G54.1 P2.34567", "G54.1 P2", "")
599
#############################################################################
602
"""Test G55 command Generation."""
603
self.compare_third_line("G55", "G55", "")
605
#############################################################################
608
"""Test G56 command Generation."""
609
self.compare_third_line("G56", "G56", "")
611
#############################################################################
614
"""Test G57 command Generation."""
615
self.compare_third_line("G57", "G57", "")
617
#############################################################################
620
"""Test G58 command Generation."""
621
self.compare_third_line("G58", "G58", "")
623
#############################################################################
626
"""Test G59 command Generation."""
627
self.compare_third_line("G59", "G59", "")
629
# Some gcode interpreters use G59 P- to select additional
630
# work coordinate systems. This is considered somewhat
631
# obsolete and is being replaced by G54.1 P- instead.
633
self.compare_third_line("G59 P2.34567", "G59 P2", "")
635
#############################################################################
638
"""Test G59.1 command Generation."""
639
self.compare_third_line("G59.1", "G59.1", "")
641
#############################################################################
644
"""Test G59.2 command Generation."""
645
self.compare_third_line("G59.2", "G59.2", "")
647
#############################################################################
650
"""Test G59.3 command Generation."""
651
self.compare_third_line("G59.3", "G59.3", "")
653
#############################################################################
656
"""Test G59.4 command Generation."""
657
self.compare_third_line("G59.4", "G59.4", "")
659
#############################################################################
662
"""Test G59.5 command Generation."""
663
self.compare_third_line("G59.5", "G59.5", "")
665
#############################################################################
668
"""Test G59.6 command Generation."""
669
self.compare_third_line("G59.6", "G59.6", "")
671
#############################################################################
674
"""Test G59.7 command Generation."""
675
self.compare_third_line("G59.7", "G59.7", "")
677
#############################################################################
680
"""Test G59.8 command Generation."""
681
self.compare_third_line("G59.8", "G59.8", "")
683
#############################################################################
686
"""Test G59.9 command Generation."""
687
self.compare_third_line("G59.9", "G59.9", "")
689
#############################################################################
692
"""Test G61 command Generation."""
693
self.compare_third_line("G61", "G61", "")
695
#############################################################################
698
"""Test G61.1 command Generation."""
699
self.compare_third_line("G61.1", "G61.1", "")
701
#############################################################################
704
"""Test G64 command Generation."""
705
self.compare_third_line("G64", "G64", "")
706
self.compare_third_line("G64 P3.456789", "G64 P3.457", "")
707
self.compare_third_line("G64 P3.456789 Q4.567891", "G64 P3.457 Q4.568", "")
708
self.compare_third_line("G64 P3.456789 Q4.567891", "G64 P0.1361 Q0.1798", "--inches")
710
#############################################################################
713
"""Test G73 command Generation."""
715
Path.Command("G0 X1 Y2"),
716
Path.Command("G0 Z8"),
719
Path.Command("G73 X1 Y2 Z0 F123 Q1.5 R5"),
731
G73 X1.000 Y2.000 Z0.000 R5.000 Q1.500 F7380.000
771
( G73 X1.000 Y2.000 Z0.000 R5.000 Q1.500 F7380.000 )
787
(Finish operation: testpath)
790
"--comments --translate_drill",
793
# Re-initialize all of the values before doing more tests.
795
postprocessor.UNITS = "G21"
796
postprocessor.init_values(postprocessor.global_values)
798
# Test translate_drill with G83 and G91.
800
Path.Command("G0 X1 Y2"),
801
Path.Command("G0 Z8"),
804
Path.Command("G73 X1 Y2 Z0 F123 Q1.5 R5"),
816
G73 X1.000 Y2.000 Z0.000 R5.000 Q1.500 F7380.000
820
"--no-comments --no-translate_drill",
858
( G73 X1.000 Y2.000 Z0.000 R5.000 Q1.500 F7380.000 )
876
(Finish operation: testpath)
879
"--comments --translate_drill",
882
#############################################################################
885
"""Test G81 command Generation."""
887
Path.Command("G0 X1 Y2"),
888
Path.Command("G0 Z8"),
891
Path.Command("G81 X1 Y2 Z0 F123 R5"),
903
G81 X1.000 Y2.000 Z0.000 R5.000 F7380.000
934
( G81 X1.000 Y2.000 Z0.000 R5.000 F7380.000 )
941
(Finish operation: testpath)
944
"--comments --translate_drill",
947
# Re-initialize all of the values before doing more tests.
949
postprocessor.UNITS = "G21"
950
postprocessor.init_values(postprocessor.global_values)
952
# Test translate_drill with G81 and G91.
954
Path.Command("G0 X1 Y2"),
955
Path.Command("G0 Z8"),
958
Path.Command("G81 X1 Y2 Z0 F123 R5"),
970
G81 X1.000 Y2.000 Z0.000 R5.000 F7380.000
974
"--no-comments --no-translate_drill",
1003
( G81 X1.000 Y2.000 Z0.000 R5.000 F7380.000 )
1012
(Finish operation: testpath)
1015
"--comments --translate_drill",
1018
#############################################################################
1020
def test10820(self):
1021
"""Test G82 command Generation."""
1023
Path.Command("G0 X1 Y2"),
1024
Path.Command("G0 Z8"),
1025
Path.Command("G90"),
1026
Path.Command("G99"),
1027
Path.Command("G82 X1 Y2 Z0 F123 R5 P1.23456"),
1028
Path.Command("G80"),
1029
Path.Command("G90"),
1031
self.single_compare(
1039
G82 X1.000 Y2.000 Z0.000 R5.000 P1.23456 F7380.000
1045
self.single_compare(
1059
"--translate_drill",
1061
self.single_compare(
1071
( G82 X1.000 Y2.000 Z0.000 R5.000 P1.23456 F7380.000 )
1079
(Finish operation: testpath)
1082
"--comments --translate_drill",
1085
# Re-initialize all of the values before doing more tests.
1087
postprocessor.UNITS = "G21"
1088
postprocessor.init_values(postprocessor.global_values)
1090
# Test translate_drill with G82 and G91.
1092
Path.Command("G0 X1 Y2"),
1093
Path.Command("G0 Z8"),
1094
Path.Command("G91"),
1095
Path.Command("G99"),
1096
Path.Command("G82 X1 Y2 Z0 F123 R5 P1.23456"),
1097
Path.Command("G80"),
1098
Path.Command("G90"),
1100
self.single_compare(
1108
G82 X1.000 Y2.000 Z0.000 R5.000 P1.23456 F7380.000
1112
"--no-comments --no-translate_drill",
1114
self.single_compare(
1130
"--translate_drill",
1132
self.single_compare(
1142
( G82 X1.000 Y2.000 Z0.000 R5.000 P1.23456 F7380.000 )
1152
(Finish operation: testpath)
1155
"--comments --translate_drill",
1158
#############################################################################
1160
def test10830(self):
1161
"""Test G83 command Generation."""
1163
Path.Command("G0 X1 Y2"),
1164
Path.Command("G0 Z8"),
1165
Path.Command("G90"),
1166
Path.Command("G99"),
1167
Path.Command("G83 X1 Y2 Z0 F123 Q1.5 R5"),
1168
Path.Command("G80"),
1169
Path.Command("G90"),
1171
self.single_compare(
1179
G83 X1.000 Y2.000 Z0.000 R5.000 Q1.500 F7380.000
1185
self.single_compare(
1207
"--translate_drill",
1209
self.single_compare(
1219
( G83 X1.000 Y2.000 Z0.000 R5.000 Q1.500 F7380.000 )
1235
(Finish operation: testpath)
1238
"--comments --translate_drill",
1241
# Re-initialize all of the values before doing more tests.
1243
postprocessor.UNITS = "G21"
1244
postprocessor.init_values(postprocessor.global_values)
1246
# Test translate_drill with G83 and G91.
1248
Path.Command("G0 X1 Y2"),
1249
Path.Command("G0 Z8"),
1250
Path.Command("G91"),
1251
Path.Command("G99"),
1252
Path.Command("G83 X1 Y2 Z0 F123 Q1.5 R5"),
1253
Path.Command("G80"),
1254
Path.Command("G90"),
1256
self.single_compare(
1264
G83 X1.000 Y2.000 Z0.000 R5.000 Q1.500 F7380.000
1268
"--no-comments --no-translate_drill",
1270
self.single_compare(
1294
"--translate_drill",
1296
self.single_compare(
1306
( G83 X1.000 Y2.000 Z0.000 R5.000 Q1.500 F7380.000 )
1324
(Finish operation: testpath)
1327
"--comments --translate_drill",
1330
#############################################################################
1332
def test10900(self):
1333
"""Test G90 command Generation."""
1334
self.compare_third_line("G90", "G90", "")
1336
#############################################################################
1338
def test10901(self):
1339
"""Test G90.1 command Generation."""
1340
self.compare_third_line("G90.1", "G90.1", "")
1342
#############################################################################
1344
def test10910(self):
1345
"""Test G91 command Generation."""
1346
self.compare_third_line("G91", "G91", "")
1348
#############################################################################
1350
def test10911(self):
1351
"""Test G91.1 command Generation."""
1352
self.compare_third_line("G91.1", "G91.1", "")
1354
#############################################################################
1356
def test10920(self):
1357
"""Test G92 command Generation."""
1358
self.compare_third_line(
1359
"G92 X10 Y20 Z30 A40 B50 C60 U70 V80 W90",
1360
("G92 X10.000 Y20.000 Z30.000 A40.000 B50.000 C60.000 " "U70.000 V80.000 W90.000"),
1364
#############################################################################
1366
def test10921(self):
1367
"""Test G92.1 command Generation."""
1368
self.compare_third_line("G92.1", "G92.1", "")
1370
#############################################################################
1372
def test10922(self):
1373
"""Test G92.2 command Generation."""
1374
self.compare_third_line("G92.2", "G92.2", "")
1376
#############################################################################
1378
def test10923(self):
1379
"""Test G92.3 command Generation."""
1380
self.compare_third_line("G92.3", "G92.3", "")
1382
#############################################################################
1384
def test10930(self):
1385
"""Test G93 command Generation."""
1386
self.compare_third_line("G93", "G93", "")
1388
#############################################################################
1390
def test10940(self):
1391
"""Test G94 command Generation."""
1392
self.compare_third_line("G94", "G94", "")
1394
#############################################################################
1396
def test10950(self):
1397
"""Test G95 command Generation."""
1398
self.compare_third_line("G95", "G95", "")
1400
#############################################################################
1402
def test10980(self):
1403
"""Test G98 command Generation."""
1404
self.compare_third_line("G98", "G98", "")
1406
#############################################################################
1408
def test10990(self):
1409
"""Test G99 command Generation."""
1410
self.compare_third_line("G99", "G99", "")