## Introduction: PI City, 3D Printable

The number π is a mathematical constant, defined as the ratio of a circle’s circumference divided by its diameter.

π is approximately equal to 3.14 (3.1415926535 …).

In this project, we’ll write an OPENSCAD program that builds a remarquable city where each building represents, by its height, a digit of π.

## Step 1: How It Works

The program reads each digit of π and draws cuboids side by side. The height of each cuboid is proportional to the value of each digit of π, in order 3,1,4,1,5, …

Note : The first decimals of π are stored in a separated file, available just here ( .rar because of the limitations).

## Step 2: Mathematics

To obtain several rows in order to give depth to the city, we’ll use the floor() function. For more information: Floor and ceiling functions (Wikipedia)

In the attached file, you can vary the width and depth of the city by changing the values of the variables in the customizer.

Note: The max number of entries in an OPENSCAD list is 9999, so the city is limited, for example, to dimensions 100x99.

### Attachments

## Step 3: A Beautiful Base

Optional (a checkbox in the customizer). To celebrate Pi day !

## Step 4: 3D Printing

Here are some STL files ready to be printed. Enjoy !

Participated in the

Pi Day Speed Challenge

## 3 Comments

10 months ago

I loved this!!!! very cool!!!

Reply 10 months ago

Thanks !

10 months ago

Thanks for including the files! :D