philips-cnc6600-interpreter/README.md

123 lines
2.7 KiB
Markdown
Raw Normal View History

# Philips CNC6600 NC System Interpreter
## Description
2020-05-08 00:37:29 +02:00
This is an interpreter for programs written for the MAHO MH-C 700.
It basically creates a state-machine that represents the Philips CNC6600 NC system.
## Requirements
- `PHP7.4`
- `composer` ([get it here](https://getcomposer.org/download/))
## Usage
### Installation
```bash
## install dependencies and autoloader
$ composer install
## copy tool configuration data and edit it
$ cp config/tools.yaml.dist config/tools.yaml
$ nano config/tools.yaml
```
### Tool data
Tools are loaded from `config/tools.yaml`.
A tool configuration example would be:
```yaml
# config/tools.yaml
T1:
X: 5500 # radius in 0.001mm
Z: 2500 # length in 0.001mm
T2:
X: 3000
Z: 61379
```
### Programs
The application loads programs from `config/part_programs` and `config/sub_programs`.
The programs are stored in the memory of the machine.
- A file containing a program _may_ have any name (a program is identified by its program number)
- A program _must_ have a program number as the first block
- A program is terminated either by a comment containing 'EOF' (case sensitive) or by a physical EOF
- A comment is denoted by `;`, anything after this character on the same line is ignored
An example of a program would be:
2020-05-08 00:37:29 +02:00
```text
; config/part_programs/some_name
;; Some program that drills two holes
N9045
; and yes, comments are fully supported,
; or rather, detected and ignored by the parser
N10 G18 T2 M6
N20 G1 F1500 S1250
N30 M4
; prepare and execute drill cycle
N40 G81 Y2000 Z-7000 B48000
; the parser also understands this
N50G79X-20000Y0Z-15000
; hell, you may even put multiple blocks on one line:
; N50G0X2N60G1Y20
; though it's good practice to align your program:
N60 G79 X20000 Y0 Z15000
N70 G0 Y150000 ; safely retract
N80 M2 ; turn off spindle, no return
;; EOF
```
2020-05-08 00:37:29 +02:00
Executing program `9045` from the example:
2020-05-08 00:37:29 +02:00
```bash
## execute the example program
$ bin/run_program 9045
## or
$ php bin/run_program 9045
```
- calling a subprogram (`G22 X9...`) is supported
- line repetitions (`E0302`) are _not_ supported yet
- parameter programming is _not_ supported yet
### Machine State
The machine state can be saved to a file to continue later on by using `State\Persister`.
```php
use Machine\CNC6600;
use State\Persister;
$CNC6600 = new CNC6600();
// Do some things with the machine...
// Saving the machine state
$persister = new Persister();
$persister->persist('some_state_identifier', $CNC6600);
// Retrieving the saved state
$CNC6600 = $persister->load('some_state_identifier');
2020-05-08 00:37:29 +02:00
```
## Future
- Tool path simulation
- Manual Data Input (_MDI_) mode
- Proper tool compensation
- Line repetitions
- Parameter programming