Tandem: Reproducible Digital Fabrication Workflows as Multimodal Programs

Experimental digital fabrication workflows are increasingly common in human-computer interaction research, but are difficult to reproduce. We present Tandem, a software library that lets a fabricator implement an end-to-end fabrication workflow as a computational notebook program that others can run to physically reproduce the workflow. Tandem notebook programs read and write to CAD and CAM software, project augmented reality interfaces onto machines for manual interventions, and directly control fabrication machines. Fabricators can also denote potential mismatches between the physical and the digital as explicit assertions in code. Using two-sided CNC milling as an example, we demonstrate how to implement a complex workflow as a single program that can be re-run by others while supporting quality control and improving reproducibility.


INTRODUCTION
From 3D printing self-supporting edible structures [82] to laser cutting fine-tuned haptic devices [85], experimental digital fabrication workflows feature unconventional ways of working with code, machines, and materials.These workflows string together multiple software tools, demand precise tuning of machine and material setups, and require manual intervention.In human-computer interaction (HCI) and beyond, researchers have been pioneering experimental workflows as a burgeoning topic of work.(Left) the notebook interacts with Fusion 360 CAD and CAM, with the AR Overlay, and with the CNC mill via HTTP requests.the notebook makes these requests to a dedicated backend server that forwards the requests to the respective tool application, e.g., an add-in we wrote for Fusion 360.The AR overlay (bottom right) prompts the fabricator to make adjustments to the physical setup.(Right) Tandem's API communicates over HTTP with tool applications in the notebook.Top: sending a value calculated in the notebook to be set as a user parameter in Fusion 360 CAD; Middle: automatically generating a toolpath in Fusion 360 CAM to mill alignment holes; Bottom: rendering boxes on the mill's bed at specified positions using the AR overlay.
Yet, despite the rise of experimental digital fabrication in HCI, we are missing a robust way to share working implementations of research with others.In contrast, in fields like the basic sciences, reproducibility of past research is fundamental [2,50,55].Researchers and practitioners should be able to reproduce, validate, and build upon prior work.In the case of experimental fabrication, those who would benefit from reproducibility are not only novices to digital fabrication, but also experts unfamiliar with a newly invented fabrication workflow.
To illustrate this scenario, consider two personas separated by geographical distance: Florence, a community wood shop manager who is experienced with CNC milling; and Siena, an HCI researcher who is working on new interaction techniques for bringing craftbased techniques to CNC mill control.Florence has developed a workflow for doing two-sided milling, where a fabricator carefully mills on two opposite sides of a workpiece using a conventional 3-axis mill.Siena is eager to learn two-sided milling not only to increase the types of objects she can manufacture on her CNC mill, but also to apply techniques used in Florence's workflow to her own research.
However, there is currently no way for Florence to create reproducible versions of her novel digital fabrication workflows beyond writing a tutorial-a helpful but incomplete representation.When Siena follows text or video tutorials (e.g., [3,25,34,44,74]), she must manually re-implement every step of the workflow using her own software tools and machine hardware.Imprecise re-implementation can result in errors that are time-consuming and difficult to debug because Siena needs to reason about interdependent physical and digital states.Figure 3 shows example errors that arise in two-sided milling.In contrast, with digital-only programming, Siena can easily fork repositories, run the code to get an immediate result, read parts of code in depth, and experiment with her own changes.
In particular, three challenges stand out for Siena in replicating Florence's workflow.
(1) Florence uses several disparate software tools interdependently, including conventional CAD/CAM software.There is no single environment to present a linear sequence of steps for Siena to execute in code.(2) Siena must adjust physical machine and material settings to match assumptions made in digital code, or vice-versa; it is difficult for Siena to know when to manually intervene and how to do so.(3) Each step of Florence's workflow has implicit preconditions about what must be satisfied before running the mill.It is difficult for Florence to explicitly formulate these "gotchas" so that Siena does not repeat the same mistakes Florence encountered.
To provide an infrastructure for implementing reproducible versions of novel fabrication workflows, we present Tandem, a library and backend that lets fabricators like Florence implement their entire workflow as a computational notebook program (Figure 1).Florence uses Tandem's API to author her workflow as function calls to CAD and CAM software, to an augmented reality (AR) overlay for manual interventions, and to the CNC mill itself (Figure 2).Tandem also lets Florence include assertions in her code that check preconditions that she provides before fabricators like Siena execute error-prone milling steps.Fabricators like Siena then reproduce the workflow simply by executing the code, following instructions that (1) A milled alignment hole is too narrow for the dowel to fit, requiring a second set of holes to be milled.(2) The CAD design of a spoon features a handle that is too narrow and gets torn off by the mill.(3) Flipping the workpiece over an axis that deviates too much from an assumed axis of rotation results in an invalid post-milling geometry.(4) An error taken from an online forum [64] where a fabricator reported misaligned features while milling a guitar.Another forum user responded that the reason was that the alignment holes were asymmetric across the axis of rotation assumed by the original poster.
the notebook produces, and manually intervening as directed by the AR overlay; Siena may also interact with the code itself if she wishes to adjust parts of the workflow.
We evaluate the feasibility of Tandem by implementing an entire end-to-end two-sided milling workflow as a computational notebook program and producing four artifacts as a result (Section 7).We chose two-sided milling as an example novel fabrication process because it is more difficult than many; it involves tool changes, synchronizing machine and material setups in physical and digital states, measurement and manual inspection, and experimenting with milling feed and speed.We elected to explore this single workflow in depth rather than explore multiple digital fabrication workflows at a shallower level.While Tandem's features are most clearly showcased in two-sided milling, they can be applied to many other novel fabrication processes as well, including 3D printing, laser cutting, and laboratory automation (see subsection 8.3).
The structure of the paper is as follows: after describing related work, we first walk through how a fabricator who reproduces a workflow (Siena) uses a Tandem notebook; then, we walk through how an authoring fabricator (Florence) implements the workflow's CAD, CAM and machine control functionality using Tandem's API (Section 4).We then detail how Florence programs physical steps using the AR overlay (Section 5), and how Florence guards against a large class of easily preventable errors using assertions (Section 6).Finally, we describe the demonstration artifacts fabricated with the notebook alongside artifact-specific assertions (Section 7) before concluding with lines of future work that are now possible with a reproducible fabrication workflow (Section 8).

