diff --git a/generate.py b/generate.py index 7467b4f..7234b28 100644 --- a/generate.py +++ b/generate.py @@ -7,7 +7,6 @@ from zipfile import ZipFile import numpy as np import regex as re -from retry import retry from selenium import webdriver from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.support.select import By @@ -29,7 +28,6 @@ PARTS = [ URL_STEP = "https://www.snapeda.com/parts/{0}/Samtec/embed/?ref=samtec" -# @retry(tries=10, delay=1) def download_step_samtec(part: str): print(part) with TemporaryDirectory(prefix=str(dir_ / "tmp") + "/") as tmp: @@ -95,6 +93,7 @@ def footprint_samtec(part: str, lib: Optional[Union[Path, str]] = None) -> str: # lead_style = { # 5: # }[int(match[4])] + lead_style = "vertical" plating = { "F": "Gold flash on post, Matte Tin on tail", "L": '10 µ" (0.25 µm) Gold on post, Matte Tin on tail', @@ -108,6 +107,10 @@ def footprint_samtec(part: str, lib: Optional[Union[Path, str]] = None) -> str: # only outer columns filled cols = 2 fp_name = f"PinHeader_{cols}x{rows:02d}_0.1in_{part}" + description = ( + f"Header, Male, {cols}x{rows:02d}, {lead_style}, {plating}{', high temperature' if high_temp else ''}" + ) + keywords = ["header", "pin"] hole_diam = 0.040 * INCH pad_size = 0.075 * INCH @@ -122,6 +125,8 @@ def footprint_samtec(part: str, lib: Optional[Union[Path, str]] = None) -> str: ( f'(footprint "{fp_name}" (version {now.strftime("%Y%m%d")}) (generator pcbnew) (layer "F.Cu")', r" (attr through_hole)", + f' (descr "{description}")', + f' (tags "{" ".join(keywords)}")', f' (fp_text reference "REF**" (at {center[0]} {-2.032}) (layer "F.SilkS")', r" (effects (font (size 0.762 0.762) (thickness 0.127)))", r" )", @@ -131,13 +136,17 @@ def footprint_samtec(part: str, lib: Optional[Union[Path, str]] = None) -> str: r' (fp_text user "${REFERENCE}" ' f'(at {center[0]} {center[1]} 90) (layer "F.Fab")', r" (effects (font (size 1 1) (thickness 0.15)))", r" )", - f" (fp_rect (start {-0.05 * INCH} {-0.05 * INCH}) (end {0.05 * INCH + strobe[0] * (cols - 1)} {0.05 * INCH + strobe[1] * (rows - 1)})", + f" (fp_rect (start {-0.05 * INCH} {-0.05 * INCH}) " + f"(end {0.05 * INCH + strobe[0] * (cols - 1)} {0.05 * INCH + strobe[1] * (rows - 1)})", f' (stroke (width {SILK_WIDTH}) (type default)) (fill none) (layer "F.SilkS")' r" )", - f' (fp_line (start {-0.05 * INCH} {0.05 * INCH}) (end {0.05 * INCH} {0.05 * INCH}) (layer "F.SilkS") (width {SILK_WIDTH}))', - f' (fp_line (start {0.05 * INCH} {-0.05 * INCH}) (end {0.05 * INCH} {0.05 * INCH}) (layer "F.SilkS") (width {SILK_WIDTH}))', + f" (fp_line (start {-0.05 * INCH} {0.05 * INCH}) (end {0.05 * INCH} {0.05 * INCH}) " + f'(layer "F.SilkS") (width {SILK_WIDTH}))', + f" (fp_line (start {0.05 * INCH} {-0.05 * INCH}) (end {0.05 * INCH} {0.05 * INCH}) " + f'(layer "F.SilkS") (width {SILK_WIDTH}))', *[ f' (pad "{pad + 1}" thru_hole {"rect" if pad == 0 else "circle"} ' - f"(at {strobe[0] * (pad % cols)} {strobe[1] * int(pad / cols)}) (size {pad_size} {pad_size}) (drill {hole_diam}) (layers *.Cu *.Mask))" + f"(at {strobe[0] * (pad % cols)} {strobe[1] * int(pad / cols)}) " + f"(size {pad_size} {pad_size}) (drill {hole_diam}) (layers *.Cu *.Mask))" for pad in range(rows * cols) ], f' (model "/home/brendan/Documents/projects/kicad/samtec.pretty/3dshapes/{part}.stp"',