Différences entre les versions de « Découvrons les imprimantes 3D - FDM »

aucun résumé de modification
Ligne 117 : Ligne 117 :
:
:
=== Programme OpenSCAD avec encoche circulaire ===
=== Programme OpenSCAD avec encoche circulaire ===
<pre>// Paramètres<br>base_length &nbsp; &nbsp; = 100;<br>base_width &nbsp; &nbsp; &nbsp;= 50;<br>base_height &nbsp; &nbsp; = 50;<br><br>encoche_diametre &nbsp; = 20;<br>encoche_profondeur = 5;<br>angle_deg &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;= 0<br>; // Inclinaison de la base en degrés<br><br>// Calcul du facteur de rétrécissement en haut<br>reduction = tan(angle_deg * PI / 180) * base_height;<br>shrink_x = (base_length - 2 * reduction) / base_length;<br>shrink_y = (base_width - 2 * reduction) / base_width;<br><br>// Génération du socle trapézoïdal par extrusion<br>module socle_trapeze() {<br>&nbsp; &nbsp; linear_extrude(height = base_height, scale = [shrink_x, shrink_y])<br>&nbsp; &nbsp; &nbsp; &nbsp; square([base_length, base_width], center = true);<br>}<br><br>// Affichage final avec encoche ronde<br>difference() {<br>&nbsp; &nbsp; socle_trapeze();<br><br>&nbsp; &nbsp; translate([0, 0, base_height - encoche_profondeur])<br>&nbsp; &nbsp; &nbsp; &nbsp; cylinder(h = encoche_profondeur + 0.1, r = encoche_diametre / 2, $fn = 64);<br>}<br></pre>
// Paramètres
base_length     = 100;
base_width     = 50;
base_height     = 50;
 
encoche_diametre   = 20;
encoche_profondeur = 5;
angle_deg         = 0
; // Inclinaison de la base en degrés
 
// Calcul du facteur de rétrécissement en haut
reduction = tan(angle_deg * PI / 180) * base_height;
shrink_x = (base_length - 2 * reduction) / base_length;
shrink_y = (base_width - 2 * reduction) / base_width;
 
// Génération du socle trapézoïdal par extrusion
module socle_trapeze() {
    linear_extrude(height = base_height, scale = [shrink_x, shrink_y])
        square([base_length, base_width], center = true);
}
 
// Affichage final avec encoche ronde
difference() {
    socle_trapeze();
 
    translate([0, 0, base_height - encoche_profondeur])
        cylinder(h = encoche_profondeur + 0.1, r = encoche_diametre / 2, $fn = 64);
}
 


== Personnalisation & Modification du Code ==
== Personnalisation & Modification du Code ==