walkmap.stl

Utility functions dealing with stereolithography (STL) files. Not a stable API yet!

binary-stl

A codec for binary STL files

binary-stl-to-ascii

(binary-stl-to-ascii in-filename)(binary-stl-to-ascii in-filename out-filename)

Convert the binary STL file indicated by in-filename, and write it to out-filename, if specified; otherwise, to a file with the same basename as in-filename but the extension .ascii.stl.

canonicalise

(canonicalise o)(canonicalise o map-kind)

Objects read in from STL won’t have all the keys/values we need them to have. o may be a map (representing a facet or a vertex), or a sequence of such maps; if it isn’t recognised it is at present just returned unchanged. map-kind, if passed, must be a keyword indicating the value represented by the z axis (defaults to :height). It is an error, and an exception will be thrown, if map-kind is not a keyword.

centre

(centre facet)

Return a canonicalised facet (i.e. a triangular polygon) with an added key :centre whose value represents the centre of this facet in 3 dimensions. This only works for triangles, so is here not in walkmap.polygon. It is an error (although no exception is currently thrown) if the object past is not a triangular polygon.

decode-binary-stl

(decode-binary-stl filename)(decode-binary-stl filename map-kind)

Parse a binary STL file from this filename and return an STL structure representing its contents. map-kind, if passed, must be a keyword indicating the value represented by the z axis (defaults to :height). It is an error, and an exception will be thrown, if map-kind is not a keyword.

NOTE that we’ve no way of verifying that the input file is binary STL data, if it is not this will run but will return garbage.

facet

A codec for a facet (triangle) within a binary STL file.

stl->ascii

(stl->ascii stl)(stl->ascii stl solidname)

Return as a string an ASCII rendering of the stl structure.

stl?

(stl? o)(stl? o verify-count?)

True if o is recogniseable as an STL structure. An STL structure must have a key :facets, whose value must be a sequence of polygons; and may have a key :header whose value should be a string, and/or a key :count, whose value should be a positive integer.

If verify-count? is passed and is not false, verify that the value of the :count header is equal to the number of facets.

vect

A codec for vectors within a binary STL file.

write-ascii-stl

(write-ascii-stl filename stl)(write-ascii-stl filename stl solidname)

Write an stl structure as read by decode-binary-stl to this filename as ASCII encoded STL.