<s> """<STR_LIT>""" <EOL> from __future__ import print_function , division <EOL> ctyd_gap = <NUM_LIT> <EOL> ctyd_grid = <NUM_LIT> <EOL> ctyd_width = <NUM_LIT> <EOL> silk_width = <NUM_LIT> <EOL> fab_width = <NUM_LIT> <EOL> font_size = ( <NUM_LIT:1.0> , <NUM_LIT:1.0> ) <EOL> font_thickness = <NUM_LIT> <EOL> font_halfheight = <NUM_LIT> <EOL> import os <EOL> import sys <EOL> import time <EOL> import math <EOL> from sexp import parse as sexp_parse , generate as sexp_generate <EOL> from kicad_mod import fp_line , fp_text , pad , draw_square <EOL> def top_pth_refs ( name ) : <EOL> out = [ ] <EOL> ctyd_h = <NUM_LIT> + <NUM_LIT:2> * ctyd_gap <EOL> y = ctyd_h / <NUM_LIT> + font_halfheight <EOL> out . append ( fp_text ( "<STR_LIT>" , "<STR_LIT>" , ( <NUM_LIT:0> , - y ) , <EOL> "<STR_LIT>" , font_size , font_thickness ) ) <EOL> out . append ( fp_text ( "<STR_LIT:value>" , name , ( <NUM_LIT:0> , y ) , <EOL> "<STR_LIT>" , font_size , font_thickness ) ) <EOL> return out <EOL> def side_pth_refs ( name ) : <EOL> out = [ ] <EOL> ctyd_h = <NUM_LIT> + <NUM_LIT:2> * ctyd_gap <EOL> y = ctyd_h / <NUM_LIT> + font_halfheight <EOL> out . append ( fp_text ( "<STR_LIT>" , "<STR_LIT>" , ( <NUM_LIT:0> , - y - <NUM_LIT> ) , <EOL> "<STR_LIT>" , font_size , font_thickness ) ) <EOL> out . append ( fp_text ( "<STR_LIT:value>" , name , ( <NUM_LIT:0> , y - <NUM_LIT> ) , <EOL> "<STR_LIT>" , font_size , font_thickness ) ) <EOL> return out <EOL> def top_smd_refs ( name ) : <EOL> out = [ ] <EOL> ctyd_h = <NUM_LIT> + <NUM_LIT> + <NUM_LIT:2> * ctyd_gap <EOL> y = ctyd_h / <NUM_LIT> + font_halfheight <EOL> out . append ( fp_text ( "<STR_LIT>" , "<STR_LIT>" , ( <NUM_LIT:0> , - y + <NUM_LIT> ) , <EOL> "<STR_LIT>" , font_size , font_thickness ) ) <EOL> out . append ( fp_text ( "<STR_LIT:value>" , name , ( <NUM_LIT:0> , y + <NUM_LIT> ) , <EOL> "<STR_LIT>" , font_size , font_thickness ) ) <EOL> return out <EOL> def side_smd_refs ( name ) : <EOL> out = [ ] <EOL> ctyd_h = <NUM_LIT> + <NUM_LIT> + <NUM_LIT:2> * ctyd_gap <EOL> y = ctyd_h / <NUM_LIT> + font_halfheight <EOL> out . append ( fp_text ( "<STR_LIT>" , "<STR_LIT>" , ( <NUM_LIT:0> , - y - <NUM_LIT> ) , <EOL> "<STR_LIT>" , font_size , font_thickness ) ) <EOL> out . append ( fp_text ( "<STR_LIT:value>" , name , ( <NUM_LIT:0> , y - <NUM_LIT> ) , <EOL> "<STR_LIT>" , font_size , font_thickness ) ) <EOL> return out <EOL> def pth_pads ( pins ) : <EOL> x = pins - <NUM_LIT:1> <EOL> pads = [ ] <EOL> for pin in range ( pins ) : <EOL> pads . append ( pad ( pin + <NUM_LIT:1> , "<STR_LIT>" , "<STR_LIT>" , ( x , <NUM_LIT:0> ) , [ <NUM_LIT> , <NUM_LIT> ] , <EOL> [ "<STR_LIT>" , "<STR_LIT>" ] , drill = <NUM_LIT> ) ) <EOL> x -= <NUM_LIT:2> <EOL> return pads <EOL> def top_smd_pads ( pins ) : <EOL> x = pins - <NUM_LIT:1> <EOL> pads = [ ] <EOL> for pin in range ( pins ) : <EOL> pads . append ( pad ( pin + <NUM_LIT:1> , "<STR_LIT>" , "<STR_LIT>" , ( x , <NUM_LIT:0> ) , [ <NUM_LIT:1> , <NUM_LIT> ] , <EOL> [ "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ] ) ) <EOL> x -= <NUM_LIT:2> <EOL> return pads <EOL> def side_smd_pads ( pins ) : <EOL> x = pins - <NUM_LIT:1> <EOL> pads = [ ] <EOL> for pin in range ( pins ) : <EOL> pads . append ( pad ( pin + <NUM_LIT:1> , "<STR_LIT>" , "<STR_LIT>" , ( x , <NUM_LIT> - <NUM_LIT> ) , [ <NUM_LIT:1> , <NUM_LIT> + <NUM_LIT:2> * <NUM_LIT> ] , <EOL> [ "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ] ) ) <EOL> x -= <NUM_LIT:2> <EOL> return pads <EOL> def top_pth_mount ( pins ) : <EOL> x = ( ( <NUM_LIT> * ( pins - <NUM_LIT:1> ) ) // <NUM_LIT:2> ) + <NUM_LIT> <EOL> size = [ <NUM_LIT> , <NUM_LIT> ] <EOL> layers = [ "<STR_LIT>" ] <EOL> return [ <EOL> pad ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , ( x , - <NUM_LIT> ) , size , layers , drill = <NUM_LIT> ) <EOL> ] <EOL> def side_pth_mount ( pins ) : <EOL> x = ( ( <NUM_LIT> * ( pins - <NUM_LIT:1> ) ) // <NUM_LIT:2> ) + <NUM_LIT> <EOL> size = [ <NUM_LIT> , <NUM_LIT> ] <EOL> layers = [ "<STR_LIT>" ] <EOL> return [ <EOL> pad ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , ( x , - <NUM_LIT> ) , size , layers , drill = <NUM_LIT> ) , <EOL> pad ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , ( - x , - <NUM_LIT> ) , size , layers , drill = <NUM_LIT> ) <EOL> ] <EOL> def top_smd_mount ( pins ) : <EOL> out = [ ] <EOL> x = pins - <NUM_LIT:1> <EOL> for xx in ( x + <NUM_LIT> , - x - <NUM_LIT> ) : <EOL> out . append ( pad ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , ( xx , <NUM_LIT> ) , ( <NUM_LIT> , <NUM_LIT> ) , <EOL> [ "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ] ) ) <EOL> return out <EOL> def side_smd_mount ( pins ) : <EOL> out = [ ] <EOL> x = pins - <NUM_LIT:1> <EOL> for xx in ( x + <NUM_LIT> , - x - <NUM_LIT> ) : <EOL> out . append ( pad ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , ( xx , - <NUM_LIT> ) , ( <NUM_LIT> , <NUM_LIT> ) , <EOL> [ "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ] ) ) <EOL> return out <EOL> def top_pth_silk ( pins ) : <EOL> s = draw_square ( <NUM_LIT:2> * ( pins - <NUM_LIT:1> ) + <NUM_LIT:4> , <NUM_LIT> , ( <NUM_LIT:0> , <NUM_LIT:0> ) , "<STR_LIT>" , silk_width ) <EOL> return s [ <NUM_LIT:4> ] <EOL> def side_pth_silk ( pins ) : <EOL> out = [ ] <EOL> w = silk_width <EOL> centre = ( <NUM_LIT:0> , - <NUM_LIT> ) <EOL> nw , ne , se , sw , _ = draw_square ( <NUM_LIT:2> * ( pins - <NUM_LIT:1> ) + <NUM_LIT:4> , <NUM_LIT> , centre , "<STR_LIT>" , w ) <EOL> out . append ( fp_line ( nw , ne , "<STR_LIT>" , w ) ) <EOL> out . append ( fp_line ( ne , se , "<STR_LIT>" , w ) ) <EOL> out . append ( fp_line ( se , ( se [ <NUM_LIT:0> ] - <NUM_LIT:1> , se [ <NUM_LIT:1> ] ) , "<STR_LIT>" , w ) ) <EOL> out . append ( fp_line ( ( se [ <NUM_LIT:0> ] - <NUM_LIT:1> , se [ <NUM_LIT:1> ] ) , ( se [ <NUM_LIT:0> ] - <NUM_LIT:1> , se [ <NUM_LIT:1> ] - <NUM_LIT:4> ) , "<STR_LIT>" , w ) ) <EOL> out . append ( fp_line ( nw , sw , "<STR_LIT>" , w ) ) <EOL> out . append ( fp_line ( sw , ( sw [ <NUM_LIT:0> ] + <NUM_LIT:1> , sw [ <NUM_LIT:1> ] ) , "<STR_LIT>" , w ) ) <EOL> out . append ( fp_line ( ( sw [ <NUM_LIT:0> ] + <NUM_LIT:1> , sw [ <NUM_LIT:1> ] ) , ( sw [ <NUM_LIT:0> ] + <NUM_LIT:1> , sw [ <NUM_LIT:1> ] - <NUM_LIT:4> ) , "<STR_LIT>" , w ) ) <EOL> return out <EOL> def top_smd_silk ( pins ) : <EOL> out = [ ] <EOL> w = silk_width <EOL> l = "<STR_LIT>" <EOL> nw , ne , se , sw , _ = draw_square ( <NUM_LIT:2> * pins + <NUM_LIT:4> , <NUM_LIT> , ( <NUM_LIT:0> , <NUM_LIT> ) , l , w ) <EOL> out . append ( fp_line ( ( nw [ <NUM_LIT:0> ] , nw [ <NUM_LIT:1> ] + <NUM_LIT> ) , ( nw [ <NUM_LIT:0> ] , nw [ <NUM_LIT:1> ] ) , l , w ) ) <EOL> out . append ( fp_line ( ( nw [ <NUM_LIT:0> ] , nw [ <NUM_LIT:1> ] ) , ( nw [ <NUM_LIT:0> ] + <NUM_LIT> , nw [ <NUM_LIT:1> ] ) , l , w ) ) <EOL> out . append ( fp_line ( ( ne [ <NUM_LIT:0> ] , ne [ <NUM_LIT:1> ] + <NUM_LIT> ) , ( ne [ <NUM_LIT:0> ] , ne [ <NUM_LIT:1> ] ) , l , w ) ) <EOL> out . append ( fp_line ( ( ne [ <NUM_LIT:0> ] , ne [ <NUM_LIT:1> ] ) , ( ne [ <NUM_LIT:0> ] - <NUM_LIT> , ne [ <NUM_LIT:1> ] ) , l , w ) ) <EOL> out . append ( fp_line ( ( sw [ <NUM_LIT:0> ] + <NUM_LIT> , sw [ <NUM_LIT:1> ] ) , ( se [ <NUM_LIT:0> ] - <NUM_LIT> , se [ <NUM_LIT:1> ] ) , l , w ) ) <EOL> return out <EOL> def side_smd_silk ( pins ) : <EOL> out = [ ] <EOL> w = silk_width <EOL> l = "<STR_LIT>" <EOL> nw , ne , se , sw , _ = draw_square ( <NUM_LIT:2> * pins + <NUM_LIT:4> , <NUM_LIT> , ( <NUM_LIT:0> , - <NUM_LIT> ) , l , w ) <EOL> out . append ( fp_line ( nw , ( nw [ <NUM_LIT:0> ] + <NUM_LIT:3> , nw [ <NUM_LIT:1> ] ) , l , w ) ) <EOL> out . append ( fp_line ( ( nw [ <NUM_LIT:0> ] + <NUM_LIT:3> , nw [ <NUM_LIT:1> ] ) , ( nw [ <NUM_LIT:0> ] + <NUM_LIT:3> , nw [ <NUM_LIT:1> ] + <NUM_LIT> ) , l , w ) ) <EOL> out . append ( fp_line ( ( nw [ <NUM_LIT:0> ] + <NUM_LIT:3> , nw [ <NUM_LIT:1> ] + <NUM_LIT> ) , ( ne [ <NUM_LIT:0> ] - <NUM_LIT:3> , ne [ <NUM_LIT:1> ] + <NUM_LIT> ) , l , w ) ) <EOL> out . append ( fp_line ( ( ne [ <NUM_LIT:0> ] - <NUM_LIT:3> , ne [ <NUM_LIT:1> ] + <NUM_LIT> ) , ( ne [ <NUM_LIT:0> ] - <NUM_LIT:3> , ne [ <NUM_LIT:1> ] ) , l , w ) ) <EOL> out . append ( fp_line ( ( ne [ <NUM_LIT:0> ] - <NUM_LIT:3> , ne [ <NUM_LIT:1> ] ) , ne , l , w ) ) <EOL> out . append ( fp_line ( ne , ( ne [ <NUM_LIT:0> ] , ne [ <NUM_LIT:1> ] + <NUM_LIT> - w ) , l , w ) ) <EOL> out . append ( fp_line ( nw , ( nw [ <NUM_LIT:0> ] , nw [ <NUM_LIT:1> ] + <NUM_LIT> - w ) , l , w ) ) <EOL> out . append ( fp_line ( se , ( se [ <NUM_LIT:0> ] , se [ <NUM_LIT:1> ] - <NUM_LIT> + w ) , l , w ) ) <EOL> out . append ( fp_line ( se , ( se [ <NUM_LIT:0> ] - <NUM_LIT> , se [ <NUM_LIT:1> ] ) , l , w ) ) <EOL> out . append ( fp_line ( sw , ( sw [ <NUM_LIT:0> ] , sw [ <NUM_LIT:1> ] - <NUM_LIT> + w ) , l , w ) ) <EOL> out . append ( fp_line ( sw , ( sw [ <NUM_LIT:0> ] + <NUM_LIT> , sw [ <NUM_LIT:1> ] ) , l , w ) ) <EOL> return out <EOL> def top_pth_fab ( pins ) : <EOL> out = [ ] <EOL> _ , _ , _ , _ , sq = draw_square ( <NUM_LIT:2> * ( pins - <NUM_LIT:1> ) + <NUM_LIT:4> , <NUM_LIT> , ( <NUM_LIT:0> , <NUM_LIT:0> ) , "<STR_LIT>" , fab_width ) <EOL> out += sq <EOL> x = pins - <NUM_LIT:1> + <NUM_LIT> <EOL> _ , _ , _ , _ , sq = draw_square ( <NUM_LIT> , <NUM_LIT> , ( x , - <NUM_LIT> ) , "<STR_LIT>" , fab_width ) <EOL> out += sq <EOL> x = pins - <NUM_LIT:1> <EOL> for pin in range ( pins ) : <EOL> _ , _ , _ , _ , sq = draw_square ( <NUM_LIT> , <NUM_LIT> , ( x , <NUM_LIT:0> ) , "<STR_LIT>" , fab_width ) <EOL> out += sq <EOL> x -= <NUM_LIT:2> <EOL> return out <EOL> def side_pth_fab ( pins ) : <EOL> out = [ ] <EOL> w = fab_width <EOL> centre = ( <NUM_LIT:0> , - <NUM_LIT> ) <EOL> nw , ne , se , sw , _ = draw_square ( <NUM_LIT:2> * ( pins - <NUM_LIT:1> ) + <NUM_LIT:4> , <NUM_LIT> , centre , "<STR_LIT>" , w ) <EOL> out . append ( fp_line ( nw , ne , "<STR_LIT>" , w ) ) <EOL> out . append ( fp_line ( ne , se , "<STR_LIT>" , w ) ) <EOL> out . append ( fp_line ( se , ( se [ <NUM_LIT:0> ] - <NUM_LIT:1> , se [ <NUM_LIT:1> ] ) , "<STR_LIT>" , w ) ) <EOL> out . append ( fp_line ( ( se [ <NUM_LIT:0> ] - <NUM_LIT:1> , se [ <NUM_LIT:1> ] ) , ( se [ <NUM_LIT:0> ] - <NUM_LIT:1> , se [ <NUM_LIT:1> ] - <NUM_LIT:4> ) , "<STR_LIT>" , w ) ) <EOL> out . append ( fp_line ( ( se [ <NUM_LIT:0> ] - <NUM_LIT:1> , se [ <NUM_LIT:1> ] - <NUM_LIT:4> ) , ( sw [ <NUM_LIT:0> ] + <NUM_LIT:1> , sw [ <NUM_LIT:1> ] - <NUM_LIT:4> ) , "<STR_LIT>" , w ) ) <EOL> out . append ( fp_line ( nw , sw , "<STR_LIT>" , w ) ) <EOL> out . append ( fp_line ( sw , ( sw [ <NUM_LIT:0> ] + <NUM_LIT:1> , sw [ <NUM_LIT:1> ] ) , "<STR_LIT>" , w ) ) <EOL> out . append ( fp_line ( ( sw [ <NUM_LIT:0> ] + <NUM_LIT:1> , sw [ <NUM_LIT:1> ] ) , ( sw [ <NUM_LIT:0> ] + <NUM_LIT:1> , sw [ <NUM_LIT:1> ] - <NUM_LIT:4> ) , "<STR_LIT>" , w ) ) <EOL> x = ( <NUM_LIT:2> * ( pins - <NUM_LIT:1> ) + <NUM_LIT:4> ) // <NUM_LIT:2> - <NUM_LIT> <EOL> _ , _ , _ , _ , sq = draw_square ( <NUM_LIT> , <NUM_LIT> , ( x , - <NUM_LIT> ) , "<STR_LIT>" , w ) <EOL> out += sq <EOL> _ , _ , _ , _ , sq = draw_square ( <NUM_LIT> , <NUM_LIT> , ( - x , - <NUM_LIT> ) , "<STR_LIT>" , w ) <EOL> out += sq <EOL> x = pins - <NUM_LIT:1> <EOL> for pin in range ( pins ) : <EOL> sq = draw_square ( <NUM_LIT:0.5> , <NUM_LIT> , ( x , - <NUM_LIT> ) , "<STR_LIT>" , fab_width ) <EOL> out += sq [ <NUM_LIT:4> ] <EOL> out . append ( fp_line ( ( x - <NUM_LIT> , - <NUM_LIT> ) , ( x + <NUM_LIT> , - <NUM_LIT> ) , "<STR_LIT>" , fab_width ) ) <EOL> x -= <NUM_LIT:2> <EOL> return out <EOL> def top_smd_fab ( pins ) : <EOL> out = [ ] <EOL> w = fab_width <EOL> _ , _ , _ , _ , sq = draw_square ( <NUM_LIT:2> * pins + <NUM_LIT:4> , <NUM_LIT> , ( <NUM_LIT:0> , <NUM_LIT> ) , "<STR_LIT>" , w ) <EOL> out += sq <EOL> x = pins - <NUM_LIT:1> <EOL> for pin in range ( pins ) : <EOL> _ , _ , _ , _ , sq = draw_square ( <NUM_LIT:0.5> , <NUM_LIT> , ( x , - <NUM_LIT:0> ) , "<STR_LIT>" , w ) <EOL> out += sq <EOL> x -= <NUM_LIT:2> <EOL> return out <EOL> def side_smd_fab ( pins ) : <EOL> out = [ ] <EOL> w = fab_width <EOL> nw , ne , se , sw , sq = draw_square ( <NUM_LIT:2> * pins + <NUM_LIT:4> , <NUM_LIT> , ( <NUM_LIT:0> , - <NUM_LIT> ) , "<STR_LIT>" , w ) <EOL> out . append ( fp_line ( nw , ( nw [ <NUM_LIT:0> ] + <NUM_LIT:3> , nw [ <NUM_LIT:1> ] ) , "<STR_LIT>" , w ) ) <EOL> out . append ( fp_line ( ( nw [ <NUM_LIT:0> ] + <NUM_LIT:3> , nw [ <NUM_LIT:1> ] ) , ( nw [ <NUM_LIT:0> ] + <NUM_LIT:3> , nw [ <NUM_LIT:1> ] + <NUM_LIT> ) , "<STR_LIT>" , w ) ) <EOL> out . append ( fp_line ( ( nw [ <NUM_LIT:0> ] + <NUM_LIT:3> , nw [ <NUM_LIT:1> ] + <NUM_LIT> ) , ( ne [ <NUM_LIT:0> ] - <NUM_LIT:3> , ne [ <NUM_LIT:1> ] + <NUM_LIT> ) , "<STR_LIT>" , w ) ) <EOL> out . append ( fp_line ( ( ne [ <NUM_LIT:0> ] - <NUM_LIT:3> , ne [ <NUM_LIT:1> ] + <NUM_LIT> ) , ( ne [ <NUM_LIT:0> ] - <NUM_LIT:3> , ne [ <NUM_LIT:1> ] ) , "<STR_LIT>" , w ) ) <EOL> out . append ( fp_line ( ( ne [ <NUM_LIT:0> ] - <NUM_LIT:3> , ne [ <NUM_LIT:1> ] ) , ne , "<STR_LIT>" , w ) ) <EOL> out . append ( fp_line ( ne , se , "<STR_LIT>" , w ) ) <EOL> out . append ( fp_line ( se , sw , "<STR_LIT>" , w ) ) <EOL> out . append ( fp_line ( sw , nw , "<STR_LIT>" , w ) ) <EOL> x = pins - <NUM_LIT:1> <EOL> for pin in range ( pins ) : <EOL> _ , _ , _ , _ , sq = draw_square ( <NUM_LIT:0.5> , <NUM_LIT> , ( x , <NUM_LIT> / <NUM_LIT:2> ) , "<STR_LIT>" , w ) <EOL> out += sq <EOL> x -= <NUM_LIT:2> <EOL> return out <EOL> def top_pth_ctyd ( pins ) : <EOL> w = <NUM_LIT:2> * ( pins - <NUM_LIT:1> ) + <NUM_LIT:4> + <NUM_LIT:2> * ctyd_gap <EOL> h = <NUM_LIT> + <NUM_LIT:2> * ctyd_gap <EOL> grid = <NUM_LIT:2> * ctyd_grid <EOL> w = grid * int ( math . ceil ( w / grid ) ) <EOL> h = grid * int ( math . ceil ( h / grid ) ) <EOL> _ , _ , _ , _ , sq = draw_square ( w , h , ( <NUM_LIT:0> , <NUM_LIT:0> ) , "<STR_LIT>" , ctyd_width ) <EOL> return sq <EOL> def side_pth_ctyd ( pins ) : <EOL> w = <NUM_LIT:2> * ( pins - <NUM_LIT:1> ) + <NUM_LIT:4> + <NUM_LIT:2> * ctyd_gap <EOL> h = <NUM_LIT> + <NUM_LIT:2> * ctyd_gap <EOL> grid = <NUM_LIT:2> * ctyd_grid <EOL> w = grid * int ( math . ceil ( w / ( <NUM_LIT:2> * ctyd_grid ) ) ) <EOL> h = grid * int ( math . ceil ( h / ( <NUM_LIT:2> * ctyd_grid ) ) ) <EOL> centre = ( <NUM_LIT:0> , - <NUM_LIT> ) <EOL> _ , _ , _ , _ , sq = draw_square ( w , h , centre , "<STR_LIT>" , ctyd_width ) <EOL> return sq <EOL> def top_smd_ctyd ( pins ) : <EOL> w = <NUM_LIT:2> * ( pins - <NUM_LIT:1> + <NUM_LIT> + <NUM_LIT> + ctyd_gap ) <EOL> h = <NUM_LIT> + <NUM_LIT> + <NUM_LIT:2> * ctyd_gap <EOL> grid = <NUM_LIT:2> * ctyd_grid <EOL> w = grid * int ( math . ceil ( w / ( <NUM_LIT:2> * ctyd_grid ) ) ) <EOL> h = grid * int ( math . ceil ( h / ( <NUM_LIT:2> * ctyd_grid ) ) ) <EOL> centre = ( <NUM_LIT:0> , <NUM_LIT> ) <EOL> _ , _ , _ , _ , sq = draw_square ( w , h , centre , "<STR_LIT>" , ctyd_width ) <EOL> return sq <EOL> def side_smd_ctyd ( pins ) : <EOL> w = <NUM_LIT:2> * ( pins - <NUM_LIT:1> + <NUM_LIT> + <NUM_LIT> + ctyd_gap ) <EOL> h = <NUM_LIT> + <NUM_LIT> + <NUM_LIT:2> * ctyd_gap <EOL> grid = <NUM_LIT:2> * ctyd_grid <EOL> w = grid * int ( math . ceil ( w / ( <NUM_LIT:2> * ctyd_grid ) ) ) <EOL> h = grid * int ( math . ceil ( h / ( <NUM_LIT:2> * ctyd_grid ) ) ) <EOL> centre = ( <NUM_LIT:0> , - <NUM_LIT> ) <EOL> _ , _ , _ , _ , sq = draw_square ( w , h , centre , "<STR_LIT>" , ctyd_width ) <EOL> return sq <EOL> def top_pth_fp ( pins ) : <EOL> name = "<STR_LIT>" . format ( pins ) <EOL> tedit = format ( int ( time . time ( ) ) , '<STR_LIT:X>' ) <EOL> sexp = [ "<STR_LIT>" , name , ( "<STR_LIT>" , "<STR_LIT>" ) , ( "<STR_LIT>" , tedit ) ] <EOL> sexp += top_pth_refs ( name ) <EOL> sexp += top_pth_silk ( pins ) <EOL> sexp += top_pth_fab ( pins ) <EOL> sexp += top_pth_ctyd ( pins ) <EOL> sexp += top_pth_mount ( pins ) <EOL> sexp += pth_pads ( pins ) <EOL> return name , sexp_generate ( sexp ) <EOL> def side_pth_fp ( pins ) : <EOL> name = "<STR_LIT>" . format ( pins ) <EOL> tedit = format ( int ( time . time ( ) ) , '<STR_LIT:X>' ) <EOL> sexp = [ "<STR_LIT>" , name , ( "<STR_LIT>" , "<STR_LIT>" ) , ( "<STR_LIT>" , tedit ) ] <EOL> sexp += side_pth_refs ( name ) <EOL> sexp += side_pth_silk ( pins ) <EOL> sexp += side_pth_fab ( pins ) <EOL> sexp += side_pth_ctyd ( pins ) <EOL> sexp += side_pth_mount ( pins ) <EOL> sexp += pth_pads ( pins ) <EOL> return name , sexp_generate ( sexp ) <EOL> def top_smd_fp ( pins ) : <EOL> name = "<STR_LIT>" . format ( pins ) <EOL> tedit = format ( int ( time . time ( ) ) , '<STR_LIT:X>' ) <EOL> sexp = [ "<STR_LIT>" , name , ( "<STR_LIT>" , "<STR_LIT>" ) , ( "<STR_LIT>" , tedit ) ] <EOL> sexp += top_smd_refs ( name ) <EOL> sexp += top_smd_silk ( pins ) <EOL> sexp += top_smd_fab ( pins ) <EOL> sexp += top_smd_ctyd ( pins ) <EOL> sexp += top_smd_mount ( pins ) <EOL> sexp += top_smd_pads ( pins ) <EOL> return name , sexp_generate ( sexp ) <EOL> def side_smd_fp ( pins ) : <EOL> name = "<STR_LIT>" . format ( pins ) <EOL> tedit = format ( int ( time . time ( ) ) , '<STR_LIT:X>' ) <EOL> sexp = [ "<STR_LIT>" , name , ( "<STR_LIT>" , "<STR_LIT>" ) , ( "<STR_LIT>" , tedit ) ] <EOL> sexp += side_smd_refs ( name ) <EOL> sexp += side_smd_silk ( pins ) <EOL> sexp += side_smd_fab ( pins ) <EOL> sexp += side_smd_ctyd ( pins ) <EOL> sexp += side_smd_mount ( pins ) <EOL> sexp += side_smd_pads ( pins ) <EOL> return name , sexp_generate ( sexp ) <EOL> def main ( prettypath , verify = False ) : <EOL> for pins in range ( <NUM_LIT:2> , <NUM_LIT:9> ) : <EOL> for generator in ( top_pth_fp , side_pth_fp , top_smd_fp , side_smd_fp ) : <EOL> name , fp = generator ( pins ) <EOL> path = os . path . join ( prettypath , name + "<STR_LIT>" ) <EOL> if verify : <EOL> print ( "<STR_LIT>" , path ) <EOL> if os . path . isfile ( path ) : <EOL> with open ( path ) as f : <EOL> old = f . read ( ) <EOL> old = [ n for n in sexp_parse ( old ) if n [ <NUM_LIT:0> ] != "<STR_LIT>" ] <EOL> new = [ n for n in sexp_parse ( fp ) if n [ <NUM_LIT:0> ] != "<STR_LIT>" ] <EOL> if new == old : <EOL> continue <EOL> if verify : <EOL> return False <EOL> else : <EOL> with open ( path , "<STR_LIT:w>" ) as f : <EOL> f . write ( fp ) <EOL> if verify : <EOL> return True <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> if len ( sys . argv ) == <NUM_LIT:2> : <EOL> prettypath = sys . argv [ <NUM_LIT:1> ] <EOL> main ( prettypath ) <EOL> elif len ( sys . argv ) == <NUM_LIT:3> and sys . argv [ <NUM_LIT:2> ] == "<STR_LIT>" : <EOL> prettypath = sys . argv [ <NUM_LIT:1> ] <EOL> if main ( prettypath , verify = True ) : <EOL> print ( "<STR_LIT>" ) <EOL> sys . exit ( <NUM_LIT:0> ) <EOL> else : <EOL> print ( "<STR_LIT>" , file = sys . stderr ) <EOL> sys . exit ( <NUM_LIT:1> ) <EOL> else : <EOL> print ( "<STR_LIT>" . format ( sys . argv [ <NUM_LIT:0> ] ) ) <EOL> sys . exit ( <NUM_LIT:0> ) </s>
