Skip to content

Commit 47bbc47

Browse files
Add native HEIDENHAIN 3+2 and five-axis execution
1 parent bac3310 commit 47bbc47

92 files changed

Lines changed: 28486 additions & 20262 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎CHANGELOG.md‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,21 @@
11
# Changelog
22

3+
## 2.7.0 - 2026-10-16
4+
5+
- Add native SINUMERIK XZ turning input in MPF/SPF with standalone G290/G291 native/ISO-T switching, diameter modes, native units, WCS, spindle/CSS and source-owned execution traces.
6+
- Expand the supported CYCLE93 rectangular groove, CYCLE95 local-contour rough/finish and CYCLE97 longitudinal thread subsets; reuse centerline drilling cycles and reject unmodeled variants explicitly. Add CAM fixtures and independent dimension/infeed regression tests; document output-post and controller tool-table limitations.
7+
- Report unverified CYCLE95 automatic tool-nose compensation for configured nonzero nose radii; nominal-contour completion does not establish controller-equivalent cycle geometry.
8+
- Add the HEIDENHAIN .h/.H Save As filter, select it for existing Klartext documents and append .h when no extension is supplied.
9+
- Add native HEIDENHAIN iTNC 530 indexed 3+2 execution with PLANE SPATIAL/RESET, STAY/TURN positioning, SEQ branch selection and configured rotary kinematics.
10+
- Support continuous Klartext L motion with A/B/C under M128/M129 or the supported FUNCTION TCPM form on AC/BC tables; retain start/end tool orientations and rotary state in execution traces.
11+
- Model M126/M127 shortest-path rotary positioning and M94 angle reduction; report missing profiles, unconfigured axes and unsupported rotary/TCP combinations at their source blocks.
12+
- Transform native arc centers, normals and IJK vectors into the resolved frame; correct Klartext circular and polar direction handling in the ZX plane.
13+
- Preserve machine-coordinate M91 positioning and guarded M140 Home retraction with tilted frames and configured WCS offsets.
14+
- Pass selected kinematics through native HEIDENHAIN execution and extend the GUI rotary notice to detect Klartext axes; add real Qt coverage for loading and calculating the supplied five-axis program.
15+
- Add an unchanged three-post CAM reference project for FANUC, SINUMERIK 840D and HEIDENHAIN iTNC 530. Compare all 1182 normalized cutting segments, arc geometry, feeds, tools and start/end tool axes, with a 0.002 mm positional tolerance for postprocessor rounding.
16+
- Consolidate multi-axis regression fixtures under milling/test_5ax and update execution, conversion, export, GUI, corpus and documentation references; preserve the existing reference program contents.
17+
- Document the supported native rotary/TCP scope and limitations. GPU milling stock removal and the iTNC output post remain restricted to their existing three-axis coverage.
18+
319
## 2.6.0 - 2026-10-16
420

521
- Add Rotate view for fixed milling Top/Front/Left views, with signed angles around model X/Y/Z axes and preserved camera center, zoom and per-document orientation; ISO/3D and turning remain disabled.

‎FAQ.md‎

Lines changed: 53 additions & 26 deletions
Large diffs are not rendered by default.

‎FAQ_RU.md‎

Lines changed: 52 additions & 25 deletions
Large diffs are not rendered by default.

‎README.md‎

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,16 @@
11
# Easy G-Code Plot
22

3-
Desktop G-code editor, analyzer, backplotter and NC/DXF exporter for FANUC turning/milling, SINUMERIK 840D milling (native and ISO-M) and HEIDENHAIN iTNC 530 three-axis Klartext. FANUC/SINUMERIK multi-axis support is described in the [FAQ](FAQ.md).
3+
Desktop G-code editor, analyzer, backplotter and NC/DXF exporter for FANUC turning/milling, SINUMERIK 840D milling (native and ISO-M), native SINUMERIK XZ turning with bounded ISO-T input, and HEIDENHAIN iTNC 530 Klartext milling. Controller coverage and configured kinematics are described in the [FAQ](FAQ.md).
44

