Giter Club home page Giter Club logo

cura-wasm-definitions's Introduction

Cura WASM Definitions

npm FOSSA Status

3D printer definitions for Cura WASM

Usage

import CuraWASM from 'cura-wasm';
import ResolveDefinition from 'cura-wasm-definitions';

const main = async () =>
{
  //Create a new slicer
  const slicer = new CuraWASM({
    /*
     * The 3D printer definition to slice for (See the src/definitions directory
     * or https://github.com/Ultimaker/Cura/tree/master/resources/definitions
     * for a list of built-in definitions)
     */
    definition: ResolveDefinition('ultimaker2'),
  });

  //Load your STL as an ArrayBuffer
  const res = await fetch('/demo/benchy.stl');
  const stl = await res.arrayBuffer();

  //Progress logger (Ranges from 0 to 100)
  slicer.on('progress', percent =>
  {
    console.log(`Progress: ${percent}%`);
  });

  //Slice (This can take multiple minutes to resolve!)
  const gcode = await slicer.slice(stl, 'stl');

  //Do something with the GCODE (ArrayBuffer)

  //Dispose (Reccomended but not necessary to call/intended for SPAs)
  slicer.dispose();
}
main();

How it works

When you call the default-exported function (ResolveDefinition in the above example), the function examines what printer definitions the requested definition depends on (eg: ultimaker2 depends on ultimaker which depends on fdmprinter which depends on fdmextruder). The function then recurs upon those parent definitions. There's also some logic for not resolving fdmextruder and fdmprinter definitions because these are bundled in Cura WASM itself (Because most printer definitions depend on them). Once it has walked the dependency hierarchy, the function squashes them together using Lodash's merge function and returns one combined definition.

What's the license?

Cura WASM Definitions relies on Cura (The upstream for 3D printer definitions) which which uses LGPL3+ hence the LGPL3+ license requirement. With that said, the LGPL3+ license only applies to tests/index.ts and all files in the src/definitions directory (Excluding src/definitions/index.ts). All other files use the MIT license.

FOSSA Status

cura-wasm-definitions's People

Contributors

fossabot avatar wakeful-cloud avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.