J'avais besoin d'un insert pour le placoplâtre pour mon haut-parleur Polk. L'IA a proposé un fichier OpenSCAD :
// ===== RÉGLAGES =====
$fn = 64 ;
IN_TO_MM = 25.4 ;
// 1 = Moitié gauche (broches)
// 2 = Moitié droite (trous)
// 3 = Les deux (Vue uniquement)
PART = 1 ;
// --- EMPLACEMENT Z D'UN SEUL PIN ---
// 0 est le visage touchant le cloisons sèches. 12.7 est le milieu du cadre de 1".
// Ajustez cette variable pour déplacer toutes les épingles/trous vers le haut ou vers le bas.
PIN_Z_POS = 12,7 ;
// --- Réglages de la broche ---
PIN_RADIUS = 4 ; // diamètre de 8 mm.
PIN_HEIGHT = 8 ; // longueur de 8 mm.
PIN_TOLERANCE = 0,25 ; // Espace supplémentaire pour le trou.
// --- Dimensions ---
INNER_X = 12,75 * IN_TO_MM ;
INNER_Y = 8,75 * IN_TO_MM ;
FRAME_WALL = 1,00 * IN_TO_MM ;
CONTACT_THICK = 0,50 * IN_TO_MM ;
REINFORCE_THICK = 0,50 * IN_TO_MM ;
TOTAL_THICK = CONTACT_THICK + REINFORCE_THICK ;
OUTER_CLEARANCE = 0,03 * IN_TO_MM ;
REINFORCE_INSET = 0,25 * IN_TO_MM ;
OUTER_X = (12,75 + 2*1,00)IN_TO_MM - (2OUTER_CLEARANCE);
OUTER_Y = (8,75 + 2*1,00)IN_TO_MM - (2OUTER_CLEARANCE);
REINF_OX = OUTER_X - (2 * REINFORCE_INSET) ;
REINF_OY = OUTER_Y - (2 * REINFORCE_INSET) ;
// ===== MODULES =====
Module rectangular_ring(ox, oy, ix, iy, h) {
difference() {
cube([ox, oy, h], centre=false);
translate([(ox-ix)/2, (oy-iy)/2, -0.1])
cube([ix, iy, h+0.2], center=false);
}
)
Module full_model() {
union() {
bague rectangulaire(X EXTÉRIEUR, Y EXTÉRIEUR, X INTÉRIEUR, Y INTÉRIEUR, ÉPAISSEUR DE CONTACT);
translate([(OUTER_X-REINF_OX)/2, (OUTER_Y-REINF_OY)/2, CONTACT_THICK])
anneau rectangulaire(REINF_OX, REINF_OY, INNER_X, INNER_Y, REINFORCE_THICK);
}
)
Module pin_geometry(extra=0) {
// Cylindre conique pour une insertion facile.
rotate([0, 90, 0])
cylindre(r1=RAYON_PIN+extra, r2=(RAYON_PIN*0.8)+extra, h=HAUTEUR_PIN);
)
// ===== ASSEMBLAGE =====
SPLIT_X = OUTER_X / 2 ;
// Logique pour centrer les goupilles au milieu des rails du châssis.
PIN_Y_TOP = OUTER_Y - (FRAME_WALL / 2);
PIN_Y_BOT = FRAME_WALL / 2 ;
// --- PARTIE 1 : CÔTÉ GAUCHE ---
si (PART == 1 || PART == 3) {
union() {
intersection() {
full_model();
cube([SPLIT_X, OUTER_Y, TOTAL_THICK]);
}
// Épingles ajoutées à la face coupée (SPLIT_X)
translate([SPLIT_X, PIN_Y_TOP, PIN_Z_POS]) pin_geometry(0);
translate([SPLIT_X, PIN_Y_BOT, PIN_Z_POS]) pin_geometry(0);
}
)
// --- PARTIE 2 : CÔTÉ DROIT ---
si (PART == 2 || PART == 3) {
// Déplacez-vous légèrement si vous regardez les deux.
VIS_OFFSET = (PART == 3) ? 10 : 0 ;
translate([VIS_OFFSET, 0, 0])
difference() {
// Déplacez la moitié droite vers l'origine pour une impression plus facile.
translate([-SPLIT_X, 0, 0])
intersection() {
full_model();
translate([SPLIT_X, 0, 0]) cube([SPLIT_X, OUTER_Y, TOTAL_THICK]);
}
// Soustraire les trous de la face coupée (maintenant à X=0)
translate([0, PIN_Y_TOP, PIN_Z_POS]) pin_geometry(PIN_TOLERANCE);
translate([0, PIN_Y_BOT, PIN_Z_POS]) pin_geometry(PIN_TOLERANCE);
}
)
J'ai utiliséhttps://ochafik.com/openscad2/
Источник модели
