@react-cad/core
TypeScript icon, indicating that this package has built-in type declarations

0.23.0 • Public • Published

@react-cad/core

Core ReactCAD WebAssembly library, providing primitives for constructing the shape tree and a viewer to render shape trees into an HTML canvas.

The viewer code is derived from the Open CASCADE WebGL Sample application.

Usage

  import reactCadCore from "@react-cad/core";

  const core = await reactCadCore();
  const cube = core.createCADNode("box");
  cube.setSize([2, 2, 2]);

  core.renderSTEP(cube).then(contents => fs.writeFileSync("cube.step", contents));;

Use on the web requires more complex loading. See @react-cad/storybook-framework for a webpack example. One you have the core object:

  const cube = core.createCADNode("box");
  cube.setSize([2, 2, 2]);

  const canvas = document.getElementById("my-canvas");
  const view = core.createView(canvas);

  core.renderNodeAsync(cube, view);

See src/react-cad-core.d.ts for the TypeScript API.

Dependents (4)

Package Sidebar

Install

npm i @react-cad/core

Weekly Downloads

5

Version

0.23.0

License

LGPL-2.1-only

Unpacked Size

27.2 MB

Total Files

14

Last publish

Collaborators

  • react.cad.dev
  • react.cad.bot