Zeljko's Blog

My first time creating a 3D model with OpenSCAD

Created: 2023-10-16
Last Modified: 2025-02-22

I had a problem with my awning on the balcony. It was not how I would have liked it to be. It was a classical one which you could get at the hardware store in the garden section. One of the cheaper ones. The main issue was, that it fans out and takes up too much space. It would be better if it just rolls down like roller window shade thing. There were no other ones, but this design. This meant I had to get creative.

The following sketch visualizes my issue.

Sketch

To do so I simply created a 3D printable part. But I quickly came to the realization that these free clicky-thingy-dingy GUIs are absolutely uncomfortable to use. With a quick search I found out, that there is a programming language to solve this problem, OpenSCAD. I liked it, the documentation was well written, and the examples online were understandable. This still did not mean that I could write down a 3D model by myself. I have to admit that I used ChatGPT for this. ChatGPT was able to provide me quickly code on how to create a tube, scale, rotate and shift it in the space.

After finishing the 3D model I went to kleinanzeigen.de (this is not sponsored by them, this is the German version of craigslist) and searched for people who provided 3D printing service. In the end this was way cheaper than the online 3D printing services. A week later I picked up my 3D print and installed it. Because this thing is used outdoor only it is printed with PETG and with 100% infill. I paid for two prints 15 euros. One is needed for each side.

Whenever I need to create a simple 3D model, I would always use OpenSCAD over any of these GUIs at the moment. Maybe there is a use case where I would be forced to use these GUI tools. I had fun creating this process and might even buy a 3D printer. After finishing this small project I see possible uses for it.

Lastly, here is the code for my 3D model and the images from the preview in OpenSCAD.

Thank you for reading!

notch_width = 10;
inner_diameter = 32;
outer_diameter = inner_diameter + notch_width + 10;
height = 40;

outer_radius = outer_diameter / 2;
inner_radius = inner_diameter / 2;

thread_diameter = 8;
thread_radius = thread_diameter / 2;

roll_holder_width = 5;
roll_holder_length = 50;

// inner tube
difference() {
    cylinder(h = height, r = outer_radius);
    translate([0, 0, -0.1]) cylinder(h = height + 0.2, r = inner_radius);
    translate([+inner_radius, 0, -0.1]) cylinder(h = height+0.2, d = notch_width);
}


// holder thing
difference() {
    translate([-1 * roll_holder_width / 2, outer_diameter / 2 - notch_width, 0]) cube([roll_holder_width,  roll_holder_length, height]);
    translate([-10, outer_diameter / 2 - notch_width - thread_diameter/2 + 40, height / 2]) rotate([0, 90, 0]) cylinder(h=700, d=thread_diameter);
}

openscad_preview_1 openscad_preview_2 outside_1 outside_2