
I got myself a 3D printer during last prime day sale. Since this is my first foray into 3D printing, I did not want to be extravagant. I got myself an Anycubic Mega S. It has very generous 3D print area and the reviews are fairly good. The primary reason for buying this printer is to make custom casing for my Arduino projects. I can create a blog about Arduino projects also at a later time. I have been taking out quite a lot of random prints since I bought it and have already exhausted test PLA and a full roll of 2.2 lbs PLA.

Like most new 3D printer owners, I also created Owl pair and 3DBenchy for testing out the printer.
After printing random objects that I got from https://www.thingiverse.com, I thought of creating some of my own. One of the other cool site for 3D resources is https://www.myminifactory.com/.
Search for a 3D modeling software
Since I am not going to model for profit, I was looking for something that is free and can grow with my needs. I started with the first recommendation, tinkercad. Coming from an engineering background, I still prefer to see elevation and plan for a design. I struggled quite a bit trying to overlay one cylinder on top of another. Even though this software was considered easiest of all, I found it a no-go.
Next I looked at Fusion 360 from Autodesk. I have seen people say very good things about it. However, the license terms for this product states that it is free for 1 year of non-commercial use. This was also crossed out from the list. Next stop was to select between FreeCAD and OpenSCAD. According to reviews, both of these have steep learning curve. I went with OpenSCAD as first option – as this gave me flexibility to create my own modules. For example, I can create my own complicated shapes and save them as libraries when I need those features. That was a huge plus for me. Also, since I am putting the values for individual coordinates, it is very easy to visualize.
Since I selected a product to use, next step was to create some simple projects and try them out. This project that I am putting in this blog is one of the first projects that I created with OpenSCAD. It is a very simple project – creating a six faced dice.
Designing the Model
We will start with defining some constants that we will use in this project. At this time some of them may seem redundant, but rest assured, by the end of the project all will be used.
sz = 10; // Half Size of cube ro = 90; // Rotation co = "white"; // Color of Cube cc = "gray"; // Color of Cube sides ch = 2; // Height of Cylinder cr = 2; // Radius of Cylinder cs = 6; // Sides of Cyliner fo = "Arial"; // Font fs = 1.5; // Font Size eh = 0.5; // Extrude Height
First thing we want to do is to create a dice. We also want to make the edges round, so that this dice rolls more easily. OpenSCAD provides a function called intersection. This function will only keep the common parts that remain after intersecting the shapes given within the block.

intersection() { color(co) cube([2*sz, 2*sz, 2*sz], center=true); color(cc) sphere(r=2*sz/1.3); }
In the code above, we are drawing a cube of size 2*sz. We are also drawing a little smaller sphere that encloses this cube. Since the sphere is smaller, we see the edges of cube get rounded by that factor.
Holes in the cube
We will now take care of adding all numbers to this cube. For this, we will use a different function called difference. This will subtract all child nodes from the first node in this block. We will use this feature to draw holes on the cube. What we are trying to do here is to subtract hexagonal cylinders from the cube created above. So we will wrap all codes within a difference block as shown below.
difference() { // Draw a dice intersection() { color(co) cube([2*sz, 2*sz, 2*sz], center=true); color(cc) sphere(r=2*sz/1.3); } // 1 translate([-sz, 0, 0]) { rotate([0, ro, 0]) { cylinder(r=cr, h=ch, $fn=cs, center=true); } } }
Code above is drawing the cube first and subtracting a hexagonal cylinder. We are also using two other functions here viz. translate and rotate. Translate moves the object to a new location in space based on the vector [x, y, z] specified. In this case we start at center, so vector is also based on this value. A cylinder is always drawn on the x,y plane. Rotate will make sure to align it to the face required. Let’s draw the rest of these faces now. All of them use the same basic functions defined here – except they draw additional holes.
Add Numbers

// 1 translate([-sz, 0, 0]) { rotate([0, ro, 0]) { cylinder(r=cr, h=ch, $fn=cs, center=true); } }

// 2 for (i = [-1:2:1]) { translate([0, -sz, (sz/2)*i]) { rotate([ro, 0, 0]) { cylinder(r=cr, h=ch, $fn=cs, center=true); } } }

// 3 for (i = [-1:1:1]) { translate([sz, (sz/2)*i, 0]) { rotate([0, ro, 0]) { cylinder(r=cr, h=ch, $fn=cs, center=true); } } }

// 4 for (j = [-1:2:1]) { for (i = [-1:2:1]) { translate([(sz/2)*i, sz, (sz/2)*j]) { rotate([ro, 0, 0]) { cylinder(r=cr, h=ch, $fn=cs, center=true); } } } }

// 5 (1 + 4) translate([0, 0, sz]) { cylinder(r=cr, h=ch, $fn=6, center=true); } for (j = [-1:2:1]) { for (i = [-1:2:1]) { translate([(sz/2)*i, (sz/2)*j, sz]) { cylinder(r=cr, h=ch, $fn=cs, center=true); } } }

// 6 for (j = [-1:2:1]) { for (i = [-1:1:1]) { translate([(sz/2)*i, (sz/2)*j, -sz]) { cylinder(r=cr, h=ch, $fn=cs, center=true); } } }
That took care of putting numbers to all the faces. We have also used looping in the statements above to make the dice holes.
Add a Logo
Lastly we will make it our own by putting our logo to it. I will add suturf-com.ibrave.host as text on the side with number 1. This is the side with enough space for me to write something. While adding this text, I realized even though the text looks fine just by adding on the cube, but since it is a 2D object it is lost after rendering the dice. So, we will pull out the text by a small amount. This can be easily done using linear_extrude. This operation takes the 2D text on the XY plane and extrudes is on the Z plane. So what we will get is a text with thickness.

// Finally add a text translate([-sz, 0, sz/2]) { rotate([ro, 0, -ro]) { linear_extrude(height=eh) { text("suturf-com.ibrave.host" , size=fs, font=fo, halign="center", valign="center", $fn=16); } } }
Slicing for Print
I used Ultimaker Cura to slice this object. Infill density was setup to 25%. Since I printed on PLA, setup extruder temperature to 205°C and bed temperature to 60°C. Printing took approximately 30 minutes at a extruder travel speed of 50 mm/s.

This is the finished product. It rolls fine and shows up each number with a probability of one in six :).
Conclusion
We created a very simple design in the blog using OpenSCAD. At this time I intend to keep on using this for all my needs. Maybe I will post some other designs later when I get some more familiarity with this software. Ciao for now.