Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const serialize = (...params) => {
let options = {}
let objects
if (params.length === 0) {
throw new Error('no arguments supplied to serialize function !')
} else if (params.length === 1) {
// assumed to be object(s)
objects = Array.isArray(params[0]) ? params[0] : params
} else if (params.length > 1) {
options = params[0]
objects = params[1]
}
// make sure we always deal with arrays of objects as inputs
objects = toArray(objects)
console.log('params', params)
console.log('options', options)
console.log('objects', objects)
const defaults = {
statusCallback: null,
unit: 'mm', // em | ex | px | in | cm | mm | pt | pc
decimals: 10000
}
options = Object.assign({}, defaults, options)
options.statusCallback && options.statusCallback({progress: 0})
// get the lower and upper bounds of ALL convertable objects
var bounds = getBounds(objects)
var width = 0
const serialize = (...params) => {
let options = {}
let objects
if (params.length === 0) {
throw new Error('no arguments supplied to serialize function !')
} else if (params.length === 1) {
// assumed to be object(s)
objects = Array.isArray(params[0]) ? params[0] : params
} else if (params.length > 1) {
options = params[0]
objects = params[1]
}
// make sure we always deal with arrays of objects as inputs
objects = toArray(objects)
const defaults = {
statusCallback: null,
unit: 'millimeter', // millimeter, inch, feet, meter or micrometer
color: [0, 0, 1, 1.0], // default colorRGBA specification
decimals: 1000
}
options = Object.assign({}, defaults, options)
options.statusCallback && options.statusCallback({progress: 0})
// construct the contents of the XML
var body = ['X3D',
{
profile: 'Interchange',
version: '3.3',
const serialize = (...params) => {
let options = {}
let objects
if (params.length === 0) {
throw new Error('no arguments supplied to serialize function !')
} else if (params.length === 1) {
// assumed to be object(s)
objects = Array.isArray(params[0]) ? params[0] : params
} else if (params.length > 1) {
options = params[0]
objects = params[1]
}
// make sure we always deal with arrays of objects as inputs
objects = toArray(objects)
const defaults = {
cagTo: 'lwpolyline', // or polyline
csgTo: '3dface', // or polyline
pathTo: 'lwpolyline',
statusCallback: null
}
options = Object.assign({}, defaults, options)
let dxfContent = `999
DXF generated by JSCAD
${dxfHeaders(options)}
${dxfClasses(options)}
${dxfTables(options)}
${dxfBlocks(options)}
${dxfEntities(objects, options)}
const serialize = (...params) => {
let options = {}
let objects
if (params.length === 0) {
throw new Error('no arguments supplied to serialize function !')
} else if (params.length === 1) {
// assumed to be object(s)
objects = Array.isArray(params[0]) ? params[0] : params
} else if (params.length > 1) {
options = params[0]
objects = params[1]
}
// make sure we always deal with arrays of objects as inputs
objects = toArray(objects)
const defaults = {
binary: true,
statusCallback: null
}
options = Object.assign({}, defaults, options)
// only use valid CSG objects
let csgs = []
objects.forEach(function (object, i) {
if (isCSG(object) & object.polygons.length > 0) {
csgs.push(ensureManifoldness(object))
}
})
return options.binary ? serializeBinary(csgs, options) : serializeText(csgs, options)
}
const serialize = (...params) => {
let options = {}
let objects
if (params.length === 0) {
throw new Error('no arguments supplied to serialize function !')
} else if (params.length === 1) {
// assumed to be object(s)
objects = Array.isArray(params[0]) ? params[0] : params
} else if (params.length > 1) {
options = params[0]
objects = params[1]
}
// make sure we always deal with arrays of objects as inputs
objects = toArray(objects)
const defaults = {
statusCallback: null,
unit: 'millimeter', // millimeter, inch, feet, meter or micrometer
metadata: null
}
options = Object.assign({}, defaults, options)
options.statusCallback && options.statusCallback({progress: 0})
// construct the contents of the XML
var body = ['amf',
{
unit: options.unit,
version: '1.1'
},
const dxfEntities = (objects, options) => {
objects = toArray(objects)
let entityContents = objects.map(function (object, i) {
if (isCAG(object)) {
let paths = object.getOutlinePaths()
if (options.cagTo === 'polyline') {
return PathsToPolyine(paths, options)
}
return PathsToLwpolyine(paths, options)
}
if (isCSG(object)) {
object = ensureManifoldness(object)
if (options.csgTo === 'polyline') {
return PolygonsToPolyline(object, options)
}
return PolygonsTo3DFaces(object, options)
}
if (isPath(object)) {