Skip to content

Instantly share code, notes, and snippets.

@Sempro97
Created December 28, 2025 11:30
Show Gist options
  • Select an option

  • Save Sempro97/994903086289e8b9d889c3b08647e83e to your computer and use it in GitHub Desktop.

Select an option

Save Sempro97/994903086289e8b9d889c3b08647e83e to your computer and use it in GitHub Desktop.
V1
// ==========================================
// CONFIGURAZIONE
// ==========================================
// Opzioni: "scatola", "coperchio", "tappo_tpu", "tutto"
mostra = "tutto";
// --- PARAMETRI PATTERN ARTISTICO ---
pattern_depth = 0.4;
pattern_spacing = 12;
pattern_line_w = 1.5;
pattern_angle = 35;
// --- MISURE PASSACAVO ---
diametro_foro_ingresso_cavo = 15;
diametro_cavo_usb = 3;
diametro_flangia_tappo = 19;
spessore_flangia_tappo = 2;
// --- MISURE VITI CHIUSURA ---
vite_chiusura_diam = 3.5;
vite_chiusura_pilota = 2.8;
vite_chiusura_testa = 7.5;
// --- MISURE SUPPORTO BICI ---
distanza_viti_supporto = 30;
diametro_rinforzo_esterno = 20;
altezza_rinforzo_esterno = 2;
diametro_sede_rondella = 12.5;
profondita_sede_rondella = 2.5;
// --- MISURE CAMERA & PI ---
cam_distanza_pcb_lente = 12;
cam_interasse_fori = 28;
cam_foro_lente = 12;
cam_vite_diam = 2.2;
diam_esterno_cilindri = 8;
pi_hole_x = 23;
pi_hole_y = 58;
pi_standoff_h = 5;
// --- DIMENSIONI SCATOLA ---
parete = 2;
parete_coperchio = 3;
raggio_lobi_angoli = 5;
box_h_interna = 35;
box_w_interna = 40;
box_l_interna = 75;
box_w_ext = box_w_interna + parete*2;
box_l_ext = box_l_interna + parete*2;
// ==========================================
// RENDER
// ==========================================
if (mostra == "tutto") {
color([0.8, 0.4, 0]) scatola();
color([0.9, 0.9, 0.9]) translate([0,0, box_h_interna + parete + 40]) coperchio();
color([0, 0.5, 1]) translate([box_w_interna/2 + parete, 0, 12]) rotate([0, 90, 0]) tappo_tpu();
} else if (mostra == "scatola") {
scatola();
} else if (mostra == "coperchio") {
rotate([0,0,0]) coperchio();
} else if (mostra == "tappo_tpu") {
tappo_tpu();
}
// ==========================================
// MODULO PATTERN ARTISTICO
// ==========================================
module artistic_pattern(w, l) {
intersection() {
cube([w, l, pattern_depth*5], center=true);
union() {
for(i = [-l*1.5 : pattern_spacing : l*1.5]) {
translate([i, 0, 0])
rotate([0, 0, pattern_angle])
cube([pattern_line_w, l*3, pattern_depth*2], center=true);
}
}
}
}
// ==========================================
// MODULO SCATOLA
// ==========================================
module scatola() {
difference() {
union() {
// Esterno
translate([-box_w_interna/2 - parete, -box_l_interna/2 - parete, 0])
cube([box_w_ext, box_l_ext, box_h_interna + parete]);
// Rinforzo laterale (Attacco Bici - LATO 1)
for(i = [-distanza_viti_supporto/2, distanza_viti_supporto/2]) {
translate([-box_w_interna/2 - parete, i, 9])
rotate([0, -90, 0])
cylinder(h = altezza_rinforzo_esterno, r = diametro_rinforzo_esterno/2, $fn=50);
}
}
// 1. Scavo Interno
translate([-box_w_interna/2, -box_l_interna/2, parete])
cube([box_w_interna, box_l_interna, box_h_interna + 1]);
// 2. Pattern Artistico Fondo
translate([0, 0, 0])
artistic_pattern(box_w_ext - 2, box_l_ext - 2);
// 3. Fori attacco bici (LATO 1)
for(i = [-distanza_viti_supporto/2, distanza_viti_supporto/2]) {
translate([-box_w_interna/2 - parete - altezza_rinforzo_esterno - 1, i, 9])
rotate([0, 90, 0])
cylinder(h = 30, r = 3.4/2, $fn=30);
translate([-box_w_interna/2 + 0.1, i, 9])
rotate([0, -90, 0])
cylinder(h = profondita_sede_rondella, r = diametro_sede_rondella/2, $fn=40);
}
// 4. Foro passacavo (LATO 2)
translate([box_w_interna/2 + parete + 1, 0, 12])
rotate([0, 90, 0])
cylinder(h = 10, r = diametro_foro_ingresso_cavo/2, center=true, $fn=60);
// 5. Fori pilota viti
for(x = [-box_w_interna/2, box_w_interna/2]) {
for(y = [-box_l_interna/2, box_l_interna/2]) {
translate([x, y, box_h_interna - 10])
cylinder(h=20, r=vite_chiusura_pilota/2, $fn=20);
}
}
// 6. GRIGLIE "PERSIANA" (Anti-Acqua)
// SOLO SU LATO 4 (Retro) - LATO 3 RIMOSSO
for(x_pos = [-12 : 6 : 12]) {
translate([x_pos, box_l_interna/2 + parete/2 + 2, 12])
rotate([-45, 0, 0]) // Inclinazione verso il basso/esterno
cube([2, 10, 8], center=true);
}
}
// Colonnine Pi
translate([0, 0, parete]) {
for(px = [-pi_hole_x/2, pi_hole_x/2]) {
for(py = [-pi_hole_y/2, pi_hole_y/2]) {
translate([px, py, 0])
difference() {
cylinder(h=pi_standoff_h, r=3, $fn=20);
cylinder(h=pi_standoff_h+1, r=1.1, $fn=20);
}
}
}
}
// Colonne angolari (Lobi Scatola)
for(x = [-box_w_interna/2, box_w_interna/2]) {
for(y = [-box_l_interna/2, box_l_interna/2]) {
translate([x, y, parete])
difference() {
cylinder(h=box_h_interna, r=raggio_lobi_angoli, $fn=30);
translate([0,0,box_h_interna - 15])
cylinder(h=20, r=vite_chiusura_pilota/2, $fn=20);
}
}
}
}
// ==========================================
// MODULO COPERCHIO
// ==========================================
module coperchio() {
h_cono_vite = (vite_chiusura_testa - vite_chiusura_diam) / 2;
difference() {
hull() {
for(x = [-box_w_interna/2, box_w_interna/2]) {
for(y = [-box_l_interna/2, box_l_interna/2]) {
translate([x, y, 0])
cylinder(h = parete_coperchio, r = raggio_lobi_angoli, $fn=50);
}
}
}
translate([0, 0, parete_coperchio])
artistic_pattern(box_w_ext, box_l_ext);
cylinder(h=20, r=cam_foro_lente/2, center=true, $fn=50);
for(x = [-box_w_interna/2, box_w_interna/2]) {
for(y = [-box_l_interna/2, box_l_interna/2]) {
translate([x, y, -1])
cylinder(h=10, r=vite_chiusura_diam/2 + 0.2, $fn=20);
translate([x, y, parete_coperchio - h_cono_vite + 0.01])
cylinder(h = h_cono_vite, r1 = vite_chiusura_diam/2, r2 = vite_chiusura_testa/2, $fn=30);
}
}
}
translate([0, 0, -cam_distanza_pcb_lente]) {
for(cx = [-cam_interasse_fori/2, cam_interasse_fori/2]) {
for(cy = [-cam_interasse_fori/2, cam_interasse_fori/2]) {
translate([cx, cy, 0])
difference() {
cylinder(h=cam_distanza_pcb_lente, r=diam_esterno_cilindri/2, $fn=40);
translate([0,0,-1])
cylinder(h=cam_distanza_pcb_lente+2, r=cam_vite_diam/2, $fn=20);
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment