Creates a new GCodePreview instance
Configuration options for the preview
Job containing parsed G-code data
OptionalonCalled whenever parsed commands have been folded into the job.
OptionalonCalled once a streamed G-code file has been read to the end.
Gets the total number of layers in the job
Number of layers
The G-code parser instance
The WebGL sceneManager instance for direct access to rendering properties
Clears the preview and resets the parser, sceneManager, gui and job
Disposes of all resources and cleans up
Executes already-parsed commands into the current job, without rendering.
Parsed G-code commands (e.g. from parser.parseGCode(...).commands)
Feeds the commands to the interpreter, which folds the resulting paths and
state changes into job, then fires onJobUpdated. Nothing is
drawn: call sceneManager.render() (or a processGCode variant) to see the
result.
Safe to call repeatedly: each call resumes the job's in-progress path before executing and finishes it after, so commands delivered across many calls accumulate into the job exactly as one big call would. This is how the streaming path executes each chunk, and it lets external tools (such as debuggers) step through a file command by command.
Processes G-code and renders the preview
G-code string or array of lines
Promise that resolves when the animated render has completed
Processes G-code using the sceneManager's built-in streaming method
G-code string or array of strings to process
Options for rendering: { render: boolean }
Main G-code preview class that orchestrates rendering and parsing
Example