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

opencascade-convert

v0.2.0

Published

STEP/IGES to glTF/GLB/OBJ converter built on opencascade.js

Readme

opencascade-convert

Docs CI codecov

Browser-first STEP/IGES to glTF/GLB/OBJ conversion on top of opencascade.js. Includes assembly metadata extraction and reusable glTF utilities.

What it does

  • Convert STEP/IGES files in the browser to glTF/GLB/OBJ.
  • Extract assembly metadata (BOM + node map) for mapping CAD parts to glTF nodes.
  • Provide small glTF utilities for stats, name cleanup, and GLB patching.
  • Offer triangulation controls and retry-based safeguards to prevent mesh “triangle explosions.”
  • Expose mesh stats so you can balance fidelity and performance for Three.js exports.

Demo

Install

npm install opencascade-convert

This package pins a specific opencascade.js build. Do not override it unless you revalidate conversions, because OCCT behavior (names, triangulation, metadata) can vary between builds.

When bundling for the browser, make sure your bundler can load opencascade.js .wasm assets (see ocjs.org for bundler guides).

Quick start (simple)

Use the high-level helper when you want a single call that returns GLB + metadata.

import { createConverter, convertCadBufferToGlbWithMetadata } from 'opencascade-convert/browser';

const converter = await createConverter();

const { glb, metadata, patchedGlb } = convertCadBufferToGlbWithMetadata(
  converter,
  new Uint8Array(fileBytes),
  {
    inputFormat: 'step',
    schemaVersion: 'my-app@1',
    embedMetadataKey: 'myApp',
    validateNodeMap: true,
    validateMesh: true,
  }
);

Advanced example (manual control)

Use the lower-level API when you need custom triangulation attempts, thresholds, or unit overrides.

import {
  createConverter,
  convertDocumentToGlbWithRetries,
  TRIANGLE_EXPLOSION_THRESHOLDS,
} from 'opencascade-convert/browser';

const converter = await createConverter();
const docHandle = converter.readBuffer(new Uint8Array(fileBytes), 'step', {
  preserveNames: true,
  preserveColors: true,
  preserveLayers: true,
  preserveMaterials: true,
});

const { glb, meshStats, conversionWarnings } = convertDocumentToGlbWithRetries(
  converter,
  docHandle,
  {
    triangulate: {
      linearDeflection: 0.5,
      angularDeflection: 0.35,
      parallel: true,
    },
    attempts: 4,
    triangleExplosionThresholds: {
      ...TRIANGLE_EXPLOSION_THRESHOLDS,
      MAX_TRIANGLES: 2_000_000,
    },
  }
);

API

Main entry: opencascade-convert/browser

Converter instance:

  • createConverter()
  • converter.readBuffer(input, format, options)
  • converter.triangulate(doc, options)
  • converter.writeBuffer(docHandle, format, options)
  • converter.createMetadataFromGlb(docHandle, options)

High-level helpers:

  • convertDocumentToGlbWithRetries(converter, docHandle, options)
  • convertCadBufferToGlbWithMetadata(converter, input, options)

Full API reference:

  • https://ilkeozi.github.io/opencascade-convert/

Assembly metadata

There are two schema families:

  • Raw schemas from createNodeMap and createBom.
  • Mapped schemas inside convertCadBufferToGlbWithMetadata().metadata, which add glTF indices.

createNodeMap and createBom provide stable IDs you can map to glTF nodes.

Example nodeMap:

{
  "roots": ["0:1"],
  "nodes": {
    "0:1": {
      "id": "0:1",
      "labelEntry": "0:1",
      "name": "Gear Box",
      "kind": "assembly",
      "productId": "0:1",
      "productName": "Gear Box",
      "parentId": null,
      "children": ["0:1/0:1:2"],
      "path": ["0:1"],
      "physical": {
        "surfaceArea": null,
        "volume": null
      }
    }
  }
}

Example bom:

{
  "roots": ["0:1"],
  "items": [
    {
      "productId": "0:1:2",
      "productName": "Flat Washer",
      "kind": "part",
      "quantity": 4,
      "physical": {
        "surfaceArea": 0.0125,
        "volume": 0.000001
      },
      "instances": [
        {
          "nodeId": "0:1/0:1:2:1",
          "instanceId": "0:1:2:1",
          "name": "Flat Washer",
          "path": ["0:1", "0:1:2:1"]
        }
      ]
    }
  ]
}

Example mappedNodeMap (from metadata.nodeMap):

{
  "roots": ["0:1"],
  "nodes": {
    "0:1": {
      "id": "0:1",
      "name": "Gear Box",
      "productId": "0:1",
      "parentId": null,
      "childrenIds": ["0:1/0:1:2"],
      "gltfNodeIndex": 0,
      "gltfMeshIndex": 0,
      "physical": {
        "surfaceArea": null,
        "volume": null
      }
    }
  }
}

Example bomSummary (from metadata.bom):

[
  {
    "name": "Flat Washer",
    "quantity": 4,
    "productId": "0:1:2",
    "kind": "part",
    "physical": {
      "surfaceArea": 0.0125,
      "volume": 0.000001
    }
  }
]

Example metadata (from convertCadBufferToGlbWithMetadata):

{
  "schemaVersion": "my-app@1",
  "meshStats": {
    "triangles": 12,
    "meshCount": 1,
    "nodeCount": 1,
    "primitiveCount": 1,
    "nodesWithMeshCount": 1,
    "primitivesWithPositionCount": 1
  },
  "conversionWarnings": [],
  "assemblyTree": [
    {
      "id": "0:1",
      "name": "Gear Box",
      "children": []
    }
  ],
  "nodeMap": {
    "roots": ["0:1"],
    "nodes": {
      "0:1": {
        "id": "0:1",
        "name": "Gear Box",
        "productId": "0:1",
        "parentId": null,
        "childrenIds": [],
        "gltfNodeIndex": 0,
        "gltfMeshIndex": 0,
        "physical": {
          "surfaceArea": null,
          "volume": null
        }
      }
    }
  },
  "bom": [
    {
      "name": "Gear Box",
      "quantity": 1,
      "productId": "0:1",
      "kind": "assembly",
      "physical": {
        "surfaceArea": null,
        "volume": null
      }
    }
  ],
  "units": {
    "inputLengthUnit": "mm",
    "inputUnitSource": "override",
    "outputLengthUnit": "m",
    "scaleToMeters": 0.001
  },
  "boundsMeters": {
    "min": [0, 0, 0],
    "max": [1, 1, 1]
  }
}

Notes

  • Names may fall back to OCCT instance IDs (e.g. NAUO###) when the source file lacks product names.
  • For better names, export AP242 (or enable product/part names) in your CAD tool.
  • Large assemblies can take time and memory during triangulation.

Docs

Hosted API docs:

Generate locally:

npm run docs:api

Build

npm run build

Tests

npm run test:unit
npm run test:integration

Coverage:

npm run test:coverage