RELATED WORK 2.1 Replicating Experimental Digital Fabrication in HCI
We built Tandem to support the burgeoning body of work in humancomputer interaction that studies new ways of using digital fabrication machines.For example, experimental additive manufacturing workflows include: printing with Play-Doh [4], printing garments via selective underextrusion [15], printing a wireframe of an object [46], 3D printing of editable materials [82] and translating audio data to printed ceramic ware [10].In the last case, the authors noted the difficulty of explicitly representing the "how-to" of machinematerial negotiation, writing that the necessary "close relationship with the machine was possible because [Author 2] already had an excellent understanding and anticipating of what the printer could do, including the innovative use of the dwell command for the production of texture." These comments showcase how experimental workflows make assumptions about the physical setup that are difficult for future fabricators to implement.Not every paper includes the necessary details to navigate these assumptions, and, even in those that do, it remains difficult for other fabricators to translate experimental details into working code.
Experimental workflows, and their potential for physical-digital mismatches, also encompass subtractive manufacturing workflows other than two-sided CNC milling.For example, Zheng et al. [85] presented a technique for producing small haptic devices using only a laser cutter and POM material.While the authors developed a computational design sandbox for developing swatches of mechanisms, swatch production is specific to Zheng et al.'s particular workflow.There is no simple way to generalize this approach to different materials, machines, or toolpath choices.The same issue holds true for fabrication techniques that involve stencil-based production, for example, with biodegradable conductive materials [31] and conductive ceramic ware [84].Subtractive workflows for custom wood joinery [35] can fail if the corresponding digital tool does not model any unpredictable behavior with the milling machine.
Tandem aims to support such existing work in experimental fabrication and help generalize the material-and machine-specific constraints that authors have already explored in their respective workflows.By documenting both computational functionality and necessary human interventions, Tandem helps fabricators make their work more reproducible by others [2,55].The fabricator, Siena, mills alignment holes in a sheet of wood and inserts two dowels to form the alignment jig   (white).Moving to the main workpiece   from which the propeller will be milled (yellow), she mills the   down to exactly   in height and mills two additional alignment holes.We denote the top and bottom faces of   as   (red) and   (blue), respectively.Next, she fixtures   on top of   and mills   in two passes: a roughing pass and a finishing pass (not shown).Finally, flipping   over the predetermined axis of rotation ì , Siena mills all areas reachable from the bottom of the propeller into   , again in two passes.

Programming Tools for Fabrication
While many existing tools support programming for digital fabrication, few address concerns in experimental workflows that span digital and physical.
Most programming tools for fabrication focus solely on the CAD stage of a workflow, spanning domains such as carpentry [79], design enclosures for electronic devices [27], patterned designs for several types of fabrication processes [24], and countless others.Research in programming languages has targeted CAD, for example, by decompiling meshes to parametric CAD [49], improving language constructs for parametric histories [6], and generating designs via reinforcement learning over CAD datasets [77].However, these works operate wholly within the digital and not the physical sphere.In contrast, we contribute programming language constructs that tie CAD-level designs to physical concerns.A smaller area of work has investigated structured direct interaction with fabrication machines such as lathes [69], laser cutters [47], large format CNC drawing [39], and sheet material manipulation [70].In particular, Piovarči et al. [56], showed how to develop reinforcement learning algorithms to improve toolpath design using data observed from a camera.Overall, these examples are workflow-specific and Florence refines her two-sided milling process on her own.She then implements the steps of her process in notebook cells by writing source code with Tandem's library calls.Right) Siena navigates to the notebook in the browser, starts the Tandem backend on her laptop, and connects it to the projector and CNC mill.She works through the notebook to replicate Florence's workflow.
do not generalize to other cases.Tandem brings material-aware logic of these examples to a single programming environment.
Few prior works feature full-fledged programming environments that handle material and machine behavior at all.One example by Fossdal et al. [17,18] integrates machine and CAM actions within the Grasshopper visual programming environment [45].Other works use Excel [19] or creative Javascript coding environments [36,65].Tran O'Leary et al. showed how computational notebooks, normally used for digital-only applications, could be extended to provide a versatile programming environment for fabrication [71]; we build on initial concepts explored in this work to form Tandem's core programming environment.Compared to these works, Tandem builds on existing programming environments by adding integration with conventional CAD and CAM tools, adding integration with augmented reality guidance, and adding assertions to align code with empirical machine and material conditions.

Physical-Digital Guarantees Outside Fabrication
Most previous tools for experimental fabrication, be they one-off workflows or more extensive CAD, CAM, or programming tools, lack explicit ways to negotiate assumptions made in code with physical realities.However, outside of digital fabrication, researchers have indeed been representing physical factors as "first class" concepts that can be used in code [22].For example, Vrana et al. [75] proposed a system, Aquarium, that lets scientists program a wet laboratory workflow both as a high-level flow chart and as a userfacing step-by-step interface that technicians follow.We were particularly inspired by Aquarium's domain-specific language for building user-facing workflows that support warnings, preconditions, and links to physical reagent locations and equipment in the lab.In the same domain, Willsey et al. [78] built a language to implement lab protocols on a microfluidics machine.The system provides error correction through the use of computer vision; if the physical configuration of droplets on the machine deviate from an expected state, the system creates a new empirical program state and rolls back future commands.Apart from laboratory automation, formal methods can also guide crafters without expertise in creating foundation-pieced quilts [37].Similarly, they have been used extensively to verify VLSI chip designs [62], robot task specifications [32,33], and interactive programming by demonstration with robot arms [59].In general, we observe existing techniques to write programs that synchronize steps in code with physical requirements in laboratories, with quilting, or with robots.Such techniques have yet to be applied to digital fabrication tasks.Tandem is a first step towards reflecting machine and material states, alongside human input, in code itself.

