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)(canonicalise o map-kind scale-vertex)

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.

decode-binary-stl

(decode-binary-stl filename)(decode-binary-stl filename map-kind)(decode-binary-stl filename mapkind superstucture)(decode-binary-stl filename map-kind superstructure scale-vertex)

Parse a binary STL file from this filename and return an STL structure representing its contents. map-kind, if passed, must be a keyword or sequence of keywords indicating the semantic value represented by the z axis (defaults to :height).

If superstructure is supplied and is a map, the generated STL structure will be stored in that superstructure, which will be returned.

If scale-vertex is supplied, it must be a three dimensional vertex (i.e. the :z key must have a numeric value) representing the amount by which each of the vertices read from the STL will be scaled.

It is an error, and an exception will be thrown, if map-kind is not a keyword or sequence of keywords.

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.