gcode-preview
gcode-preview copied to clipboard
Feature/multi color
This implements multi-color previews for 3D printers that can switch filaments / tools via T0,T1,..Tx. (see T0-T7 gcode command info)
Systems that should be supported this way include:
- Prusa MMU1/2/3 & XL
- Bambulabs AMS and AMS Lite
- 3D Chameleon
- Enraged Rabbit Carrot Feeder (ERCF)
- IDEX systems
- Tool change systems
- Color mixing nozzles when used with a 'virtual tool' (M164 - Save Mix)
Systems that are not supported include:
- Mosaic Palette series (I think the way it works is: gcode is transformed using their own tool Chroma and this is interpreted by the Palette).
- Color mixing w/o saving as a virtual tool
- Color gradients - color mixes that change their ratio over time
- Manual filament swap (this relies on the use of gcode M600)
It implements #122
TODO:
- [x] support T0-T3
- [x] support T4-T7
- [ ] decide on API
- [x] add to demo
- [x] decide the gcode processing state handling
- [ ] add unit tests
API : the extrusionColor is allowed to be a Color or an object (Record<number, ColorRepresentation>)
this.extrusionColor = {
0: new Color(0xff8000),
1: 'red',
2: 'rgb(255,255,0)',
3: 'fff'
};
Run & review this pull request in StackBlitz Codeflow.