I'm currently writing on an STL-Splitter, based on three.js STLLoader.js. This little Tool should parse a STL-File and save the floating points to an array. After this I look up which triangles are connected and save them to an string, which I send to an Server which creates a new STL File (with PHP). This actually works.
But after decoding the binary file and saving the floating points, I have no idea how to convert the floating points back to the correct format like this:
UINT8[80] – Header
UINT32 – Number of triangles
foreach triangle
REAL32[3] – Normal vector
REAL32[3] – Vertex 1
REAL32[3] – Vertex 2
REAL32[3] – Vertex 3
UINT16 – Attribute byte count
end
Currently I write it in ASCII-Format, doesnt matter which format you have. Maybe a little example or a keyword (which i can search for) could help.
Thanks for your Help ! (Sry if this is a "noob"-Question :/ )
I'm not sure in which language do you want to solve this but in javascript/node.js you have to create
buffer
with fixed size. Into the buffer you can add header (84 bytes) and then faces with normals. Usebuf.writeFloatLE()
function. In the end you can write whole buffer to file or do anything you want with it.