Antimony:源自 Lisp 机器而非制图桌的 CAD 软件
Antimony: CAD Software Evolved from Lisp Machines and Not Drafting Tables (2015)

原始链接: https://www.mattkeeter.com/projects/antimony/3/

Antimony 是一个基于 Python 的 CAD 工具,围绕三个组件构建:DAG 图引擎、函数式/CSG 几何引擎,以及一个形状与变换的标准库。在一个 CAD 从 Lisp 机器演化而来的平行宇宙构想中,用户通过连接节点进行建模;每个节点是一个 Python 脚本,定义输入、输出和可选的交互式 UI 覆层,变化会向下游传播。几何以函数形式表示,渲染为着色位图,并可导出为高度图或锐边 STL 文件。库涵盖从基本变换到不寻常操作,用户还可定义自定义形状。Antimony 是来自 MIT Bits and Atoms 中心传承的活跃 beta 项目,提供 Mac/Linux 源码和预编译 Mac 应用;欢迎使用 Python 或 C++ 贡献。

**关于Antimony CAD软件的Hacker News讨论摘要** 一篇Hacker News帖子介绍了Antimony,Matt Keeter在2015年开发的CAD工具,灵感来自Lisp机器而非传统绘图板。Keeter本人也发表了评论,表示自2016年起已减少维护,但有一个名为Stibium的活跃维护分支。他概述了自己的职业轨迹:libfive(C++内核,现处于维护模式)、2020年关于GPU隐式曲面渲染的SIGGRAPH论文,以及当前基于Rust的项目——Fidget(内核)和Halfspace(IDE),正在开发GPU渲染后端。 评论者讨论了更广泛的代码CAD生态,列举了OpenSCAD、PythonSCAD、CADquery、Build123D和FluidCAD等项目。一个反复出现的主题是代码CAD与GUI CAD之间的权衡:代码CAD在程序化和参数化设计上表现出色,但因CSG操作导致不可预测的拓扑变化,在复杂模型上表现吃力。传统GUI CAD(Fusion、OnShape)在复杂编辑上处理得更好。 其他话题包括STEP文件作为常见交换格式(但它们是"哑"实体,不可编辑)、AI辅助CAD建模(有前景但需要大量手动精修),以及历史背景:AutoCAD的AutoLISP和Ivan Sutherland的Sketchpad(1963)都早于Lisp机器。多名用户强调FluidCAD是一个结合代码与GUI方法的前景广阔的混合方案。
相关文章

原文

about

Antimony is a computer-aided design (CAD) tool from a parallel universe in which CAD software evolved from Lisp machines rather than drafting tables.

demo

foundations

Antimony is built on three mostly-orthogonal axes:

  • A framework for tracking information flow through directed acyclic graphs
  • A geometry engine for doing CSG
  • A standard library of shapes and transforms

Graph engine

Solid modeling in Antimony is done by connecting nodes in a graph:
Graph example

Each node is defined by a customizable script. Antimony uses Python 3.x plus a few extra magic keywords.

Here's what the circle node above looks like:

import fab.shapes

# Define a set of input ports
# (and inject variables into the local namespace)
input('x', float)
input('y', float)
input('r', float)

# Call the 'circle' function in the standard shapes library
# using the variables that came in from the input ports
c = fab.shapes.circle(x, y, r)

# Create an output port that produces the circle shape
output('shape', c)

Nodes usually represent a primitive shape or transform. Links are tracked and changes are automatically propagated downstream.

Change propagation

The graph engine scales up to complex multi-part assembles.

Kelvin

Kelvin

Geometry engine

Antimony's geometry engine uses functional representations for solid modeling. This representation is particularly suitable for modeling with boolean operations (union / intersection / difference).

Boolean example

In the application, the geometry engine renders shapes as shaded bitmaps. They're then blitted to a 3D viewport.

Application screenshot

Antimony can export heightmaps for 2.5D processes and .stl files for 3D manufacturing. The .stl export includes feature detection to keep corners and edges sharp.

Mesh

Standard library

Antimony's standard library defines many shapes and transforms, from basic (rotate, scale, boolean operations) to unusual (attract, repel, bend).

These shapes are used in node definitions, which typically add input and output ports and can optionally define UI features.

Here's an example of a node that defines UI features:

import fab

title('Rectangle')

input('xmin', float)
input('ymin', float)
input('xmax', float, 1)
input('ymax', float, 1)

output('shape', fab.shapes.rectangle(xmin, xmax, ymin, ymax))

# UI
sb.ui.wireframe([(xmin, ymin, 0), (xmax, ymin, 0),
                 (xmax, ymax, 0), (xmin, ymax, 0)], close=True)
sb.ui.point(xmin, ymin, 0)
sb.ui.point(xmax, ymax, 0)

In the 3D viewport, the UI features defined at the bottom of the script are drawn over the rendering of the rectangle.

These UI features are hooked back into the graph: dragging the points at the rectangle's corners pushes changes to the graph node.

UI dragging

As an aside: most users will be satisfied with the built-in shapes, but it's also possible to define custom shapes.

Shapes are represented with a prefix string syntax that's easy to parse but a bit cryptic to decipher. Here's the definition for the circle shape used above:

def circle(x0, y0, r):
    return Shape(
            '-r+q-Xf%gq-Yf%gf%g' % (x0, y0, r), # math string
            x0 - r, y0 - r, x0 + r, y0 + r)     # bounds

Unpacking and hierarchically indenting the prefix string gives

-
  r
    +
      q
        -
          X
          f%g
      q
        -
          Y
          f%g
  f%g
% (x, y, r)

This encodes a distance field representation of a 2D circle:

f(x,y) = sqrt(pow(x - x0, 2) + pow(y - y0, 2)) - r

where x0, y0, and r are the circle's center and radius (specified when circle is called).

The exact mapping from prefix strings to infix functions is left as an exercise for the reader (or can be looked up in Appendix A of my thesis).

download

A prebuilt Mac application can be downloaded from the Github releases page.

Antimony's source is available on Github, along with instructions for building it on Mac and Linux.

development

Antimony is a long-running project under active development.

Development

It's at a beta level of stability: solid, but not recommended for mission-critical use.

If you're interested in contributing, there's a pretty low bar for entry. Given basic Python knowledge, you can get started making custom nodes (like this HSB color node contributed by RobotGrrl or the plethora of nodes contributed by Neil).

For more ambitious folks with C++ experience, there are a whole host of improvements that could be made, from speeding up rendering to cleaning up the UI and optimizing graph evaluation. Send me a note if this piques your interest.

history

Antimony grew out of my work on powerful personal-scale CAD/CAM workflows at the MIT Center for Bits and Atoms.

It's the latest tool in a line of software that included cad_ui and kokopelli, and draws inspiration from fabserver.

For a historical perspective, there are a set of earlier Antimony writeups:

  • Early 2014 (developed as a demo for the World Economic Forum)
  • Fall 2014 (updated for use in How to Make Almost Anything)

This update coincides with the 2015 edition of Fab Academy; use this search query to see how people are using it.

press & discussion

联系我们 contact @ memedata.com