diff --git a/fp-info-cache b/fp-info-cache index 250ae1c..573541a 100644 --- a/fp-info-cache +++ b/fp-info-cache @@ -1,435 +1 @@ -104494488070859 -Resistor_SMD -R_0201_0603Metric -Resistor SMD 0201 (0603 Metric), square (rectangular) end terminal, IPC_7351 nominal, (Body size source: https://www.vishay.com/docs/20052/crcw0201e3.pdf), generated with kicad-footprint-generator -resistor 0 -4 -2 -Resistor_SMD -R_0201_0603Metric_Pad0.64x0.40mm_HandSolder -Resistor SMD 0201 (0603 Metric), square (rectangular) end terminal, IPC_7351 nominal with elongated pad for handsoldering. (Body size source: https://www.vishay.com/docs/20052/crcw0201e3.pdf), generated with kicad-footprint-generator -resistor handsolder -0 -4 -2 -Resistor_SMD -R_0402_1005Metric -Resistor SMD 0402 (1005 Metric), square (rectangular) end terminal, IPC_7351 nominal, (Body size source: IPC-SM-782 page 72, https://www.pcb-3d.com/wordpress/wp-content/uploads/ipc-sm-782a_amendment_1_and_2.pdf), generated with kicad-footprint-generator -resistor -0 -2 -2 -Resistor_SMD -R_0402_1005Metric_Pad0.72x0.64mm_HandSolder -Resistor SMD 0402 (1005 Metric), square (rectangular) end terminal, IPC_7351 nominal with elongated pad for handsoldering. (Body size source: IPC-SM-782 page 72, https://www.pcb-3d.com/wordpress/wp-content/uploads/ipc-sm-782a_amendment_1_and_2.pdf), generated with kicad-footprint-generator -resistor handsolder -0 -2 -2 -Resistor_SMD -R_0603_1608Metric -Resistor SMD 0603 (1608 Metric), square (rectangular) end terminal, IPC_7351 nominal, (Body size source: IPC-SM-782 page 72, https://www.pcb-3d.com/wordpress/wp-content/uploads/ipc-sm-782a_amendment_1_and_2.pdf), generated with kicad-footprint-generator -resistor -0 -2 -2 -Resistor_SMD -R_0603_1608Metric_Pad0.98x0.95mm_HandSolder -Resistor SMD 0603 (1608 Metric), square (rectangular) end terminal, IPC_7351 nominal with elongated pad for handsoldering. (Body size source: IPC-SM-782 page 72, https://www.pcb-3d.com/wordpress/wp-content/uploads/ipc-sm-782a_amendment_1_and_2.pdf), generated with kicad-footprint-generator -resistor handsolder -0 -2 -2 -Resistor_SMD -R_0612_1632Metric -Resistor SMD 0612 (1632 Metric), square (rectangular) end terminal, IPC_7351 nominal, (Body size source: https://www.vishay.com/docs/20019/rcwe.pdf), generated with kicad-footprint-generator -resistor -0 -2 -2 -Resistor_SMD -R_0612_1632Metric_Pad1.18x3.40mm_HandSolder -Resistor SMD 0612 (1632 Metric), square (rectangular) end terminal, IPC_7351 nominal with elongated pad for handsoldering. (Body size source: https://www.vishay.com/docs/20019/rcwe.pdf), generated with kicad-footprint-generator -resistor handsolder -0 -2 -2 -Resistor_SMD -R_0805_2012Metric -Resistor SMD 0805 (2012 Metric), square (rectangular) end terminal, IPC_7351 nominal, (Body size source: IPC-SM-782 page 72, https://www.pcb-3d.com/wordpress/wp-content/uploads/ipc-sm-782a_amendment_1_and_2.pdf), generated with kicad-footprint-generator -resistor -0 -2 -2 -Resistor_SMD -R_0805_2012Metric_Pad1.20x1.40mm_HandSolder -Resistor SMD 0805 (2012 Metric), square (rectangular) end terminal, IPC_7351 nominal with elongated pad for handsoldering. (Body size source: IPC-SM-782 page 72, https://www.pcb-3d.com/wordpress/wp-content/uploads/ipc-sm-782a_amendment_1_and_2.pdf), generated with kicad-footprint-generator -resistor handsolder -0 -2 -2 -Resistor_SMD -R_0815_2038Metric -Resistor SMD 0815 (2038 Metric), square (rectangular) end terminal, IPC_7351 nominal, (Body size source: https://www.susumu.co.jp/common/pdf/n_catalog_partition07_en.pdf), generated with kicad-footprint-generator -resistor -0 -2 -2 -Resistor_SMD -R_0815_2038Metric_Pad1.20x4.05mm_HandSolder -Resistor SMD 0815 (2038 Metric), square (rectangular) end terminal, IPC_7351 nominal with elongated pad for handsoldering. (Body size source: https://www.susumu.co.jp/common/pdf/n_catalog_partition07_en.pdf), generated with kicad-footprint-generator -resistor handsolder -0 -2 -2 -Resistor_SMD -R_01005_0402Metric -Resistor SMD 01005 (0402 Metric), square (rectangular) end terminal, IPC_7351 nominal, (Body size source: http://www.vishay.com/docs/20056/crcw01005e3.pdf), generated with kicad-footprint-generator -resistor -0 -4 -2 -Resistor_SMD -R_01005_0402Metric_Pad0.57x0.30mm_HandSolder -Resistor SMD 01005 (0402 Metric), square (rectangular) end terminal, IPC_7351 nominal with elongated pad for handsoldering. (Body size source: http://www.vishay.com/docs/20056/crcw01005e3.pdf), generated with kicad-footprint-generator -resistor handsolder -0 -4 -2 -Resistor_SMD -R_1020_2550Metric -Resistor SMD 1020 (2550 Metric), square (rectangular) end terminal, IPC_7351 nominal, (Body size source: https://www.vishay.com/docs/20019/rcwe.pdf), generated with kicad-footprint-generator -resistor -0 -2 -2 -Resistor_SMD -R_1020_2550Metric_Pad1.33x5.20mm_HandSolder -Resistor SMD 1020 (2550 Metric), square (rectangular) end terminal, IPC_7351 nominal with elongated pad for handsoldering. (Body size source: https://www.vishay.com/docs/20019/rcwe.pdf), generated with kicad-footprint-generator -resistor handsolder -0 -2 -2 -Resistor_SMD -R_1206_3216Metric -Resistor SMD 1206 (3216 Metric), square (rectangular) end terminal, IPC_7351 nominal, (Body size source: IPC-SM-782 page 72, https://www.pcb-3d.com/wordpress/wp-content/uploads/ipc-sm-782a_amendment_1_and_2.pdf), generated with kicad-footprint-generator -resistor -0 -2 -2 -Resistor_SMD -R_1206_3216Metric_Pad1.30x1.75mm_HandSolder -Resistor SMD 1206 (3216 Metric), square (rectangular) end terminal, IPC_7351 nominal with elongated pad for handsoldering. (Body size source: IPC-SM-782 page 72, https://www.pcb-3d.com/wordpress/wp-content/uploads/ipc-sm-782a_amendment_1_and_2.pdf), generated with kicad-footprint-generator -resistor handsolder -0 -2 -2 -Resistor_SMD -R_1210_3225Metric -Resistor SMD 1210 (3225 Metric), square (rectangular) end terminal, IPC_7351 nominal, (Body size source: IPC-SM-782 page 72, https://www.pcb-3d.com/wordpress/wp-content/uploads/ipc-sm-782a_amendment_1_and_2.pdf), generated with kicad-footprint-generator -resistor -0 -2 -2 -Resistor_SMD -R_1210_3225Metric_Pad1.30x2.65mm_HandSolder -Resistor SMD 1210 (3225 Metric), square (rectangular) end terminal, IPC_7351 nominal with elongated pad for handsoldering. (Body size source: IPC-SM-782 page 72, https://www.pcb-3d.com/wordpress/wp-content/uploads/ipc-sm-782a_amendment_1_and_2.pdf), generated with kicad-footprint-generator -resistor handsolder -0 -2 -2 -Resistor_SMD -R_1218_3246Metric -Resistor SMD 1218 (3246 Metric), square (rectangular) end terminal, IPC_7351 nominal, (Body size source: https://www.vishay.com/docs/20035/dcrcwe3.pdf), generated with kicad-footprint-generator -resistor -0 -2 -2 -Resistor_SMD -R_1218_3246Metric_Pad1.22x4.75mm_HandSolder -Resistor SMD 1218 (3246 Metric), square (rectangular) end terminal, IPC_7351 nominal with elongated pad for handsoldering. (Body size source: https://www.vishay.com/docs/20035/dcrcwe3.pdf), generated with kicad-footprint-generator -resistor handsolder -0 -2 -2 -Resistor_SMD -R_1812_4532Metric -Resistor SMD 1812 (4532 Metric), square (rectangular) end terminal, IPC_7351 nominal, (Body size source: https://www.nikhef.nl/pub/departments/mt/projects/detectorR_D/dtddice/ERJ2G.pdf), generated with kicad-footprint-generator -resistor -0 -2 -2 -Resistor_SMD -R_1812_4532Metric_Pad1.30x3.40mm_HandSolder -Resistor SMD 1812 (4532 Metric), square (rectangular) end terminal, IPC_7351 nominal with elongated pad for handsoldering. (Body size source: https://www.nikhef.nl/pub/departments/mt/projects/detectorR_D/dtddice/ERJ2G.pdf), generated with kicad-footprint-generator -resistor handsolder -0 -2 -2 -Resistor_SMD -R_2010_5025Metric -Resistor SMD 2010 (5025 Metric), square (rectangular) end terminal, IPC_7351 nominal, (Body size source: IPC-SM-782 page 72, https://www.pcb-3d.com/wordpress/wp-content/uploads/ipc-sm-782a_amendment_1_and_2.pdf), generated with kicad-footprint-generator -resistor -0 -2 -2 -Resistor_SMD -R_2010_5025Metric_Pad1.40x2.65mm_HandSolder -Resistor SMD 2010 (5025 Metric), square (rectangular) end terminal, IPC_7351 nominal with elongated pad for handsoldering. (Body size source: IPC-SM-782 page 72, https://www.pcb-3d.com/wordpress/wp-content/uploads/ipc-sm-782a_amendment_1_and_2.pdf), generated with kicad-footprint-generator -resistor handsolder -0 -2 -2 -Resistor_SMD -R_2512_6332Metric -Resistor SMD 2512 (6332 Metric), square (rectangular) end terminal, IPC_7351 nominal, (Body size source: IPC-SM-782 page 72, https://www.pcb-3d.com/wordpress/wp-content/uploads/ipc-sm-782a_amendment_1_and_2.pdf), generated with kicad-footprint-generator -resistor -0 -2 -2 -Resistor_SMD -R_2512_6332Metric_Pad1.40x3.35mm_HandSolder -Resistor SMD 2512 (6332 Metric), square (rectangular) end terminal, IPC_7351 nominal with elongated pad for handsoldering. (Body size source: IPC-SM-782 page 72, https://www.pcb-3d.com/wordpress/wp-content/uploads/ipc-sm-782a_amendment_1_and_2.pdf), generated with kicad-footprint-generator -resistor handsolder -0 -2 -2 -Resistor_SMD -R_2816_7142Metric -Resistor SMD 2816 (7142 Metric), square (rectangular) end terminal, IPC_7351 nominal, (Body size from: https://www.vishay.com/docs/30100/wsl.pdf), generated with kicad-footprint-generator -resistor -0 -2 -2 -Resistor_SMD -R_2816_7142Metric_Pad3.20x4.45mm_HandSolder -Resistor SMD 2816 (7142 Metric), square (rectangular) end terminal, IPC_7351 nominal with elongated pad for handsoldering. (Body size from: https://www.vishay.com/docs/30100/wsl.pdf), generated with kicad-footprint-generator -resistor handsolder -0 -2 -2 -Resistor_SMD -R_4020_10251Metric -Resistor SMD 4020 (10251 Metric), square (rectangular) end terminal, IPC_7351 nominal, (Body size source: http://datasheet.octopart.com/HVC0603T5004FET-Ohmite-datasheet-26699797.pdf), generated with kicad-footprint-generator -resistor -0 -2 -2 -Resistor_SMD -R_4020_10251Metric_Pad1.65x5.30mm_HandSolder -Resistor SMD 4020 (10251 Metric), square (rectangular) end terminal, IPC_7351 nominal with elongated pad for handsoldering. (Body size source: http://datasheet.octopart.com/HVC0603T5004FET-Ohmite-datasheet-26699797.pdf), generated with kicad-footprint-generator -resistor handsolder -0 -2 -2 -Resistor_SMD -R_Array_Concave_2x0603 -Thick Film Chip Resistor Array, Wave soldering, Vishay CRA06P (see cra06p.pdf) -resistor array -0 -4 -4 -Resistor_SMD -R_Array_Concave_4x0402 -Thick Film Chip Resistor Array, Wave soldering, Vishay CRA04P (see cra04p.pdf) -resistor array -0 -8 -8 -Resistor_SMD -R_Array_Concave_4x0603 -Thick Film Chip Resistor Array, Wave soldering, Vishay CRA06P (see cra06p.pdf) -resistor array -0 -8 -8 -Resistor_SMD -R_Array_Convex_2x0402 -Chip Resistor Network, ROHM MNR02 (see mnr_g.pdf) -resistor array -0 -4 -4 -Resistor_SMD -R_Array_Convex_2x0603 -Chip Resistor Network, ROHM MNR12 (see mnr_g.pdf) -resistor array -0 -4 -4 -Resistor_SMD -R_Array_Convex_2x0606 -Precision Thin Film Chip Resistor Array, VISHAY (see http://www.vishay.com/docs/28770/acasat.pdf) -resistor array -0 -4 -4 -Resistor_SMD -R_Array_Convex_2x1206 -Chip Resistor Network, ROHM MNR32 (see mnr_g.pdf) -resistor array -0 -4 -4 -Resistor_SMD -R_Array_Convex_4x0402 -Chip Resistor Network, ROHM MNR04 (see mnr_g.pdf) -resistor array -0 -8 -8 -Resistor_SMD -R_Array_Convex_4x0603 -Chip Resistor Network, ROHM MNR14 (see mnr_g.pdf) -resistor array -0 -8 -8 -Resistor_SMD -R_Array_Convex_4x0612 -Precision Thin Film Chip Resistor Array, VISHAY (see http://www.vishay.com/docs/28770/acasat.pdf) -resistor array -0 -8 -8 -Resistor_SMD -R_Array_Convex_4x1206 -Chip Resistor Network, ROHM MNR34 (see mnr_g.pdf) -resistor array -0 -8 -8 -Resistor_SMD -R_Array_Convex_5x0603 -Chip Resistor Network, ROHM MNR15 (see mnr_g.pdf) -resistor array -0 -10 -10 -Resistor_SMD -R_Array_Convex_5x1206 -Chip Resistor Network, ROHM MNR35 (see mnr_g.pdf) -resistor array -0 -10 -10 -Resistor_SMD -R_Array_Convex_8x0602 -Chip Resistor Network, ROHM MNR18 (see mnr_g.pdf) -resistor array -0 -16 -16 -Resistor_SMD -R_Cat16-2 -SMT resistor net, Bourns CAT16 series, 2 way -SMT resistor net Bourns CAT16 series 2 way -0 -4 -4 -Resistor_SMD -R_Cat16-4 -SMT resistor net, Bourns CAT16 series, 4 way -SMT resistor net Bourns CAT16 series 4 way -0 -8 -8 -Resistor_SMD -R_Cat16-8 -SMT resistor net, Bourns CAT16 series, 8 way -SMT resistor net Bourns CAT16 series 8 way -0 -16 -16 -Resistor_SMD -R_MELF_MMB-0207 -Resistor, MELF, MMB-0207, http://www.vishay.com/docs/28713/melfprof.pdf -MELF Resistor -0 -2 -2 -Resistor_SMD -R_MicroMELF_MMU-0102 -Resistor, MicroMELF, MMU-0102, http://www.vishay.com/docs/28713/melfprof.pdf -MicroMELF Resistor -0 -2 -2 -Resistor_SMD -R_MiniMELF_MMA-0204 -Resistor, MiniMELF, MMA-0204, http://www.vishay.com/docs/28713/melfprof.pdf -MiniMELF Resistor -0 -2 -2 -Resistor_SMD -R_Shunt_Ohmite_LVK12 -4 contact shunt resistor -shunt resistor 4 contacts -0 -4 -4 -Resistor_SMD -R_Shunt_Ohmite_LVK20 -4 contacts shunt resistor, https://www.ohmite.com/assets/docs/res_lvk.pdf -4 contacts resistor smd -0 -4 -4 -Resistor_SMD -R_Shunt_Ohmite_LVK24 -4 contacts shunt resistor,https://www.ohmite.com/assets/docs/res_lvk.pdf -4 contacts resistor smd -0 -4 -4 -Resistor_SMD -R_Shunt_Ohmite_LVK25 -4 contacts shunt resistor,https://www.ohmite.com/assets/docs/res_lvk.pdf -4 contacts resistor smd -0 -4 -4 -Resistor_SMD -R_Shunt_Vishay_WSK2512_6332Metric_T1.19mm -Shunt Resistor SMD 2512 (6332 Metric), 2.6mm thick, Vishay WKS2512, Terminal length (T) 1.19mm, 5 to 200 milli Ohm (http://http://www.vishay.com/docs/30108/wsk.pdf) -resistor shunt WSK2512 -0 -4 -4 -Resistor_SMD -R_Shunt_Vishay_WSK2512_6332Metric_T2.21mm -Shunt Resistor SMD 2512 (6332 Metric), 2.6mm thick, Vishay WKS2512, Terminal length (T) 2.21mm, 1 to 4.9 milli Ohm (http://http://www.vishay.com/docs/30108/wsk.pdf) -resistor shunt WSK2512 -0 -4 -4 -Resistor_SMD -R_Shunt_Vishay_WSK2512_6332Metric_T2.66mm -Shunt Resistor SMD 2512 (6332 Metric), 2.6mm thick, Vishay WKS2512, Terminal length (T) 2.66mm, 0.5 to 0.99 milli Ohm (http://http://www.vishay.com/docs/30108/wsk.pdf) -resistor shunt WSK2512 -0 -4 -4 -Resistor_SMD -R_Shunt_Vishay_WSKW0612 -https://www.vishay.com/docs/30332/wskw0612.pdf -4-Terminal SMD Shunt -0 -4 -4 -Resistor_SMD -R_Shunt_Vishay_WSR2_WSR3 -Power Metal Strip Resistors 0.005 to 0.2, https://www.vishay.com/docs/30101/wsr.pdf -SMD Shunt Resistor -0 -2 -2 -Resistor_SMD -R_Shunt_Vishay_WSR2_WSR3_KelvinConnection -Power Metal Strip Resistors 0.005 to 0.2, https://www.vishay.com/docs/30101/wsr.pdf -SMD Shunt Resistor -0 -4 -2 diff --git a/layout_radial.py b/layout_radial.py index 7bd9e8e..e0c9f6a 100644 --- a/layout_radial.py +++ b/layout_radial.py @@ -2,6 +2,7 @@ import re import math +from dataclasses import replace import gerbonara.cad.kicad.pcb as pcb import gerbonara.cad.primitives as cad_pr @@ -10,6 +11,7 @@ import gerbonara.cad.primitives as cad_pr r = 85 cx, cy = 150, 100 +prev_next_cycle = lambda l: zip(l[-1:] + l[:-1], l, l[1:] + l[:1]) si_prefixes = {'k': 1e3, 'M': 1e6, 'G': 1e9, 'm': 1e-3, 'u': 1e-6, 'ยต': 1e-6, 'n': 1e-9, 'p': 1e-12, '.': 1, 'r': 1} def parse_si(s, unit=''): @@ -28,14 +30,22 @@ b.unfill_zones() matches = list(b.find_footprints(name='Package_TO_SOT_SMD:SOT-23', sheetfile='resistor_bank.kicad_sch')) -for i, fp in enumerate(sorted(matches, key=lambda fp: fp.parsed_reference[1])): +components = [(transistor, *transistor.pads_by_number[3].find_connected(name='Resistor_SMD.*')) for transistor in + sorted(matches, key=lambda fp: fp.parsed_reference[1])] + +components = [(q, r1, r2) if parse_si(r1.value) < parse_si(r2.value) else (q, r2, r1) for q, r1, r2 in components] + +num_lgs = 8 +lg_pitch = 1 + +for i, (fp, res1, res2) in enumerate(components): alpha = 2*math.pi * i/len(matches) fp.at.x, fp.at.y = cx+r, cy fp.set_rotation(0) - - res1, res2 = fp.pads_by_number[3].find_connected(name='Resistor_SMD.*') - if parse_si(res1.value) > parse_si(res2.value): - res1, res2 = res2, res1 + for text in fp.texts: + text.at.rotation = 0 + for prop in fp.properties: + prop.at.rotation = 0 res1.at.x, res1.at.y = cx+r+5, cy+2 res1.face('right', net='*/V+') @@ -43,16 +53,60 @@ for i, fp in enumerate(sorted(matches, key=lambda fp: fp.parsed_reference[1])): res2.at.x, res2.at.y = cx+r+5, cy-2 res2.face('right', net='*/V+') - for tr in [ - cad_pr.Trace(0.5, fp.pad(3), res1.pad(2), orientation=['cw']), - cad_pr.Trace(0.5, fp.pad(3), res2.pad(2)) + gnd_via = pcb.Via(at=pcb.XYCoord(fp.pad(2)).with_offset(y=1.5), + size=1.2, + drill=0.6, + net=fp.pad(2).net.number + ) + b.add(gnd_via) + + lg = int(re.search(r'[0-9]*$', fp.pad(1).net.name).group(0)) + lg_via = pcb.Via(at=pcb.XYCoord(fp.pad(1)).with_offset(x=-2-lg_pitch*lg), + size=0.8, + drill=0.4, + net=fp.pad(1).net.number + ) + b.add(lg_via) + + for tr, net_name in [ + (cad_pr.Trace(0.5, fp.pad(3), res1.pad(2), orientation=['ccw']), fp.pad(3).net.name), + (cad_pr.Trace(0.5, fp.pad(3), res2.pad(2), orientation=['cw']), fp.pad(3).net.name), + (cad_pr.Trace(0.5, res1.pad(1), res2.pad(1)), res1.pad(1).net.name), + (cad_pr.Trace(0.5, fp.pad(2), gnd_via), fp.pad(2).net.name), + (cad_pr.Trace(0.5, fp.pad(1), lg_via), fp.pad(1).net.name), ]: - for obj in b.map_gn_cad(tr): + for obj in b.map_gn_cad(tr, net_name=net_name): obj.rotate(alpha, cx, cy) b.add(obj) + for i in range(num_lgs): + p1 = pcb.XYCoord(fp.pad(1)).with_offset(x=-2-lg_pitch*i) + arc = pcb.TrackArc( + start=p1, + end=p1.with_rotation(2*math.pi / len(matches), cx, cy), + center=(cx, cy), + layer='B.Cu', + width=0.5, + net=b.net_id(f'LG{i}'), + ) + arc.rotate(alpha, cx, cy) + b.add(arc) + + gnd_via.rotate(alpha, cx, cy) + lg_via.rotate(alpha, cx, cy) fp.rotate(alpha, cx, cy) res1.rotate(alpha, cx, cy) res2.rotate(alpha, cx, cy) +for i, ((prev_q, prev_r1, prev_r2), (fp, res1, res2), (next_q, next_r1, next_r2)) in enumerate(prev_next_cycle(components)): + if res1.pad(1).net == next_r2.pad(1).net: + arc = pcb.TrackArc( + end=res1.pad(1), + center=(cx, cy), + start=next_r2.pad(1), + width=0.5, + net=res2.pad(1).net.number, + ) + b.add(arc) + b.write('self-balancing-test-a.testout.kicad_pcb')