Lesson goal: Make a 3D-printable XY-graph

Previous: Play a chirp | Home

Do you have a 3D printer? How would you like to design an object that you can actually print, using your math and coding skills?

If you understand arrays, from this lesson or this lesson or how to fill arrays and make on-screen plots from this lesson, then you should be all set.

To make 3D prints using math, you need to fill two arrays with data points. One will hold x-axis points, and the other y-axis points. Once done, our function called print3d, will prepare your arrays for 3D-printing. It will cause your printer to lay down plastic at the corresponding (x,y) millimeter positions on your print-platform as read from your x and y arrays. (Think of your print-platform as a piece of graph paper. Your x and y arrays are the points you'd normally plot with a pencil on the graph paper.)

Here's print3d, that will create a print-ready STL file, based on the numbers in your arrays:
id=print3d(x,y,R)
Move the mouse over a dotted box for more information.

  • When done, the varible id will contain an identifier that allows you to retrieve you 3d-printable STL file from this link:
    http://www.codebymath.com/welcome/index.php/getstl/--INSERT-YOUR-RETURNED-ID-HERE--

  • This STL file should be loaded into your 3D-printer's software for printing.

  • All numbers you use will be interpreted by your 3D-printer to be in millimeters.

Now you try. Go for it! Let's get your 3D printer cranking! Design with math!

Type your code here:


See your results here: