File: GCodeLoader.md | Updated: 11/15/2025
A loader for the GCode format.
GCode files are usually used for 3D printing or CNC applications.
const loader = new GCodeLoader();
const object = await loader.loadAsync( 'models/gcode/benchy.gcode' );
scene.add( object );
GCodeLoader is an addon, and must be imported explicitly, see Installation#Addons.
import { GCodeLoader } from 'three/addons/loaders/GCodeLoader.js';
Constructs a new GCode loader.
manager | The loading manager.
---|---
Whether to split layers or not.
Default is false.
Starts loading from the given URL and passes the loaded GCode asset to the onLoad() callback.
url | The path/URL of the file to be loaded. This can also be a data URI.
---|---
onLoad | Executed when the loading process has been finished.
onProgress | Executed while the loading is in progress.
onError | Executed when errors occur.
Overrides: Loader#load
Parses the given GCode data and returns a group with lines.
data | The raw Gcode data as a string.
---|---
Overrides: Loader#parse
Returns: The parsed GCode asset.