Augmented Reality for Fabrication
One goal of Tandem is to help fabricators adjust physical circumstances, e.g., adjust the physical setup on a milling machine or change the position of the machine's tool.Tandem does so by providing a grammar of AR-based interactions that guides the fabricator to carry out these physical steps (see Section 5).This functionality complements an existing body of work in fabrication and humanrobot interaction (HRI) that leverages AR, for example: machine maintenance with AR [13,67], CNC milling with a camera feed that supports direct manipulation [48], AR-supported collaborative making with a robot arm [68], and projecting CNC machine parameters onto machine safety glass [52].
Outside of CNC milling, many HRI papers leverage AR to enhance interactions between humans and robots; Suzuki et al. [66] created a taxonomy of several design dimensions for this emerging space.One focus area is helping people work with understanding [29] and debugging [7] printed circuit boards by projecting data from schematics onto the physical boards.Follmer et al. [14] and Weichel et al. [76] both use AR to prototype interactions for returning physical 3D scan data back to a programming interface.Mahapatra et al. [43] further study pain points that fabricators face when working with data from existing physical constraints.AR methods have also been leveraged for mixed-reality 3D modeling [40], 3D printing [12,54,80], carving [20,21,86], laser cutting [47,57], building-scale construction [83], and for providing tutorials for fabrication machines [23,60,81].
These works prototype fixed interactions between a machine and an AR interface.In contrast, Tandem uses programmable AR interfaces within a coding environment-fabricators use AR interactions to specify what other fabricators must do to accurately replicate a given workflow.

WALKTHROUGH: REPLICATING AN EXISTING WORKFLOW
We now provide a high-level walkthrough of how a fabricator like Siena would follow Florence's notebook to replicate Florence's workflow; her goal is to CNC mill a spoon (Section 7).Section 4 provides a code-level explanation of how the workflow is implemented in part of the notebook.
To start the walkthrough, Siena would need to have installed Tandem's backend on her computer; then, she opens an Observable computational notebook [51] in her web browser; the notebook contains all the source code, prose, and input elements that she uses to interact with CAD/CAM tools and an AR overlay for interacting with the physical setup of materials on the mill's bed and with the mill itself.Note that our implementation provides a messaging service for the backend to communicate with the Shopbot PRSAlpha Mill [63] that we use; to use another machine instead, the fabricator would need a service built for that machine or custom built if one does not exist.
Once the notebook is open, Siena proceeds through the 6 notebook sections, which we represent in respective subsections below.We present the high-level progression of these steps in Figure 4 and moments corresponding to each step in Figure 6.

Prepare the CAD File
Siena opens the Fusion 360 CAD file of the spoon she wants to mill in Fusion 360.While there are several approaches to two-sided milling, Tandem's current approach uses two alignment dowels that hold the main workpiece, i.e., the piece of material being milled into a spoon, in the same place after Siena flips it over to mill the second side.This means that Siena must add an extra part to her CAD file, which we call the outer.The outer, pictured in Figure 6 Part 1, contains two precisely positioned holes for the alignment dowels and connects to the spoon itself using tabs.Using the notebook, Siena enters the diameter of the dowels she measured and the notebook automatically generates the outer in Fusion 360 CAD.

Mill the Alignment Jig
Next, Siena mills the alignment jig, which holds the main workpiece of the spoon in place while it is being milled (Figure 6 Part 2).Using the AR overlay, the notebook guides Siena through cutting down and positioning the jig workpiece from which she will mill the jig.The overlay projects a rectangle onto the the CNC mill's bed where the stock material goes.Once the physical stock is synchronized with the projection, the notebook changes the overlay to a new projection that shows Siena where she should drill screws to fixture the stock to the mill's bed.Using the dimensions gathered about the jig workpiece, the notebook then generates a toolpath in Fusion 360 CAM for the machine to mill the alignment holes in the jig workpiece.It then guides Siena through manually setting the zero (the XYZ origin) on the CNC mill to match the zero assumed by the toolpath in CAM.Finally, the notebook generates low level machine instructions for the toolpath and lets Siena dispatch the instructions to the mill directly from the notebook.After the holes have been milled in the jig workpiece, Siena presses the dowels into place to complete the jig.

Mill the Main Workpiece to the Correct Height
Next, Siena moves to the main workpiece and mills it down to the exact height of the spoon that will be milled.She mostly repeats the same steps she took with milling the alignment jig except for using the main workpiece.However, because the mill will remove all material above a certain height, she must be careful to screw the main workpiece to the bed so that the screws lie below the lowest cut that the mill will make.To do this, Tandem uses counterbores that position the top of a screw lower than the top of the material that it is screwed into, as shown in Figure 6 Part 3 post-milling.The notebook calculates the depths and locations of the counterbores that Siena needs to make and projects a visual guide using the AR overlay (Figure 12 Right).

Mill Alignment Holes in the Main Workpiece
Once the main workpiece is milled to the exact height of the spoon, Siena works through steps in the notebook to mill alignment holes in the main workpiece.This is the same as milling holes in the alignment jig, except applied to the main workpiece.

Mill the Top-Down Cut (Face A)
After the four previous preparation steps, Siena is finally ready to mill the spoon itself.The notebook guides Siena through otherwise error-prone steps.First, the the notebook generates toolpaths in CAM that mill the main workpiece from the "top-down" before Siena flips the workpiece on the alignment jig and mills "bottom-up" from the perspective of the workpiece.Next, the notebook asks Siena to establish a designated axis of rotation ì  around which she will flip the part.the notebook adjusts the origins in CAM to match this axis.Finally, the notebook prompts the AR overlay to preview the cut before milling so that Siena can visually confirm that the cut looks correct before dispatching it from the notebook; the workpiece then looks like that shown in Figure 6 Part 4.

