main
John Lauer Preserve board29, component assets and scaffold-fit correction candidate with reviewed footage c54169e
"""Document off-board catalog candidates without misrepresenting PCB footprints."""
from pathlib import Path
import json,shutil,hashlib
R=Path(__file__).resolve().parents[1]
for slug,n in [('m20-1060200',2),('m20-1060300',3),('m20-1180046',1)]:
 P=R/'components'/slug;mpn=slug.upper();housing=n>1;model=json.loads((P/'review/model-review.json').read_text())
 if not housing:
  (P/(slug+'-harness.kicad_sym')).write_text(f'''(kicad_symbol_lib (version 20231120) (generator "adom") (symbol "{mpn}" (in_bom yes) (on_board no)
(property "Reference" "J" (at 0 2.54 0) (effects (font (size 1.27 1.27))))
(property "Value" "{mpn}" (at 0 -2.54 0) (effects (font (size 1.27 1.27))))
(symbol "{mpn}_0_1" (rectangle (start 0 1.27) (end 2.54 -1.27) (stroke (width 0) (type default)) (fill (type background))))
(symbol "{mpn}_1_1" (pin passive line (at -2.54 0 0) (length 2.54) (name "CONTACT" (effects (font (size 1.27 1.27)))) (number "1" (effects (font (size 1.27 1.27))))))))\n''')
  (P/(slug+'-mechanical.kicad_mod')).write_text(f'''(footprint "{mpn}_MECHANICAL_ONLY" (version 20240108) (generator "adom") (layer "F.Cu")
(attr board_only exclude_from_pos_files exclude_from_bom)
(descr "Loose cable contact envelope; no PCB copper pads; not a solder footprint")
(fp_rect (start -1.15 -1.3) (end 1.15 1.3) (stroke (width 0.1) (type default)) (fill none) (layer "F.Fab"))
(model "${{KIPRJMOD}}/{slug}.step" (offset (xyz 0 0 0)) (scale (xyz 1 1 1)) (rotate (xyz 0 0 0))))\n''')
 parts={'symbol':slug+'-harness.kicad_sym','footprint':slug+'-mechanical.kicad_mod','step':slug+'.step','model_3d':slug+'.glb','model_3d_plain':slug+'.glb','model_3d_step':slug+'.step'}
 if housing:parts['mating_pcb_footprint']=f'm20-9990{n}46-MATING-PCB.kicad_mod'
 source='https://www.harwin.com/products/'+mpn
 drawing=('https://content.harwin.com/asset/b9496f9a-d89f-420f-aea9-abb4534be02f/DRG-00376-Technical-Drawing-Datasheet-M20-106-pdf.pdf' if housing else 'https://content.harwin.com/asset/d742d022-1905-41c8-b996-8feb2ed262c8/DRG-00379-Technical-Drawing-Datasheet-M20-118-pdf.pdf')
 page={'slug':slug,'type':'hardware','kind':'component','version':'0.1.0','title':f'Harwin {mpn} '+(f'{n}-position cable housing' if housing else 'loose tin crimp contact'),'description':'Off-board cable component with clearly labeled nominal geometry and harness documentation assets. Not a PCB solder footprint or qualified mating model.','brief':'Cable '+('housing, contacts sold separately' if housing else 'contact, housing sold separately')+'; nominal original CAD, harness symbol and mechanical envelope.','license':'MIT','tags':['connector','cable','Harwin','off-board'],'hero':{'type':'image','path':'hero.png'},'source':{'name':'Harwin','url':source},'component':{'mpn':mpn,'manufacturer':'Harwin','package':'Off-board cable '+('housing' if housing else 'crimp contact'),'pin_count':n,'category':'Connectors','datasheet':drawing,'wiki_url':'https://wiki.adom.inc/adom/'+slug,'parts':parts,'pins':[{'number':str(i+1),'name':str(i+1),'type':'passive','description':'Harness contact position; empty housing has no conductor' if housing else 'Single continuous conductive contact'} for i in range(n)],'assetRoles':{'symbol':'Harness documentation only; on_board=no','footprint':'Mechanical-only envelope with zero copper pads, excluded from board BOM and placement','mating_pcb_footprint':'Separate header exact MPN, not a footprint for this cable housing' if housing else 'Not applicable; contact inserts into a housing'},'qualification':{'status':'provisional','model':'Original simplified nominal geometry; not manufacturer CAD','mating':'Not qualified; internal details and installed contact geometry remain open'}},'because':'Reusable off-board component for Adom electronic-load fan/sensor harness documentation.'}
 (P/'page.json').write_text(json.dumps(page,indent=2)+'\n');pkg=dict(page,name='@adom/'+slug,files=['README.md','LICENSE','THIRD_PARTY.md','page.json','package.json','provenance.json',slug+'*','*-MATING-PCB.kicad_mod','hero.png','symbol.html','footprint.html','skills/**','review/model-review.json'],dependencies={});(P/'package.json').write_text(json.dumps(pkg,indent=2)+'\n')
 shutil.copy2(R/'components/m20-9990346/LICENSE',P/'LICENSE')
 (P/'THIRD_PARTY.md').write_text('Original Adom simplified geometry and documentation are MIT licensed. Manufacturer names and marks remain their owners property. Datasheets/drawings are linked as primary references and are not relicensed or included in this package. These assets are not manufacturer-approved CAD.\n')
 prov={'mpn':mpn,'reviewDate':'2026-10-11','source':source,'drawing':drawing,'geometry':'Original nominal model generated by project tools/build_harwin_cable_assets.py; not downloaded vendor CAD','scope':model,'visualReview':'pending','wikiVisualReview':'pending; task browser closed by user','assetRoles':page['component']['assetRoles']};(P/'provenance.json').write_text(json.dumps(prov,indent=2)+'\n')
 skill=P/'skills'/slug;skill.mkdir(parents=True,exist_ok=True)
 (skill/'SKILL.md').write_text(f'''---
name: {slug}
description: Use the Harwin {mpn} off-board cable component without confusing its mechanical envelope with a PCB solder footprint.
---
# {mpn}
Read README.md and provenance.json. Use the harness symbol with on_board=no. The zero-pad footprint is an assembly envelope only; never invent copper pads for this part. {'Use '+str(n)+' M20-1180046 contacts and the separate exact mating header page. Housing alone has no electrical continuity.' if housing else 'Use one contact per circuit in an M20-106/M20-107 housing. Select reviewed tooling and verify crimp preparation.'}
The model is nominal and simplified. Do not infer retention, engagement or crimp quality from it. Preserve manufacturer contact numbering, document cable orientation and verify continuity; housings are not polarized. The factory Sunon fan has flying leads, not this connector. Keep its as-supplied variant and label any added harness explicitly.
Do not qualify hardware from these assets. Review wire gauge, insulation diameter, strip preparation, crimp heights, insertion, pull retention and mating geometry. Published hero has no state animation because the connector is passive.
''')
 text=f'''# {page['title']}

{page['description']}

[Manufacturer product]({source}) · [Manufacturer drawing]({drawing})

## Assets and use

The harness symbol is off-board (`on_board=no`). The mechanical envelope has **zero copper pads** and is excluded from PCB placement/BOM; it is not a solder footprint. {'The separately named mating PCB footprint is for Harwin M20-9990'+str(n)+'46, not this housing.' if housing else 'The contact belongs inside a cable housing; it has no PCB footprint.'} STEP and GLB show original simplified geometry; inspect `review/model-review.json` for dimensions and omissions.

'''
 if housing:text+=f'''The {n}-position empty housing uses {n} separately purchased M20-1180046 contacts. Nominal exterior is {2.54*n+.2:.2f} × 2.50 × 14.00 mm; pitch 2.54 mm. It mates to 0.64 mm square pins with a specified 5.50–6.30 mm mating length. It is unpolarized. Use the drawn contact-one convention and verify orientation/continuity. Product temperature range is −25 to +85 °C. Electrical ratings apply only when assembled with specified contacts.

Internal passages are illustrative, not a dimensional tolerance model. Latches, cavity steps, chamfers and molded pin-one indication are not reproduced. Do not use this CAD to qualify mating fit.
'''
 else:text+='''Tin-over-nickel brass loose contact, for 22–30 AWG. Manufacturer specifies insulation diameter 0.90–1.60 mm and strip length 3–4 mm. Recommended conductor crimp height is 0.69–0.75 mm for 26–30 AWG, or 0.83–0.89 mm for 22–24 AWG. Hand tool Z20-320 and its instructions are required for the reviewed process. Factory solder-dipped sensor ends are not automatically acceptable for crimping.

CAD is only a loose-contact illustration: socket, spine and open wings are approximate; spring tongue, retention latch and formed curves are omitted. Do not treat it as installed/crimped CAD or fit evidence.
'''
 text+='''
## Verification boundary

Native import, visual checks and physical harness qualification are tracked separately. Live wiki visual review remains pending because the task browser was closed. No factory connector is implied for the Sunon fan. No hardware, crimp or manufacturing release is claimed.
''';(P/'README.md').write_text(text)
 print(slug)