## What is OpenSCAD?

OpenSCAD is software to design 3D object with the power of a programming language.

## What is a Monogram Cube?

A cube with a letter on each axis. I will be showing you 3 different forms of monogram cubes.

## Getting started.

Install OpenScad from http://www.openscad.org/

## Let’s start with one letter.

```
text("R", size=30, font="Calibri", halign="center", valign="center");
```

But a flat letter is not very interesting, so let’s turn it into a 3d object.

```
linear_extrude(height=30, convexity=4) {
text("R", size=30, font="Calibri", halign="center", valign="center");
}
```

Now we need to center it on the z axis so it can be easily rotated.

```
translate([0,0,-15]) {
linear_extrude(height=30, convexity=4) {
text("R", size=30, font="Calibri", halign="center", valign="center");
}
}
```

Let’s now scale the letter on the X axis so it is roughly cube shaped.

```
scale([1.4,1,1]) {
translate([0,0,-15]) {
linear_extrude(height=30, convexity=4) {
text("R", size=30, font="Calibri", halign="center", valign="center");
}
}
}
```

At this point, there’s obviously a lot of magic numbers, so let’s make use of the variables and modules.

```
monogram = "RX2";
font = "Calibri";
size = 30;
LetterBlock(monogram[0]);
module LetterBlock(letter) {
scale([1.4,1,1]) {
translate([0,0,-size/2]) {
line_extrude(height=size, convexity=4) {
text(letter, size=size, font=font, halign="center", valign="center");
}
}
}
}
```

Now we can call the module 3 times and translate the letters in space.

```
Word();
module Word() {
LetterBlock(monogram[0]);
translate([size,0,0]) LetterBlock(monogram[1]);
translate([size*2,0,0]) LetterBlock(monogram[2]);
}
```

But what we really want is all 3 letters centered on the origin and rotated to the X, Y, and Z axis. We also need to union the letters together into one object.

```
Union();
module Union() {
union() {
LetterBlock(monogram[0]);
rotate([90,0,0]) LetterBlock(monogram[1]);
rotate([90, 0, 90]) LetterBlock(monogram[2]);
}
}
```

Another way to do a monogram cube is with negative letters. For that we need to subtract the letters from a hollow cube. Also, note that the cube needs to be slightly smaller than the letters in order to get clean edges.

```
Difference();
module Difference() {
difference() {
cube([size*.99,size*.99,size*.99], true);
cube([size*.75,size*.75,size*.75], true);
LetterBlock(monogram[0]);
rotate([90,0,0]) LetterBlock(monogram[1]);
rotate([90, 0, 90]) LetterBlock(monogram[2]);
}
}
```

This looks great, but it can’t be 3D printed due to the center of the R, this could be fixed by removing it, or by creating small supports. I’ll leave that as an exercise for the reader.

The last form of monogram cube is made by intersecting the 3 letters. In order to do this we need to change the font to Impact and make use of the intersect function.

```
font = 'Impact';
Intersection();
module Intersection() {
intersection() {
LetterBlock(monogram[0]);
rotate([90,0,0]) LetterBlock(monogram[1]);
rotate([90, 0, 90]) LetterBlock(monogram[2]);
}
}
```

Now we can export to a STL file for printing.

All files related to this post can be found at Thingiverse