# Hannah and Grace’s openSCAD Project

## Initial Design Idea

We want to make a customizable LEGO set that allows you to create the size, shape, color, number, and placement of LEGO pieces in openscad. The openscad code would allow users to also customize their dimensions of each LEGO piece so that they could decide to be printed separately and connect together or not. They can also adjust the translate and rotate codes to move and connect their LEGO pieces directly to the platform included in the code. We thought this was a really fun idea because we wanted to make something that was both customizable and could possibly be altered again after it is printed. By choosing this LEGO set design we are trying to create something that can be moved around and played with once it is printed in addition to having a stationary print option as well. Going into this project we already found a LEGO openscad code that created a 3D single LEGO block design. We first figured out how to alter the single LEGO code by inputing different dimensions to change the shape of the piece. The next thing we have to learn for this project is to replicate the code to make more pieces in the same openscad file. We are going to have to incorporate rotate and translate codes, as well as the loop tool in our openscad code. We also plan on allowing the code to change different colors to help identify the different LEGO pieces. These things we will learn by watching youtube tutorials, experimenting, and using the openscad cheat sheet.

## Design Iteration

//Ring module
\$fn=50;
difference (){
cylinder(r=10, h=5, center=true);
cylinder(r=8, h=6, center=true);
}
translate([10,0,0])
rotate([0,-90,0])
cylinder(h=2, r1=4, r2=1, center=true);
/* [General] */
// Width of the block, in studs
block_width = 2;
So for this part of the code, we figured out how to make a ring shape because we are going to make a ring with a lego block on top. The ring part is the two cylinders and then we used the difference tool to make the hole in the middle of it. Also, we made a base for our lego block to sit on that is on top of the ring. We did this by using another cylinder but we made the radius different for each. For both the ring and the base we had to use translate and rotate tools to make sure it connected the way we wanted it to connect. For the lego block part we used someone’s code and customized it to fit our ring how we wanted. The code for the lego is not above because it is so long.
A cool thing about our code is you can adjust the ring size how you want and also you can adjust the lego size depending on how many rows you want on your lego.
We had to change our design from originally just being legos to being a lego ring. We did this because our lego ring was not our own code and we had to figure out how to design the ring on our own. Also another thing we changed is the base originally we did not have a base for our ring but realized the block would not fit on the ring without an added base.

Here is a picture of the model in progress. In the first picture you can see the base we added for support to connect the block and the ring.

Also, we are hoping to print a block using the other persons code that will be able to connect to our ring, making it even more customizable.

## First Draft Print

Our first draft print failed. At first we could not figure out why it was failing and tried different ways of printing. Finally we saw that our base to the ring and the block were not completely attached so the printer was trying to print in mid air which was messing it up. In the picture above you can see what was happening and why it was causing the plastic to build up and not actually print to the model. To fix this we re translated the location we wanted our base and block parts of the ring to fully connect everything. Also we figured out that we will not need a plate adhesion base, as it was impossible to tear off. We should print it with skirt instead to just go around the outer edge.

## Thingiverse Customizer

Below is part of our code that customizes our lego block ring. We wanted people to be able to change their ring size, because everyone has different finger sizes. For this code if you want a bigger or smaller ring size, you can change “outer_size” to a smaller or larger number depending on what you want. Also you can change the thickness of the ring by changing “outer_thickness” which will either make the ring base thicker or thinner.

Another part of our code that is customizable is the size of the lego block on the ring. This part of the code is not our own and we have given credit to who wrote it below as well. However, we did figure out how to customize it. By changing “block_width” and “block_length” you can either make the lego piece bigger or smaller.

The parameters that people will be altering with ranges are

• outer_size with the range of (9-12)
• outer_thickness with the range of (1-5)
• block_width with the range of (1-4)
• block_length with the range of (1-4)

All other aspects are not customizable and will need to stay the same in order to print a ring that functions.

```//Ring module
\$fn=50;
// customisable ring size
outer_size = 10; outer_thickness= 5; size = 8; thickness = 5;
//customisable lego dimensions
//Code Credit// Christopher Finke @cfinke on GitHub
block_width = 2;
block_length = 2;
difference ()
{ cylinder(r=outer_size, h=outer_thickness, center=true);
cylinder(r=size, h=thickness, center=true); }
translate([10,0,0]) rotate([0,-90,0])
cylinder(h=2, r1=4, r2=1, center=true);```