|
50 | 50 | FootprintPad, |
51 | 51 | LetterSpacing, |
52 | 52 | LineSpacing, |
| 53 | + MinCopperClearance, |
53 | 54 | Mirror, |
54 | 55 | Package, |
55 | 56 | Package3DModel, |
@@ -99,22 +100,15 @@ def uuid(category: str, full_name: str, identifier: str) -> str: |
99 | 100 | return uuid_cache[key] |
100 | 101 |
|
101 | 102 |
|
102 | | -def get_y(pin_number: int, pin_count: int, spacing: float, grid_align: bool) -> float: |
| 103 | +def get_y(pin_number: int, pin_count: int, spacing: float) -> float: |
103 | 104 | """ |
104 | | - Return the y coordinate of the specified pin. Keep the pins grid aligned, if desired. |
| 105 | + Return the y coordinate of the specified pin. |
105 | 106 |
|
106 | 107 | The pin number is 1 index based. Pin 1 is at the top. The middle pin will |
107 | 108 | be at or near 0. |
108 | | -
|
109 | 109 | """ |
110 | | - if grid_align: |
111 | | - mid = float((pin_count + 1) // 2) |
112 | | - else: |
113 | | - mid = (pin_count + 1) / 2 |
114 | | - y = -round(pin_number * spacing - mid * spacing, 2) |
115 | | - if y == -0.0: # Returns true for 0.0 too, but that doesn't matter |
116 | | - return 0.0 |
117 | | - return y |
| 110 | + mid = (pin_count + 1) / 2 |
| 111 | + return -pin_number * spacing + mid * spacing |
118 | 112 |
|
119 | 113 |
|
120 | 114 | def generate_pkg( |
@@ -193,12 +187,13 @@ def _uuid(identifier: str) -> str: |
193 | 187 | description=Description(full_description), |
194 | 188 | keywords=Keywords(full_keywords), |
195 | 189 | author=Author(author), |
196 | | - version=Version('0.2'), |
| 190 | + version=Version('0.3'), |
197 | 191 | created=Created(create_date or now()), |
198 | 192 | deprecated=Deprecated(False), |
199 | 193 | generated_by=GeneratedBy(''), |
200 | 194 | categories=[Category(pkgcat)], |
201 | 195 | assembly_type=AssemblyType.SMT, |
| 196 | + min_copper_clearance=MinCopperClearance(0.15), |
202 | 197 | ) |
203 | 198 |
|
204 | 199 | # Create pads |
@@ -254,7 +249,7 @@ def _generate_footprint(key: str, name: str, tag: str, pad_extension: float) -> |
254 | 249 | # Place pads |
255 | 250 | for pad_idx, pad_nr in enumerate(range(1, config.pin_count + 1)): |
256 | 251 | half_n_pads = config.pin_count // 2 |
257 | | - pad_pos_y = get_y(pad_idx % half_n_pads + 1, half_n_pads, config.pitch, False) |
| 252 | + pad_pos_y = get_y(pad_idx % half_n_pads + 1, half_n_pads, config.pitch) |
258 | 253 |
|
259 | 254 | if pad_idx < (config.pin_count / 2): |
260 | 255 | pad_pos_x = -abs_pad_pos_x |
@@ -314,7 +309,7 @@ def _generate_footprint(key: str, name: str, tag: str, pad_extension: float) -> |
314 | 309 | silk_down = ( |
315 | 310 | config.length / 2 |
316 | 311 | - SILKSCREEN_OFFSET |
317 | | - - get_y(1, half_n_pads, config.pitch, False) |
| 312 | + - get_y(1, half_n_pads, config.pitch) |
318 | 313 | - config.lead_width / 2 |
319 | 314 | - SILKSCREEN_LINE_WIDTH / 2 |
320 | 315 | ) # required for round ending of line |
@@ -383,7 +378,7 @@ def _generate_footprint(key: str, name: str, tag: str, pad_extension: float) -> |
383 | 378 |
|
384 | 379 | # Make silkscreen lead exact pad width and length |
385 | 380 | half_n_pads = config.pin_count // 2 |
386 | | - pad_pos_y = get_y(pad_idx % half_n_pads + 1, half_n_pads, config.pitch, False) |
| 381 | + pad_pos_y = get_y(pad_idx % half_n_pads + 1, half_n_pads, config.pitch) |
387 | 382 | if pad_idx >= (config.pin_count / 2): |
388 | 383 | pad_pos_y = -pad_pos_y |
389 | 384 | y_min = pad_pos_y - config.lead_width / 2 |
@@ -625,7 +620,7 @@ def generate_3d( |
625 | 620 | pins_per_side = config.pin_count // 2 |
626 | 621 | for i in range(0, config.pin_count): |
627 | 622 | side = -1 if (i < pins_per_side) else 1 |
628 | | - y1 = get_y(1 if (i < pins_per_side) else pins_per_side, pins_per_side, config.pitch, False) |
| 623 | + y1 = get_y(1 if (i < pins_per_side) else pins_per_side, pins_per_side, config.pitch) |
629 | 624 | y_index = i % pins_per_side |
630 | 625 | assembly.add_body( |
631 | 626 | lead, |
|
0 commit comments