@bitbybit-dev/jscad
Version:
Bit By Bit Developers JSCAD based CAD Library to Program Geometry
3,839 lines (3,795 loc) • 1.28 MB
JavaScript
let CSG;
(function () { function r(e, n, t) { function o(i, f) { if (!n[i]) {
if (!e[i]) {
var c = "function" == typeof require && require;
if (!f && c)
return c(i, !0);
if (u)
return u(i, !0);
var a = new Error("Cannot find module '" + i + "'");
throw a.code = "MODULE_NOT_FOUND", a;
}
var p = n[i] = { exports: {} };
e[i][0].call(p.exports, function (r) { var n = e[i][1][r]; return o(n || r); }, p, p.exports, r, e, n, t);
} return n[i].exports; } for (var u = "function" == typeof require && require, i = 0; i < t.length; i++)
o(t[i]); return o; } return r; })()({ 1: [function (require, module, exports) {
CSG = require('./node_modules/@jscad/modeling/src/index.js');
CSG.IOUTILS = require('./node_modules/@jscad/io-utils/index.js');
CSG.STLSERIALIZER = require('./node_modules/@jscad/stl-serializer/index.js');
CSG.DXFSERIALIZER = require('./node_modules/@jscad/dxf-serializer/index.js');
CSG.THREEMFSERIALIZER = require('./node_modules/@jscad/3mf-serializer/src/index.js');
}, { "./node_modules/@jscad/3mf-serializer/src/index.js": 2, "./node_modules/@jscad/dxf-serializer/index.js": 13, "./node_modules/@jscad/io-utils/index.js": 418, "./node_modules/@jscad/modeling/src/index.js": 511, "./node_modules/@jscad/stl-serializer/index.js": 826 }], 2: [function (require, module, exports) {
/*
JSCAD Object to 3MF (XML) Format Serialization
## License
Copyright (c) 2022 JSCAD Organization https://github.com/jscad
All code released under MIT license
Notes:
1) geom2 conversion to:
none
2) geom3 conversion to:
mesh
3) path2 conversion to:
none
*/
/**
* Serializer of JSCAD geometries to 3D manufacturing format (XML)
*
* The serialization of the following geometries are possible.
* - serialization of 3D geometry (geom3) to 3MF object (a unique mesh containing both vertices and triangles)
*
* Colors are added to base materials when found on the 3D geometry, i.e. attribute color.
* Names are added to meshs when found on the 3D geometry, i.e. attribute name.
*
* @module io/3mf-serializer
* @example
* const { serializer, mimeType } = require('@jscad/3mf-serializer')
*/
const zipSync = require('fflate').zipSync;
const strToU8 = require('fflate').strToU8;
const stringify = require('onml/lib/stringify');
const { colors, geometries, modifiers } = require('@jscad/modeling');
const { flatten, toArray } = require('@jscad/array-utils');
const mimeType = 'model/3mf';
const fileExtension = '3mf';
/**
* Serialize the give objects to 3MF contents (XML) or 3MF packaging (OPC).
* @see https://3mf.io/specification/
* @param {Object} [options] - options for serialization
* @param {String} [options.unit='millimeter'] - unit of design; millimeter, inch, feet, meter or micrometer
* @param {Boolean} [options.metadata=true] - add metadata to 3MF contents, such at CreationDate
* @param {Array} [options.defaultcolor=[0,0,0,1]] - default color for objects
* @param {Boolean} [options.compress=true] - package and compress the contents
* @param {Object|Array} objects - objects to serialize into 3D manufacturing format
* @returns {Array} serialized contents, 3MF contents (XML) or 3MF packaging (ZIP)
* @example
* const geometry = primitives.cube()
* const package = serializer({unit: 'meter'}, geometry) // 3MF package, ZIP format
*/
const serialize = (options, ...objects) => {
const defaults = {
unit: 'millimeter',
metadata: true,
defaultcolor: [255 / 255, 160 / 255, 0, 1],
compress: true
};
options = Object.assign({}, defaults, options);
objects = flatten(objects);
// convert only 3D geometries
let objects3d = objects.filter((object) => geometries.geom3.isA(object));
if (objects3d.length === 0)
throw new Error('only 3D geometries can be serialized to 3MF');
if (objects.length !== objects3d.length)
console.warn('some objects could not be serialized to 3MF');
// convert to triangles
objects = toArray(modifiers.generalize({ snap: true, triangulate: true }, objects3d));
// construct the contents of the 3MF 'model'
const body = ['model',
{
unit: options.unit,
'xml:lang': 'und'
},
['metadata', { name: 'Application' }, 'JSCAD']
];
if (options.metadata) {
body.push(['metadata', { name: 'CreationDate' }, new Date().toISOString()]);
}
body.push(translateResources(objects, options));
body.push(translateBuild(objects, options));
// convert the contents to 3MF (XML) format
const xml = `<?xml version="1.0" encoding="UTF-8"?>
${stringify(body, 2)}`;
// compress and package the contents if requested
if (options.compress) {
const data = {
'3D': {
'3dmodel.model': strToU8(xml)
},
'_rels': {
'.rels': strToU8(rels)
},
'[Content_Types].xml': strToU8(contenttype)
};
const opts = {
comment: 'created by JSCAD'
};
const zipData = zipSync(data, opts);
return [zipData.buffer];
}
return [xml];
};
const contenttype = `<?xml version="1.0" encoding="UTF-8" ?>
<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types">
<Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml">
</Default>
<Default Extension="model" ContentType="application/vnd.ms-package.3dmanufacturing-3dmodel+xml">
</Default>
</Types>`;
const rels = `<?xml version="1.0" encoding="UTF-8" ?>
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
<Relationship Target="/3D/3dmodel.model" Id="rel0" Type="http://schemas.microsoft.com/3dmanufacturing/2013/01/3dmodel">
</Relationship>
</Relationships>`;
const translateResources = (objects, options) => {
let resources = ['resources', {}, translateMaterials(objects, options)];
resources = resources.concat(translateObjects(objects, options));
return resources;
};
const translateMaterials = (objects, options) => {
let basematerials = ['basematerials', { id: '0' }];
const materials = [];
objects.forEach((object, i) => {
let srgb = colors.rgbToHex(options.defaultcolor).toUpperCase();
if (object.color) {
srgb = colors.rgbToHex(object.color).toUpperCase();
}
materials.push(['base', { name: `mat${i}`, displaycolor: srgb }]);
});
basematerials = basematerials.concat(materials);
return basematerials;
};
const translateObjects = (objects, options) => {
const contents = [];
objects.forEach((object, i) => {
if (geometries.geom3.isA(object)) {
const polygons = geometries.geom3.toPolygons(object);
if (polygons.length > 0) {
options.id = i;
contents.push(convertToObject(object, options));
}
}
});
return contents;
};
const translateBuild = (objects, options) => {
let build = ['build', {}];
const items = [];
objects.forEach((object, i) => {
items.push(['item', { objectid: `${i + 1}` }]);
});
build = build.concat(items);
return build;
};
/*
* This section converts each 3D geometry to object / mesh
*/
const convertToObject = (object, options) => {
const name = object.name ? object.name : `Part ${options.id}`;
const contents = ['object', { id: `${options.id + 1}`, type: 'model', pid: '0', pindex: `${options.id}`, name: name }, convertToMesh(object, options)];
return contents;
};
const convertToMesh = (object, options) => {
const contents = ['mesh', {}, convertToVertices(object, options), convertToVolumes(object, options)];
return contents;
};
/*
* This section converts each 3D geometry to mesh vertices
*/
const convertToVertices = (object, options) => {
const contents = ['vertices', {}];
const vertices = [];
const polygons = geometries.geom3.toPolygons(object);
polygons.forEach((polygon) => {
for (let i = 0; i < polygon.vertices.length; i++) {
vertices.push(convertToVertex(polygon.vertices[i], options));
}
});
return contents.concat(vertices);
};
const convertToVertex = (vertex, options) => {
const contents = ['vertex', { x: vertex[0], y: vertex[1], z: vertex[2] }];
return contents;
};
/*
* This section converts each 3D geometry to mesh triangles
*/
const convertToVolumes = (object, options) => {
let n = 0;
const polygons = geometries.geom3.toPolygons(object);
let contents = ['triangles', {}];
polygons.forEach((polygon) => {
if (polygon.vertices.length < 3) {
return;
}
const triangles = convertToTriangles(polygon, n);
contents = contents.concat(triangles);
n += polygon.vertices.length;
});
return contents;
};
const convertToTriangles = (polygon, index) => {
const contents = [];
// making sure they are all triangles (triangular polygons)
for (let i = 0; i < polygon.vertices.length - 2; i++) {
const triangle = ['triangle', { v1: index, v2: (index + i + 1), v3: (index + i + 2) }];
contents.push(triangle);
}
return contents;
};
module.exports = {
serialize,
mimeType,
fileExtension
};
}, { "@jscad/array-utils": 6, "@jscad/modeling": 511, "fflate": 827, "onml/lib/stringify": 829 }], 3: [function (require, module, exports) {
/**
* Flatten the given array into a single array of elements.
* The given array can be composed of multiple depths of objects and or arrays.
* @param {Array} array - array to flatten
* @returns {Array} a flat array with a single list of elements
* @alias module:array-utils.flatten
* @example
* const flat = flatten([[1], [2, 3, [4, 5]], 6]) // returns [1, 2, 3, 4, 5, 6]
*/
const flatten = (arr) => arr.reduce((acc, val) => Array.isArray(val) ? acc.concat(flatten(val)) : acc.concat(val), []);
module.exports = flatten;
}, {}], 4: [function (require, module, exports) {
/**
* Compare function for sorting arrays of numbers.
* @param {Number} a - first number
* @param {Number} b - second number
* @return {Number} result of a - b
* @alias module:array-utils.fnNumberSort
* @example
* const numbers = [2, 1, 4, 3, 6, 5, 8, 7, 9, 0]
* const sorted = numbers.sort(fnNumberSort)
*/
const fnNumberSort = (a, b) => a - b;
module.exports = fnNumberSort;
}, {}], 5: [function (require, module, exports) {
/**
* Return the first element of the given array.
* @param {*} array - anything
* @returns {*} first element of the array, or undefined
* @alias module:array-utils.head
* @example
* let element = head([1, 2])
*/
const head = (array) => {
if (!Array.isArray(array) || array.length === 0) {
return undefined;
}
return array[0];
};
module.exports = head;
}, {}], 6: [function (require, module, exports) {
/**
* Utility functions for arrays.
* @module array-utils
* @example
* const { flatten, head } = require('@jscad/array-utils')
*/
module.exports = {
flatten: require('./flatten'),
fnNumberSort: require('./fnNumberSort'),
head: require('./head'),
insertSorted: require('./insertSorted'),
nth: require('./nth'),
padToLength: require('./padToLength'),
toArray: require('./toArray')
};
}, { "./flatten": 3, "./fnNumberSort": 4, "./head": 5, "./insertSorted": 7, "./nth": 8, "./padToLength": 9, "./toArray": 10 }], 7: [function (require, module, exports) {
/**
* Insert the given element into the give array using the compareFunction.
* @param {Array} array - array in which to insert
* @param {*} element - element to insert into the array
* @param {Function} compareFunction - a function that defines the sort order of elements
* @alias module:array-utils.insertSorted
* @example
* const numbers = [1, 5]
* const result = insertSorted(numbers, 3, fnNumberSort)
*/
const insertSorted = (array, element, compareFunction) => {
let leftbound = 0;
let rightbound = array.length;
while (rightbound > leftbound) {
const testindex = Math.floor((leftbound + rightbound) / 2);
const testelement = array[testindex];
const compareresult = compareFunction(element, testelement);
if (compareresult > 0) { // element > testelement
leftbound = testindex + 1;
}
else {
rightbound = testindex;
}
}
array.splice(leftbound, 0, element);
return array;
};
module.exports = insertSorted;
}, {}], 8: [function (require, module, exports) {
/**
* Return the Nth element of the given array.
* @param {*} array - anything
* @param {Number} index - index of the element to return
* @returns {*} Nth element of the array, or undefined
* @alias module:array-utils.nth
* @example
* let value = nth([1], 2) // undefined
* let value = nth([1, 2, 3, 4, 5], 3) // 4
*/
const nth = (array, index) => {
if (!Array.isArray(array) || array.length < index) {
return undefined;
}
return array[index];
};
module.exports = nth;
}, {}], 9: [function (require, module, exports) {
/**
* Build an array of the given target length from an existing array and a padding value.
* If the array is already larger than the target length, it will not be shortened.
* @param {Array} anArray - the source array to copy into the result.
* @param {*} padding - the value to add to the new array to reach the desired length.
* @param {Number} targetLength - The desired length of the returned array.
* @returns {Array} an array with at least 'target length" elements
* @alias module:array-utils.padToLength
* @example
* const srcArray = [2, 3, 4]
* const paddedArray = padToLength(srcArray, 0, 5)
*/
const padToLength = (anArray, padding, targetLength) => {
anArray = anArray.slice();
while (anArray.length < targetLength) {
anArray.push(padding);
}
return anArray;
};
module.exports = padToLength;
}, {}], 10: [function (require, module, exports) {
/**
* Convert the given array to an array if not already an array.
* @param {*} array - anything
* @returns {Array} an array
* @alias module:array-utils.toArray
* @example
* const array = toArray(1) // [1]
*/
const toArray = (array) => {
if (Array.isArray(array))
return array;
if (array === undefined || array === null)
return [];
return [array];
};
module.exports = toArray;
}, {}], 11: [function (require, module, exports) {
/*
AutoCAD DXF Content
These are the common headers, classes, tables, blocks, and objects required for AC2017 DXF files.
## License
Copyright (c) 2018 Z3 Development https://github.com/z3dev
All code released under MIT license
*/
// Important Variables
// ANGDIR = 0 : counter clockwise angles
// INSUNITS = 4 : millimeters
//
const dxfHeaders = function () {
const content = ` 0
SECTION
2
HEADER
9
$ACADVER
1
AC1027
9
$ACADMAINTVER
70
8
9
$DWGCODEPAGE
3
ANSI_1252
9
$LASTSAVEDBY
1
unknown
9
$REQUIREDVERSIONS
160
0
9
$INSBASE
10
0.0
20
0.0
30
0.0
9
$EXTMIN
10
1e+20
20
1e+20
30
1e+20
9
$EXTMAX
10
-1e+20
20
-1e+20
30
-1e+20
9
$LIMMIN
10
0.0
20
0.0
9
$LIMMAX
10
12.0
20
9.0
9
$ORTHOMODE
70
0
9
$REGENMODE
70
1
9
$FILLMODE
70
1
9
$QTEXTMODE
70
0
9
$MIRRTEXT
70
0
9
$LTSCALE
40
1.0
9
$ATTMODE
70
1
9
$TEXTSIZE
40
0.2
9
$TRACEWID
40
0.05
9
$TEXTSTYLE
7
Notes
9
$CLAYER
8
0
9
$CELTYPE
6
ByLayer
9
$CECOLOR
62
256
9
$CELTSCALE
40
1.0
9
$DISPSILH
70
0
9
$DIMSCALE
40
1.0
9
$DIMASZ
40
3.0
9
$DIMEXO
40
1.5
9
$DIMDLI
40
6.0
9
$DIMRND
40
0.0
9
$DIMDLE
40
0.0
9
$DIMEXE
40
3.0
9
$DIMTP
40
0.0
9
$DIMTM
40
0.0
9
$DIMTXT
40
3.0
9
$DIMCEN
40
3.0
9
$DIMTSZ
40
0.0
9
$DIMTOL
70
0
9
$DIMLIM
70
0
9
$DIMTIH
70
0
9
$DIMTOH
70
0
9
$DIMSE1
70
0
9
$DIMSE2
70
0
9
$DIMTAD
70
1
9
$DIMZIN
70
3
9
$DIMBLK
1
9
$DIMASO
70
1
9
$DIMSHO
70
1
9
$DIMPOST
1
9
$DIMAPOST
1
9
$DIMALT
70
0
9
$DIMALTD
70
2
9
$DIMALTF
40
25.4
9
$DIMLFAC
40
1.0
9
$DIMTOFL
70
0
9
$DIMTVP
40
0.0
9
$DIMTIX
70
0
9
$DIMSOXD
70
0
9
$DIMSAH
70
0
9
$DIMBLK1
1
9
$DIMBLK2
1
9
$DIMSTYLE
2
Civil-Metric
9
$DIMCLRD
70
0
9
$DIMCLRE
70
0
9
$DIMCLRT
70
0
9
$DIMTFAC
40
1.0
9
$DIMGAP
40
2.0
9
$DIMJUST
70
0
9
$DIMSD1
70
0
9
$DIMSD2
70
0
9
$DIMTOLJ
70
1
9
$DIMTZIN
70
0
9
$DIMALTZ
70
0
9
$DIMALTTZ
70
0
9
$DIMUPT
70
0
9
$DIMDEC
70
2
9
$DIMTDEC
70
2
9
$DIMALTU
70
2
9
$DIMALTTD
70
2
9
$DIMTXSTY
7
Standard
9
$DIMAUNIT
70
0
9
$DIMADEC
70
2
9
$DIMALTRND
40
0.0
9
$DIMAZIN
70
2
9
$DIMDSEP
70
46
9
$DIMATFIT
70
3
9
$DIMFRAC
70
1
9
$DIMLDRBLK
1
9
$DIMLUNIT
70
2
9
$DIMLWD
70
-2
9
$DIMLWE
70
-2
9
$DIMTMOVE
70
0
9
$DIMFXL
40
1.0
9
$DIMFXLON
70
0
9
$DIMJOGANG
40
0.785398163397
9
$DIMTFILL
70
0
9
$DIMTFILLCLR
70
0
9
$DIMARCSYM
70
0
9
$DIMLTYPE
6
9
$DIMLTEX1
6
9
$DIMLTEX2
6
9
$DIMTXTDIRECTION
70
0
9
$LUNITS
70
2
9
$LUPREC
70
4
9
$SKETCHINC
40
0.1
9
$FILLETRAD
40
0.0
9
$AUNITS
70
4
9
$AUPREC
70
5
9
$MENU
1
.
9
$ELEVATION
40
0.0
9
$PELEVATION
40
0.0
9
$THICKNESS
40
0.0
9
$LIMCHECK
70
0
9
$CHAMFERA
40
0.0
9
$CHAMFERB
40
0.0
9
$CHAMFERC
40
0.0
9
$CHAMFERD
40
0.0
9
$SKPOLY
70
0
9
$TDCREATE
40
2457986.69756
9
$TDUCREATE
40
2455631.2632
9
$TDUPDATE
40
2457986.69756
9
$TDUUPDATE
40
2456436.43179
9
$TDINDWG
40
0.0003490741
9
$TDUSRTIMER
40
0.0003487153
9
$USRTIMER
70
1
9
$ANGBASE
50
0.0
9
$ANGDIR
70
0
9
$PDMODE
70
0
9
$PDSIZE
40
0.0
9
$PLINEWID
40
0.0
9
$SPLFRAME
70
0
9
$SPLINETYPE
70
6
9
$SPLINESEGS
70
8
9
$HANDSEED
5
5C7
9
$SURFTAB1
70
6
9
$SURFTAB2
70
6
9
$SURFTYPE
70
6
9
$SURFU
70
6
9
$SURFV
70
6
9
$UCSBASE
2
9
$UCSNAME
2
9
$UCSORG
10
0.0
20
0.0
30
0.0
9
$UCSXDIR
10
1.0
20
0.0
30
0.0
9
$UCSYDIR
10
0.0
20
1.0
30
0.0
9
$UCSORTHOREF
2
9
$UCSORTHOVIEW
70
0
9
$UCSORGTOP
10
0.0
20
0.0
30
0.0
9
$UCSORGBOTTOM
10
0.0
20
0.0
30
0.0
9
$UCSORGLEFT
10
0.0
20
0.0
30
0.0
9
$UCSORGRIGHT
10
0.0
20
0.0
30
0.0
9
$UCSORGFRONT
10
0.0
20
0.0
30
0.0
9
$UCSORGBACK
10
0.0
20
0.0
30
0.0
9
$PUCSBASE
2
9
$PUCSNAME
2
9
$PUCSORG
10
0.0
20
0.0
30
0.0
9
$PUCSXDIR
10
1.0
20
0.0
30
0.0
9
$PUCSYDIR
10
0.0
20
1.0
30
0.0
9
$PUCSORTHOREF
2
9
$PUCSORTHOVIEW
70
0
9
$PUCSORGTOP
10
0.0
20
0.0
30
0.0
9
$PUCSORGBOTTOM
10
0.0
20
0.0
30
0.0
9
$PUCSORGLEFT
10
0.0
20
0.0
30
0.0
9
$PUCSORGRIGHT
10
0.0
20
0.0
30
0.0
9
$PUCSORGFRONT
10
0.0
20
0.0
30
0.0
9
$PUCSORGBACK
10
0.0
20
0.0
30
0.0
9
$USERI1
70
0
9
$USERI2
70
0
9
$USERI3
70
0
9
$USERI4
70
0
9
$USERI5
70
0
9
$USERR1
40
0.0
9
$USERR2
40
0.0
9
$USERR3
40
0.0
9
$USERR4
40
0.0
9
$USERR5
40
0.0
9
$WORLDVIEW
70
1
9
$SHADEDGE
70
3
9
$SHADEDIF
70
70
9
$TILEMODE
70
1
9
$MAXACTVP
70
64
9
$PINSBASE
10
0.0
20
0.0
30
0.0
9
$PLIMCHECK
70
0
9
$PEXTMIN
10
0.628866766397
20
0.799999952316
30
0.0
9
$PEXTMAX
10
9.02886638493
20
7.19999957085
30
0.0
9
$PLIMMIN
10
-0.700541819174
20
-0.228100386192
9
$PLIMMAX
10
10.2994579405
20
8.27189937351
9
$UNITMODE
70
0
9
$VISRETAIN
70
1
9
$PLINEGEN
70
0
9
$PSLTSCALE
70
1
9
$TREEDEPTH
70
3020
9
$CMLSTYLE
2
Standard
9
$CMLJUST
70
0
9
$CMLSCALE
40
1.0
9
$PROXYGRAPHICS
70
1
9
$MEASUREMENT
70
1
9
$CELWEIGHT
370
-1
9
$ENDCAPS
280
0
9
$JOINSTYLE
280
0
9
$LWDISPLAY
290
0
9
$INSUNITS
70
4
9
$HYPERLINKBASE
1
9
$STYLESHEET
1
9
$XEDIT
290
1
9
$CEPSNTYPE
380
0
9
$PSTYLEMODE
290
1
9
$FINGERPRINTGUID
2
{39DB1BDD-BC6C-46D3-A333-DFCC0DC4782D}
9
$VERSIONGUID
2
{69EEBB2D-7039-498F-9366-3F994E4A07E7}
9
$EXTNAMES
290
1
9
$PSVPSCALE
40
0.0
9
$OLESTARTUP
290
0
9
$SORTENTS
280
127
9
$INDEXCTL
280
0
9
$HIDETEXT
280
1
9
$XCLIPFRAME
280
0
9
$HALOGAP
280
0
9
$OBSCOLOR
70
257
9
$OBSLTYPE
280
0
9
$INTERSECTIONDISPLAY
280
0
9
$INTERSECTIONCOLOR
70
257
9
$DIMASSOC
280
2
9
$PROJECTNAME
1
9
$CAMERADISPLAY
290
0
9
$LENSLENGTH
40
50.0
9
$CAMERAHEIGHT
40
0.0
9
$STEPSPERSEC
40
2.0
9
$STEPSIZE
40
6.0
9
$3DDWFPREC
40
2.0
9
$PSOLWIDTH
40
0.25
9
$PSOLHEIGHT
40
4.0
9
$LOFTANG1
40
1.57079632679
9
$LOFTANG2
40
1.57079632679
9
$LOFTMAG1
40
0.0
9
$LOFTMAG2
40
0.0
9
$LOFTPARAM
70
7
9
$LOFTNORMALS
280
1
9
$LATITUDE
40
37.795
9
$LONGITUDE
40
-122.394
9
$NORTHDIRECTION
40
0.0
9
$TIMEZONE
70
-8000
9
$LIGHTGLYPHDISPLAY
280
1
9
$TILEMODELIGHTSYNCH
280
1
9
$CMATERIAL
347
96
9
$SOLIDHIST
280
1
9
$SHOWHIST
280
1
9
$DWFFRAME
280
2
9
$DGNFRAME
280
0
9
$REALWORLDSCALE
290
1
9
$INTERFERECOLOR
62
1
9
$INTERFEREOBJVS
345
A3
9
$INTERFEREVPVS
346
A0
9
$CSHADOW
280
0
9
$SHADOWPLANELOCATION
40
0.0
0
ENDSEC`;
return content;
};
const dxfClasses = function () {
const content = ` 0
SECTION
2
CLASSES
0
CLASS
1
ACDBDICTIONARYWDFLT
2
AcDbDictionaryWithDefault
3
ObjectDBX Classes
90
0
91
1
280
0
281
0
0
CLASS
1
DICTIONARYVAR
2
AcDbDictionaryVar
3
ObjectDBX Classes
90
0
91
15
280
0
281
0
0
CLASS
1
TABLESTYLE
2
AcDbTableStyle
3
ObjectDBX Classes
90
4095
91
1
280
0
281
0
0
CLASS
1
MATERIAL
2
AcDbMaterial
3
ObjectDBX Classes
90
1153
91
3
280
0
281
0
0
CLASS
1
VISUALSTYLE
2
AcDbVisualStyle
3
ObjectDBX Classes
90
4095
91
26
280
0
281
0
0
CLASS
1
SCALE
2
AcDbScale
3
ObjectDBX Classes
90
1153
91
17
280
0
281
0
0
CLASS
1
MLEADERSTYLE
2
AcDbMLeaderStyle
3
ACDB_MLEADERSTYLE_CLASS
90
4095
91
3
280
0
281
0
0
CLASS
1
CELLSTYLEMAP
2
AcDbCellStyleMap
3
ObjectDBX Classes
90
1152
91
2
280
0
281
0
0
CLASS
1
EXACXREFPANELOBJECT
2
ExAcXREFPanelObject
3
EXAC_ESW
90
1025
91
0
280
0
281
0
0
CLASS
1
NPOCOLLECTION
2
AcDbImpNonPersistentObjectsCollection
3
ObjectDBX Classes
90
1153
91
0
280
0
281
0
0
CLASS
1
LAYER_INDEX
2
AcDbLayerIndex
3
ObjectDBX Classes
90
0
91
0
280
0
281
0
0
CLASS
1
SPATIAL_INDEX
2
AcDbSpatialIndex
3
ObjectDBX Classes
90
0
91
0
280
0
281
0
0
CLASS
1
IDBUFFER
2
AcDbIdBuffer
3
ObjectDBX Classes
90
0
91
0
280
0
281
0
0
CLASS
1
DIMASSOC
2
AcDbDimAssoc
3
"AcDbDimAssoc|Product Desc: AcDim ARX App For Dimension|Company: Autodesk, Inc.|WEB Address: www.autodesk.com"
90
0
91
0
280
0
281
0
0
CLASS
1
ACDBSECTIONVIEWSTYLE
2
AcDbSectionViewStyle
3
ObjectDBX Classes
90
1025
91
1
280
0
281
0
0
CLASS
1
ACDBDETAILVIEWSTYLE
2
AcDbDetailViewStyle
3
ObjectDBX Classes
90
1025
91
1
280
0
281
0
0
CLASS
1
IMAGEDEF
2
AcDbRasterImageDef
3
ISM
90
0
91
1
280
0
281
0
0
CLASS
1
RASTERVARIABLES
2
AcDbRasterVariables
3
ISM
90
0
91
1
280
0
281
0
0
CLASS
1
IMAGEDEF_REACTOR
2
AcDbRasterImageDefReactor
3
ISM
90
1
91
1
280
0
281
0
0
CLASS
1
IMAGE
2
AcDbRasterImage
3
ISM
90
2175
91
1
280
0
281
1
0
CLASS
1
PDFDEFINITION
2
AcDbPdfDefinition
3
ObjectDBX Classes
90
1153
91
1
280
0
281
0
0
CLASS
1
PDFUNDERLAY
2
AcDbPdfReference
3
ObjectDBX Classes
90
4095
91
1
280
0
281
1
0
CLASS
1
DWFDEFINITION
2
AcDbDwfDefinition
3
ObjectDBX Classes
90
1153
91
2
280
0
281
0
0
CLASS
1
DWFUNDERLAY
2
AcDbDwfReference
3
ObjectDBX Classes
90
1153
91
1
280
0
281
1
0
CLASS
1
DGNDEFINITION
2
AcDbDgnDefinition
3
ObjectDBX Classes
90
1153
91
2
280
0
281
0
0
CLASS
1
DGNUNDERLAY
2
AcDbDgnReference
3
ObjectDBX Classes
90
1153
91
1
280
0
281
1
0
ENDSEC`;
return content;
};
const dxfTables = function () {
const content = ` 0
SECTION
2
TABLES
0
TABLE
2
VPORT
5
8
330
0
100
AcDbSymbolTable
70
0
0
ENDTAB
0
TABLE
2
LTYPE
5
5F
330
0
100
AcDbSymbolTable
70
7
0
LTYPE
5
14
330
5F
100
AcDbSymbolTableRecord
100
AcDbLinetypeTableRecord
2
ByBlock
70
0
3
72
65
73
0
40
0.0
0
LTYPE
5
15
330
5F
100
AcDbSymbolTableRecord
100
AcDbLinetypeTableRecord
2
ByLayer
70
0
3
72
65
73
0
40
0.0
0
LTYPE
5
16
330
5F
100
AcDbSymbolTableRecord
100
AcDbLinetypeTableRecord
2
Continuous
70
0
3
Solid line
72
65
73
0
40
0.0
0
LTYPE
5
1B1
330
5F
100
AcDbSymbolTableRecord
100
AcDbLinetypeTableRecord
2
CENTER
70
0
3
Center ____ _ ____ _ ____ _ ____ _ ____ _ ____
72
65
73
4
40
2.0
49
1.25
74
0
49
-0.25
74
0
49
0.25
74
0
49
-0.25
74
0
0
LTYPE
5
1B2
330
5F
100
AcDbSymbolTableRecord
100
AcDbLinetypeTableRecord
2
DASHED
70
0
3
Dashed __ __ __ __ __ __ __ __ __ __ __ __ __ _
72
65
73
2
40
0.75
49
0.5
74
0
49
-0.25
74
0
0
LTYPE
5
1B3
330
5F
100
AcDbSymbolTableRecord
100
AcDbLinetypeTableRecord
2
PHANTOM
70
0
3
Phantom ______ __ __ ______ __ __ ______
72
65
73
6
40
2.5
49
1.25
74
0
49
-0.25
74
0
49
0.25
74
0
49
-0.25
74
0
49
0.25
74
0
49
-0.25
74
0
0
LTYPE
5
39E
330
5F
100
AcDbSymbolTableRecord
100
AcDbLinetypeTableRecord
2
HIDDEN
70
0
3
Hidden __ __ __ __ __ __ __ __ __ __ __ __ __ __
72
65
73
2
40
9.525
49
6.35
74
0
49
-3.175
74
0
0
ENDTAB
0
TABLE
2
LAYER
5
2
330
0
100
AcDbSymbolTable
70
3
0
LAYER
5
10
330
2
100
AcDbSymbolTableRecord
100
AcDbLayerTableRecord
2
0
70
0
6
Continuous
370
-3
390
F
347
98
348
0
0
LAYER
5
1B4
330
2
100
AcDbSymbolTableRecord
100
AcDbLayerTableRecord
2
View Port
70
0
6
Continuous
290
0
370
-3
390
F
347
98
348
0
0
LAYER
5
21D
330
2
100
AcDbSymbolTableRecord
100
AcDbLayerTableRecord
2
Defpoints
70
0
6
Continuous
290
0
370
-3
390
F
347
98
348
0
0
ENDTAB
0
TABLE
2
STYLE
5
3
330
0
100
AcDbSymbolTable
70
3
0
STYLE
5
11
330
3
100
AcDbSymbolTableRecord
100
AcDbTextStyleTableRecord
2
Standard
70
0
40
0.0
41
1.0
50
0.0
71
0
42
0.2
3
arial.ttf
4
0
STYLE
5
DC
330
3
100
AcDbSymbolTableRecord
100
AcDbTextStyleTableRecord
2
Annotative
70
0
40
0.0
41
1.0
50
0.0
71
0
42
0.2
3
arial.ttf
4
0
STYLE
5
178
330
3
100
AcDbSymbolTableRecord
100
AcDbTextStyleTableRecord
2
Notes
70
0
40
3.0
41
1.0
50
0.0
71
0
42
0.2
3
arial.ttf
4
0
ENDTAB
0
TABLE
2
VIEW
5
6
330
0
100
AcDbSymbolTable
70
0
0
ENDTAB
0
TABLE
2
UCS
5
7
330
0
100
AcDbSymbolTable
70
0
0
ENDTAB
0
TABLE
2
APPID
5
9
330
0
100
AcDbSymbolTable
70
12
0
APPID
5
12
330
9
100
AcDbSymbolTableRecord
100
AcDbRegAppTableRecord
2
ACAD
70
0
0
APPID
5
DD
330
9
100
AcDbSymbolTableRecord
100
AcDbRegAppTableRecord
2
AcadAnnoPO
70
0
0
APPID
5
DE
330
9
100
AcDbSymbolTableRecord
100
AcDbRegAppTableRecord
2
AcadAnnotative
70
0
0
APPID
5
DF
330
9
100
AcDbSymbolTableRecord
100
AcDbRegAppTableRecord
2
ACAD_DSTYLE_DIMJAG
70
0
0
APPID
5
E0
330
9
100
AcDbSymbolTableRecord
100
AcDbRegAppTableRecord
2
ACAD_DSTYLE_DIMTALN
70
0
0
APPID
5
107
330
9
100
AcDbSymbolTableRecord
100
AcDbRegAppTableRecord
2
ACAD_MLEADERVER
70
0
0
APPID
5
1B5
330
9
100
AcDbSymbolTableRecord
100
AcDbRegAppTableRecord
2
AcAecLayerStandard
70
0
0
APPID
5
1BA
330
9
100
AcDbSymbolTableRecord
100
AcDbRegAppTableRecord
2
ACAD_EXEMPT_FROM_CAD_STANDARDS
70
0
0
APPID
5
237
330
9
100
AcDbSymbolTableRecord
100
AcDbRegAppTableRecord
2
ACAD_DSTYLE_DIMBREAK
70
0
0
APPID
5
28E
330
9
100
AcDbSymbolTableRecord
100
AcDbRegAppTableRecord
2
ACAD_PSEXT
70
0
0
APPID
5
4B0
330
9
100
AcDbSymbolTableRecord
100
AcDbRegAppTableRecord
2
ACAD_NAV_VCDISPLAY
70
0
0
APPID
5
4E3
330
9
100
AcDbSymbolTableRecord
100
AcDbRegAppTableRecord
2
HATCHBACKGROUNDCOLOR
70
0
0
ENDTAB
0
TABLE
2
DIMSTYLE
5
A
330
0
100
AcDbSymbolTable
70
3
100
AcDbDimStyleTable
71
3
340
242
340
27
340
E1
0
DIMSTYLE
105
27
330
A
100
AcDbSymbolTableRecord
100
AcDbDimStyleTableRecord
2
Standard
70
0
41
3.0
42
2.0
43
9.0
44
5.0
140
3.0
141
2.0
147
2.0
340
11
1001
ACAD_DSTYLE_DIMJAG
1070
388
1040
38.0
1001
ACAD_DSTYLE_DIMBREAK
1070
391
1040
90.0
1001
ACAD_DSTYLE_DIMTALN
1070
392
1070
0
0
DIMSTYLE
105
E1
330
A
100
AcDbSymbolTableRecord
100
AcDbDimStyleTableRecord
2
Annotative
70
0
40
0.0
41
3.0
42
2.5
43
10.0
44
5.0
140
3.0
141
2.0
147
2.0
340
11
1001
AcadAnnotative
1000
AnnotativeData
1002
{
1070
1
1070
1
1002
}
1001
ACAD_DSTYLE_DIMJAG
1070
388
1040
38.0
1001
ACAD_DSTYLE_DIMBREAK
1070
391
1040
90.0
1001
ACAD_DSTYLE_DIMTALN
1070
392
1070
0
0
DIMSTYLE
105
242
330
A
100
AcDbSymbolTableRecord
100
AcDbDimStyleTableRecord
2
Civil-Metric
70
0
41
3.0
42
1.5
43
6.0
44
3.0
73
0
74
0
77
1
78
3
79
2
140
3.0
141
3.0
147
2.0
179
2
271
2
272
2
276
1
340
11
1001
ACAD_DSTYLE_DIMBREAK
1070
391
1040
3.0
1001
ACAD_DSTYLE_DIMJAG
1070
388
1040
38.0
1001
ACAD_DSTYLE_DIMTALN
1070
392
1070
0
0
ENDTAB
0
TABLE
2
BLOCK_RECORD
5
1
330
0
100
AcDbSymbolTable
70
4
0
BLOCK_RECORD
5
1F
330
1
100
AcDbSymbolTableRecord
100
AcDbBlockTableRecord
2
*Model_Space
340
530
70
0
280
1
281
0
0
BLOCK_RECORD
5
58
330
1
100
AcDbSymbolTableRecord
100
AcDbBlockTableRecord
2
*Paper_Space
340
531
70
0
280
1
281
0
0
BLOCK_RECORD
5
238
330
1
100
AcDbSymbolTableRecord
100
AcDbBlockTableRecord
2
_ArchTick
340
0
70
0
280
1
281
0
0
BLOCK_RECORD
5
23C
330
1
100
AcDbSymbolTableRecord
100
AcDbBlockTableRecord
2
_Open30
340
0
70
0
280
1
281
0
0
ENDTAB
0
ENDSEC`;
return content;
};
const dxfBlocks = function () {
const content = ` 0
SECTION
2
BLOCKS
0
BLOCK
5
23A
330
238
100
AcDbEntity
8
0
100
AcDbBlockBegin
2
_ArchTick
70
0
10
0.0
20
0.0
30
0.0
3
_ArchTick
1
0
ENDBLK
5
23B
330
238
100
AcDbEntity
8
0
100
AcDbBlockEnd
0
BLOCK
5
20
330
1F
100
AcDbEntity
8
0
100
AcDbBlockBegin
2
*Model_Space
70
0
10
0.0
20
0.0
30
0.0
3
*Model_Space
1
0
ENDBLK
5
21
330
1F
100
AcDbEntity
8
0
100
AcDbBlockEnd
0
BLOCK
5
5A
330
58
100
AcDbEntity
67
1
8
0
100
AcDbBlockBegin
2
*Paper_Space
70
0
10
0.0
20
0.0
30
0.0
3
*Paper_Space
1
0
ENDBLK
5
5B
330
58
100
AcDbEntity
67
1
8
0
100
AcDbBlockEnd
0
BLOCK
5
240
330
23C
100
AcDbEntity
8
0
100
AcDbBlockBegin
2
_Open30
70
0
10
0.0
20
0.0
30
0.0
3
_Open30
1
0
ENDBLK
5
241
330
23C
100
AcDbEntity
8
0
100
AcDbBlockEnd
0
ENDSEC`;
return content;
};
const dxfObjects = function () {
const content = ` 0
SECTION
2
OBJECTS
0
DICTIONARY
5
C
330
0
100
AcDbDictionary
281
1
3
ACAD_COLOR
350
524
3
ACAD_GROUP
350
525
3
ACAD_LAYOUT
350
526
3
ACAD_MATERIAL
350
527
3
ACAD_MLEADERSTYLE
350
528
3
ACAD_MLINESTYLE
350
529
3
ACAD_PLOTSETTINGS
350
52A
3
ACAD_PLOTSTYLENAME
350
52C
3
ACAD_SCALELIST
350
52D
3
ACAD_TABLESTYLE
350
52E
3
ACAD_VISUALSTYLE
350
52F
0
DICTIONARY
5
524
330
C
100
AcDbDictionary
281
1
0
DICTIONARY
5
525
330
C
100
AcDbDictionary
281
1
0
DICTIONARY
5
526
330
C
100
AcDbDictionary
281
1
3
Model
350
530
3
Layout1
350
531
0
DICTIONARY
5
527
330
C
100
AcDbDictionary
281
1
0
DICTIONARY
5
528
330
C
100
AcDbDictionary
281
1
0
DICTIONARY
5
529
330
C
100
AcDbDictionary
281
1
0
DICTIONARY
5
52A
330
C
100
AcDbDictionary
281
1
0
ACDBPLACEHOLDER
5
52B
330
52C
0
ACDBDICTIONARYWDFLT
5
52C
330
C
100
AcDbDictionary
281
1
3
Normal
350
52B
100
AcDbDictionaryWithDefault
340
52B
0
DICTIONARY
5
52D
330
C
100
AcDbDictionary
281
1
0
DICTIONARY
5
52E
330
C
100
AcDbDictionary
281
1
0
DICTIONARY
5
52F
330
C
100
AcDbDictionary
281
1
0
LAYOUT
5
530
330
526
100
AcDbPlotSettings
1
2
DWFx ePlot (XPS Compatible).pc3
4
ANSI_A_(8.50_x_11.00_Inches)
6
40
5.8
41
17.8
42
5.8
43
17.8
44
215.9
45
279.4
46
0.0
47
0.0
48
0.0
49
0.0
140
0.0
141
0.0
142
1.0
143
14.53
70
11952
72
0
73
1
74
0
7
75
0
147
0.069
148
114.98
149
300.29
100
AcDbLayout
1
Model
70
1
71
0
10
0.0
20
0.0
11
12.0
21
9.0
12
0.0
22
0.0
32
0.0
14
0.0
24
0.0
34
0.0
15
0.0
25
0.0
35
0.0
146
0.0
13
0.0
23
0.0
33
0.0
16
1.0
26
0.0
36
0.0
17
0.0
27
1.0
37
0.0
76
0
330
1F
0
LAYOUT
5
531
330
526
100
AcDbPlotSettings
1
2
DWFx ePlot (XPS Compatible).pc3
4
ANSI_A_(8.50_x_11.00_Inches)
6
40
5.8
41
17.8
42
5.8
43
17.8
44
215.9
45
279.4
46
0.0
47
0.0
48
0.0
49
0.0
140
0.0
141
0.0
142
1.0
143
1.0
70
688
72
0
73
1
74
5
7
acad.ctb
75
16
147
1.0
148
0.0
149
0.0
100
AcDbLayout
1
Layout1
70
1
71
1
10
-0.7
20
-0.23
11
10.3
21
8.27
12
0.0
22
0.0
32
0.0
14
0.63
24
0.8
34
0.0
15
9.0
25
7.2
35
0.0
146
0.0
13
0.0
23
0.0
33
0.0
16
1.0
26
0.0
36
0.0
17
0.0
27
1.0
37
0.0
76
0
330
58
0
ENDSEC`;
return content;
};
module.exports = {
dxfHeaders,
dxfClasses,
dxfTables,
dxfBlocks,
dxfObjects
};
}, {}], 12: [function (require, module, exports) {
/*
* AutoCAD 2017 2018 Color Index (1-255) as RGB + ALPHA colors
*/
const colorIndex = [
[0, 0, 0, 255],
// 1
[255, 0, 0, 255],
[255, 255, 0, 255],
[0, 255, 0, 255],
[0, 255, 255, 255],
[0, 0, 255, 255],
[255, 0, 255, 255],
[255, 255, 255, 255],
[128, 128, 128, 255],
[192, 192, 192, 255],
[255, 0, 0, 255],
// 11
[255, 127, 127, 255],
[165, 0, 0, 255],
[165, 82, 82, 255],
[127, 0, 0, 255],
[127, 63, 63, 255],
[76, 0, 0, 255],
[76, 38, 38, 255],
[38, 0, 0, 255],
[38, 19, 19, 255],
[255, 63, 0, 255],
// 21
[255, 159, 127, 255],
[165, 41, 0, 255],
[165, 103, 82, 255],
[127, 31, 0, 255],
[127, 79, 63, 255],
[76, 19, 0, 255],
[76, 47, 38, 255],
[38, 9, 0, 255],
[38, 28, 19, 255],
[255, 127, 0, 255],
// 31
[255, 191, 127, 255],
[165, 82, 0, 255],
[165, 124, 82, 255],
[127, 63, 0, 255],
[127, 95, 63, 255],
[76, 38, 0, 255],
[76, 57, 38, 255],
[38, 19, 0, 255],
[38, 28, 19, 255],
[255, 191, 0, 255],
// 41
[255, 223, 127, 255],
[165, 124, 0, 255],
[165, 145, 82, 255],
[127, 95, 0, 255],
[127, 111, 63, 255],
[76, 57, 0, 255],
[76, 66, 38, 255],
[38, 28, 0, 255],
[38, 33, 19, 255],
[255, 255, 0, 255],
// 51
[255, 255, 127, 255],
[165, 165, 0, 255],
[165, 165, 82, 255],
[127, 127, 0, 255],
[127, 127, 63, 255],
[76, 76, 0, 255],
[76, 76, 38, 255],
[38, 38, 0, 255],
[38, 38, 19, 255],
[191, 255, 0, 255],
// 61
[223, 255, 127, 255],
[124, 165, 0, 255],
[145, 165, 82, 255],
[95, 127, 0, 255],
[111, 127, 63, 255],
[57, 76, 0, 255],
[66, 76, 38, 255],
[28, 38, 0, 255],
[33, 38, 19, 255],
[127, 255, 0, 255],
// 71
[191, 255, 127, 255],
[82, 165, 0, 255],
[124, 165, 82, 255],
[63, 127, 0, 255],
[95, 127, 63, 255],
[38, 76, 0, 255],
[57, 76, 38, 255],
[19, 38, 0, 255],
[28, 38, 19, 255],
[63, 255, 0, 255],
// 81
[159, 255, 127, 255],
[41, 165, 0, 255],
[103, 165, 82, 255],
[31, 127, 0, 255],
[79, 127, 63, 255],
[19, 76, 0, 255],
[47, 76, 38, 255],
[9, 38, 0, 255],
[23, 38, 19, 255],
[0, 255, 0, 255],
// 91
[125, 255, 127, 255],
[0, 165, 0, 255],
[82, 165, 82, 255],
[0, 127, 0, 255],
[63, 127, 63, 255],
[0, 76, 0, 255],
[38, 76, 38, 255],
[0, 38, 0, 255],
[19, 38, 19, 255],
[0, 255, 63, 255],
// 101
[127, 255, 159, 255],
[0, 165, 41, 255],
[82, 165, 103, 255],
[0, 127, 31, 255],
[63, 127, 79, 255],
[0, 76, 19, 255],
[38, 76, 47, 255],
[0, 38, 9, 255],
[19, 88, 23, 255],
[0, 255, 127, 255],
// 111
[127, 255, 191, 255],
[0, 165, 82, 255],
[82, 165, 124, 255],
[0, 127, 63, 255],
[63, 127, 95, 255],
[0, 76, 38, 255],
[38, 76, 57, 255],
[0, 38, 19, 255],
[19, 88, 28, 255],
[0, 255, 191, 255],
// 121
[127, 255, 223, 255],
[0, 165, 124, 255],
[82, 165, 145, 255],
[0, 127, 95, 255],
[63, 127, 111, 255],
[0, 76, 57, 255],
[38, 76, 66, 255],
[0, 38, 28, 255],
[19, 88, 88, 255],
[0, 255, 255, 255],
// 131
[127, 255, 255, 255],
[0, 165, 165, 255],
[82, 165, 165, 255],
[0, 127, 127, 255],
[63, 127, 127, 255],
[0, 76, 76, 255],
[38, 76, 76, 255],
[0, 38, 38, 255],
[19, 88, 88, 255],
[0, 191, 255, 255],
// 141
[127, 223, 255, 255],
[0, 124, 165, 255],
[82, 145, 165, 255],
[0, 95, 127, 255],
[63, 111, 217, 255],
[0, 57, 76, 255],
[38, 66, 126, 255],
[0, 28, 38, 255],
[19, 88, 88, 255],
[0, 127, 255, 255],
// 151
[127, 191, 255, 255],
[0, 82, 165, 255],
[82, 124, 165, 255],
[0, 63, 127, 255],
[63, 95, 127, 255],
[0, 38, 76, 255],
[38, 57, 126, 255],
[0, 19, 38, 255],
[19, 28, 88, 255],
[0, 63, 255, 255],
// 161
[127, 159, 255, 255],
[0, 41, 165, 255],
[82, 103, 165, 255],
[0, 31, 127, 255],
[63, 79, 127, 255],
[0, 19, 76, 255],
[38, 47, 126, 255],
[0, 9, 38, 255],
[19, 23, 88, 255],
[0, 0, 255, 255],
// 171
[127, 127, 255, 255],
[0, 0, 165, 255],
[82, 82, 165, 255],
[0, 0, 127, 255],
[63, 63, 127, 255],
[0, 0, 76, 255],
[38, 38, 126, 255],
[0, 0, 38, 255],
[19, 19, 88, 255],
[63, 0, 255, 255],
// 181
[159, 127, 255, 255],
[41, 0, 165, 255],
[103, 82, 165, 255],
[31, 0, 127, 255],
[79, 63, 127, 255],
[19, 0, 76, 255],
[47, 38, 126, 255],
[9, 0, 38, 255],
[23, 19, 88, 255],
[127, 0, 255, 255],
// 191
[191, 127, 255, 255],
[165, 0, 82, 255],
[124, 82, 165, 255],
[63, 0, 127, 255],
[95, 63, 127, 255],
[38, 0, 76, 255],
[57, 38, 126, 255],
[19, 0, 38, 255],
[28, 19, 88, 255],
[191, 0, 255, 255],
// 201
[223, 127, 255, 255],
[124, 0, 165, 255],
[142, 82, 165, 255],
[95, 0, 127, 255],
[111, 63, 127, 255],
[57, 0, 76, 255],
[66, 38, 76, 255],
[28, 0, 38, 255],
[88, 19, 88, 255],
[255, 0, 255, 255],
// 211
[255, 127, 255, 255],
[165, 0, 165, 255],
[165, 82, 165, 255],
[127, 0, 127, 255],
[127, 63, 127, 255],
[76, 0, 76, 255],
[76, 38, 76, 255],
[38, 0, 38, 255],
[88, 19, 88, 255],
[255, 0, 191, 255],
// 221
[255, 127, 223, 255],
[165, 0, 124, 255],
[165, 82, 145, 255],
[127, 0, 95, 255],
[127, 63, 111, 255],
[76, 0, 57, 255],
[76, 38, 66, 255],
[38, 0, 28, 255],
[88, 19, 88, 255],
[255, 0, 127, 255],
// 231
[255, 127, 191, 255],
[165, 0, 82, 255],
[165, 82, 124, 255],
[127, 0, 63, 255],
[127, 63, 95, 255],
[76, 0, 38, 255],
[76, 38, 57, 255],
[38, 0, 19, 255],
[88, 19, 28, 255],
[255, 0, 63, 255],
// 241
[255, 127, 159, 255],
[165, 0, 41, 255],
[165, 82, 103, 255],
[127, 0, 31, 255],
[127, 63, 79, 255],
[76, 0, 19, 255],
[76, 38, 47, 255],
[38, 0, 9, 255],
[88, 19, 23, 255],
[0, 0, 0, 255],
// 251
[101, 101, 101, 255],
[102, 102, 102, 255],
[153, 153, 153, 255],
[204, 204, 204, 255],
[255, 255, 255, 255]
];
module.exports = colorIndex;
}, {}], 13: [function (require, module, exports) {
/*
JSCAD Object to AutoCAD DXF Entity Serialization
## License
Copyright (c) 2018 Z3 Development https://github.com/z3dev
All code released under MIT license
Notes:
1) geom2 conversion to:
POLYLINE
LWPOLYLINE
2) geom3 conversion to:
3DFACE
POLYLINE (face mesh)
3) path2 conversion to:
LWPOLYLINE
TBD
1) support binary output
2) add color conversion
*/
const { geometries, modifiers } = require('@jscad/modeling');
const { geom3, geom2, path2 } = geometries;
const { flatten, toArray } = require('@jscad/array-utils');
const { dxfHeaders, dxfClasses, dxfTables, dxfBlocks, dxfObjects } = require('./autocad_AC2017');
const colorindex2017 = require('./colorindex2017');
const mimeType = 'application/dxf';
/**
* Serializer of JSCAD geometries to DXF entities.
* @module io/dxf-serializer
* @example
* const { serializer, mimeType } = require('@jscad/dxf-serializer')
*/
/**
* Serialize the give objects to AutoCad DXF format.
* @param {Object} options - options for serialization, REQUIRED
* @param {String} [options.geom2To='lypolyline'] - target entity for 2D geometries, 'lwpolyline' or 'polyline'
* @param {String} [options.geom3To='3dface'] - target entity for 3D geometries, '3dface' or 'polyline'
* @param {Object|Array} objects - objects to serialize as DXF
* @returns {Array} serialized contents, DXF format
* @alias module:io/dxf-serializer.serialize
* @example
* const geometry = primitives.cube()
* const dxfData = serializer({geom3To: '3dface'}, geometry)
*/
const serialize = (options, ...objects) => {
const defaults = {
geom2To: 'lwpolyline',
geom3To: '3dface',
pathTo: 'lwpolyline',
statusCallback: null,
colorIndex: colorindex2017
};
options = Object.assign({}, defaults, options);
options.entityId = 0; // sequence id for entities created
objects = flatten(objects);
objects = objects.filt