Capítulo 168 de 859

Chapter 168: GCodeLoader

Core Idea

A loader for the GCode format.

GCode files are usually used for 3D printing or CNC applications.

Key Concepts

  • splitLayer : boolean: Whether to split layers or not.

Code Examples

const loader = new GCodeLoader();
const object = await loader.loadAsync( 'models/gcode/benchy.gcode' );
scene.add( object );
  • What it demonstrates: Typical usage of GCodeLoader.

Reference Tables

Constructor

Signature
new GCodeLoader( manager : LoadingManager )

Properties

PropertyDescription
.splitLayer : booleanWhether to split layers or not.

Methods

MethodDescription
.load( url : string, onLoad : function, onProgress : onProgressCallback, onError : onErrorCallback )Starts loading from the given URL and passes the loaded GCode asset to the onLoad() callback.
.parse( data : string ) : GroupParses the given GCode data and returns a group with lines.

Key Takeaways

  1. GCodeLoader extends: Loader
  2. Most relevant properties: splitLayer.
  3. Key methods: load, parse.

Connects To