Skip to main content

Rabah Hamiteche

Exercice 1 : créer un objet fonctionnel sur open Scad.

Programme : 

// Dimensions principales
base_height = 20;        // Hauteur de la base (en mm)
base_radius = 100;       // Rayon de la base (en mm)
pole_height = 1500;      // Hauteur du poteau central (en mm)
pole_radius = 20;        // Rayon du poteau (en mm)
hook_length = 80;        // Longueur des crochets (en mm)
hook_thickness = 10;     // Épaisseur des crochets (en mm)
num_hooks = 6;           // Nombre de crochets

// Création du porte-manteau
coat_rack();

module coat_rack() {
    // Base du porte-manteau
    cylinder(h = base_height, r = base_radius, center = false);
    
    // Poteau central
    translate([0, 0, base_height]) {
        cylinder(h = pole_height, r = pole_radius, center = false);
    }
    
    // Crochets
    for (i = [0:num_hooks-1]) {
        rotate([0, 0, i * 360 / num_hooks]) {
            translate([base_radius / 2, 0, pole_height - 200]) {
                hook();
            }
        }
    }
}

// Module pour un crochet
module hook() {
    union() {
        // Partie horizontale du crochet
        translate([0, 0, 0]) {
            cube([hook_length, hook_thickness, hook_thickness], center = true);
        }
        // Partie verticale du crochet
        translate([hook_length / 2, 0, -hook_thickness / 2]) {
            cube([hook_thickness, hook_thickness, hook_length], center = true);
        }
    }
}

image.png