jscad / io

DEPRECATED : Input Output handling for JSCAD (see the link below)
https://github.com/jscad/OpenJSCAD.org/tree/V2/packages
34 stars 13 forks source link

STL serializer not working #93

Closed RedHatter closed 4 years ago

RedHatter commented 4 years ago

I'm trying to use the stl-serializer package but the follow code isn't working. (all packages are v2 branches)

const { serialize } = require('@jscad/stl-serializer')
const { primitives: { cube } } = require('@jscad/csg')

const c1 = cube({center: [5, 5, 5], size: 5})
console.log(serialize(c1))

I get the following error

/home/timothy/Projects/crosscad/node_modules/@jscad/stl-serializer/CSGToStlb.js:58
        triangleFloat32array[0] = normal._x
                                         ^

TypeError: Cannot read property '_x' of undefined
    at /home/timothy/Projects/crosscad/node_modules/@jscad/stl-serializer/CSGToStlb.js:58:42
    at Array.forEach (<anonymous>)
    at /home/timothy/Projects/crosscad/node_modules/@jscad/stl-serializer/CSGToStlb.js:54:21
    at Array.forEach (<anonymous>)
    at serializeBinary (/home/timothy/Projects/crosscad/node_modules/@jscad/stl-serializer/CSGToStlb.js:53:11)
    at serialize (/home/timothy/Projects/crosscad/node_modules/@jscad/stl-serializer/index.js:56:27)
    at Object.<anonymous> (/home/timothy/Projects/crosscad/src/index.js:5:13)
    at Module._compile (internal/modules/cjs/loader.js:1151:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1171:10)
    at Module.load (internal/modules/cjs/loader.js:1000:32)
z3dev commented 4 years ago

@RedHatter thanks for using JSCAD.

Sorry, but the V2 IO modules / packages have been integrated into OpenJSCAD.org, under packages/io directory.

We have NOT published the V2 packages yet, so you will have to become a early adopter. There are some notes here: https://openjscad.org/dokuwiki/doku.php?id=early_v2

If you need some help to use packages from OpenJSCAD.org then please let us know.

RedHatter commented 4 years ago

Thank you.

Should probably add a note to the top of the README pointing to the OpenJSCAD.org repo