Skip to content

Instantly share code, notes, and snippets.

@ridercz ridercz/water_mill.scad
Last active Sep 25, 2019

Embed
What would you like to do?
Water mill toy 3D model OpenSCAD source
/******************************************************************************
* WATER MILL TOY version 1.0 (2019-09-24)
* Copyright (c) Michal Altair Valasek, 2019, licensed under CC BY-NC-SA
* www.rider.cz | www.altair.blog
*****************************************************************************/
/* OSBS:build */ // enable https://github.com/ridercz/OSBS
/* [Common] */
side_width = 100;
side_height = 200;
side_thickness = 3;
water_hole_diameter = 5;
/* [Wheel] */
outer_diameter = 120;
inner_diameter = 20;
blade_count = 6;
blade_size = 4;
blade_height = 40;
blade_twist = 7.5;
/* [Screws] */
screw_diameter = 2.2;
screw_head_diameter = 4;
screw_head_height = 1.5;
screw_pillar_size = 8;
screw_length = 20;
/* [Hidden] */
$tolerance = 1;
$fudge = 1;
// Computed variables
side_total = blade_height + $tolerance + side_thickness;
axle_position = [inner_diameter / 2 + blade_size, outer_diameter / 2 * 1.1 + side_thickness];
screw_hole_positions = [
[screw_pillar_size / 2, screw_pillar_size / 2], // BL corner
[side_width - screw_pillar_size / 2, screw_pillar_size / 2], // BR corner
[side_width - screw_pillar_size / 2, side_height - screw_pillar_size / 2], // TR corner
[screw_pillar_size / 2, side_height - screw_pillar_size / 2], // TL corner
axle_position, // Axle
[side_width - screw_pillar_size / 2, axle_position[1] + outer_diameter / 2 + screw_pillar_size / 2] // Right side below reservoir
];
// Render the whole contraption, unless part of OSBS build
if(is_undef(osbs_selected_extruder)) {
color("#ddff44") translate([axle_position[0], axle_position[1], side_thickness + $tolerance / 2]) rotate(15) part_wheel();
color("#33aa33") part_side_a();
color("#33ccff") translate([0, 0, side_total]) part_side_b();
}
// Parts
module part_side_b() {
difference() {
// Base shape
linear_extrude(side_thickness) difference() {
square([side_width, side_height]);
translate([side_width, axle_position[1]]) rotate(180/blade_count) circle(d = outer_diameter, $fn = blade_count);
}
// Screw holes
translate([0, 0, -$fudge]) for(pos = screw_hole_positions) {
translate(pos) cylinder(d = screw_diameter, h = side_thickness + 2 * $fudge, $fn = 8);
}
// Screw head holes
translate([0, 0, side_thickness - screw_head_height]) for(pos = screw_hole_positions) {
translate(pos) cylinder(d = screw_head_diameter, h = side_thickness, $fn = 16);
}
// Signature
translate([0,0,side_thickness - .6]) linear_extrude(side_thickness) {
translate([side_width / 2, side_height * .9]) text(text = "designed by", font = "Arial:bold", size = 8, halign = "center", valign = "center");
translate([side_width / 2, side_height * .8]) text(text = "RIDER.CZ", font = "Arial:bold", size = 10, halign = "center", valign = "center");
translate([side_width / 2, side_height * .7]) text(text = "2019 - V1.0", font = "Arial:bold", size = 6, halign = "center", valign = "center");
}
}
}
module part_side_a() {
difference() {
union() {
// Base
linear_extrude(side_thickness) difference() {
square([side_width, side_height]);
translate([side_width, axle_position[1]]) rotate(180/blade_count) circle(d = outer_diameter, $fn = blade_count);
}
// Bottom
cube([side_width, side_thickness, side_total]);
// Axle
translate(axle_position) cylinder(d = inner_diameter - $tolerance, h = side_total, $fn = 128);
// Water reservoir
difference() {
linear_extrude(side_total) difference() {
reservoir_shape();
offset(-side_thickness) reservoir_shape();
translate([side_thickness, side_height - side_thickness]) square([side_width - 2 * side_thickness, side_thickness]);
}
// Water hole
translate([side_width / 2, 0, side_total / 2]) rotate([-90, 0, 0]) cylinder(d = water_hole_diameter, h = side_height);
}
// Screw pillars
for(pos = screw_hole_positions) translate(pos) cylinder(d = screw_pillar_size, h = side_total, $fn = 32);
}
// Screw holes
for(pos = screw_hole_positions) translate(pos) translate([0,0,side_total - screw_length]) cylinder(d = screw_diameter, h = side_total, $fn = 16);
}
}
module part_wheel() {
translate([0, 0, blade_height / 2])
for(x = [[0,0,0], [0,0,1]]) {
mirror(x) linear_extrude(height = blade_height / 2, twist = -blade_twist, slices = 10) difference() {
union() {
for(a = [0:360 / blade_count:179]) {
rotate(a) hull() {
translate([-outer_diameter / 2 + blade_size / 2, 0]) circle(d = blade_size, $fn = 24);
translate([+outer_diameter / 2 - blade_size / 2, 0]) circle(d = blade_size, $fn = 24);
}
}
circle(d = inner_diameter + blade_size * 2, $fn = 128);
}
circle(d = inner_diameter, $fn = 128);
}
}
}
// Helper modules
module reservoir_shape() {
res_height = side_height - (outer_diameter * 1.1 + side_thickness);
hull() {
translate([side_width * .5, side_height - res_height + side_thickness * 1.5]) circle(d = side_thickness * 3);
translate([0, side_height - res_height * .8]) square([side_width, res_height * .8]);
}
}
wheel: part_wheel();
side_a: part_side_a();
side_b: part_side_b();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.