Date:2012-03-23 18:31:47 (7 years 5 months ago)
Author:Werner Almesberger
Commit:d00ccd81012b435de43188fea5173916ded5ed53
Message:bacon/case/case.fpd: added the bottom part (untested)

Files: bacon/case/case.fpd (8 diffs)

Change Details

bacon/case/case.fpd
1111    vc##_center: vec va rb; \
1212    arc vc##_center va vb
1313
14#define QLL(pfx, r) \
15    Q(pfx##lly, pfx##llx, pfx##ll, (0mm, r), (r, 0mm))
16#define QLR(pfx, r) \
17    Q(pfx##lrx, pfx##lry, pfx##lr, (-r, 0mm), (0mm, r))
18#define QUL(pfx, r) \
19    Q(pfx##ulx, pfx##uly, pfx##ul, (r, 0mm), (0mm, -r))
20#define QUR(pfx, r) \
21    Q(pfx##ury, pfx##urx, pfx##ur, (0mm, -r), (-r, 0mm))
22
1423/*
1524 * Rectangle with rounded corners.
1625 *
...... 
1928 * corners.
2029 */
2130
22#define RRECT_SETUP(pfx, origin, w, h, r) \
23    pfx##ll: vec origin(0mm, 0mm); \
24    pfx##lr: vec pfx##ll(w, 0mm); \
25    pfx##ul: vec pfx##ll(0mm, h); \
26    pfx##ur: vec pfx##ll(w, h); \
27    Q(pfx##lly, pfx##llx, pfx##ll, (0mm, r), (r, 0mm)); \
28    Q(pfx##lrx, pfx##lry, pfx##lr, (-r, 0mm), (0mm, r)); \
29    Q(pfx##ulx, pfx##uly, pfx##ul, (r, 0mm), (0mm, -r)); \
30    Q(pfx##ury, pfx##urx, pfx##ur, (0mm, -r), (-r, 0mm))
31#define RRECT_SETUP(pfx, origin, w, h) \
32    pfx##ll: vec origin(0mm, 0mm); \
33    pfx##lr: vec pfx##ll(w, 0mm); \
34    pfx##ul: vec pfx##ll(0mm, h); \
35    pfx##ur: vec pfx##ll(w, h); \
36
37#define RRECT_DRAW_ARCS(pfx, r) \
38    QLL(pfx, r); \
39    QLR(pfx, r); \
40    QUL(pfx, r); \
41    QUR(pfx, r)
3142
3243#define RRECT_DRAW_LINES(pfx) \
3344    line pfx##llx pfx##lrx; \
...... 
3647    line pfx##lry pfx##ury
3748
3849#define RRECT(pfx, origin, w, h, r) \
39    RRECT_SETUP(pfx, origin, w, h, r); \
50    RRECT_SETUP(pfx, origin, w, h); \
51    RRECT_DRAW_ARCS(pfx, r); \
4052    RRECT_DRAW_LINES(pfx)
4153
4254
...... 
95107frame mid_rrect {
96108    base: vec @(red, red)
97109
98    RRECT_SETUP(edge_, base, width-2*red, length-2*red, ro_edge)
110    RRECT_SETUP(edge_, base, width-2*red, length-2*red);
111        RRECT_DRAW_ARCS(edge_, ro_edge);
99112
100    usb_ur: vec edge_ur(-usb_roff, 0mm)
113    usb_ur: vec edge_ur(-usb_roff+red, 0mm)
101114    usb_ul: vec usb_ur(-usb_w, 0mm)
102115    usb_ll: vec usb_ul(0mm, -usb_d+red)
103    usb_lr: vec usb_ur(0mm, -usb_d-red)
116    usb_lr: vec usb_ur(0mm, -usb_d+red)
104117
105118    line edge_llx edge_lrx
106119    line edge_ulx usb_ul
...... 
162175}
163176
164177
178/* ----- Bottom part ------------------------------------------------------- */
179
180
181frame bot_rrect {
182    base: vec @(0mm, cvr_f)
183
184    RRECT_SETUP(edge_, base, width, length-cvr_f);
185    QUL(edge_, ro_edge);
186    QUR(edge_, ro_edge);
187
188    set side = (width-cvr_w-cvr_play)/2-red
189    cvr_ll: vec edge_ll(side, 0mm)
190    cvr_lr: vec edge_lr(-side, 0mm)
191    cvr_ul: vec cvr_ll(0mm, cvr_d+cvr_play+red)
192    cvr_ur: vec cvr_lr(0mm, cvr_d+cvr_play+red)
193
194    line edge_ll cvr_ll
195
196    line cvr_ll cvr_ul /* cover bay */
197    line cvr_ul cvr_ur
198    line cvr_ur cvr_lr
199
200    line cvr_lr edge_lr
201    line edge_ll edge_uly
202    line edge_lr edge_ury
203    line edge_ulx edge_urx
204}
205
206
207frame bot_posts {
208    loop if = 1, bot_posts
209
210    set r = post_di/2
211    vec @(post_x, cvr_f+cvr_d+post_y)
212    frame post .
213    vec @(width-post_x, cvr_f+cvr_d+post_y)
214    frame post .
215}
216
217
218frame bot_base {
219    loop if = 1, bot_base
220
221    set red = cvr_foot+cvr_play
222    frame bot_rrect @
223}
224
225
226frame bot_surface {
227    loop if = 1, bot_surface
228
229    set red = 0mm
230    frame bot_rrect @
231}
232
233
165234/* ----- Main -------------------------------------------------------------- */
166235
167236
168package "top-$part-$z"
237package "$part-$z"
169238unit mm
170239
171240table
172241    { part, z, top_surface, top_window, top_pcb, top_ridge,
173            mid_ridge, mid_pcb, mid_body }
174    { "top_surface", 2.5, 1, 0, 0, 0, 0, 0, 0 }
175    { "top_window", 1.5, 0, 1, 0, 0, 0, 0, 0 }
176// { "top_pcb", 0.5, 0, 0, 1, 0, 0, 0, 0 }
177    { "top_ridge", 0.5, 0, 0, 0, 1, 0, 0, 0 }
178    { "mid_ridge", 0.5, 0, 0, 0, 0, 1, 0, 0 }
179    { "mid_pcb", 1.0, 0, 0, 0, 0, 0, 1, 0 }
180    { "mid_body", 1.0, 0, 0, 0, 0, 0, 0, 1 }
242            mid_ridge, mid_pcb, mid_body,
243            bot_posts, bot_base, bot_surface}
244    { "top_surface", 2.5, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
245    { "top_window", 1.5, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0 }
246// { "top_pcb", 0.5, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0 }
247    { "top_ridge", 0.5, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0 }
248    { "mid_ridge", 0.5, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0 }
249    { "mid_pcb", 1.0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0 }
250    { "mid_body", 4.5, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0 }
251    { "bot_posts", 1.2, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0 }
252    { "bot_base", 2.0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0 }
253    { "bot_surface", 2.7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 }
181254
182255table
183256    { pcbw, pcbl, pcbgap }
...... 
204277    { 20.2mm, 12.1mm, 4.1mm, 4.0mm, 5.0mm, 4.5mm }
205278
206279table
207    { cvr_w, cvr_d, cvr_f, cvr_play }
208    { 20.0mm, 15.0mm, 5.0mm, 0.1 mm }
280    { cvr_w, cvr_d, cvr_f, cvr_foot, cvr_play }
281    { 20.0mm, 15.0mm, 5.0mm, 0.8mm, 0.1 mm }
209282
210283set width = pcbw+2*(pcbgap+topridge+topborder)
211284set length = pcbl+2*(pcbgap+topridge+topborder)
...... 
229302frame mid_pcb @
230303frame mid_body @
231304
305frame bot_posts @
306frame bot_base @
307frame bot_surface @
308
232309measx top_outline.edge_ul -> top_outline.edge_ur 4mm
233310measy top_outline.edge_ll -> top_outline.edge_ul 4mm
234311measx top_pcb.pcb_ul -> top_pcb.pcb_ur 3mm
...... 
238315measy top_ridge.ridge_o_ll -> top_ridge.ridge_o_ul 4mm
239316measx top_ridge.ridge_i_ul -> top_ridge.ridge_i_ur 3mm
240317measy top_ridge.ridge_i_ll -> top_ridge.ridge_i_ul 3mm
318
319measy bot_rrect.edge_ll -> bot_rrect.edge_ul 4mm
320measx bot_rrect.edge_ll -> bot_rrect.cvr_ll -3mm

Archive Download the corresponding diff file

Branches:
master



interactive