Package: lisscad
lisscadis a library for generating OpenSCAD code from Lissp scripts.Don’t worry! You’re not supposed to track all the parentheses yourself. With an
automatic formatter likeparinfer, Lissp is easier than Python.FeaturesThe terseness of Lisp.The usability of Lisp. For example, with the-<>>“thread-through” macro of
Lissp, you can code for OpenSCAD operations in the order that they will be
executed, instead of the order they have in OpenSCAD scripts.Thelisscadpackage is executable on the command line to manage CAD
projects. This includes support for tracking a project withinotifyto
re-render work in progress.Boilerplate is minimal and explicit. It takes one line in CAD scripts to
importlisscad, and one line to transpile to OpenSCAD. Both of these and a
Git repo are included in a template for new projects.Most oflisscadis pure, type-annotated Python 3.10+. It can be used
without the Lissp layer. Conversely, you can use any Python code from Lissp.The data model is based on dataclasses, not object-oriented Python. Pydantic
handles type conversions for you in the back end.See also thegoalsof the project.InstallationOn Linux:pip install lisscadAt minimum, you also need OpenSCAD, which you must install separately. There
are several ways to do that. For example:sudo snap install openscadConveniences built intolisscadassume that you also havenohupandgitinstalled.Editor integrationLissp is not a common dialect, so you may need to inform your text editor that
it is Lisp. For example, if you are using Neovim, you can add the following to~/.config/nvim/init.vim:au BufRead,BufNewFile *.lissp             setfiletype lispFor Vim, only the file path is different (~/.vimrc).parinfer-rustis an
excellent Lisp autoformatter for Vim, Neovim, and other editors.UsageCommand-line interfaceTo start a new project:lisscadnewmyprojectcdmyprojectThe shape of your model(s) is defined bymain.lissp. Edit it. To render your
project to OpenSCAD once, run the normal Lissp compiler:lisspmain.lisspTo render a 3D model all the way to STL, pass a CLI argument via the Lissp
compiler with--:lisspmain.lissp---r
lisspmain.lissp----render# Equivalent long option.To view the most recently transpiled model in the OpenSCAD GUI:lisscadviewTo automatically transpile to OpenSCAD each time you editmain.lissp, so that
the GUI always shows the current version:lisscadtrackScripting interfaceThe vocabulary oflisscadis very similar to that of OpenSCAD.
However, some function signatures have been adjusted to reduce the overall
complexity of the interface.Example:lisscad’scubeis centred by default, becausesphereis
centred in both OpenSCAD andlisscad.Example: If you want to use a keyword argument to define an angle, it’s namedangle; it doesn’t vary.For maximum fidelity to OpenSCAD, use thelispprelude:(lisscad.prelude.._macro_.lisp)(translate'(10)(square'(23)))lisscadgives you the option of consistency with standard geometric and
English terms instead. For example, in itsenglishprelude,lisscadhas asquarefunction that draws squares, and arectanglefunction that draws
rectangles.(lisscad.prelude.._macro_.english)(right1(rectangle'(23)))When you runlisscad new, you get a version of theenglishprelude calledenglish-util. Named on a single line, this prelude combines the vocabulary ofenglishwith a set of higher-level utilities built intolisscad.For the use of operators like+, seehere.Historylisscadis loosely patterned afterscad-clj, ported from Clojure to another
dialect of Lisp. The new dialect, andlisscaditself, are implemented in
Python. This makeslisscadcomparable to numerous Python-based OpenSCAD
generators/transpilers, including SolidPython, SolidPy,openpyscad,pycad,py2scad,py-scadandpyscad.lisscadwas started to combine the best of its two ancestries: The simplicity
and elegance of a Lisp similar to Clojure, and the JVM-free accessibility and
startup time of Python. One notable difference is that whereasscad-cljuses
hash tables as an implementation detail in its intermediate data model, and
SolidPython has its own object-oriented data model,lisscaduses Pydantic
dataclasses.LegalCopyright (C) 2022–2023 Viktor Eikmanlisscadis licensed as detailed in the accompanying file COPYING.md.