The delimiter for the number. Default is one space
The number of digits. Default is undefined and will not fixe the digits (number will be "as is")
Save or not the attributes. Default is true
Save or not the point geometry. Default is true
Any user data (undefined by default)
Usage for getting an encoder/decoder
const filename = 'myFile.obj'
const filter = IOFactory.getFilter(filename)
if (filter) {
// buffer is the content of the file
filter.decode(buffer, {shared: true})
}
Usage for registering a new filter
// Register a decoder/encoder for the extension abc,
// where myEncoder and myDecoder are your 2 functions
IOFactory.registerFilter('abc', {encoder: myEncoder, decoder: myDecoder})
Create a Gocad Polyline (DataFrame) from a string buffer
Create a Gocad Voule (DataFrame) from a string buffer
Create a Gocad Surface (DataFrame) from a string buffer
Create a Gocad Pointset (DataFrame) from a string buffer
Decode STL files either in ASCII or in BINARY format. When usnig node.js, you should be carreful of how you read the data before calling decodeSTL.
For example, for ASCII file, you should use:
const array = fs.readFileSync('object.stl', 'utf8')
const state = loaders.decodeSTL(array)
And when using BINARY file, you should remove the utf8
encoding and use the buffer
of the return array:
const array = fs.readFileSync('object.stl')
const state = loaders.decodeSTL(array.buffer)
Format in order to know this is a cube:
# nx: 10
# ny: 10
# nz: 10
# x y z a normal stress1
# sizes 1 3 6
0 0 0 9 1 3 2 0 0 0 0 0 0
...
Decode a dxf file in the most simple form. We assume a list of:
999
And this is a comment (previous group is 999)
LINE
8
Calque 1
999 x1
10
6.425910
999 y1
20
66.390800
999 x2
11
7.497000
999 y2
21
67.080556
0
...
A serie with itemSize=2 (i.e., 2D points) and such that 2 consecutive points form a segments. Therefore, the number of segments in the serie is simply the `serie.count/4``
Get the buffer object of a Gocad lineset
Get the buffer object of a Gocad volume
Get the buffer object of a Gocad triangulated surface
Get the buffer object of a Gocad pointset
Encode a set of lines given in DataFrame(s) in SVG format. Positions will be normalized in output and therefore we introduce a scaling and trabslation in option.
Options are:
Note that the scaling is applied before the translation.
Get the buffer object of an xyz pointset
Get the base name of a filename, i.e., the name without the extension
Get the extension of a filename
Merge several objects loaded by any filter into one. Take care of the reindexation of the topological elements if any (combinatorial elements of dim > 1, i.e., meshes lines, meshed surfaces, meshed volumes). Also, attributes (other series) are merged as well if and only if they have the same name and itemSize.
Options for getting a buffer (string) in XYZ format