Mill the Bottom-Up Cut (Face B)
Now, Siena has milled the spoon completely from the top downwards, but she must flip it over to mill the parts that were unreachable with the workpiece's first orientation.To this end, the AR overlay prompts Siena to flip the workpiece in this direction according to ì , which was set previously.Siena then mills the bottom-up cut (Figure 6 Part 5), removes the main workpiece from the mill, and separates the spoon from the tabs, concluding the workflow.

IMPLEMENTING A WORKFLOW USING TANDEM
To better describe how Florence uses Tandem's API to implement her workflow as a notebook for Siena to use, we walk through the code for the first two sections of the notebook1 : preparing the CAD model and milling the alignment jig.

Prepare the Model in CAD
In our implementation, the notebook communicates, for both CAD and CAM functionality, with Autodesk Fusion 360.We assume that Siena has already modeled the object she wishes to fabricate in Fusion 360.Then, she uses the notebook to talk directly to Fusion 360 and make necessary adjustments for two-sided milling.For example, the notebook prompts her to measure the diameter of two dowel to be used to hold the workpiece in place during milling.To do this, the notebooks uses a coeffect function, which generates a user input element; when Siena types in the diameter or adjusts the slider, that value is captured in the variable dowelDiam, as shown in the notebook snippet in Figure 7. Since CAD and CAM state is stored in Fusion 360, Siena can still make adjustments in Fusion 360 and re-run any necessary effect functions from the notebook.For all notebook snippets, the notebook cell, which contains the source code, appears below the result of evaluating the code.In this case, the coeffect_range function generates the slider element above and assigns the current value of the slider to dowelDiam. 2hen, in Figure 8, Siena sends the diameter of the dowel to Fusion 360 to be set as a user parameter, which is a value that Fusion 360 can reference to set the actual diameter of the hole in CAD, mutating the model accordingly.To do this, she uses an effect function, i.e., a function that generates a button that, when pressed, sends the value to Fusion 360.Effect functions send messages to Fusion 360 CAD and CAM, to the AR overlay, or to the CNC mill-we refer to these recipients as tool applications.They take commands as arguments, which contain parameters that dictate what the receiving tool application should do; for example, Figure 12 shows commands for changing the AR overlay.We generate a button that must be  pressed first, rather than simply sending the value, because Observable Notebook is a live programming environment that frequently re-evaluates cells when related cells change.Thus, eagerly sending the values would result in extraneous messages being sent.
Once Siena presses the button, Tandem knows that the model in Fusion 360 has the correct user parameter for the alignment holes.Afterwards, the notebook walks her through several more steps, including: generating the outer, which bounds the artifact to be milled; generating the alignment holes in the outer; and generating tabs that connect the outer to the artifact.At the end of this notebook section, the CAD model is ready to be transformed through CAM into toolpaths that dictate the mill's motion.

Mill the Alignment Jig
The alignment jig consists of a flat sheet of wood (the jig workpiece   ) with two dowels that are press-fit into respective alignment   holes.To properly generate the toolpath for the alignment jig, Siena must measure the physical material's dimensions and location.
To align the physical dimensions and position of   with code in the notebook, Siena uses a coeffect function (sliders) to generate a contingent list of dimensions and position on the mill bed (Figure 9).
In Figure 10, she then uses the gathered data to construct a command for the AR overlay (more information in Section 5).Next, she passes the command to an effect function to project a rectangle of light corresponding to the contingent dimensions via the AR overlay, as shown in Figure 12 Photo 1.
Siena iterates by changing the dimensions on the sliders and/or repositioning or cutting down the jig workpiece.After this iterative process, the AR projection, representing the dimensions sent from the notebook, matches the top of the physical jig workpiece.Siena then checks a box generated by a coeffect function (Figure 11) so that the function now evaluates to true; this result can subsequently be used in an assertion (see Section 6).
Once the dimensions and position in the notebook are matched with the physical setup, the rest of the section generates a CAM setup with this information, helps Siena zero the tool according to the CAM setup, fixtures   , generates a toolpath from the setup, and dispatches the cutting job.

THE AR OVERLAY
The preceding programming examples show how Florence programs the AR overlay to let Siena "read from" and "write to" the state of the physical setup.Through a declarative syntax, Florence writes code to help Siena position a workpiece, drill fixture screws at designated points, double-check machine zeroes, and more.Specifically, the AR overlay is an interface projected from a projector mounted above the CNC mill onto the mill's bed.We implemented the AR overlay as a standalone web page whose appearance changes based on overlay commands (see below) sent from the notebook.

Overlay Grammar
Siena interacts with the AR overlay by sending commands in JSON syntax to Tandem's backend.A command consists of projected marks, which help her complete a step in the notebook.A mark could be an outline of where she should place the stock, a crosshair indicating where the center, or zero, is, or a more complex visualization, such as the toolpath of certain steps, like surfacing the stock.For each step in the notebook, Siena can send a group of marks to the projector using the "Send to Overlay" button, which appears after calling the respective effect function.The overlay and notebook together provide visual and text directions on how to accurately complete each step needed for the workflow.
The code snippets included in Figure 12 show the syntax fabricators use to create different overlay commands to send to the projector.Florence specifies several properties in the command for Siena, e.g., the type of mark, mark location, and arguments to pass to the overlay.For example, for the screwDepth annotation, stock thickness and model height are both needed to calculate a safe drilling depth.

Toolpath Visualizations
One important mark for overlay commands is toolpath, which projects a visualization of the toolpath for a certain step in the milling workflow.For example, Figure 14 shows an overlay for milling the main workpiece down to the correct height.We implemented the "toolpath" mark by extending techniques proposed in previous work on AR toolpath visualization [72].Figure 13 shows two overlays corresponding respectively to the roughing and finishing passes for   for the propeller.

