diff --git a/bacon/case/case.fpd b/bacon/case/case.fpd index c7d0d4a..02cff64 100644 --- a/bacon/case/case.fpd +++ b/bacon/case/case.fpd @@ -11,6 +11,15 @@ vc##_center: vec va rb; \ arc vc##_center va vb +#define QLL(pfx, r) \ + Q(pfx##lly, pfx##llx, pfx##ll, (0mm, r), (r, 0mm)) +#define QLR(pfx, r) \ + Q(pfx##lrx, pfx##lry, pfx##lr, (-r, 0mm), (0mm, r)) +#define QUL(pfx, r) \ + Q(pfx##ulx, pfx##uly, pfx##ul, (r, 0mm), (0mm, -r)) +#define QUR(pfx, r) \ + Q(pfx##ury, pfx##urx, pfx##ur, (0mm, -r), (-r, 0mm)) + /* * Rectangle with rounded corners. * @@ -19,15 +28,17 @@ * corners. */ -#define RRECT_SETUP(pfx, origin, w, h, r) \ - pfx##ll: vec origin(0mm, 0mm); \ - pfx##lr: vec pfx##ll(w, 0mm); \ - pfx##ul: vec pfx##ll(0mm, h); \ - pfx##ur: vec pfx##ll(w, h); \ - Q(pfx##lly, pfx##llx, pfx##ll, (0mm, r), (r, 0mm)); \ - Q(pfx##lrx, pfx##lry, pfx##lr, (-r, 0mm), (0mm, r)); \ - Q(pfx##ulx, pfx##uly, pfx##ul, (r, 0mm), (0mm, -r)); \ - Q(pfx##ury, pfx##urx, pfx##ur, (0mm, -r), (-r, 0mm)) +#define RRECT_SETUP(pfx, origin, w, h) \ + pfx##ll: vec origin(0mm, 0mm); \ + pfx##lr: vec pfx##ll(w, 0mm); \ + pfx##ul: vec pfx##ll(0mm, h); \ + pfx##ur: vec pfx##ll(w, h); \ + +#define RRECT_DRAW_ARCS(pfx, r) \ + QLL(pfx, r); \ + QLR(pfx, r); \ + QUL(pfx, r); \ + QUR(pfx, r) #define RRECT_DRAW_LINES(pfx) \ line pfx##llx pfx##lrx; \ @@ -36,7 +47,8 @@ line pfx##lry pfx##ury #define RRECT(pfx, origin, w, h, r) \ - RRECT_SETUP(pfx, origin, w, h, r); \ + RRECT_SETUP(pfx, origin, w, h); \ + RRECT_DRAW_ARCS(pfx, r); \ RRECT_DRAW_LINES(pfx) @@ -95,12 +107,13 @@ frame top_surface { frame mid_rrect { base: vec @(red, red) - RRECT_SETUP(edge_, base, width-2*red, length-2*red, ro_edge) + RRECT_SETUP(edge_, base, width-2*red, length-2*red); + RRECT_DRAW_ARCS(edge_, ro_edge); - usb_ur: vec edge_ur(-usb_roff, 0mm) + usb_ur: vec edge_ur(-usb_roff+red, 0mm) usb_ul: vec usb_ur(-usb_w, 0mm) usb_ll: vec usb_ul(0mm, -usb_d+red) - usb_lr: vec usb_ur(0mm, -usb_d-red) + usb_lr: vec usb_ur(0mm, -usb_d+red) line edge_llx edge_lrx line edge_ulx usb_ul @@ -162,22 +175,82 @@ frame mid_body { } +/* ----- Bottom part ------------------------------------------------------- */ + + +frame bot_rrect { + base: vec @(0mm, cvr_f) + + RRECT_SETUP(edge_, base, width, length-cvr_f); + QUL(edge_, ro_edge); + QUR(edge_, ro_edge); + + set side = (width-cvr_w-cvr_play)/2-red + cvr_ll: vec edge_ll(side, 0mm) + cvr_lr: vec edge_lr(-side, 0mm) + cvr_ul: vec cvr_ll(0mm, cvr_d+cvr_play+red) + cvr_ur: vec cvr_lr(0mm, cvr_d+cvr_play+red) + + line edge_ll cvr_ll + + line cvr_ll cvr_ul /* cover bay */ + line cvr_ul cvr_ur + line cvr_ur cvr_lr + + line cvr_lr edge_lr + line edge_ll edge_uly + line edge_lr edge_ury + line edge_ulx edge_urx +} + + +frame bot_posts { + loop if = 1, bot_posts + + set r = post_di/2 + vec @(post_x, cvr_f+cvr_d+post_y) + frame post . + vec @(width-post_x, cvr_f+cvr_d+post_y) + frame post . +} + + +frame bot_base { + loop if = 1, bot_base + + set red = cvr_foot+cvr_play + frame bot_rrect @ +} + + +frame bot_surface { + loop if = 1, bot_surface + + set red = 0mm + frame bot_rrect @ +} + + /* ----- Main -------------------------------------------------------------- */ -package "top-$part-$z" +package "$part-$z" unit mm table { part, z, top_surface, top_window, top_pcb, top_ridge, - mid_ridge, mid_pcb, mid_body } - { "top_surface", 2.5, 1, 0, 0, 0, 0, 0, 0 } - { "top_window", 1.5, 0, 1, 0, 0, 0, 0, 0 } -// { "top_pcb", 0.5, 0, 0, 1, 0, 0, 0, 0 } - { "top_ridge", 0.5, 0, 0, 0, 1, 0, 0, 0 } - { "mid_ridge", 0.5, 0, 0, 0, 0, 1, 0, 0 } - { "mid_pcb", 1.0, 0, 0, 0, 0, 0, 1, 0 } - { "mid_body", 1.0, 0, 0, 0, 0, 0, 0, 1 } + mid_ridge, mid_pcb, mid_body, + bot_posts, bot_base, bot_surface} + { "top_surface", 2.5, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 } + { "top_window", 1.5, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0 } +// { "top_pcb", 0.5, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0 } + { "top_ridge", 0.5, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0 } + { "mid_ridge", 0.5, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0 } + { "mid_pcb", 1.0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0 } + { "mid_body", 4.5, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0 } + { "bot_posts", 1.2, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0 } + { "bot_base", 2.0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0 } + { "bot_surface", 2.7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 } table { pcbw, pcbl, pcbgap } @@ -204,8 +277,8 @@ table { 20.2mm, 12.1mm, 4.1mm, 4.0mm, 5.0mm, 4.5mm } table - { cvr_w, cvr_d, cvr_f, cvr_play } - { 20.0mm, 15.0mm, 5.0mm, 0.1 mm } + { cvr_w, cvr_d, cvr_f, cvr_foot, cvr_play } + { 20.0mm, 15.0mm, 5.0mm, 0.8mm, 0.1 mm } set width = pcbw+2*(pcbgap+topridge+topborder) set length = pcbl+2*(pcbgap+topridge+topborder) @@ -229,6 +302,10 @@ frame mid_ridge @ frame mid_pcb @ frame mid_body @ +frame bot_posts @ +frame bot_base @ +frame bot_surface @ + measx top_outline.edge_ul -> top_outline.edge_ur 4mm measy top_outline.edge_ll -> top_outline.edge_ul 4mm measx top_pcb.pcb_ul -> top_pcb.pcb_ur 3mm @@ -238,3 +315,6 @@ measx top_ridge.ridge_o_ul -> top_ridge.ridge_o_ur 4mm measy top_ridge.ridge_o_ll -> top_ridge.ridge_o_ul 4mm measx top_ridge.ridge_i_ul -> top_ridge.ridge_i_ur 3mm measy top_ridge.ridge_i_ll -> top_ridge.ridge_i_ul 3mm + +measy bot_rrect.edge_ll -> bot_rrect.edge_ul 4mm +measx bot_rrect.edge_ll -> bot_rrect.cvr_ll -3mm