This is a Clojure library of miscellaneous abstractions and conveniences for
use in CAD work with Matthew Farrell’s
scad-clj
.
The Lojban word tarmi refers to a conceptual shape.
The core
module is trivial, meant only to reduce
boilerplate.
The util
module contains a few utilities that
leverage the power of Clojure to do fairly common CAD operations with OpenSCAD
primitives. It has a loft
function, but please read the fine print.
The maybe
module is very simple: It carries
drop-in replacements for scad-clj
functions that will produce as little
output as possible, for slightly shorter OpenSCAD artefacts. The maybe
version of translate
will compact a series of translations into one
operation in OpenSCAD.
The reckon
and flex
modules also contain drop-in replacements, but for the purpose of reasoning
about what a model will look like. reckon
has numeric versions of OpenSCAD
operations. flex
uses either reckon
or standard scad-clj
functions
depending on input.
The dfm
module exposes an error-fn
function.
This simple function represents a compromise between several concerns in DFM for ordinary 3D printers. It is based on these assumptions:
-
The target printer is correctly calibrated, but the combination of printer firmware and slicer software causes printed models to be larger than indicated by their blueprint: A measurable error.
-
z-level accuracy is beyond software control, as in FDM.
-
The size of the error is absolute for a given combination of printer nozzle, flow rate, material properties, temperature, cooling method etc. Thus, unlike errors due to a process of annealing, the size of the error predicted by
error-fn
does not itself vary with the size of the printed part, except at very small multiples of the nozzle diameter. -
The size of the error is about twice as big on the inside of a gap in the model as it is on the outside. In other words, if the outside diameter of a model grows by 0.1 mm in printing, a hole (i.e. negative space) in that model, caused by a difference() operation in OpenSCAD, will shrink by 0.2 mm.
These assumptions, and default values applied in error-fn
, are based
on tests of a LulzBot TAZ 6, an FDM printer with a 0.5 mm nozzle, running
its default Marlin firmware (version current as of 2018-11), slicing in Cura
(LulzBot edition, v3.2) and printing PLA at 100% flow. Results will vary
with other printers, slicers and materials. Measure the size of your error
with a test print and pass it to error-fn
to get a compensator.
Lastly, error-fn
assumes that negative space will be used to fit other parts,
such as threaded fasteners, where dimensions are sensitive. Therefore, negative
space is the primary use case. error-fn
primarily expects a negative value
as a measurement of error and will assume that any passed nominal measurement
passed to a compensator should be enlarged.
The thread-drawing function (threaded/thread
, deprecated since scad-tarmi
v0.5.0 in favour of scad-klupe
) is a reimplementation in Clojure of a
corresponding function in polyScrewThread_r1.scad
, created by aubenc at
Thingiverse and released by the author
into the public domain.
Copyright © 2018-2020 Viktor Eikman
This software is distributed under the Eclipse Public License, (EPL) v2.0 or any later version thereof. This software may also be made available under the GNU General Public License (GPL), v3.0 or any later version thereof, as a secondary license hereby granted under the terms of the EPL.