3D-Printed Slices and Traces of Functions of Two Variables

I have been using OpenSCAD to generate mathematical objects for 3D printing. Many months ago, I tried using ChatGPT as a coding assistant for OpenSCAD. It was pretty terrible. There was a lot of hallucinating regarding what code OpenSCAD would accept. Recently, I thought I’d try again. It is much better now!

I’m teaching Multivariable Calculus this semester. In that class, we look at surfaces and graphs of functions of two variables. We talk about things like traces and level curves for these objects. I decided I wanted to try 3D printing them.

My approach was to use VS Code for typing the OpenSCAD code. I didn’t know if this would work, but it worked very well. I had the file open in OpenSCAD; when I made an edit in VS Code, it automatically updated in OpenSCAD. Perfect. Then, I used GitHub Copilot in the sidebar as a coding assistant. It was hugely helpful.

Below are some examples of the objects I created. All the OpenSCAD code is available on my GitHub page. The code can generate

  • The complete solid
  • Traces for x=constant, y=constant, and z=constant with supporting structures so they stay together.
  • One slice at a time, with slots in them, and a stand with slots in them, so they can be assembled and disassembled.

There are a variety of parameters you can tinker with to get the design exactly the way you want it. These objects printed very well, with the exception of the z=constant traces. Because the traces are horizontal, I had to turn the object 90°. But the slicer still had to add substantial support to get the object to print. They did print, but the edges where the supports were attached were a little ragged.

A hyperbolic paraboloid
An elliptic paraboloid
Slices for a hyperbolic paraboloid

Leave a comment