aboutsummaryrefslogtreecommitdiff
path: root/diagrams/panels-grid.typ
blob: 82cc88897ed912e389c3a1b779e25457e2ba6e28 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
// SAME Analog Modular Ecosystem
//
// / SPDX-FileCopyrightText: 2026 Denis Chevalier <perso@denischevalier.fr>
// / SPDX-License-Identifier: CC-BY-SA-4.0
// / SPDX-License-Identifier: CERN-OHL-S-2.0+
// / SPDX-License-Identifier: GPL-3.0-or-later
//
// The prose, explanatory text, rendered figures, tables, and mathematical
// content of this specification are licensed under CC BY-SA 4.0. If a later
// version of CC BY-SA is published, the author grants permission to distribute
// this work under that later version as well.
//
// Hardware designs contained herein (schematics, PCB layouts, mechanical
// drawings, and CAD models) are licensed under CERN-OHL-S-2.0+.
//
// All executable code, helper libraries (`lib/*`), metrology assertions, and
// embedded verification scripts throughout the source documents are licensed
// under the GNU General Public License v3.0 or later (GPL-3.0-or-later).

#import "../lib/unify.typ": qty
#import "@preview/cetz:0.5.2"

#figure(
  cetz.canvas({
    import cetz.draw: *

    // Scale factor: 1 mm = 0.06 drawing units
    let s = 0.06

    let panel-w = 38.0 * s // 1.824 units
    let panel-h = 177.8 * s // 8.5344 units
    let lip-h = 6.35 * s // Lip height top/bottom

    // Grid Origin & Pitch
    let orig-x = 9.525 * s // Column 1 (A)
    let col2-x = 28.575 * s // Column 2 (B)
    let col-pitch = 19.05 * s // 0.75 inch pitch

    let orig-y-top = 22.225 * s // Row 1 Y offset from top
    let row-pitch = 19.05 * s // 0.75 inch pitch

    let y-panel-top = panel-h
    let y-panel-bot = 0

    // Row Y-coordinates from bottom Y=0
    let row-y = (
      y-panel-top - orig-y-top - 0 * row-pitch, // Row 1
      y-panel-top - orig-y-top - 1 * row-pitch, // Row 2
      y-panel-top - orig-y-top - 2 * row-pitch, // Row 3
      y-panel-top - orig-y-top - 3 * row-pitch, // Row 4
      y-panel-top - orig-y-top - 4 * row-pitch, // Row 5
      y-panel-top - orig-y-top - 5 * row-pitch, // Row 6
      y-panel-top - orig-y-top - 6 * row-pitch, // Row 7
      y-panel-top - orig-y-top - 7 * row-pitch, // Row 8
    )

    // ==========================================
    // 1. FULL PANEL GRID MATRIX (A1 to B8)
    // ==========================================
    let x-grid-start = 0

    // View Title
    content((x-grid-start + panel-w / 2, y-panel-top + 1.5), text(
      size: 8.5pt,
      weight: "bold",
    )[1. 2 $times$ 8 GRID MATRIX LAYOUT])
    content((x-grid-start + panel-w / 2, y-panel-top + 1.15), text(
      size: 7pt,
      fill: luma(90),
    )[($38.0 upright("mm") times 177.8 upright("mm")$ Panel)])

    // Panel Outer Boundary
    rect(
      (x-grid-start, y-panel-bot),
      (x-grid-start + panel-w, y-panel-top),
      fill: luma(250),
      stroke: 1.2pt + black,
    )

    // Top/Bottom Lip Boundaries
    line(
      (x-grid-start, y-panel-top - lip-h),
      (x-grid-start + panel-w, y-panel-top - lip-h),
      stroke: (paint: luma(140), thickness: 0.5pt, dash: "dashed"),
    )
    line(
      (x-grid-start, y-panel-bot + lip-h),
      (x-grid-start + panel-w, y-panel-bot + lip-h),
      stroke: (paint: luma(140), thickness: 0.5pt, dash: "dashed"),
    )

    // Grid Column Lines (A & B)
    line(
      (x-grid-start + orig-x, y-panel-bot + lip-h),
      (x-grid-start + orig-x, y-panel-top - lip-h),
      stroke: (paint: luma(130), thickness: 0.5pt, dash: "dash-dotted"),
    )
    line(
      (x-grid-start + col2-x, y-panel-bot + lip-h),
      (x-grid-start + col2-x, y-panel-top - lip-h),
      stroke: (paint: luma(130), thickness: 0.5pt, dash: "dash-dotted"),
    )

    // Grid Row Lines (1 to 8)
    for ry in row-y {
      line(
        (x-grid-start, ry),
        (x-grid-start + panel-w, ry),
        stroke: (paint: luma(130), thickness: 0.5pt, dash: "dash-dotted"),
      )
    }

    // Grid Node Markers & Labels (A1..A8, B1..B8)
    let col-names = ("A", "B")
    let col-xs = (x-grid-start + orig-x, x-grid-start + col2-x)

    for (c-idx, cx) in col-xs.enumerate() {
      let c-letter = col-names.at(c-idx)
      for (r-idx, ry) in row-y.enumerate() {
        let node-name = c-letter + str(r-idx + 1)
        circle((cx, ry), radius: 0.08, fill: white, stroke: 0.8pt + black)
        content((cx, ry + 0.18), text(size: 5pt, weight: "bold")[#node-name])
      }
    }

    // Dimension: Origin X (9.525 mm)
    line(
      (x-grid-start, y-panel-top),
      (x-grid-start, y-panel-top + 0.4),
      stroke: 0.4pt + luma(140),
    )
    line(
      (x-grid-start + orig-x, y-panel-top),
      (x-grid-start + orig-x, y-panel-top + 0.4),
      stroke: 0.4pt + luma(140),
    )
    line(
      (x-grid-start, y-panel-top + 0.35),
      (x-grid-start + orig-x, y-panel-top + 0.35),
      mark: (start: "stealth", end: "stealth"),
      mark-size: 0.08,
      stroke: 0.5pt + black,
    )
    content((x-grid-start + orig-x / 2, y-panel-top + 0.15), text(
      size: 6.5pt,
    )[$qty(9.525, "mm")$])

    // Dimension: Column Pitch (19.05 mm)
    line(
      (x-grid-start + col2-x, y-panel-top),
      (x-grid-start + col2-x, y-panel-top + 0.4),
      stroke: 0.4pt + luma(140),
    )
    line(
      (x-grid-start + orig-x, y-panel-top + 0.35),
      (x-grid-start + col2-x, y-panel-top + 0.35),
      mark: (start: "stealth", end: "stealth"),
      mark-size: 0.08,
      stroke: 0.5pt + black,
    )
    content((x-grid-start + (orig-x + col2-x) / 2, y-panel-top + 0.55), text(
      size: 6.5pt,
    )[$qty(19.05, "mm")$ Pitch])

    // Dimension: Origin Y (22.225 mm from top)
    let row1-y = row-y.at(0)
    line(
      (x-grid-start, y-panel-top),
      (x-grid-start - 0.5, y-panel-top),
      stroke: 0.4pt + luma(140),
    )
    line(
      (x-grid-start, row1-y),
      (x-grid-start - 0.5, row1-y),
      stroke: 0.4pt + luma(140),
    )
    line(
      (x-grid-start - 0.45, y-panel-top),
      (x-grid-start - 0.45, row1-y),
      mark: (start: "stealth", end: "stealth"),
      mark-size: 0.08,
      stroke: 0.5pt + black,
    )
    content(
      (x-grid-start - 0.75, (y-panel-top + row1-y) / 2),
      text(size: 6.5pt)[Origin Y: $qty(22.225, "mm")$],
      angle: 90deg,
    )

    // Dimension: Row Pitch (19.05 mm)
    let row2-y = row-y.at(1)
    line(
      (x-grid-start, row2-y),
      (x-grid-start - 0.5, row2-y),
      stroke: 0.4pt + luma(140),
    )
    line(
      (x-grid-start - 0.45, row1-y),
      (x-grid-start - 0.45, row2-y),
      mark: (start: "stealth", end: "stealth"),
      mark-size: 0.08,
      stroke: 0.5pt + black,
    )
    content(
      (x-grid-start - 0.25, (row1-y + row2-y) / 2),
      text(size: 6.5pt)[Row pitch: $qty(19.05, "mm")$],
      angle: 90deg,
    )

    // ==========================================
    // 2. COMPONENT PLACEMENT EXAMPLES (MAGNIFIED ROWS 1–3)
    // ==========================================
    let x-ex-start = 5.8
    let ex-scale = 1.35 // Magnification factor for detail view
    let ex-w = panel-w * ex-scale
    let ex-h = (orig-y-top + 2.5 * row-pitch) * ex-scale

    let y-ex-top = y-panel-top
    let y-ex-bot = y-ex-top - ex-h

    // View Title
    content((x-ex-start + ex-w / 2, y-panel-top + 1.5), text(
      size: 8.5pt,
      weight: "bold",
    )[2. COMPONENT PLACEMENT EXAMPLES])
    content((x-ex-start + ex-w / 2, y-panel-top + 1.15), text(
      size: 7pt,
      fill: luma(90),
    )[(Magnified Detail: Rows 1 to 3)])

    // Magnified Panel Outline
    rect(
      (x-ex-start, y-ex-bot),
      (x-ex-start + ex-w, y-ex-top),
      fill: luma(248),
      stroke: 1.2pt + black,
    )

    // Magnified Grid Lines
    let ex-colA-x = x-ex-start + orig-x * ex-scale
    let ex-colB-x = x-ex-start + col2-x * ex-scale
    let ex-row1-y = y-ex-top - orig-y-top * ex-scale
    let ex-row2-y = ex-row1-y - row-pitch * ex-scale
    let ex-row3-y = ex-row2-y - row-pitch * ex-scale

    let ex-rows = (ex-row1-y, ex-row2-y, ex-row3-y)

    line((ex-colA-x, y-ex-bot), (ex-colA-x, y-ex-top), stroke: (
      paint: luma(140),
      thickness: 0.4pt,
      dash: "dash-dotted",
    ))
    line((ex-colB-x, y-ex-bot), (ex-colB-x, y-ex-top), stroke: (
      paint: luma(140),
      thickness: 0.4pt,
      dash: "dash-dotted",
    ))
    for ery in ex-rows {
      line((x-ex-start, ery), (x-ex-start + ex-w, ery), stroke: (
        paint: luma(140),
        thickness: 0.4pt,
        dash: "dash-dotted",
      ))
    }

    // Placement Example 1: 4 mm Banana Jack Hole on A1 (\diameter 8.0 mm)
    let r-banana = (8.0 / 2) * s * ex-scale
    circle(
      (ex-colA-x, ex-row1-y),
      radius: r-banana,
      fill: white,
      stroke: 1pt + black,
    )
    circle((ex-colA-x, ex-row1-y), radius: 0.05, fill: black)

    // Placement Example 2: Potentiometer Shaft Hole on B1 (\diameter 7.0 mm)
    let r-pot = (7.0 / 2) * s * ex-scale
    circle(
      (ex-colB-x, ex-row1-y),
      radius: r-pot,
      fill: white,
      stroke: 1pt + black,
    )
    circle((ex-colB-x, ex-row1-y), radius: 0.05, fill: black)

    // Placement Example 3: Off-Grid 3 mm LED Hole between A1 and A2 (\diameter 3.2 mm)
    let ex-led-y = (ex-row1-y + ex-row2-y) / 2
    let r-led = (3.2 / 2) * s * ex-scale
    circle(
      (ex-colA-x, ex-led-y),
      radius: r-led,
      fill: luma(220),
      stroke: 0.9pt + black,
    )
    circle((ex-colA-x, ex-led-y), radius: 0.04, fill: black)

    // Placement Example 4: Toggle Switch Hole on B2 (\diameter 6.0 mm)
    let r-sw = (6.0 / 2) * s * ex-scale
    circle(
      (ex-colB-x, ex-row2-y),
      radius: r-sw,
      fill: white,
      stroke: 1pt + black,
    )

    // Callout Annotations for Placement Examples
    line(
      (ex-colA-x, ex-row1-y),
      (ex-colA-x - 0.85, ex-row1-y),
      stroke: 0.5pt + black,
    )
    content(
      (ex-colA-x - 0.95, ex-row1-y + r-banana + 0.35),
      angle: 90deg,
      text(
        size: 6pt,
      )[A1: $4 upright("mm")$ Banana Jack ($diameter 8.0 upright("mm")$)],
      anchor: "east",
    )

    line(
      (ex-colB-x, ex-row1-y),
      (ex-colB-x + 0.85, ex-row1-y),
      stroke: 0.5pt + black,
    )
    content(
      (ex-colB-x + 0.95, ex-row1-y),
      text(
        size: 6pt,
      )[B1: Pot shaft ($diameter 7.0 upright("mm")$)],
      anchor: "west",
    )

    line(
      (ex-colA-x + r-led, ex-led-y),
      (x-ex-start + ex-w + 0.3, ex-led-y),
      stroke: 0.5pt + black,
    )
    content(
      (x-ex-start + ex-w + 0.35, ex-led-y),
      text(
        size: 6pt,
      )[Off-grid LED ($diameter 3.2 upright("mm")$)],
      anchor: "west",
    )

    line(
      (ex-colB-x + r-sw, ex-row2-y),
      (x-ex-start + ex-w + 0.3, ex-row2-y),
      stroke: 0.5pt + black,
    )
    content(
      (x-ex-start + ex-w + 0.35, ex-row2-y),
      text(
        size: 6pt,
      )[B2: toggle switch ($diameter 6.0 upright("mm")$)],
      anchor: "west",
    )
  }),
  caption: [Panels grid specification technical drawing showing full $2 times 8$ grid matrix coordinates (origin X = $qty(9.525, "mm")$, origin Y = $qty(22.225, "mm")$, pitch = $qty(19.05, "mm")$) and component placement rules],
) <figure-panels-grid-diagram>