Skip to content

GCodeLoader marks relative travel moves as extrusion #34876

Closed

Description

@6639835

Description

After G91, a movement with no E parameter is put in the extruded geometry if a previous move advanced the extruder. The two-line example below produces four extruded vertices and no path vertices. The second move should be travel.

delta(state.e, line.e) returns the accumulated E position in relative mode, rather than the extrusion change. The same check misclassifies a retract with G91 plus M82 when the absolute E value remains positive.

This is different from the absolute-position travel timing issue in #22469. Reproduced offline with the current dev loader and official core build, Node 26.10.0.

Reproduction steps

Run the code below and compare its output with the expected result. No renderer or external asset is needed.

Code

import { GCodeLoader } from 'three/addons/loaders/GCodeLoader.js';
const object = new GCodeLoader().parse('G91\nG1 X1 E1\nG1 X1');
console.log(object.children.map(o => [o.material.name, o.geometry.attributes.position.count]));
// Actual: [['extruded', 4], ['path', 0]]
// Expected: [['extruded', 2], ['path', 2]]

Live example

No hosted live example. The code above is a self-contained offline parser reproduction.

Screenshots

No response

Version

dev / 0.186.0; Node 26.10.0

Device

No response

Browser

No response

OS

No response

Activity

  1. cmhhelgeson commented on Oct 8, 2026

    @cmhhelgeson
    Contributor

    For some reason the AIs just love the loaders.

  2. added this to the r187 milestone on Oct 8, 2026
  3. mrdoob commented on Oct 8, 2026

    @mrdoob
    Owner

    I mean... Loaders are very useful tools for the AI 🙃

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions