@tscircuit/footprinter 0.0.135 → 0.0.136

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -2151,125 +2151,166 @@ var stampreceiver = (raw_params) => {
2151
2151
  const params = stampreceiver_def.parse(raw_params);
2152
2152
  const height = params.h ?? getHeight2(params);
2153
2153
  const rectpads = [];
2154
+ const pinLabels = [];
2154
2155
  const holes = [];
2155
2156
  const innerDiameter = 1;
2156
2157
  const outerDiameter = 1.2;
2157
2158
  const totalPadsNumber = params.left + params.right + (params.bottom ?? 0) + (params.top ?? 0);
2158
2159
  let routes = [];
2159
- if (params.right) {
2160
- const yoff = -((params.right - 1) / 2) * params.p;
2161
- for (let i = 0; i < params.right; i++) {
2162
- if (i === 0 && !params.left && !params.bottom) {
2160
+ let padIndex = 1;
2161
+ if (params.left) {
2162
+ const yoff = (params.left - 1) / 2 * params.p;
2163
+ for (let i = 0; i < params.left; i++) {
2164
+ if (i === 0) {
2163
2165
  routes = getTriangleDir2(
2164
- params.w / 2 + params.pl * 1.4,
2165
- yoff + i * params.p,
2166
- "right"
2166
+ -params.w / 2 - params.pl / 2,
2167
+ yoff - i * params.p,
2168
+ "left"
2167
2169
  );
2168
2170
  }
2169
2171
  rectpads.push(
2170
2172
  rectpad(
2171
- i + 1 + params.left + (params.bottom ?? 0),
2172
- params.w / 2 - params.pl / 2,
2173
- yoff + i * params.p,
2173
+ padIndex,
2174
+ -params.w / 2 + params.pl / 2,
2175
+ yoff - i * params.p,
2174
2176
  params.pl,
2175
2177
  params.pw
2176
2178
  )
2177
2179
  );
2180
+ pinLabels.push({
2181
+ type: "pcb_silkscreen_text",
2182
+ pcb_silkscreen_text_id: `pin_${padIndex}`,
2183
+ pcb_component_id: "1",
2184
+ layer: "top",
2185
+ anchor_position: {
2186
+ x: -params.w / 2 + params.pl / 2 - 4.5,
2187
+ y: yoff - i * params.p
2188
+ },
2189
+ text: `pin${padIndex}`,
2190
+ font_size: 0.7,
2191
+ font: "tscircuit2024",
2192
+ anchor_alignment: "center"
2193
+ });
2194
+ padIndex++;
2178
2195
  params.innerhole && holes.push(
2179
2196
  platedhole(
2180
- i + 1 + params.left + (params.bottom ?? 0) + totalPadsNumber,
2181
- params.w / 2 - params.innerholeedgedistance,
2182
- yoff + i * params.p,
2197
+ padIndex + totalPadsNumber,
2198
+ -params.w / 2 + params.innerholeedgedistance,
2199
+ yoff - i * params.p,
2183
2200
  innerDiameter,
2184
2201
  outerDiameter
2185
2202
  )
2186
2203
  );
2187
2204
  }
2188
2205
  }
2189
- if (params.left) {
2190
- const yoff = -((params.left - 1) / 2) * params.p;
2191
- for (let i = 0; i < params.left; i++) {
2192
- if (i === params.left - 1) {
2193
- routes = getTriangleDir2(
2194
- -params.w / 2 - params.pl / 3,
2195
- yoff + i * params.p,
2196
- "left"
2197
- );
2198
- }
2206
+ if (params.bottom) {
2207
+ const xoff = (params.bottom - 1) / 2 * params.p;
2208
+ for (let i = params.bottom - 1; i >= 0; i--) {
2199
2209
  rectpads.push(
2200
2210
  rectpad(
2201
- i + 1,
2202
- -params.w / 2 + params.pl / 2,
2203
- yoff + i * params.p,
2204
- params.pl,
2205
- params.pw
2211
+ padIndex,
2212
+ xoff - i * params.p,
2213
+ -height / 2 + params.pl / 2,
2214
+ params.pw,
2215
+ params.pl
2206
2216
  )
2207
2217
  );
2218
+ pinLabels.push({
2219
+ type: "pcb_silkscreen_text",
2220
+ pcb_silkscreen_text_id: `pin_${padIndex}`,
2221
+ pcb_component_id: "1",
2222
+ layer: "top",
2223
+ anchor_position: {
2224
+ x: xoff - i * params.p,
2225
+ y: -height / 2 + params.pl / 2 - 3.2
2226
+ },
2227
+ text: `pin${padIndex}`,
2228
+ font_size: 0.7,
2229
+ font: "tscircuit2024",
2230
+ anchor_alignment: "center"
2231
+ });
2232
+ padIndex++;
2208
2233
  params.innerhole && holes.push(
2209
2234
  platedhole(
2210
- i + 1 + totalPadsNumber,
2211
- -params.w / 2 + params.innerholeedgedistance,
2212
- yoff + i * params.p,
2235
+ padIndex + totalPadsNumber,
2236
+ xoff - i * params.p,
2237
+ -height / 2 + params.innerholeedgedistance,
2213
2238
  innerDiameter,
2214
2239
  outerDiameter
2215
2240
  )
2216
2241
  );
2217
2242
  }
2218
2243
  }
2219
- if (params.top) {
2220
- const xoff = -((params.top - 1) / 2) * params.p;
2221
- for (let i = 0; i < params.top; i++) {
2222
- if (i === params.top - 1 && !params.left && !params.bottom && !params.right) {
2223
- routes = getTriangleDir2(
2224
- xoff + i * params.p,
2225
- height / 2 + params.pl * 1.4,
2226
- "top"
2227
- );
2228
- }
2244
+ if (params.right) {
2245
+ const yoff = -((params.right - 1) / 2) * params.p;
2246
+ for (let i = 0; i < params.right; i++) {
2229
2247
  rectpads.push(
2230
2248
  rectpad(
2231
- i + 1 + params.right + (params.bottom ?? 0) + params.left,
2232
- xoff + i * params.p,
2233
- height / 2 - params.pl / 2,
2234
- params.pw,
2235
- params.pl
2249
+ padIndex,
2250
+ params.w / 2 - params.pl / 2,
2251
+ yoff + i * params.p,
2252
+ params.pl,
2253
+ params.pw
2236
2254
  )
2237
2255
  );
2256
+ pinLabels.push({
2257
+ type: "pcb_silkscreen_text",
2258
+ pcb_silkscreen_text_id: `pin_${padIndex}`,
2259
+ pcb_component_id: "1",
2260
+ layer: "top",
2261
+ anchor_position: {
2262
+ x: params.w / 2 - params.pl / 2 + 3.7,
2263
+ y: yoff + i * params.p
2264
+ },
2265
+ text: `pin${padIndex}`,
2266
+ font_size: 0.7,
2267
+ font: "tscircuit2024",
2268
+ anchor_alignment: "center"
2269
+ });
2270
+ padIndex++;
2238
2271
  params.innerhole && holes.push(
2239
2272
  platedhole(
2240
- i + 1 + params.right + (params.bottom ?? 0) + params.left + totalPadsNumber,
2241
- xoff + i * params.p,
2242
- height / 2 - params.innerholeedgedistance,
2273
+ padIndex + totalPadsNumber,
2274
+ params.w / 2 - params.innerholeedgedistance,
2275
+ yoff + i * params.p,
2243
2276
  innerDiameter,
2244
2277
  outerDiameter
2245
2278
  )
2246
2279
  );
2247
2280
  }
2248
2281
  }
2249
- if (params.bottom) {
2250
- const xoff = -((params.bottom - 1) / 2) * params.p;
2251
- for (let i = 0; i < params.bottom; i++) {
2252
- if (i === 0 && !params.left) {
2253
- routes = getTriangleDir2(
2254
- xoff + i * params.p,
2255
- -height / 2 - params.pl * 1.4,
2256
- "bottom"
2257
- );
2258
- }
2282
+ if (params.top) {
2283
+ const xoff = -((params.top - 1) / 2) * params.p;
2284
+ for (let i = params.top - 1; i >= 0; i--) {
2259
2285
  rectpads.push(
2260
2286
  rectpad(
2261
- i + 1 + params.left,
2287
+ padIndex,
2262
2288
  xoff + i * params.p,
2263
- -height / 2 + params.pl / 2,
2289
+ height / 2 - params.pl / 2,
2264
2290
  params.pw,
2265
2291
  params.pl
2266
2292
  )
2267
2293
  );
2294
+ pinLabels.push({
2295
+ type: "pcb_silkscreen_text",
2296
+ pcb_silkscreen_text_id: `pin_${padIndex}`,
2297
+ pcb_component_id: "1",
2298
+ layer: "top",
2299
+ anchor_position: {
2300
+ x: xoff + i * params.p,
2301
+ y: height / 2 - params.pl / 2 + 3.2
2302
+ },
2303
+ text: `pin${padIndex}`,
2304
+ font_size: 0.7,
2305
+ font: "tscircuit2024",
2306
+ anchor_alignment: "center"
2307
+ });
2308
+ padIndex++;
2268
2309
  params.innerhole && holes.push(
2269
2310
  platedhole(
2270
- i + 1 + params.left + totalPadsNumber,
2311
+ padIndex + totalPadsNumber,
2271
2312
  xoff + i * params.p,
2272
- -height / 2 + params.innerholeedgedistance,
2313
+ height / 2 - params.innerholeedgedistance,
2273
2314
  innerDiameter,
2274
2315
  outerDiameter
2275
2316
  )
@@ -2322,6 +2363,7 @@ var stampreceiver = (raw_params) => {
2322
2363
  circuitJson: [
2323
2364
  ...holes,
2324
2365
  ...rectpads,
2366
+ ...pinLabels,
2325
2367
  silkscreenPath,
2326
2368
  silkscreenTriangle,
2327
2369
  silkscreenRefText