How to use the @jscad/io.stlSerializer.mimeType 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 / jscad-desktop / src / core / io / prepareOutput.js View on Github external
} else {
    const formatInfo = formats[format]
    object = convertToSolid2(objects, formatInfo)
  }

  const metaData = {
    producer: 'OpenJSCAD.org ' + version,
    date: new Date(),
    version
  }

  const outputFormatHandlers = {
    amf: amfSerializer, // CSG to AMF
    stl: stlSerializer, // CSG to STL ASCII // NOTE: now using binary output by default !!
    stla: {
      mimeType: stlSerializer.mimeType,
      serialize: data => stlSerializer.serialize(data, {binary: false})
    }, // CSG to STL ASCII
    stlb: stlSerializer, // CSG to STL BINARY
    dxf: dxfSerializer, // CAG to DXF
    svg: svgSerializer, // CAG to SVG
    x3d: x3dSerializer, // CSG to X3D
    json: jsonSerializer, // CSG or CAG to JSON
    js: {
      mimeType: formats['js'].mimetype,
      serialize: object => [object] // js , pass through
    },
    jscad: {
      mimeType: formats['jscad'].mimetype,
      serialize: object => [object] // jscad , pass through
    },
    undefined: () => {
github jscad / OpenJSCAD.org / packages / core / io / prepareOutput.js View on Github external
format: undefined,
    version: '0.0.0'
  }
  const { format, version } = Object.assign({}, defaults, params)

  const metaData = {
    producer: 'OpenJSCAD.org ' + version,
    date: new Date(),
    version
  }

  const outputFormatHandlers = {
    amf: amfSerializer, // Geom3 to AMF
    stl: stlSerializer, // Geom3 to STL ASCII // NOTE: now using binary output by default !!
    stla: {
      mimeType: stlSerializer.mimeType,
      serialize: (options, data) => stlSerializer.serialize(Object.assign({}, { binary: false }, options), data)
    }, // Geom3 to STL ASCII
    stlb: stlSerializer, // Geom3 to STL BINARY
    dxf: dxfSerializer, // Geom2 to DXF
    svg: svgSerializer, // Geom2 to SVG
    x3d: x3dSerializer, // Geom3 to X3D
    json: jsonSerializer, // Geom3 or Geom2 to JSON
    js: {
      mimeType: formats['js'].mimetype,
      serialize: (options, objects) => toArray(objects) // js , pass through
    },
    jscad: {
      mimeType: formats['jscad'].mimetype,
      serialize: (options, objects) => toArray(objects) // jscad , pass through
    },
    undefined: () => {
github jscad / OpenJSCAD.org / packages / core / io / prepareOutput.js View on Github external
} else {
    const formatInfo = formats[format]
    object = mergeSolids2(objects, formatInfo)
  }

  const metaData = {
    producer: 'OpenJSCAD.org ' + version,
    date: new Date(),
    version
  }

  const outputFormatHandlers = {
    amf: amfSerializer, // CSG to AMF
    stl: stlSerializer, // CSG to STL ASCII // NOTE: now using binary output by default !!
    stla: {
      mimeType: stlSerializer.mimeType,
      serialize: data => stlSerializer.serialize(data, {binary: false})
    }, // CSG to STL ASCII
    stlb: stlSerializer, // CSG to STL BINARY
    dxf: dxfSerializer, // CAG to DXF
    svg: svgSerializer, // CAG to SVG
    x3d: x3dSerializer, // CSG to X3D
    json: jsonSerializer, // CSG or CAG to JSON
    js: {
      mimeType: formats['js'].mimetype,
      serialize: object => [object] // js , pass through
    },
    jscad: {
      mimeType: formats['jscad'].mimetype,
      serialize: object => [object] // jscad , pass through
    },
    undefined: () => {