Calibrating the Overlay
To calibrate the overlay for her machine-projector setup, at the beginning of the notebook, Siena projects a calibration rectangle onto the CNC mill's bed.She sets the position and dimensions of the rectangle to match a ground truth rectangle on the mill's bed; the rectangle should encompass the area in which she will place workpieces.Siena then drags the distorted projected rectangle's corners to match the ground truth rectangle on the bed.From these four point transforms, Tandem computes a homography that ensures that marks appear at the correct  and  location on the bed at depth  = 0.For greater depths, i.e., marks projected on a workpiece, we downscale the projection by a factor of 1 −    where  is the thickness of the workpiece and   is the distance from the projector's lens to the machine bed.With this relatively simple calibration technique, we found that test marks projected where precise within 3mm of the specified position.More sophisticated techniques could reduce this margin of error.

PHYSICAL DIGITAL ASSERTIONS
When implementing her workflow in Tandem, Florence wants to prevent future fabricators like Siena from encountering the same errors she did.As with any novel fabrication workflow, errors arise from many sources: digital logic, material behavior, artifact geometry (CAD), manufacturing settings (CAM), and setups on the physical machine.Further, many errors arise from mismatched assumptions between these disparate factors.For example, CAM software may assume a given coordinate space origin (the zero), but the zero assumed by the fabricator in their physical setup is different (see Figure 16).Errors with novel workflows can range from being time-consuming at best to catastrophic at worst.
To solve this problem, Tandem lets workflow implementers like Florence write physical-digital assertions in the workflow's code.In digital-only programs, assertions check whether a predicate evaluates to true, and, if not, typically halts program execution; for example the Python statement assert material_thickness > 0 will raise an exception at runtime if the variable material_thickness is less than zero.Assertions are available in most modern programming languages, including some end user programming environments [5].The goal of physical-digital assertions is to extend the reach of assertions from digital-only code to now include fabrication workflows.

Example Assertions
We briefly walk through examples of how Florence notices where she can write assertions and how she does so in Tandem.As a simple example, Florence wants to let fabricators know to install a quarter-inch flat end mill before milling the alignment jig.Intuitively, Florence wants to make sure that Siena and any other fabricators using the notebook mill the alignment jig only if they have first installed the correct tool.Equivalently, we can say that the code that mills the jig executes only when a prior tool installation assertion evaluates to true.
As basic tool change assertion, Florence writes her precondition as a predicate in Javascript code as shown in Figure 15.As with other calls to coeffect_toggle, the notebook generates a checkbox with a label instructing Siena to check the box only if she has manually changed the tool to the specified end mill.Because coeffect_toggle evaluates to true if the checkbox is checked and false otherwise, mainEndMillInstalled is a valid predicate.In an adjacent notebook cell, Florence can also describe in prose why her precondition is necessary, e.g., to prevent leftover material that can result from drilling the jig with a ball end mill.Florence then passes mainEndMillInstalled as an argument alongside other predicates to the requires function which evaluates to true exactly when all the predicates evaluate to true.As shown in Figure 17, the result of requires is thus a "checklist" of preconditions that must be fulfilled before Siena can a run the jig milling step on the physical machine.She passes the result to the effect function effect_sendToMill; if precondFinishing evaluates to false, then the button generated by effect_sendToMill will be disabled to prevent error-prone milling.
Altogether, combination of requires and an effect function comprises a physical-digital assertion.Florence then repeats the process for each milling step in the notebook, first writing predicates that are specific to each step, then combines them using requires whose resulting value she passes to each effect function.As a more complicated example, consider the final predicate in Figure 17, "CAM zero matches physical zero." This predicate means that the origin used in the CAM setup-where the point (0, 0, 0) is assumed to be in relation to the stock material-must match the true physical location at which the machine was zeroed (see Figure 16).To zero the machine, Siena must first move the tool head to the desired location and then run the zeroing command on the mill, which sets the location to (0, 0, 0).This establishes a local coordinate system relative to the stock material, while the world coordinate system remains relative to the unchanging machine bed.
To implement this predicate, Florence must check that the origin used in the CAM setup visually matches the zero set in hardware using the overlay and user confirmation.To do so, she writes an effect function to safely move the mill's tool to the zero currently in hardware.The notebook then prompts fabricators like Siena to visually compare the current position of the tool in hardware with the zero assumed in the CAM setup; Siena checks the predicate's checkbox to confirm a visual match.

Scope and Limitations of Assertions
The goal of assertions is to allow Florence to prevent a large set of predictable errors from occurring when Siena uses the notebook by explicitly including checks and preconditions in the notebook's code.Just like in digital-only code, assertions cannot prevent all errors.In Tandem's case, assertions focus on errors that are easily preventable as long as Siena is made aware of prerequisite steps such as mismatched CAM zeros, tool changes, and material positioning.While these checks may be "trivial" to those experienced with a given workflow, they are easily missed as workflows grow more complex or deviate from techniques that Siena is used to.Assertions can be more or less useful depending on their implementation in code.For example, Florence could improve the simple checkbox that Siena checks to verify that the correct tool is installed.Namely, she could implement a model that uses computer vision to classify the currently installed tool 3 .In addition, rather than using a hard-coded end mill, Florence could query the current CAM setup's designated tool using a coeffect function.Currently, predicates primarily rely on user verification such as checkboxes to "sense" physical state; this suffices for many types of assertions we encountered.Still, in future work, we intend to leverage sensor data, such as video feed, touch sensors, and audio data to automatically satisfy or invalidate assertions based on empirical data (see subsection 8.2).
Finally, assertions are not meant to be absolutely binding.Like any programmer, Siena can check off, rewrite, or remove an assertion if she finds her own working style is at odds with an assertion that Florence implemented.Even in this case, Florence's assertion still serves as a "heads up" and Siena can add the assertion back in later if needed.Also, we note that physical-digital assertions are not the same as design rule checks that occur solely within CAD or CAM, e.g., checking for collisions while simulating a toolpath.Instead, these assertions concern potential errors that cross between physical setup and CAD/CAM, such as synchronizing the zero in CAM with the zero set on the machine.

