How to use the @jscad/io.stlSerializer.serialize function in @jscad/io

To help you get started, we’ve selected a few @jscad/io examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jscad / OpenJSCAD.org / packages / core / io / prepareOutput.js View on Github external
      serialize: data => stlSerializer.serialize(data, {binary: false})
    }, // CSG to STL ASCII
github jscad / OpenJSCAD.org / packages / core / io / prepareOutput.js View on Github external
      serialize: (options, data) => stlSerializer.serialize(Object.assign({}, { binary: false }, options), data)
    }, // Geom3 to STL ASCII
github jscad / jscad-desktop / src / core / io / prepareOutput.js View on Github external
      serialize: data => stlSerializer.serialize(data, {binary: false})
    }, // CSG to STL ASCII
github szymonkaliski / modeler / packages / modeler-cli / to-stl.js View on Github external
const compiled = requireString(code.toString(), modelFile);
      const element = compiled();
      const firstChild = element.props.children;

      const root = CSGRenderer.createContainer(createElement("ROOT"));
      CSGRenderer.updateContainer(firstChild, root, null);
      const model = CSGRenderer.getPublicRootInstance(root);

      const MM = 10;

      const finalModel = model.csg
        .transform(CSG.Matrix4x4.rotationX(90))
        .transform(CSG.Matrix4x4.scaling([MM, MM, MM]))
        .fixTJunctions();

      const rawData = stlSerializer.serialize(finalModel, { binary: false });

      fs.writeFileSync(outFile, rawData.join());
    });