项目作者: Cloud-CNC

项目描述 :
3D printer definitions for Cura WASM
高级语言: TypeScript
项目地址: git://github.com/Cloud-CNC/cura-wasm-definitions.git
创建时间: 2020-11-25T00:45:18Z
项目社区:https://github.com/Cloud-CNC/cura-wasm-definitions

开源协议:Other

下载


Cura WASM Definitions

npm
tests
last commit
FOSSA Status

3D printer definitions for Cura WASM

Install

  1. npm i cura-wasm-definitions

Usage

  1. import {CuraWASM} from 'cura-wasm';
  2. import {resolveDefinition} from 'cura-wasm-definitions';
  3. const main = async () =>
  4. {
  5. //Create a new slicer
  6. const slicer = new CuraWASM({
  7. /*
  8. * The 3D printer definition to slice for (See the src/definitions directory
  9. * or https://github.com/Ultimaker/Cura/tree/master/resources/definitions
  10. * for a list of built-in definitions)
  11. */
  12. definition: resolveDefinition('ultimaker2'),
  13. });
  14. //Load your STL as an ArrayBuffer
  15. const res = await fetch('/demo/benchy.stl');
  16. const stl = await res.arrayBuffer();
  17. //Progress logger (Ranges from 0 to 100)
  18. slicer.on('progress', percent =>
  19. {
  20. console.log(`Progress: ${percent}%`);
  21. });
  22. //Slice (This can take multiple minutes to resolve!)
  23. const gcode = await slicer.slice(stl, 'stl');
  24. //Do something with the GCODE (ArrayBuffer)
  25. //Dispose (Reccomended but not necessary to call/intended for SPAs)
  26. slicer.dispose();
  27. }
  28. main();

How it works

When you call the default-exported function (ResolveDefinition in the above example), the function examines what printer definitions the requested printer definition depends on (eg: ultimaker2 depends on ultimaker which depends on fdmprinter which depends on fdmextruder). The function then recurs upon those parent printer 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. The function also performs a similar process on extruder definitions. Finally, the function combines both the extruder and printer definitions 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.

License Obligations

Upstream Modifications

None - all definitions are used verbatim.

Source

The source is located at github.com/ultimaker/cura.

FOSSA Status