Sign inSign up

reactcad/build

By reactcad

•Updated over 3 years ago

The build environment for @react-cad/core

Image
0

1.4K

reactcad/build repository overview

⁠@react-cad/core

Core @react-cad 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 canvas = document.getElementById("my-canvas");

  reactCadCore({ canvas: canvas }).then((core) => {
    const cube = core.createCADNode("box");
    cube.setProps({ x: 2:, y: 2, z: 2 });
    core.getView().addNode(cube);
  });

The JS module must be able to find the WebAssembly file at run time. You can provide a URI with the locateFile option:

  import reactCadCore from "@react-cad/core";
  /* Get URL from webpack file-loader */
  import reactCadCoreWasmUrl from "file-loader!@react-cad/core/lib/react-cad-core.wasm";

  reactCadCore({ locateFile: () => reactCadCoreWasmUrl }).then((core) => {
    // ...
  });

See src/main.cpp for available node types and the relevant shape factory .cpp file for available props.

Tag summary

Content type

Image

Digest

sha256:22237be4d…

Size

768.8 MB

Last updated

over 3 years ago

docker pull reactcad/build