DEMONSTRATIONS
To demonstrate Tandem, we (the authors) used our two-sided milling program to mill four artifacts: a propeller, a spoon, a bowl, and a printed circuit board (PCB).As we fabricated each artifact, we documented the challenges we faced, e.g., the spoon snapping during a roughing operation.To prevent other fabricators from encountering these same errors, we formalized assertions for each object or implemented additional notebook functionality to support future notebook users.Again, in all cases, we assume that the fabricator has already designed an initial 3D model or PCB layout of the artifact they wish to produce since Tandem focuses on post-modeling steps of the workflow.

Propeller
We first fabricated a drone propeller with extremely thin blades (Figure 19) that are difficult to mill (4.7mm thick, 248mm total length).Because the propeller was relatively long and thin, it was prone to heavy vibration during the bottom-up cuts.Further, we had to ensure that the line through the alignment holes was completely parallel to the machine's y axis to avoid moving the alignment jig post-fabrication.In one instance, having both a misaligned alignment axis and insufficient tabs tore through a blade (Figure 3, 3).
To minimize the chance of tear-out occurring while milling the thin blades, we established two assertions: (1) there must be four tabs holding the propeller to the outer, two at the blade tips and two at the center of the propeller, and (2) the alignment holes must be axis aligned.To implement the first assertion, we simply ask in the notebook whether the fabricator has manually created four tabs where the origin ("zero") is designated as the center of the stock on the x and y axes (red), and a CAM setup  ì   where the origin is designated as a constant location on the machine bed (blue).(Right) assuming  ì   , if the fabricator sets the physical zero ì  1 at the top left of the stock, the mill will cut through only half of the stock.Similarly, assuming  ì   , with ì  2 as the physical zero, the mill will crash catastrophically into the stock and the bed.Assuming  ì   , if the fabricator zeros on the stock at ì  3 , then the mill will instead cut air far from the stock.in CAD; to implement the second, we projected the location of the alignment holes as calculated earlier in the notebook, alongside a line representing the axis of rotation ì .Using a coeffect function, we manually checked whether the true alignment holes corresponded with the projected locations; if excessive deviation is observed, we added code in the notebook bridge to guide the user to re-mill the alignment holes.Finally, using the precondition function, we required both checks before a fabricator could begin the top-down and bottom-up cuts.

Spoon
Compared to the propeller, fabricating the spoon raised additional challenges due to its asymmetrical form in the XZ plane; it has a low, shallow bowl with a long, thin handle that rises up vertically (see Figure 20).Despite creative placement of tabs, we found that if any part of the spoon's handle was below a minimum thickness, the spoon bowl would tear out during milling.
To counteract this, we developed an assertion that enforces a minimum thickness requirement along the longest axis of the spoon, in our case, the y axis.Formally, we express this assertion as checking the intersection of the XZ cut plane with the spoon at all points on the y axis through the body of the spoon: where  is the body denoting the artifact, in this case the spoon,  (  ) is the XZ cut plane with its origin at (0,   , 0),   is the minimum thickness (dimension in the z direction) of the intersection of the cut plane and the artifact, and   is a user-defined minimum thickness value.
To implement this assertion, we added code in the notebook bridge that analyzes the CAD model in Fusion 360.For now, it opens the model in section analysis mode (Figure 18) and asks the user to manually verify that the the minimum thickness is met.In the future, we aim to fully automate this process in the tool application.We added this assertion before fabricators mill anything at all; if their model is too thin, the notebook will prompt them to edit it in CAD to conform to a minimum thickness requirement.

Plywood Bowl
Next, we milled a bowl out of a glued stack of plywood.The bowl's design features multiple layers of laminated wood in its profile (Figure 21).We chose the bowl as a larger artifact to mill than the previous two, too large, in fact, to mill on most conventional mills for metal.It measures 300mm wide, 250mm long and 38mm tall.
Accordingly, we faced challenges of scale and size.First, unlike one-sided milling, the maximum thickness of any millable artifact is limited by the maximum length below the collet of the shortest end mill.To prevent fabricators from realizing this too late during the milling process and then needing to start over, we implemented additional checks in the form of a coeffect function that asks for the maximum depth-below-holder values for all end mills to be used during the process.The coeffect function then checks the height of the model and warns the user if the model is too tall for the given end mills.
Second, the main workpiece must itself be fabricated in advance from pieces of plywood cut from larger stock; we provided additional functionality for generating the CAD and CAM to mill stackable pieces to create the main stock.Namely, for a desired artifact thickness   and plywood thickness   , we mill exactly  pieces from the larger stock, where which results in the minimal necessary thickness of the workpiece that must be wasted by milling down to artifact height     =   −   .

Printed Circuit Board
As a final example, we implemented two-sided milling of a different type of artifact: printed circuit boards (PCBs).We implemented a separate notebook program that works with a PCB layout in Fusion 360 standalone 3D models.Our notebook program takes a 3D model that Fusion 360 generates from the fabricator's PCB layout (Figure 22) as input and generates the following CAM operations to dispatch to the mill, in order: cutting traces on the top layer, drilling through-holes, cutting traces on the bottom layer, and cutting out the outline of the entire board.
For milling PCBs, we used the Clank open-source small-format mill [58], which has a static bed and space above the tool carriage where we mounted a mini laser projector.We controlled the mill with a Duet2 control board [9] connected directly to the fabricator's computer over a single-pair Ethernet connection.To communicate directly with the mill, we added additional functionality to the Tandem backend to forward HTTP requests sent from the notebook directly to the Duet2 control board.

