# Math. Formula to 3D Printable Object

25,841

21

0

Are you an expressions / formulas passionate?
Are you also a 3d printer fan? And you own one?

If so, you must read this tutorial!
Here you can learn how to convert your formula into a physic 3d printable object!

Because of today (date of this Instructable submission) is Valentine's Day, we'll work on the "Love Formula"!
This formula draws an heart.
I found it in the "I fu**ing love science" fb page:

At the end of this tutorial, you'll have a simple and clever Valentine's day gift!

## Step 1: Install Inkscape

DISCLAIMER: For this tutorial, we are going to use *only* opensource software!

You need first of all Inkscape:
http://www.inkscape.org/en/

They say (and it's true!):
"Inkscape is a professional vector graphics editor for Windows, Mac OS X and Linux. It's free and open source."

## Step 2: Install LaTeX

DISCLAIMER: For this tutorial, we are going to use *only* opensource software!

Then you need to install LaTeX:
http://www.latex-project.org/

They say (and again, it's true :D):
"LaTeX is a high-quality typesetting system; it includes features designed for the production of technical and scientific documentation. LaTeX is the de facto standahttp://www.inkscape.org/en/download/rd for the communication and publication of scientific documents"

http://latex-project.org/ftp.html

DISCLAIMER: For this tutorial, we are going to use *only* opensource software!

You need also to install OpenSCAD:

They say:
"OpenSCAD is a software for creating solid 3D CAD objects. [cut] OpenSCAD is not an interactive modeller. Instead it is something like a 3D-compiler that reads in a script file that describes the object and renders the 3D model from this script file. This gives you (the designer) full control over the modelling process and enables you to easily change any step in the modelling process or make designs that are defined by configurable parameters."

## Step 4: Install Inkscape Extensions

DISCLAIMER: For this tutorial, we are going to use *only* opensource software!

Once installed these main softwares, you need to install two Inkscape extensions.

1. First extension is textex
http://pav.iki.fi/software/textext/

Textex allows you to insert formulas or expressions easly into inkscape project, using LaTeX syntax.

http://pav.iki.fi/software/textext/#installation

2. The other one is inkscape2openscad

This extension allows you to export the path into a format supported by OpenSCAD.

If you are in doubt on how to install an Inkscape extension, read here:
http://www.inkscapeforum.com/viewtopic.php?f=5&t=4205#p19141

## Step 5: Let's Start! Choose Formula / Expression

So, you have your own formula.

As already said, in this tutorial i'll use a particular formula, considering also that today (date of this Instructable submission) is Valentine's Day.

This formula draws an heart.
I found it in the "I fu**ing love science" fb page:

## Step 6: Write Formula / Expression on Inkscape

Next step is to write formula on Inkscape.

You need to use the LaTeX syntax, available here:
http://www.stdout.org/~winston/latex/
(also attached in this step)

Open Inkscape, then select:
Extensions -> Render -> LaTeX formula...

The syntax for the formula i've choose is:

$$x^2+(y-\sqrt[3]{x^2})^2=1$$

Press Apply when done.

If you have any problem using the extension, or you can't find it at all, check the previous steps!

## Step 7: Export Formula / Expression to OpenSCAD

Now select the formula (simply click on it) on Inkscape document.

Extensions -> Generate from Path -> Paths to OpenSCAD...

Define name of the exported file, the height, and then press Apply.

If you have any problem using the extension, or you can't find it at all, check the previous steps!

## Step 8: Import Formula / Expression in OpenSCAD

Open OpenSCAD and simply go to:
File -> open
and choose the file created on the previuos step!

You can see on the left side a lot of codes: it's not important to read (and understand) :D
In the right side there's still nothing.
To compile all the code, you need to press F5 key.

And after a while, here you are your formula in 3d !

- compiling and rendering the code pressing F6
- exporting it in STL format (the format used normally in 3d slicing & printing software); go to:
Design -> Export as STL..

## Step 9: Customization

In order to print i.e. a keychain with that formula, we need to put all on a single piece!

In OpenSCAD is simple: we create a cube big enough to keep all elements.

So, at the end of all code, we add this line:
translate([0,0,3]) cube([150,30,6], center=true);
with the displayed result!

To learn OpenSCAD basic syntax, a good reference is the cheat sheet:

## Step 10: Final Steps

OK, as you can see, it's possible to work on the 3d formula by adding (and also deleting) elements.

In order to do a keychain, we need to do few steps more.
The updated code is attached, and the lines added to the original file are:

difference() {
union() {
translate([10,0,2.5]) cube([170,30,5], center=true);
translate([95,0,2.5]) cylinder(5,15,15, true);
}
translate([93,0,0]) cylinder(100,10,10, true);
translate([0,0,-3]) sv_formula();
}

You can see the result!

Now you can compile, render and export you keychain, and print it with your 3d printer!

It's a very beautiful and clever gift for Valentine's day!

## Recommendations

• ### Mold Making & Casting Class

21,963 Enrolled