npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@gcode-viewer/core

v0.3.2

Published

WebGL 3D print preview engine on Three.js — view/scrub slicer GCode toolpaths in the browser, plus STL, OBJ, glTF/GLB, FBX and other common print-industry formats.

Readme

@gcode-viewer/core

npm version npm downloads License

WebGL 3D print preview engine built on Three.js. Preview slicer GCode toolpaths in the browser (GCodeViewer), plus a CAD / mesh viewer (Viewer3d) for common print-industry formats such as STL, OBJ, and glTF — no server required for local files.

Reference app: https://gcode.thingraph.site/ (Vue app in gcode-viewer-web, built on this package plus @gcode-viewer/plugins and @gcode-viewer/ui).

Built with @gcode-viewer/core

| Application | Description | |---|---| | gcode.thingraph.site | Thingraph GCode Viewer — GCode preview and CAD Viewer pages |

Supported formats

GCodeViewergcode, gco, nc

Viewer3dgltf, glb, obj, fbx, stl, ply, dae, 3dm, stp/step, igs/iges (STEP / IGES via @gcode-viewer/plugins loaders)

Features

  • GCode preview — client-side parse/render of slicer toolpaths; layer / step scrubbing, legend, and text panel via plugins
  • CAD / 3D — orbit, load common mesh formats; measure, section, screenshot, tree view, settings via plugins
  • Local-first — files stay in the browser for viewing (optional URL load needs CORS)
  • Modular — engine in core; chrome and loaders in plugins / ui
  • TypeScript — full type definitions

Installation

pnpm add @gcode-viewer/core @gcode-viewer/plugins
# or
npm install @gcode-viewer/core @gcode-viewer/plugins

Quick Start

GCodeViewer

import { GCodeViewer } from "@gcode-viewer/core";
import { GCodeLegendPlugin, GCodeLayerBarPlugin } from "@gcode-viewer/plugins";

const viewer = new GCodeViewer({ containerId: "myCanvas" });
new GCodeLayerBarPlugin(viewer);
new GCodeLegendPlugin(viewer);
await viewer.loadModel({ modelId: "print", src: "path/to/model.gcode" });

Viewer3d

import { Viewer3d } from "@gcode-viewer/core";

const viewer = new Viewer3d({ containerId: "myCanvas" });
await viewer.loadModel({ modelId: "model", src: "path/to/model.stl" });

API Examples

Loading with Progress

await viewer.loadModel(
    { modelId: "m1", src: "./models/part.gcode" },
    (event) => {
        const pct = (event.loaded / event.total) * 100;
        console.log(`${pct.toFixed(0)}%`);
    }
);

Camera Control

import { CameraProjection, THREE } from "@gcode-viewer/core";

viewer.cameraManager.setProjection(CameraProjection.Perspective);
viewer.cameraManager.flyToViewpoint({
    eye: new THREE.Vector3(100, 50, 100),
    look: new THREE.Vector3(0, 0, 0),
});
viewer.zoomToBBox(new THREE.Box3(min, max));

Using Three.js

Import Three.js from this package to avoid version conflicts:

import { THREE, THREEAddons } from "@gcode-viewer/core";

const vector = new THREE.Vector3(0, 0, 0);
viewer.zoomToBBox(new THREE.Box3(min, max));

Coordinate System & Units

  • Coordinate system: Right-handed, Z-up (slicer / CAD; Three.js default is Y-up)
    • +X: right | -X: left
    • +Y: back (into the screen) | -Y: front
    • +Z: up | -Z: down
    • GCode, STL, and OBJ are imported as-is. glTF / FBX / DAE / PLY (Y-up) are rotated +90° around X on import.
  • Length: Millimeter | Area: mm² | Angle: Degrees, CCW | Time: Milliseconds

Related Packages

| Package | Description | |---------|-------------| | @gcode-viewer/plugins | Layer / steps bars, legend, text panel, toolbar, measure, screenshot, … | | @gcode-viewer/ui | Shared panels and widgets |

Links

License

UNLICENSED — contact [email protected] for licensing inquiries.