LIMITATIONS AND FUTURE WORK 8.1 Characterizing and Formalizing Material Behavior
Currently, Tandem uses standard techniques for accommodating material constraints.For example, if a fabricator uses Tandem to generate a setup for milling a step, Tandem sets the feed and speed values of the mill to an appropriate default for the given material, such as soft wood like fir, hard wood, or plywood.Thus, some material-specific assertions are possible; for example, a notebook could prompt the user to verify that they are milling wood and not foam for fine detailing work.However, fabricators often need to experiment with settings like feed and speed depending on the actual results that they obtain with their mill given a certain material.Tandem does not yet support automatic adjustment of parameters based on the observed response of a workpiece being milled.To address this, in future work, we plan to include support for gathering empirical data about material response.For example, for milling a propeller, Tandem could support a fabricator like Florence in helping future fabricators like Siena select an appropriate feed rate for milling the ends of the propeller blades, which are prone to excess vibration.In this case, Tandem would generate several thin test cuts, each milled with a different feed rate.Tandem would prompt Siena to select a rate that does not result in breakage yet is not excessively slow.Her selection would then fulfill an assertion that Siena must select an appropriate feed rate for milling the propeller blades.

Automatically Sensing Manual Interventions
The need for material characterization raises another opportunity for future research: integrating sensing into Tandem programs.Currently, coeffect functions rely on manual verification that a fabricator enters into the notebook by means of user interface elements.This approach offers some benefits, including prompting fabricators to physically intervene and identify the state of a physical setup at a tactile level.Further, in most cases, measuring electrical and thermal properties of a material requires manual inspection with a multimeter or thermometer, respectively.Yet, manual verification can be slow, cumbersome, and difficult to characterize features such as electrical properties or heat.An important future line of work, then, would be integrating automated sensing into Tandem programs.One important sensor would be a camera; though we initially explored camera-projector interactions for the AR overlay, we decided to focus solely on manual interventions for the scope of this paper.In future work, we plan to leverage camera support to automate some assertions, such as finding the position and geometry of a workpiece on the machine bed.Other techniques like speckle sensing [11] or motor torque monitoring [42] could aid novices in setting reasonable initial feed and speed values like in the example above.Sensing would also let fabricators program workflow-specific versions of runtime monitoring, e.g., pausing a CNC mill if a workpiece deviates from its fixturing.We envision a larger body of work that explores implementing closed-loop control for fabrication (e.g., as explored by Piovarči et al. [56]) in Tandem.

Generalization to Non-Milling Fabrication Techniques
Though we designed and implemented Tandem as a platform for any experimental digital fabrication workflow, this paper focuses only on two-sided CNC milling, a subtractive manufacturing workflow.The single-workflow focus let us describe Tandem's functionality in all the complexity that this single workflow entails.However, other experimental workflows, such as those mentioned in Section 2, navigate different physical-digital mismatches than those faced here.Nonetheless, this limitation also highlights a strength of Tandem: fabricators can program their own workflows and tests that are specific to additive manufacturing and laser cutting.
As an example, we briefly discuss how Tandem could help a fabricator like Florence implement an experimental 3D printing technique, Wireprint, as a notebook [46].Wireprint is a technique for 3D printing a wireframe of an object, rather than an entire solid body; the approach is difficult to replicate and has not yet seen widespread adoption 4 .The approach involves several steps: designing a geometry in CAD that is feasible with the approach, generating wireframe triangles from the geometry, and adjusting the printer's feed, extruder, and pause parameters.
Using Tandem, Florence could write effect functions that bring the CAD model into the notebook as an STL before passing it into the toolpath generation algorithm.She would then write code, possibly using graphical elements from coeffect functions, that help fabricators like Siena adjust feed, extrusion, and pauses at different points in the toolpath.Florence would design the notebook to progressively print more complex parts of a wireframe, starting with a single triangle, moving to a surface of triangle, and finally to concentric slices of the model.Florence would use assertions to ensure that Siena debugs and fabricates simpler constructions before moving on to more intractable ones.Florence could also use assertions to analyze the model's feasibility for the Wireprint approach; for example, an assertion could reject geometries with overhangs or non-concentric parts and ask the fabricator to redesign those parts.Finally, while AR functionality would likely not be useful for the Wireprint workflow, it could be useful for novel 3D printing workflows that involve precisely printing on existing geometries [8,28].

Notebooks versus External tools
The benefit of the notebook is that Florence can lay out her steps sequentially so that Siena can follow along in one environment without the additional cognitive load of managing many applications at once.Though the notebook uses Tandem's API to read and write to Fusion 360, the actual state of the CAD model and CAM setups still lies outside of the notebook.Siena is free to make adjustments to CAD and CAM in Fusion 360 itself, independently of the notebook's instructions.Still, we could imagine a future where CAD and CAM functionality were part of the notebook itself; for example, a fabricator could simply call a function to open a CAM environment within the notebook.Some tools provide basic CAD functionality for web environments [53] and even for Jupyter [30] computational notebooks [26,61].Unfortunately, two-sided milling called for more mature CAD and CAM functionality than these tools offer.Ideally, future versions of Fusion 360 could support embedded CAD and CAM windows inside notebook environments.Alongside Fusion 360, future fabricators could expand Tandem's backend to interface with 3D printing-specific CAM, such as Cura, Formlabs PreForm, or Slic3r, all of which have respective APIs [1,16,73].

Encouraging Practice and Debugging Skills
The goal of Tandem is to perform all the major steps of a digital fabrication workflow from a single program and check that prerequisites are satisfied during the workflow.It thus complements, not replaces, the need for craft-specific knowledge and hands-on tool education.The notebook scaffolds Siena's understanding of why she must do something and how the workflow works and how to avoid errors.Future iterations of fabrication-as-reproducible notebooks could include extra steps for encouraging debugging [41] and practice [38].

CONCLUSION
Through sustained attention to an example experimental workflowtwo-sided CNC milling-we have shown why reproducing workflows is unexpectedly complicated yet crucial for research and practice.Through Tandem, we addressed this issue by making sharing experimental workflows more like sharing code.Tandem breaks the different parts that must occur into programmable components: changes to the design of 3D models, changes to the movements of machines, control of machines themselves, and the setup of the physical environment as necessitated by decisions in software.Tandem programs explicitly include unspoken preconditions that allow future fabricators to safely carry out and modify workflows, rather than leave this knowledge as informal lore passed down only in machine shops and makerspaces.
Overall, Tandem challenges an unsustainable status quo of a workflow as an abstract concept spread across multiple pieces of software and physical assumptions.Instead, Tandem provides the computational "glue" for concrete implementations of fabrication research.Through programming, Tandem unites disparate requirements for experimental fabrication in HCI and encourages a holistic, reproducible notation of physical-digital labor.