5-
**New in 2.6.0: rotate fixed milling views around model X/Y/Z axes.** Use **View → Rotate view**, the plot context menu or the View toolbar to enter an angle. Top/Front/Left are supported; ISO/3D and turning are disabled. Camera rotation preserves the toolpath and scale without CNC recalculation.
5+
**New in 2.7.0: native HEIDENHAIN iTNC 530 indexed 3+2 and continuous five-axis input.** Execute `PLANE SPATIAL/RESET` and rotary positioning with configured kinematics; use `M128/M129` or the supported `FUNCTION TCPM` form for continuous `L` motion on AC/BC tables. Opening `.h`/`.H` selects native Klartext milling automatically. Regression tests compare the supplied FANUC, SINUMERIK and HEIDENHAIN CAM programs across 1182 normalized cutting segments, including arc geometry and tool-axis directions. See the [iTNC input coverage and limits](FAQ.md#heidenhain-itnc-530-input). GPU milling stock removal remains three-axis.
66

7-
**Also available: MDI and Compare (since 2.4.0), and native HEIDENHAIN iTNC Klartext input (since 2.5.0).** Start with one empty milling document; use **+**, the document list and **×** to manage independent programs. **CNC Functions → Compare** shows aligned, read-only text differences between open buffers or disk files, with synchronized scrolling and Refresh. The **iTNC-code** editor mode highlights Klartext; `.h`/`.H` files automatically select native three-axis milling execution. See the [iTNC input coverage and limits](FAQ.md#heidenhain-itnc-530-input) for executable commands and syntax-only features.
7+
2.7.0 also adds [native SINUMERIK XZ turning and bounded ISO-T input](FAQ.md#is-sinumerik-lathe-supported): G290/G291 switching, diameter modes and supported CYCLE93/95/97 subsets. CYCLE95 uses nominal-contour geometry and reports unverified automatic nose compensation when applicable; completion is not full controller-equivalence validation. Save As includes the HEIDENHAIN `.h/.H` filter.
88

9-
**New in 2.3.1: customizable toolbars.** Right-click a toolbar and choose **Customize Toolbars** to choose its buttons. Search and enable static commands such as Tool Library, WCS, Stock, Tokens/Variables and CNC Functions. Choices are saved across restarts; menus and shortcuts stay available. OK applies changes, Cancel discards them, and Restore Defaults restores the compact button set. Recent Files and other dynamic lists are excluded.
10-
11-
**New in 2.3.0: 3D toolpath picking and optional Cimco Like Picking controls.** Click a milling trajectory line or arc to locate its executed movement in the editor and playback slider.
12-
13-
The default controls remain **Shift+left-click to select** and **left-button dragging to pan**. Enable **Options → General → Cimco Like Picking** for **left-click to select** and **right-button dragging to pan**. A right-click without dragging opens the context menu; dragging does not. Middle-button rotation and wheel zoom are available in both modes. The option is off by default, applies on OK and affects milling views; turning controls stay the same.
9+
**New in 2.6.0: fixed-view rotation, Tokens/Variables and native Klartext contour improvements.** Use **View → Rotate view**, the plot context menu or the View toolbar to rotate Top/Front/Left milling views around model X/Y/Z while preserving the camera center and scale. **Tokens/Variables** inspects FANUC, SINUMERIK and HEIDENHAIN execution state with diagnostic filters and search. Native `RND`/`CHF` construct rounding/chamfers before cutter compensation; a persistent notice helps select missing rotary kinematics.
1410

1511
[3D milling stock removal on the GPU](#3d-milling-stock-removal) follows the remaining material through a three-axis program, lets you inspect the machined surface and saves the current stock as STL. Turning stock removal remains available separately.
1612

17-
Checked CAM examples include programs generated in Autodesk Fusion 360 and Siemens NX 2312 with SINUMERIK 840D and FANUC postprocessors. Coverage follows the supported commands and configured kinematics documented below.
13+
Checked CAM examples include programs generated in Autodesk Fusion 360 and Siemens NX 2312, plus a three-post Fusion project for FANUC, SINUMERIK 840D and HEIDENHAIN iTNC 530. Coverage follows the supported commands and configured kinematics documented below.
1814

1915
[![Build and release](https://github.com/MaestroFusion360/easy_gcode_plot/actions/workflows/release.yml/badge.svg)](https://github.com/MaestroFusion360/easy_gcode_plot/actions/workflows/release.yml)
2016

@@ -118,7 +114,7 @@ Checked CAM examples include programs generated in Autodesk Fusion 360 and Sieme
118114

119115
## What it is
120116

121-
Easy G-Code Plot is a desktop workspace for editing CNC programs, inspecting calculated toolpaths, simulating stock removal and exporting NC/DXF geometry. It supports FANUC turning/milling, a documented subset of SINUMERIK 840D native/ISO-M milling and native HEIDENHAIN iTNC 530 three-axis Klartext. Configured 3+2 and five-axis FANUC/SINUMERIK toolpaths have controller-specific limits described in the FAQ.
117+
Easy G-Code Plot is a desktop workspace for editing CNC programs, inspecting calculated toolpaths, simulating stock removal and exporting NC/DXF geometry. It supports FANUC turning/milling, documented subsets of SINUMERIK 840D native/ISO-M milling and native/ISO-T turning, and native HEIDENHAIN iTNC 530 Klartext milling. Configured 3+2 and five-axis FANUC/SINUMERIK toolpaths have controller-specific limits described in the FAQ.
122118

123119
The GUI and CLI share one CNC execution kernel. Supported behavior, controller limits and diagnostics are described in the [FAQ](FAQ.md). The application does not model a complete physical machine.
124120

@@ -223,5 +219,5 @@ MIT License — see [LICENSE.md](LICENSE.md).
223219
---
224220

225221
<p align="center">
226-
<img src="https://komarev.com/ghpvc/?username=MaestroFusion360-easy-gcode-plot&label=Project+Views&color=blue" alt="Project Views">
222+
<img src="https://api.visitorbadge.io/api/VisitorHit?user=MaestroFusion360&repo=easy_gcode_plot&countColor=%230077cc&label=Project%20Views" alt="Project Views">
227223
</p>

‎ROADMAP.md‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## Current direction
44

5-
Current development baseline: **2.6.0 (2026-10-16)**. This is the current code baseline; publication/release status is tracked separately. Completed work belongs in [CHANGELOG](CHANGELOG.md), not in the list of future features.
5+
Current development baseline: **2.7.0 (2026-10-16)**. This is the current code baseline; publication/release status is tracked separately. Completed work belongs in [CHANGELOG](CHANGELOG.md), not in the list of future features.
66

77
The 2.0.0 GPU milling-stock milestone, the 2.1.x validation and workflow fixes, toolbar customization in 2.3.x and MDI/Compare in 2.4.0, and the first native Heidenhain iTNC 530 Klartext implementation and GUI stabilization in 2.5.0 are recorded in CHANGELOG.
88

@@ -16,6 +16,7 @@ Development now focuses on expanding useful NC workflows **without duplicating t
1616
- **Heidenhain output:** an existing `heidenhain_itnc530` EXPANDED post target, distinct from native-source input coverage. Klartext FULL formatting remains unsupported; `.h` source filenames are preserved where applicable.
1717
- **Generators:** existing hole/grid and pocket workflows emit **ISO G-code and native iTNC Klartext** where supported. The 2.5.0 work added native L/CR fragments and CC/CP helical output, with shared preview/generation validations. This is **not yet a general post-aware generator framework**.
1818
- **Rotary kinematics:** configurable profiles and Options editing are implemented. Additional pivot/offset geometry and broader machine-layout verification are future work, not implicit support claims.
19+
- **SINUMERIK turning:** bounded native XZ and ISO-T execution, including supported CYCLE93/95/97 and centerline drilling variants. CYCLE95 automatic nose compensation, controller-equivalent pass optimization, ISO turning canned cycles and a native Siemens turning output post remain future work; see [current coverage](FAQ.md#is-sinumerik-lathe-supported).
1920

2021
---
2122

@@ -95,10 +96,10 @@ Do not replace or overwrite users' existing snippets when installing or updating
9596

9697
The initial lexer, native AST, and bounded Klartext executor are already delivered. Future work should be driven by actual reference programs rather than a claim of complete iTNC compatibility.
9798

98-
RND/CHF geometry is implemented in 2.5.1 for planar local corners, including line/arc RND combinations. The reference corpus includes `6bas154.h` (explicit T4 Ø6 in regression setup) and the manual's `LINEAR` chamfer example. Full-circle/multi-turn neighbors, spatial corners, ambiguous tangent solutions and corners that consume an entire neighboring element remain explicitly diagnosed boundaries; broader controller behavior requires independent reference cases.
99+
RND/CHF geometry is implemented in 2.6.0 for planar local corners, including line/arc RND combinations. The reference corpus includes `6bas154.h` (explicit T4 Ø6 in regression setup) and the manual's `LINEAR` chamfer example. Version 2.7.0 adds the supported PLANE SPATIAL/RESET and AC/BC M128/TCPM input subset. Full-circle/multi-turn neighbors, spatial corners, ambiguous tangent solutions and corners that consume an entire neighboring element remain explicitly diagnosed boundaries; broader controller behavior requires independent reference cases.
99100

100-
- Evaluate supported Q/QL/QR expressions and control-flow constructs only after defining their scope, state model, limits and diagnostics.
101-
- Expand `LBL` calls/returns and native cycle execution only with documented semantics and golden reference programs.
101+
- Extend the existing bounded Q/QL/QR expression and control-flow runtime with defined scope, limits and diagnostics.
102+
- Expand existing `LBL` call/return and native cycle coverage only with documented semantics and golden reference programs.
102103
- Preserve native constructs in the AST; do not silently reinterpret unknown Klartext as FANUC/ISO.
103104
- Maintain Python/Cython parity and separate input-support tables from postprocessor output-support tables.
104105
- Extend GUI syntax/diagnostic integration together with the implementation, not before it.

‎app/cli.py‎

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,15 @@
3232
from app.gcode.trace import format_trace_statistics, trace_statistics
3333
from app.native import NativeRuntimeError, require_packaged_native
3434

35+
MACHINE_TYPE_HELP = (
36+
"Machine type (auto: H milling; MPF/SPF turning with native turning signatures, otherwise milling; "
37+
"other extensions turning)"
38+
)
39+
3540

3641
def _add_kinematics_option(command: argparse.ArgumentParser) -> None:
3742
command.add_argument(
38-
"--kinematics", metavar="PROFILE_ID", help="Milling rotary-kinematics profile (FANUC or SINUMERIK)"
43+
"--kinematics", metavar="PROFILE_ID", help="Milling rotary-kinematics profile (FANUC, SINUMERIK or HEIDENHAIN)"
3944
)
4045

4146

@@ -64,7 +69,7 @@ def _add_export_options(command: argparse.ArgumentParser) -> None:
6469
"--arc-type",
6570
choices=("auto", "ijk-relative", "ijk-absolute", "radius", "linearized"),
6671
default="auto",
67-
help="Milling expanded arc representation",
72+
help="Expanded arc representation",
6873
)
6974
command.add_argument("--coordinates", choices=("absolute", "incremental"), default="absolute")
7075
for name in (
@@ -176,7 +181,7 @@ def _parser() -> tuple[argparse.ArgumentParser, tuple[argparse.ArgumentParser, .
176181
"--lang",
177182
choices=("fanuc_turn", "fanuc_mill"),
178183
default=None,
179-
help="Machine type (default: milling for MPF/SPF/H, turning for other extensions)",
184+
help=MACHINE_TYPE_HELP,
180185
)
181186
command.add_argument("--lathe-gcode-system", choices=("A", "B"), default="A")
182187
command.add_argument(
@@ -212,7 +217,7 @@ def _parser() -> tuple[argparse.ArgumentParser, tuple[argparse.ArgumentParser, .
212217
"--lang",
213218
choices=("fanuc_turn", "fanuc_mill"),
214219
default=None,
215-
help="Machine type (default: milling for MPF/SPF/H, turning for other extensions)",
220+
help=MACHINE_TYPE_HELP,
216221
)
217222
batch.add_argument("--html", type=Path, metavar="DIRECTORY", help="Save one HTML statistics/SVG report per NC file")
218223
batch.add_argument("--inches", action="store_true", help="Display HTML statistics in inches")
@@ -252,7 +257,7 @@ def _parser() -> tuple[argparse.ArgumentParser, tuple[argparse.ArgumentParser, .
252257
"--lang",
253258
choices=("fanuc_turn", "fanuc_mill"),
254259
default=None,
255-
help="Machine type (default: milling for MPF/SPF/H, turning for other extensions)",
260+
help=MACHINE_TYPE_HELP,
256261
)
257262
batch_export.add_argument("--lathe-gcode-system", choices=("A", "B"), default="A")
258263
batch_export.add_argument(

‎app/gcode/execution/source.py‎

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
_MODE_RE = re.compile(r"(?<![A-Z_])G\s*(290|291)(?![0-9.])", re.IGNORECASE)
1818
_NATIVE_RE = re.compile(
1919
r"(?<![A-Z_])(?:SUPA|CIP|TRANS|ATRANS|ROT|AROT|RPL|SCALE|ASCALE|MIRROR|AMIRROR|MCALL|"
20-
r"TRAORI|TRAFOOF|WORKPIECE|CYCLE\d+|POCKET[1-4]|HOLES[12]|LONGHOLE|SLOT[12])\b",
20+
r"TRAORI|TRAFOOF|WORKPIECE|DIAMON|DIAMOF|DIAM90|CYCLE\d+|POCKET[1-4]|HOLES[12]|LONGHOLE|SLOT[12])\b",
2121
re.I,
2222
)
2323

@@ -51,10 +51,22 @@ def has_sinumerik_signature(source: str) -> bool:
5151
return False
5252

5353

54+
def has_sinumerik_turning_signature(source: str) -> bool:
55+
"""Recognize unambiguous turning constructs, excluding comments and strings."""
56+
for raw in str(source).splitlines():
57+
code = strip_comments(re.sub(r'"(?:[^"\n]|"")*"', "", raw))
58+
if re.search(r"\b(?:DIAMON|DIAMOF|DIAM90|CYCLE(?:93|95|97))\b", code, re.I):
59+
return True
60+
return False
61+
62+
5463
def language_for_path(path: str | Path, language: str | None = None) -> str:
5564
"""Respect an explicit machine type, otherwise use the source container."""
5665
if language is not None:
5766
return language
67+
if source_dialect_for_path(path) == SOURCE_DIALECT_SINUMERIK and Path(path).is_file():
68+
if has_sinumerik_turning_signature(Path(path).read_text(encoding="utf-8", errors="replace")):
69+
return "fanuc_turn"
5870
return "fanuc_turn" if source_dialect_for_path(path) == SOURCE_DIALECT_FANUC else "fanuc_mill"
5971

6072

‎app/gcode/export/full.py‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,11 @@ def normalize_full_program(result, source, options=None, *, cancelled=None):
6363
"Klartext FULL formatting is not modeled; use EXPANDED or save the source document",
6464
code="UNSUPPORTED_HEIDENHAIN_FULL_EXPORT",
6565
)
66+
if result.source_dialect == "sinumerik" and result.language == "fanuc_turn":
67+
raise ExportLimitation(
68+
"Native SINUMERIK turning FULL formatting is not modeled; use EXPANDED or save the source document",
69+
code="UNSUPPORTED_SINUMERIK_TURNING_FULL_EXPORT",
70+
)
6671
_require_complete_export(result, "FULL requires a valid and complete execution result", cancelled)
6772
if result.program is None or not result.execution_steps:
6873
raise ValueError("FULL requires source blocks and a complete execution map")

‎app/gcode/kernel/api/engine.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ def execute(
105105
try:
106106
threading_steps = (
107107
_threading_step_flags(result.execution_steps)
108-
if language == "fanuc_turn"
108+
if language == "fanuc_turn" and result.source_dialect != "sinumerik"
109109
else (False,) * len(result.execution_steps)
110110
)
111111
for step_index, step in enumerate(result.execution_steps):

0 commit comments

Comments
 (0)