Display Panel Bezel
A snap-in bezel that mounts a small display module in a rectangular panel cutout, with no screws. The flange with the viewing window sits on the front of the panel, a neck passes through the cutout and two snap arms in its short walls catch behind the panel; the module goes in from the back, its glass dropping into a recess behind the window and the PCB resting on a ledge where two snap tabs click over its edge. Presets cover the 0.96 inch and 1.3 inch OLED modules and the 16x2 character LCD (whose metal frame passes through the window), and every dimension (PCB, window, glass, panel thickness) is a parameter for any other module. The 0.96 inch bezel is 36 x 37 x 16 mm and needs a 30.5 x 31 mm cutout; the model prints the cutout size. Prints face down with no supports; the snap barbs are 0.6 mm and the arm strain stays near 1 %.
# Display Panel Bezel - snap-in bezel that mounts an OLED or LCD module in a panel cutout
#
# A flange with the viewing window sits on the front of the panel; a neck passes
# through a rectangular cutout, and two snap arms in the neck's short walls catch
# behind the panel. The module goes in from the back: its glass drops into a
# recess behind the window, the PCB is located by the neck walls and rests on the
# ledge around the recess, and two snap tabs in the long walls click over the PCB
# edge. No screws. Presets give the 0.96" and 1.3" OLED modules and the 16x2
# character LCD (whose metal frame passes through the window); every dimension
# is also a parameter for any other module. Prints face down (flange on the bed),
# no supports: the snap barbs are the only overhangs, 0.6 mm.
#
# Panel cutout to make: (pcb width + 2.8) x (pcb height + 2.8) mm, see the print line.
# Snap strain: 1.5 * t * y / L^2 = 1.5 * 1.2 * 0.6 / 10^2 = 1.1 % (PLA / PETG, repeated use).
@profile {
"oled096": { pcb_w: 27.3, pcb_h: 27.8, win_w: 24, win_h: 13, win_oy: -2, glass_w: 26.6, glass_h: 19.5, glass_oy: -2.2, glass_t: 1.8 },
"oled13": { pcb_w: 35.4, pcb_h: 33.5, win_w: 29.5, win_h: 15, win_oy: -2, glass_w: 33.4, glass_h: 22, glass_oy: -2.5, glass_t: 2.0 },
"lcd1602": { pcb_w: 80, pcb_h: 36, win_w: 71.5, win_h: 24.5, win_oy: 0, glass_w: 72.5, glass_h: 25.5, glass_oy: 0, glass_t: 6.5 }
}
@param 20..120 step:0.1 group:"Module" desc:"PCB width (mm)"
$pcb_w = 27.3
@param 15..80 step:0.1 group:"Module" desc:"PCB height (mm)"
$pcb_h = 27.8
@param 1.2..2 step:0.1 group:"Module" desc:"PCB thickness (mm)"
$pcb_t = 1.6
@param 10..100 step:0.5 group:"Window" desc:"Window width (mm)"
$win_w = 24
@param 5..60 step:0.5 group:"Window" desc:"Window height (mm)"
$win_h = 13
@param -10..10 step:0.1 group:"Window" desc:"Window centre offset from the PCB centre along Y (mm; negative = away from the pin header)"
$win_oy = -2
@param 10..100 step:0.1 group:"Window" desc:"Glass (or LCD frame) width: the recess behind the window (mm)"
$glass_w = 26.6
@param 5..60 step:0.1 group:"Window" desc:"Glass height (mm)"
$glass_h = 19.5
@param -10..10 step:0.1 group:"Window" desc:"Glass centre offset along Y (mm)"
$glass_oy = -2.2
@param 0.5..8 step:0.1 group:"Window" desc:"Glass thickness in front of the PCB: the recess depth (mm)"
$glass_t = 1.8
@param 1..4 step:0.5 group:"Panel" desc:"Panel thickness (mm)"
$panel_t = 2
$flange_t = 2
$rim = 3 # flange beyond the neck
$neck_w = 1.2 # neck wall, thin enough to flex as the snap arms
$clr = 0.2 # PCB in the neck, per side
$in_w = $pcb_w + 2 * $clr
$in_h = $pcb_h + 2 * $clr
$nw = $in_w + 2 * $neck_w # neck outside; the panel cutout is 0.4 larger
$nh = $in_h + 2 * $neck_w
$fw = $nw + 2 * $rim
$fh = $nh + 2 * $rim
$z_ledge = $flange_t + $glass_t # PCB front face
$z_pcb_back = $z_ledge + $pcb_t
$arm_len = 12 # neck above the ledge; the panel arms get 10 mm of free length
$neck_top = max($z_pcb_back + 2.5, $flange_t + $panel_t + 3, $z_ledge + $arm_len)
assert $win_w < $glass_w and $win_h < $glass_h
assert $glass_w < $pcb_w and $glass_h + abs($glass_oy) < $pcb_h - 1 # the PCB rests on a ledge of 0.5 mm or more along its top and bottom edges
print "panel cutout (mm)" [$nw + 0.4, $nh + 0.4]
print "neck depth behind the panel (mm)" ($neck_top - $flange_t)
def rr($w, $h, $r) = rect ($w - 2 * $r) ($h - 2 * $r) | offset $r
# --- flange, neck, window, glass recess, PCB cavity (face down) -----------------
$flange = rr($fw, $fh, 2) | extrude $flange_t
$neck = rr($nw, $nh, 1.5) | extrude ($neck_top - $flange_t) | translate 0 0 $flange_t
$window = rect $win_w $win_h at:(0, $win_oy) | extrude ($flange_t + 2) | translate 0 0 -1
$glass = rect $glass_w $glass_h at:(0, $glass_oy) | extrude ($glass_t + 0.01) | translate 0 0 $flange_t
$cavity = rect $in_w $in_h | extrude ($neck_top - $z_ledge + 1) | translate 0 0 $z_ledge
$body0 = ($flange + $neck) - $window - $glass - $cavity
# --- PCB snap tabs in the long (y) walls: a tongue slit free on both sides from the
# --- ledge up, with an inward barb just behind the PCB; lead-in chamfer faces up ------
$tab_w = 6
$barb = 0.6
$slit = 0.8
# four slits: i selects the wall (+y / -y) and the side of the tongue
def sg($i) = ($i % 2) * 2 - 1
def sw($i) = floor($i / 2) * 2 - 1
$tab_slit1 = box $slit ($neck_w + 0.4) ($neck_top - $z_ledge + 1) center:(true, true, false)
$tab_slits = union [$tab_slit1 | translate (sg($i) * ($tab_w / 2 + $slit / 2)) (sw($i) * ($in_h / 2 + $neck_w / 2)) $z_ledge for $i in range(4)]
# barb drawn for the +y wall, pointing inward (-y); mirrored for the -y wall
def tab_barb0() = workplane YZ
| polyline [(0, $z_pcb_back + 0.2), (-$barb, $z_pcb_back + 0.2), (0, $z_pcb_back + 0.2 + 2 * $barb)]
| extrude $tab_w
| translate (-$tab_w / 2) ($in_h / 2) 0
$tab_p = tab_barb0()
$tab_m = $tab_p | mirror "Y"
# --- panel snap arms in the short (x) walls: the tongue hangs from the neck top, free
# --- at the flange end (a slit above the flange), with an outward barb at panel depth --
$arm_w = 8
$z_catch = $flange_t + $panel_t + 0.2
$arm_slit1 = box ($neck_w + 0.4) $slit ($neck_top - $flange_t - 1.5) center:(true, true, false)
$arm_slit2 = box ($neck_w + 0.4) ($arm_w + 2 * $slit) $slit center:(true, true, false)
$arm_slits = (union [$arm_slit1 | translate (sw($i) * ($nw / 2 - $neck_w / 2)) (sg($i) * ($arm_w / 2 + $slit / 2)) $flange_t for $i in range(4)])
+ ($arm_slit2 | translate ($nw / 2 - $neck_w / 2) 0 $flange_t)
+ ($arm_slit2 | translate (-($nw / 2 - $neck_w / 2)) 0 $flange_t)
def arm_barb0() = workplane XZ
| polyline [(0, $z_catch), ($barb, $z_catch), (0, $z_catch + 2 * $barb)]
| extrude $arm_w
| translate ($nw / 2) (-$arm_w / 2) 0
$arm_p = arm_barb0()
$arm_m = $arm_p | mirror "X"
assert $arm_p.bbox.center[1] ~ 0 tol:0.01 # the barb is centred on the wall
assert $arm_p.bbox.min[0] ~ ($nw / 2) tol:0.01
$body1 = $body0 - $tab_slits - $arm_slits
$body = $body1 + $tab_p + $tab_m + $arm_p + $arm_m
assert $body.solids == 1
assert $body.bbox.x ~ $fw
assert $body.bbox.y ~ $fh
assert $body.bbox.z ~ $neck_top
# the module fits: a PCB and its glass, placed as they sit, touch nothing
$pcb = box $pcb_w $pcb_h $pcb_t center:(true, true, false) | translate 0 0 $z_ledge
$glass_dummy = box ($glass_w - 0.2) ($glass_h - 0.2) ($glass_t - 0.1) center:(true, true, false) | translate 0 $glass_oy ($flange_t + 0.05)
assert clear($body, $pcb)
assert clear($body, $glass_dummy)
$body