Figure 2 :
Figure2: Tandem System Architecture.(Left) the notebook interacts with Fusion 360 CAD and CAM, with the AR Overlay, and with the CNC mill via HTTP requests.the notebook makes these requests to a dedicated backend server that forwards the requests to the respective tool application, e.g., an add-in we wrote for Fusion 360.The AR overlay (bottom right) prompts the fabricator to make adjustments to the physical setup.(Right) Tandem's API communicates over HTTP with tool applications in the notebook.Top: sending a value calculated in the notebook to be set as a user parameter in Fusion 360 CAD; Middle: automatically generating a toolpath in Fusion 360 CAM to mill alignment holes; Bottom: rendering boxes on the mill's bed at specified positions using the AR overlay.

Figure 3 :
Figure 3: Examples of Errors that Arise in Two-Sided Milling.(1)A milled alignment hole is too narrow for the dowel to fit, requiring a second set of holes to be milled.(2)The CAD design of a spoon features a handle that is too narrow and gets torn off by the mill.(3) Flipping the workpiece over an axis that deviates too much from an assumed axis of rotation results in an invalid post-milling geometry.(4) An error taken from an online forum[64] where a fabricator reported misaligned features while milling a guitar.Another forum user responded that the reason was that the alignment holes were asymmetric across the axis of rotation assumed by the original poster.

Figure 4 :
Figure4: Schematic of Two-Sided Milling a Propeller in Tandem.The fabricator, Siena, mills alignment holes in a sheet of wood and inserts two dowels to form the alignment jig   (white).Moving to the main workpiece   from which the propeller will be milled (yellow), she mills the   down to exactly   in height and mills two additional alignment holes.We denote the top and bottom faces of   as   (red) and   (blue), respectively.Next, she fixtures   on top of   and mills   in two passes: a roughing pass and a finishing pass (not shown).Finally, flipping   over the predetermined axis of rotation ì , Siena mills all areas reachable from the bottom of the propeller into   , again in two passes.

Figure 5 :
Figure 5: Programming and Handing Off a Notebook.Left)Florence refines her two-sided milling process on her own.She then implements the steps of her process in notebook cells by writing source code with Tandem's library calls.Right) Siena navigates to the notebook in the browser, starts the Tandem backend on her laptop, and connects it to the projector and CNC mill.She works through the notebook to replicate Florence's workflow.

Figure 6 :
Figure 6: Moments from Siena's Steps in the Notebook.(1) Given the already modeled spoon, Tandem generates the outer and tabs that surround the spoon.(2) A completed alignment jig.(3) The main workpiece   after being milled to the height of the spoon   .(4) The top face   of the main workpiece   after milling the top-down cut.(5) The bottom face   of the main workpiece   after milling the bottom-up cut.

Figure 7 :
Figure 7: Prompting for User Input with a Coeffect Function.Some properties are omitted in the listing for brevity.

Figure 8 :Figure 9 :
Figure 8: Mutating an External CAD Model with an Effect Function.

Figure 10 :
Figure 10: Using Position and Dimensional Information to Generate a Command.When sent to the AR overlay, the command generates a rectangular projection on the machine's bed corresponding to the values provided.

Figure 11 :
Figure 11: Coeffect Function for Checking that the AR Overlay's Workpiece Projection Aligns with the Physical Workpiece.

Figure 12 :
Figure 12: Example Overlay Commands on the Physical Setup (top) and the Command Syntax (bottom).(1) Projecting a red rectangle with the same dimensions as the stock helps the user place the stock correctly on the bed before milling.(2) Projecting a crosshair at the center (or zero) of the stock helps the user zero the machine at the center of the stock, as assumed in a corresponding CAM setup.(3) The screwDepth annotation generates lines that show the top/bottom surfaces of the stock and drill bit as well as a label that indicates how deeply the user must drill the screws when securing the stock to the bed before milling.

Figure 13 :
Figure 13: Toolpath Visualizations for the Roughing (left) and Finishing (right) Milling Passes for   of the Propeller.

Figure 14 :
Figure 14: Preventing Leftover Stock while Milling the   to the   .(1) Slight deviations in the physical position of   , versus the ideal position, can cause leftover "slivers" of unmilled stock.(2) A screenshot of the web interface for the AR overlay with a visualization of the toolpath for cutting down to   .The red boundary is the calculated boundary of   , and the green lines represent the path of the end mill.The fabricator adjusts the "stock offset" option in CAM to increase the bounds of the green lines beyond the red boundary.Too little offset results in unmilled stock, while too much results in wasted time spent milling air.The entire rendering in the web interface is warped using an empirically gathered perspective transform to account for the positioning of the projector above the machine.(3) The overlay projected onto   .(4)   after being milled with the corrected toolpath.

Figure 15 :
Figure15: A basic predicate that prompts the fabricator to manually check that a given end mill is installed.

Figure 16 :
Figure 16: Potential errors resulting from differing origins between a CAM setup and a physical setup.(Left) A CAM setup  ì

Figure 18 :
Figure18: Minimum Thickness Assertion.From the notebook, an effect function enables Fusion 360 CAM's section analysis tool and prompts the fabricator to inspect the minimum thicknesses of the XZ cut planes.After inspecting this, the fabricator checks a checkbox in the notebook, which returns true, fulfilling the assertion.

Figure 21 :
Figure 21: A Bowl Milled from a Stack of Plywood.Because the bowl is ellipsoidal, it cannot be turned on a lathe and must be milled.

Figure 22 :
Figure 22: A Simple Two-Sided Printed Circuit Board Milled with Tandem Using a Modified Notebook.