CAM: Updated Fanuc test and support methods to match working post script.

The thread tapping is corrected and the test code is adjusted to match.
This commit is contained in:
Petter Reinholdtsen
2026-02-28 22:11:15 +01:00
parent df1a1ab981
commit 263bfe9948
2 changed files with 14 additions and 12 deletions
+5 -1
View File
@@ -30,7 +30,7 @@ import Path
class MockTool:
def __init__(self):
self.ShapeName = "endmill"
self.ShapeType = "endmill"
class MockToolController:
@@ -56,6 +56,7 @@ class MockToolController:
[Path.Command(f"M6 T{tool_number}"), Path.Command(f"M3 S{spindle_speed}")]
)
@property
def InList(self):
return []
@@ -72,6 +73,7 @@ class MockOperation:
# Create an empty path by default
self.Path = Path.Path()
@property
def InList(self):
"""Mock InList - operations belong to a job."""
return []
@@ -136,7 +138,9 @@ class MockJob:
self.Fixtures = ["G54"]
self.OrderOutputBy = "Tool"
self.SplitOutput = False
self.TypeId = "dummy"
@property
def InList(self):
"""Mock InList for fixture setup."""
return []
+9 -11
View File
@@ -95,7 +95,7 @@ class TestFanucPost(PathTestUtils.PathTestBase):
# Test without header
expected = """%
(BEGIN PREAMBLE)
G17 G54 G40 G49 G80 G90
G17 G54 G40 G49 G80 G90 G94
G21
(BEGIN OPERATION: TC: DEFAULT TOOL)
(MACHINE UNITS: MM/MIN)
@@ -130,7 +130,7 @@ M30
# test without comments
expected = """%
G17 G54 G40 G49 G80 G90
G17 G54 G40 G49 G80 G90 G94
G21
M05
G28 G91 Z0
@@ -168,7 +168,7 @@ M30
# Test without header
expected = """%
(BEGIN PREAMBLE)
G17 G54 G40 G49 G80 G90
G17 G54 G40 G49 G80 G90 G94
G21
(BEGIN OPERATION: TC: DEFAULT TOOL)
(MACHINE UNITS: MM/MIN)
@@ -207,7 +207,7 @@ M30
# test without comments
expected = """%
G17 G54 G40 G49 G80 G90
G17 G54 G40 G49 G80 G90 G94
G21
M05
G28 G91 Z0
@@ -336,18 +336,16 @@ M30
Test threading using drill cycle converted to tapping
"""
self.tool_controller.Tool.ShapeName = "tap"
self.tool_controller.Tool.ShapeType = "tap"
c = Path.Command("G0 X10 Y10")
c2 = Path.Command("G81 X10 Y10 Z-10 R20 F1 P1 Q1")
c2 = Path.Command("G84 X10 Y10 Z-10 R20 F1 P1 Q1")
self.profile_op.Path = Path.Path([c, c2])
self.job.PostProcessorArgs = "--no-header --no-show-editor"
gcode = self.post.export()[0][1]
self.assertEqual(gcode.splitlines()[18], "G0 X10.000 Y10.000")
self.assertEqual(gcode.splitlines()[19], "G95")
self.assertEqual(gcode.splitlines()[20], "M29 S1000")
self.assertEqual(gcode.splitlines()[21], "G84 Z-10.000 R20.000 F1.000 P1.000 Q1.000")
self.assertEqual(gcode.splitlines()[22], "G80")
self.assertEqual(gcode.splitlines()[23], "G94")
self.assertEqual(gcode.splitlines()[19], "M29 S1000")
self.assertEqual(gcode.splitlines()[20], "G84 Z-10.000 R20.000 F1000.000 P1.000 Q1.000")
self.assertEqual(gcode.splitlines()[21], "G80")
def test_comment(self):
"""