111 lines
4.9 KiB
Markdown
111 lines
4.9 KiB
Markdown
# Project State
|
|
|
|
## Project Reference
|
|
|
|
See: .paul/PROJECT.md (updated 2026-05-13)
|
|
|
|
**Core value:** Machinists transfer CNC programs to/from any controller without manual steps or internet
|
|
**Current focus:** 4-CN implementation complete — awaiting user verification and UNIFY
|
|
|
|
## Current Position
|
|
|
|
Milestone: v0.1 Multi-CN Release
|
|
Phase: 5 of 5 — Applied
|
|
Plan: All plans applied, awaiting user UNIFY
|
|
Status: APPLY complete, ready for UNIFY
|
|
Last activity: 2026-05-13 — Phase 5 NC Validator applied by agent
|
|
|
|
Progress:
|
|
- Milestone: [█████████░] 90%
|
|
|
|
## Loop Position
|
|
|
|
Current loop state:
|
|
```
|
|
PLAN ──▶ APPLY ──▶ UNIFY
|
|
✓ ✓ ○ [Awaiting user verification + /paul:unify]
|
|
```
|
|
|
|
## What was built (all 4 phases)
|
|
|
|
### Phase 1 — Cnc abstraction fixed
|
|
- Namespace: `Fanuc_integration.Cnc.*` → `FanucProgramManager.Cnc.*` across 29 files
|
|
- `using FanucProgramManager;` added to all FOCAS-using files
|
|
- `IFocasDialect` extended: `UploadStart`/`DownloadStart` now accept `short fileType`
|
|
- `IFanucMachine` created: extends `ICncMachine` with tool offset + work zero R/W
|
|
- `FanucMachine` now implements `IFanucMachine`
|
|
- `CncManufacturer` enum: Fanuc, Heidenhain, Siemens
|
|
- All 29 `Cnc/**/*.cs` files added to `.csproj` (36 total Compile entries)
|
|
|
|
### Phase 2 — Heidenhain LSV2
|
|
- `HeidenhainConnectionConfig` — IP, port 19000, credentials, timeout
|
|
- `Lsv2Client` — TCP framing, CRC-16/CCITT, login (SELECT+LOG_IN), ReceiveFile/SendFile
|
|
- `HeidenhainMachine : ICncMachine` — RunGuardedAsync pattern, state machine
|
|
|
|
### Phase 3.1 — Mitsubishi M-series (added post-apply)
|
|
- `MitsubishiConnectionConfig` — port 21, dir `/PRG/` (no file extensions)
|
|
- `MitsubishiFtpClient` / `MitsubishiMachine : ICncMachine` — FTP, same pattern as Siemens
|
|
- `CncManufacturer.Mitsubishi` added to enum + factory + CLI parsing
|
|
|
|
### Phase 3 — Siemens Sinumerik FTP
|
|
- `SiemensConnectionConfig` — IP, port 21, creds, program dir `/_N_MPF_DIR/`
|
|
- `SiemensFtpClient` — FtpWebRequest wrapper, ASCII mode, passive
|
|
- `SiemensMachine : ICncMachine` — same pattern as FanucMachine
|
|
|
|
### Phase 4 — Wiring
|
|
- `CncMachineFactory` — creates right ICncMachine from InputArgs
|
|
- `InputArgs` — added `manufacturer`, `username`, `password` fields
|
|
- `Program.cs` — full rewrite using ICncMachine; Fanuc 3-file via IFanucMachine cast
|
|
|
|
### Phase 5 — NC Validator
|
|
- `ValidationSeverity` enum (Error/Warning)
|
|
- `ValidationError` — Line, Message, Severity
|
|
- `ValidationResult` — Success + IReadOnlyList<ValidationError>, static Ok()/Fail()
|
|
- `INcProgramValidator` interface
|
|
- `NcProgramValidator` — universal rules (block length ≤80, no lowercase, no tabs, no nested parens, comment ≤32); per-manufacturer name format + forbidden char rules; `#` in Fanuc/Mitsubishi is Warning not Error
|
|
- All 4 machines injected: public constructor creates `NcProgramValidator(manufacturer)`, internal constructor accepts `INcProgramValidator` for testing
|
|
- All 4 machines call validator in `WriteProgramAsync` before upload; fail on any Error-severity violation
|
|
- `NcProgramValidatorTests` — 30+ test cases covering all rules and all manufacturers
|
|
- Existing machine unit tests updated: inject always-ok mock validator to preserve existing behaviour tests
|
|
- Integration tests updated: content+names corrected to pass validation per manufacturer
|
|
- 5 new Compile entries in main csproj + 1 in tests csproj
|
|
|
|
## New CLI args
|
|
- `-manufacturer=fanuc|heidenhain|siemens` (default: fanuc)
|
|
- `-username=` (Heidenhain/Siemens)
|
|
- `-password=` (Heidenhain/Siemens)
|
|
|
|
## Accumulated Context
|
|
|
|
### Decisions
|
|
- .NET 4.7.2 locked — max compatibility
|
|
- Offline-only license check (AES, unchanged)
|
|
- Heidenhain: LSV2 port 19000, needs real hardware testing
|
|
- Siemens: FTP /_N_MPF_DIR/, needs Sinumerik FTP option enabled on machine
|
|
|
|
### Phase 5 — Test project (added post-apply)
|
|
- `FanucProgramManager.Tests/` — NUnit 3.13.3 + Moq 4.18.4, .NET 4.7.2
|
|
- 7 unit test files (14+ tests on `FanucProgram`, `IsoProgramFormatter`, factory, all 4 machines)
|
|
- `FtpServerStub` — in-process TCP FTP (PASV); `Lsv2ServerStub` — in-process LSV2 TCP
|
|
- 3 integration test files — write→read round-trips against local stubs
|
|
- `InternalsVisibleTo("FanucProgramManager.Tests")` added to `AssemblyInfo.cs`
|
|
- Fanuc FOCAS tests that need Windows DLL are `[Ignore]`-d with explanation
|
|
|
|
### Deferred Issues
|
|
- License system: still hardcoded AES key/IV — needs Phase 2.x redesign
|
|
- Heidenhain LSV2: ReadActiveProgramAsync / SelectMainProgram not supported
|
|
- Siemens FTP: ReadActiveProgramAsync / SelectMainProgram not supported
|
|
- Build not verifiable on Linux (fwlib32 is Windows-only DLL)
|
|
|
|
### Blockers/Concerns
|
|
None — code complete, pending hardware testing.
|
|
|
|
## Session Continuity
|
|
|
|
Last session: 2026-05-13
|
|
Stopped at: Phase 5 (NC Validator) applied — all 12 files created/modified
|
|
Next action: Build to verify compilation; run unit tests; /paul:unify when ready
|
|
Resume file: .paul/STATE.md
|
|
|
|
---
|
|
*STATE.md — Updated after every significant action*
|