@tscircuit/cli 0.1.1594 → 0.1.1595
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/cli/main.js +559 -187
- package/dist/lib/index.js +528 -156
- package/package.json +2 -2
package/dist/cli/main.js
CHANGED
|
@@ -35296,7 +35296,7 @@ var __create3, __defProp3, __getOwnPropDesc2, __getOwnPropNames3, __getProtoOf3,
|
|
|
35296
35296
|
}, e = (t) => {
|
|
35297
35297
|
let o = t.primitives ?? [...Object.values(t.paths ?? {}), ...Object.values(t.texts ?? {}), ...Object.values(t.circles ?? {}), ...Object.values(t.rects ?? {})], i = t.ports ?? Object.entries(t.refblocks).flatMap(([a, y]) => [{ ...y, labels: [a] }]), l = t.center ?? { x: t.bounds.centerX, y: t.bounds.centerY };
|
|
35298
35298
|
return i.length === 2 && (l = { x: (i[0].x + i[1].x) / 2, y: (i[0].y + i[1].y) / 2 }), new _r({ ...t, primitives: o, ports: i, center: l });
|
|
35299
|
-
}, w, If, o5, Ct, dp, Bf, bp, qf, a5, Nt, _p, Df, gp, Gf, m5, It, up, Uf, vp, Wf, h5, Bt, wp, Hf, Ap, Zf, g5, qt, Pp, Qf, Sp, Kf, A5, Dt, Rp, tc, Fp, A, rc, T5, Gt, Tp, oc, Ep, Yp, ic, k5, Ut, Xp, lc, Lp, Vp, pc, N5, Wt, jp, ac, kp, yc, D5, Ht, zp, xc, Op, j, mc, Z5, Zt, Jp, nc, $p, fc, eg, Qt, Mp, cc, Kt, hc, lg, te, Cp, dc, Np, gr, ur, vr, Ip, Bp, _c, qp, ee, Dp, gc, re, Gp, k, vc, Tg, Up, Wp, wc, Hp, Ac, Lg, Zp, Qp, Pc, Kp, Sc, zg, ta, ea, Rc, ra, z2, Tc, Cg, oe, oa, Ec, ia, Yc, qg, ie, la, Xc, pa, Lc, Wg, le, aa, Vc, ya, jc, Kg, pe, xa, kc, sa, zc, ou, ma, na, Oc, fa, ut, $c, yu, ca, ha, Mc, da, Cc, nu, ba, _a, Nc, ae, ga, Ic, gu, ua, va, Bc, wa, O, Dc, Pu, ye, Aa, Gc, Pa, Sa, J, Wc, Lu, xe, Ra, Hc, Fa, Ta, Zc, $u, se, Ea, Qc, Ya, Kc, Iu, me, Xa, th, La, Va, eh, Hu, ne, ja, rh, ka, P, ih, e3, fe, za, lh, Oa, Ja, ph, y3, ce, $a, ah, Ma, Ca, yh, h3, he, Na, xh, Ia, sh, g3, de, Ba, mh, qa, $2, fh, P3, be, _e, ch, Da, Ga, Ua, hh, j3, ge, ue, dh, Wa, M, _h, $3, ve, Ha, gh, Za, Qa, Ka, uh, W3, we, ty, vh, ey, St = 0.6, wr = 0.3, wh, ry, Rt = 0.6, Ar = 0.3, Ah, oy, Ft = 0.6, Pr = 0.3, Ph, iy, Tt = 0.6, Sr = 0.3, Sh, ly, S, py, ay, yy, xy, sy, my, ny, Th, Eh, Ae, fy, Yh, Et, Rr, Fr, Vh, cy, hy, R, zh, j7, Pe, dy, Oh, by, Jh, J7, Se, _y, $h, gy, Mh, N7, Re, uy, Ch, vy, Nh, D7, Fe, wy, Ih, Ay, Bh, H7, Te, Py, qh, Sy, Dh, t8, Ee, Ry, Gh, Fy, F, Ty, Ey, Yy, Xy7, Ly, Vy, C, Hh, jy, Zh, ky2, Qh, zy, Kh, Oy, td, Jy, ed, $y, rd, My, od, Cy, Ny, N, Iy, By, qy, Dy, I, Tr, Er, Yr, Gy, Xr, Lr, Vr, Uy, jr, kr, zr, Wy, Hy, B, Or, Jr, $r, Zy, Mr, Cr, Nr, Qy, Ir, Br, qr, Ky2, tx, q, Dr, Gr, Ur, ex, Wr, Hr, Zr, rx, Qr, Kr, to, ox, ix, D, eo, ro, oo, lx, io, lo, po, px, ao, yo, xo, ax, Ye, sd, Uv, Xe, yx, md, Le, so, mo, no, xx, Ve, sx, T, fd, x6, je, mx, cd, nx, hd, f6, ke, fx, dd, cx, bd, b6, ze, hx, _d, dx, gd, v6, Oe, bx, ud, _x, vd, S6, Je, gx, wd, ux, Ad, E6, $e, vx, Pd, wx, Ax, Rd, Fd, Me, Px, Td, Yt, Ed, Yd, Sx, Rx, Fx, Vd, jd, Ce, Tx, Ne, Ex, E, Yx, Xx, Lx, Vx, jx, kx, Xt, zx, Ox, Jx, G, $x, Mx, fo, co, ho, Cx, Nx, Ie, bo, _o, Ix, Bx, qx, Be, Dx, Gx, go, uo, Ux, Wx, Cd, Hx, qe, Zx, Nd, vt, De, Qx, Kx, vo, U, wo, Ao, Po, ts, So, Ro, Fo, es, To, Eo, Yo, rs, os5, qd, is, Ge, ls, Dd, wt, Xo, Lo, Vo, Ue, jo, ko, zo, ps, as, ys, Ud, xs, We, ss, Wd, He, ms, ns, Oo, Jo, fs41, cs, Zd, hs, Ze, $o, Qe, Mo, ds, Co, bs, _s, Kd, gs, Ke, us, t2, t0, No, Lt, e0, vs, ws, r2, As, r0, Io, o2, o0, Ps, Ss, Bo, qo, Rs, Fs, l2, Ts, i0, Do, p2, l0, Es, Ys, Go, Uo, Xs, Ls, y2, Vs, p0, Wo, x2, a0, js, ks, Ho, Zo, zs, Os, m2, Js, n2, W, $s, Ms, Cs, g, c2, MP, y0, Qo, h2, Ns, Is, d2, QP, x0, Ko, b2, Bs, _2, rS, s0, ti, g2, qs, u2, pS, m0, ei, v2, Ds, w2, sS, n0, ri, A2, Gs, Us, H, Ws, Hs, Zs, Qs, Z, Ks, tm, em, rm, F2, om, f0, oi, T2, c0, im, lm, ii, li, pm, am, Y2, ym, h0, pi, X2, d0, xm, sm, ai, yi, mm, nm, b0, fm, V2, cm, hm, dm, k2, bm, _0, xi, z22, g0, _m, gm, si, mi, um, u, J2, hR, u0, ni, $22, vm, wm, M2, FR, v0, fi, C2, Am, N2, XR, w0, ci, I2, Pm, B2, kR, A0, hi, q2, Sm, D2, $R, P0, di, G2, Rm, Fm, W2, Tm, S0, Em, R0, H2, Ym, Xm, Q2, Lm, F0, Vm, Q, bi, _i, gi, jm, ui, vi, wi, km, Ai, Pi, Si, zm, K, t9, sF, T0, Ri, e9, Om, r9, cF, E0, Fi, o9, Jm, $m, i9, vF, Y0, Ti, l9, Mm, Cm, a9, RF, X0, Nm, y9, L0, Im, Ei, Yi, Xi, Li, Bm, qm, s9, Dm, V0, Gm, m9, j0, Um, k0, f9, Wm, z0, Hm, c9, X, Vi, ji, ki, Zm, h9, Qm, O0, Km, d9, tn, zi, Oi, Ji, en, $i, Mi, Ci, rn, Ni, Ii, Bi, on2, tt, _9, pT, ln, g9, u9, pn, v9, sT, an, w9, A9, yn, P9, cT, xn, S9, R9, sn, F9, _T, mn, T9, nn, fn, Y9, cn, J0, $0, X9, M0, qi, L9, V9, hn, et, k9, YT, C0, dn, z9, bn, O9, jT, N0, _n, J9, gn, $9, JT, I0, un, M9, vn, C9, NT, B0, wn, N9, An, q0, B9, Pn, D0, Di, q9, rt, Gi, Ui, Wi, Sn, D9, KT, G0, Hi, G9, U0, Zi, Qi, Ki, Rn, tl, el, rl, Fn, Tn, En, ot, ol, il, ll, Yn, pl, al, yl, Xn, xl, sl, ml, Ln, nl, W0, Vn, H9, jn, kn, it, zn, On, Jn, $n, lt, Mn, Cn, Nn, In, pt, Bn, qn, Dn, Gn, at, Un, Wn, Hn, Zn, yt, Qn, Kn, t1, e1, xt, r1, o1, i1, l1, p1, st, fl, cl, hl, a1, dl, bl, _l, y1, gl, ul, vl, x1, s1, mt, wl, Al, Pl, m1, Sl, Rl, Fl, n1, Tl, El, Yl, f1, Vt, nt, Xl, Ll, Vl, c1, jl, kl, zl, h1, Ol, Jl, $l, d1, jt, ft, Ml, Cl, Nl, b1, Il, Bl, ql, _1, Dl, Gl, Ul, g1, ct, u1, v1, w1, A1, Wl, H0, P1, S1, sb, mb, Z0, R1, nb, kt, fb, cb, F1, T1, ht, Y1, E1, X1, L1, j1, V1, k1, z1,
|
|
35299
|
+
}, w, If, o5, Ct, dp, Bf, bp, qf, a5, Nt, _p, Df, gp, Gf, m5, It, up, Uf, vp, Wf, h5, Bt, wp, Hf, Ap, Zf, g5, qt, Pp, Qf, Sp, Kf, A5, Dt, Rp, tc, Fp, A, rc, T5, Gt, Tp, oc, Ep, Yp, ic, k5, Ut, Xp, lc, Lp, Vp, pc, N5, Wt, jp, ac, kp, yc, D5, Ht, zp, xc, Op, j, mc, Z5, Zt, Jp, nc, $p, fc, eg, Qt, Mp, cc, Kt, hc, lg, te, Cp, dc, Np, gr, ur, vr, Ip, Bp, _c, qp, ee, Dp, gc, re, Gp, k, vc, Tg, Up, Wp, wc, Hp, Ac, Lg, Zp, Qp, Pc, Kp, Sc, zg, ta, ea, Rc, ra, z2, Tc, Cg, oe, oa, Ec, ia, Yc, qg, ie, la, Xc, pa, Lc, Wg, le, aa, Vc, ya, jc, Kg, pe, xa, kc, sa, zc, ou, ma, na, Oc, fa, ut, $c, yu, ca, ha, Mc, da, Cc, nu, ba, _a, Nc, ae, ga, Ic, gu, ua, va, Bc, wa, O, Dc, Pu, ye, Aa, Gc, Pa, Sa, J, Wc, Lu, xe, Ra, Hc, Fa, Ta, Zc, $u, se, Ea, Qc, Ya, Kc, Iu, me, Xa, th, La, Va, eh, Hu, ne, ja, rh, ka, P, ih, e3, fe, za, lh, Oa, Ja, ph, y3, ce, $a, ah, Ma, Ca, yh, h3, he, Na, xh, Ia, sh, g3, de, Ba, mh, qa, $2, fh, P3, be, _e, ch, Da, Ga, Ua, hh, j3, ge, ue, dh, Wa, M, _h, $3, ve, Ha, gh, Za, Qa, Ka, uh, W3, we, ty, vh, ey, St = 0.6, wr = 0.3, wh, ry, Rt = 0.6, Ar = 0.3, Ah, oy, Ft = 0.6, Pr = 0.3, Ph, iy, Tt = 0.6, Sr = 0.3, Sh, ly, S, py, ay, yy, xy, sy, my, ny, Th, Eh, Ae, fy, Yh, Et, Rr, Fr, Vh, cy, hy, R, zh, j7, Pe, dy, Oh, by, Jh, J7, Se, _y, $h, gy, Mh, N7, Re, uy, Ch, vy, Nh, D7, Fe, wy, Ih, Ay, Bh, H7, Te, Py, qh, Sy, Dh, t8, Ee, Ry, Gh, Fy, F, Ty, Ey, Yy, Xy7, Ly, Vy, C, Hh, jy, Zh, ky2, Qh, zy, Kh, Oy, td, Jy, ed, $y, rd, My, od, Cy, Ny, N, Iy, By, qy, Dy, I, Tr, Er, Yr, Gy, Xr, Lr, Vr, Uy, jr, kr, zr, Wy, Hy, B, Or, Jr, $r, Zy, Mr, Cr, Nr, Qy, Ir, Br, qr, Ky2, tx, q, Dr, Gr, Ur, ex, Wr, Hr, Zr, rx, Qr, Kr, to, ox, ix, D, eo, ro, oo, lx, io, lo, po, px, ao, yo, xo, ax, Ye, sd, Uv, Xe, yx, md, Le, so, mo, no, xx, Ve, sx, T, fd, x6, je, mx, cd, nx, hd, f6, ke, fx, dd, cx, bd, b6, ze, hx, _d, dx, gd, v6, Oe, bx, ud, _x, vd, S6, Je, gx, wd, ux, Ad, E6, $e, vx, Pd, wx, Ax, Rd, Fd, Me, Px, Td, Yt, Ed, Yd, Sx, Rx, Fx, Vd, jd, Ce, Tx, Ne, Ex, E, Yx, Xx, Lx, Vx, jx, kx, Xt, zx, Ox, Jx, G, $x, Mx, fo, co, ho, Cx, Nx, Ie, bo, _o, Ix, Bx, qx, Be, Dx, Gx, go, uo, Ux, Wx, Cd, Hx, qe, Zx, Nd, vt, De, Qx, Kx, vo, U, wo, Ao, Po, ts, So, Ro, Fo, es, To, Eo, Yo, rs, os5, qd, is, Ge, ls, Dd, wt, Xo, Lo, Vo, Ue, jo, ko, zo, ps, as, ys, Ud, xs, We, ss, Wd, He, ms, ns, Oo, Jo, fs41, cs, Zd, hs, Ze, $o, Qe, Mo, ds, Co, bs, _s, Kd, gs, Ke, us, t2, t0, No, Lt, e0, vs, ws, r2, As, r0, Io, o2, o0, Ps, Ss, Bo, qo, Rs, Fs, l2, Ts, i0, Do, p2, l0, Es, Ys, Go, Uo, Xs, Ls, y2, Vs, p0, Wo, x2, a0, js, ks, Ho, Zo, zs, Os, m2, Js, n2, W, $s, Ms, Cs, g, c2, MP, y0, Qo, h2, Ns, Is, d2, QP, x0, Ko, b2, Bs, _2, rS, s0, ti, g2, qs, u2, pS, m0, ei, v2, Ds, w2, sS, n0, ri, A2, Gs, Us, H, Ws, Hs, Zs, Qs, Z, Ks, tm, em, rm, F2, om, f0, oi, T2, c0, im, lm, ii, li, pm, am, Y2, ym, h0, pi, X2, d0, xm, sm, ai, yi, mm, nm, b0, fm, V2, cm, hm, dm, k2, bm, _0, xi, z22, g0, _m, gm, si, mi, um, u, J2, hR, u0, ni, $22, vm, wm, M2, FR, v0, fi, C2, Am, N2, XR, w0, ci, I2, Pm, B2, kR, A0, hi, q2, Sm, D2, $R, P0, di, G2, Rm, Fm, W2, Tm, S0, Em, R0, H2, Ym, Xm, Q2, Lm, F0, Vm, Q, bi, _i, gi, jm, ui, vi, wi, km, Ai, Pi, Si, zm, K, t9, sF, T0, Ri, e9, Om, r9, cF, E0, Fi, o9, Jm, $m, i9, vF, Y0, Ti, l9, Mm, Cm, a9, RF, X0, Nm, y9, L0, Im, Ei, Yi, Xi, Li, Bm, qm, s9, Dm, V0, Gm, m9, j0, Um, k0, f9, Wm, z0, Hm, c9, X, Vi, ji, ki, Zm, h9, Qm, O0, Km, d9, tn, zi, Oi, Ji, en, $i, Mi, Ci, rn, Ni, Ii, Bi, on2, tt, _9, pT, ln, g9, u9, pn, v9, sT, an, w9, A9, yn, P9, cT, xn, S9, R9, sn, F9, _T, mn, T9, nn, fn, Y9, cn, J0, $0, X9, M0, qi, L9, V9, hn, et, k9, YT, C0, dn, z9, bn, O9, jT, N0, _n, J9, gn, $9, JT, I0, un, M9, vn, C9, NT, B0, wn, N9, An, q0, B9, Pn, D0, Di, q9, rt, Gi, Ui, Wi, Sn, D9, KT, G0, Hi, G9, U0, Zi, Qi, Ki, Rn, tl, el, rl, Fn, Tn, En, ot, ol, il, ll, Yn, pl, al, yl, Xn, xl, sl, ml, Ln, nl, W0, Vn, H9, jn, kn, it, zn, On, Jn, $n, lt, Mn, Cn, Nn, In, pt, Bn, qn, Dn, Gn, at, Un, Wn, Hn, Zn, yt, Qn, Kn, t1, e1, xt, r1, o1, i1, l1, p1, st, fl, cl, hl, a1, dl, bl, _l, y1, gl, ul, vl, x1, s1, mt, wl, Al, Pl, m1, Sl, Rl, Fl, n1, Tl, El, Yl, f1, Vt, nt, Xl, Ll, Vl, c1, jl, kl, zl, h1, Ol, Jl, $l, d1, jt, ft, Ml, Cl, Nl, b1, Il, Bl, ql, _1, Dl, Gl, Ul, g1, ct, u1, v1, w1, A1, Wl, H0, P1, S1, sb, mb, Z0, R1, nb, kt, fb, cb, F1, T1, ht, Y1, E1, X1, L1, j1, V1, k1, z1, At5, Hl, Zl, Ql, Q0, Kl, tp, ep, O1, rp, op, ip, J1, lp, K0, $1, M1, _b, gb, C1, N1, vb, I1, tr, B1, wb, er, pp, Ab, Pb, q1, D1, Rb, G1, rr, ap, Fb, or, U1, W1, Tb, H1, Z1, Q1, K1, tf, Xb, yp, ir, ef, Lb, lr, rf, of, jb, lf, pr, pf, kb, ar, xp, zb, Ob, af, yf, $b, xf, yr, sf, xr, mf, nf, Cb, Nb, sr, ff, Ib, zt, Bb, qb, cf, hf, dt, Ub, df, Wb, bf, Hb, _f, Zb, gf, sp, mr, uf, vf, t_, e_, nr, wf, r_, Ot, o_, i_, Af, Pf, Sf, a_, y_, fr, Rf, x_, Jt, s_, m_, Ff, Tf, Ef, c_, Yf, cr, Xf, h_, hr, mp, d_, b_, Lf, Vf, YC, calculateElbowBends = (p12, p22, overshootAmount) => {
|
|
35300
35300
|
const result = [{
|
|
35301
35301
|
x: p12.x,
|
|
35302
35302
|
y: p12.y
|
|
@@ -39616,8 +39616,8 @@ var init_chunk_4ISXDEM5 = __esm(() => {
|
|
|
39616
39616
|
V1 && (V1.anchor = "middle_bottom");
|
|
39617
39617
|
k1 = j1;
|
|
39618
39618
|
z1 = { paths: { path40: { type: "path", points: [{ x: 0.44, y: 0.04 }, { x: 0.19, y: -0.09 }], color: "primary", fill: false }, path41: { type: "path", points: [{ x: 0.19, y: 0.18 }, { x: 0.44, y: 0.04 }], color: "primary", fill: false }, path42: { type: "path", points: [{ x: 0.19, y: -0.09 }, { x: 0.19, y: 0.18 }], color: "primary", fill: false }, path44: { type: "path", points: [{ x: 0.19, y: 0.04 }, { x: -0.11, y: 0.04 }], color: "primary", fill: false }, path45: { type: "path", points: [{ x: -0.43, y: 0.22 }, { x: -0.11, y: 0.04 }], color: "primary", fill: false } }, texts: { top1: { type: "text", text: "{REF}", x: -0.01, y: 0.27 }, bottom1: { type: "text", text: "{VAL}", x: 0, y: -0.27 } }, refblocks: { right1: { x: -0.43, y: 0.22 } }, bounds: { minX: -0.55, maxX: 0.55, minY: -0.27, maxY: 0.27, width: 1.09, height: 0.55, centerX: 0, centerY: 0 }, circles: {} };
|
|
39619
|
-
|
|
39620
|
-
Hl = r(
|
|
39619
|
+
At5 = e(z1).labelPort("right1", ["1"]).changeTextAnchor("{REF}", "middle_bottom").changeTextAnchor("{VAL}", "middle_top").build();
|
|
39620
|
+
Hl = r(At5, "up");
|
|
39621
39621
|
Zl = Hl.primitives.find((t) => t.type === "text" && t.text === "{REF}");
|
|
39622
39622
|
Ql = Hl.primitives.find((t) => t.type === "text" && t.text === "{VAL}");
|
|
39623
39623
|
Zl.anchor = "middle_bottom";
|
|
@@ -39637,7 +39637,7 @@ var init_chunk_4ISXDEM5 = __esm(() => {
|
|
|
39637
39637
|
ep.y -= 0.4;
|
|
39638
39638
|
ep.x = 0.35;
|
|
39639
39639
|
O1 = Kl;
|
|
39640
|
-
rp = r(
|
|
39640
|
+
rp = r(At5, "left");
|
|
39641
39641
|
op = rp.primitives.find((t) => t.type === "text" && t.text === "{REF}");
|
|
39642
39642
|
ip = rp.primitives.find((t) => t.type === "text" && t.text === "{VAL}");
|
|
39643
39643
|
op.anchor = "middle_bottom";
|
|
@@ -39734,7 +39734,7 @@ var init_chunk_4ISXDEM5 = __esm(() => {
|
|
|
39734
39734
|
d_.anchor = "middle_left";
|
|
39735
39735
|
b_.anchor = "middle_right";
|
|
39736
39736
|
Lf = mp;
|
|
39737
|
-
Vf = { ac_voltmeter_down: bp, ac_voltmeter_horz: gp, ac_voltmeter_left: vp, ac_voltmeter_right: Ap, ac_voltmeter_up: Sp, ac_voltmeter_vert: Fp, avalanche_diode_down: Ep, avalanche_diode_horz: Yp, avalanche_diode_left: Lp, avalanche_diode_right: Vp, avalanche_diode_up: kp, avalanche_diode_vert: Op, backward_diode_down: $p, backward_diode_left: Kt, backward_diode_right: Np, backward_diode_up: Ip, battery_horz: re, battery_vert: Gp, boxresistor_down: Hp, boxresistor_left: Kp, boxresistor_right: ra, boxresistor_small_down: ia, boxresistor_small_left: pa, boxresistor_small_right: ya, boxresistor_small_up: sa, boxresistor_up: fa, bridged_ground_down: da, bridged_ground_left: ga, bridged_ground_right: ae, bridged_ground_up: wa, capacitor_down: Pa, capacitor_left: Sa, capacitor_polarized_down: Fa, capacitor_polarized_left: Ta, capacitor_polarized_right: Ya, capacitor_polarized_up: La, capacitor_right: Va, capacitor_up: ka, constant_current_diode_down: Oa, constant_current_diode_horz: Ja, constant_current_diode_left: Ma, constant_current_diode_right: Ca, constant_current_diode_up: Ia, constant_current_diode_vert: qa, crystal_4pin_down: Da, crystal_4pin_left: Ga, crystal_4pin_right: Ua, crystal_4pin_up: Wa, crystal_down: Za, crystal_left: Qa, crystal_right: Ka, crystal_up: ey, current_source_down: ry, current_source_left: oy, current_source_right: iy, current_source_up: ly, darlington_pair_transistor_down: py, darlington_pair_transistor_horz: ay, darlington_pair_transistor_left: yy, darlington_pair_transistor_right: xy, darlington_pair_transistor_up: sy, darlington_pair_transistor_vert: my, dc_ammeter_horz: Et, dc_ammeter_vert: hy, dc_voltmeter_down: by, dc_voltmeter_horz: gy, dc_voltmeter_left: vy, dc_voltmeter_right: Ay, dc_voltmeter_up: Sy, dc_voltmeter_vert: Fy, diac_down: Ty, diac_horz: Ey, diac_left: Yy, diac_right: Xy7, diac_up: Ly, diac_vert: Vy, digital_ground_down: ky2, digital_ground_left: Oy, digital_ground_right: $y, digital_ground_up: Cy, diode_down: Iy, diode_left: By, diode_right: N, diode_up: qy, dpdt_normally_closed_switch_down: Gy, dpdt_normally_closed_switch_left: Uy, dpdt_normally_closed_switch_right: I, dpdt_normally_closed_switch_up: Wy, dpdt_switch_down: Zy, dpdt_switch_left: Qy, dpdt_switch_right: B, dpdt_switch_up: Ky2, dpst_normally_closed_switch_down: ex, dpst_normally_closed_switch_left: rx, dpst_normally_closed_switch_right: q, dpst_normally_closed_switch_up: ox, dpst_switch_down: lx, dpst_switch_left: px, dpst_switch_right: D, dpst_switch_up: ax, ferrite_bead_down: xx, ferrite_bead_left: sx, ferrite_bead_right: Ve, ferrite_bead_up: Le, filled_diode_down: nx, filled_diode_horz: cx, filled_diode_left: dx, filled_diode_right: _x, filled_diode_up: ux, filled_diode_vert: wx, frequency_meter_horz: Yt, frequency_meter_vert: Rx, fuse_horz: Ne, fuse_vert: Ex, ground_down: Yx, ground_horz: Xx, ground_left: Lx, ground_right: Vx, ground_up: jx, ground_vert: kx, gunn_diode_horz: zx, gunn_diode_vert: Ox, icled_down: $x, icled_left: Mx, icled_right: G, icled_up: Cx, igbt_transistor_horz: Ie, igbt_transistor_vert: Bx, illuminated_push_button_normally_open_horz: Be, illuminated_push_button_normally_open_vert: Ux, inductor_down: Qx, inductor_left: Kx, inductor_right: vt, inductor_up: De, laser_diode_down: ts, laser_diode_left: es, laser_diode_right: U, laser_diode_up: rs, led_down: ps, led_left: as, led_right: wt, led_up: Ue, light_dependent_resistor_horz: He, light_dependent_resistor_vert: fs41, mosfet_depletion_normally_on_horz: Qe, mosfet_depletion_normally_on_vert: bs, mushroom_head_normally_open_momentary_horz: t0, mushroom_head_normally_open_momentary_vert: vs, n_channel_d_mosfet_transistor_horz: o0, n_channel_d_mosfet_transistor_vert: Rs, n_channel_e_mosfet_transistor_horz: l0, n_channel_e_mosfet_transistor_vert: Xs, njfet_transistor_horz: a0, njfet_transistor_vert: zs, not_connected_down: $s, not_connected_left: Ms, not_connected_right: W, not_connected_up: Cs, npn_bipolar_transistor_down: Ns, npn_bipolar_transistor_horz: Is, npn_bipolar_transistor_left: Bs, npn_bipolar_transistor_right: qs, npn_bipolar_transistor_up: Ds, npn_bipolar_transistor_vert: Gs, opamp_no_power_down: Ws, opamp_no_power_left: Hs, opamp_no_power_right: H, opamp_no_power_up: Zs, opamp_with_power_down: Ks, opamp_with_power_left: tm, opamp_with_power_right: Z, opamp_with_power_up: em, p_channel_d_mosfet_transistor_horz: c0, p_channel_d_mosfet_transistor_vert: pm, p_channel_e_mosfet_transistor_horz: d0, p_channel_e_mosfet_transistor_vert: mm, photodiode_horz: b0, photodiode_vert: hm, pjfet_transistor_horz: g0, pjfet_transistor_vert: um, pnp_bipolar_transistor_down: vm, pnp_bipolar_transistor_horz: wm, pnp_bipolar_transistor_left: Am, pnp_bipolar_transistor_right: Pm, pnp_bipolar_transistor_up: Sm, pnp_bipolar_transistor_vert: Rm, potentiometer_horz: R0, potentiometer_vert: Ym, potentiometer2_down: jm, potentiometer2_left: km, potentiometer2_right: Q, potentiometer2_up: zm, potentiometer3_down: Om, potentiometer3_left: Jm, potentiometer3_right: $m, potentiometer3_up: Mm, power_factor_meter_horz: L0, power_factor_meter_vert: Bm, push_button_normally_closed_momentary_horz: j0, push_button_normally_closed_momentary_vert: Um, push_button_normally_open_momentary_down: Zm, push_button_normally_open_momentary_horz: tn, push_button_normally_open_momentary_left: en, push_button_normally_open_momentary_right: X, push_button_normally_open_momentary_up: rn, push_button_normally_open_momentary_vert: on2, rail_down: pn, rail_left: yn, rail_right: sn, rail_up: nn, rectifier_diode_horz: M0, rectifier_diode_vert: hn, resistor_down: bn, resistor_left: gn, resistor_right: vn, resistor_up: An, resonator_down: Sn, resonator_horz: U0, resonator_left: Rn, resonator_right: rt, resonator_up: Fn, resonator_vert: Tn, schottky_diode_down: Yn, schottky_diode_left: Xn, schottky_diode_right: ot, schottky_diode_up: Ln, silicon_controlled_rectifier_horz: W0, silicon_controlled_rectifier_vert: kn, solderjumper2_bridged12_down: zn, solderjumper2_bridged12_left: On, solderjumper2_bridged12_right: Jn, solderjumper2_bridged12_up: $n, solderjumper2_down: Mn, solderjumper2_left: Cn, solderjumper2_right: Nn, solderjumper2_up: In, solderjumper3_bridged12_down: Bn, solderjumper3_bridged12_left: qn, solderjumper3_bridged12_right: Dn, solderjumper3_bridged12_up: Gn, solderjumper3_bridged123_down: Un, solderjumper3_bridged123_left: Wn, solderjumper3_bridged123_right: Hn, solderjumper3_bridged123_up: Zn, solderjumper3_bridged23_down: Qn, solderjumper3_bridged23_left: Kn, solderjumper3_bridged23_right: t1, solderjumper3_bridged23_up: e1, solderjumper3_down: r1, solderjumper3_left: o1, solderjumper3_right: i1, solderjumper3_up: l1, spdt_normally_closed_switch_down: a1, spdt_normally_closed_switch_left: y1, spdt_normally_closed_switch_right: st, spdt_normally_closed_switch_up: x1, spdt_switch_down: m1, spdt_switch_left: n1, spdt_switch_right: mt, spdt_switch_up: f1, spst_normally_closed_switch_down: c1, spst_normally_closed_switch_left: h1, spst_normally_closed_switch_right: nt, spst_normally_closed_switch_up: d1, spst_switch_down: b1, spst_switch_left: _1, spst_switch_right: ft, spst_switch_up: g1, square_wave_down: u1, square_wave_left: v1, square_wave_right: w1, square_wave_up: A1, step_recovery_diode_horz: H0, step_recovery_diode_vert: P1, tachometer_horz: kt, tachometer_vert: T1, testpoint_down: X1, testpoint_left: L1, testpoint_right: ht, testpoint_up: k1, tilted_ground_down: O1, tilted_ground_left: J1, tilted_ground_right:
|
|
39737
|
+
Vf = { ac_voltmeter_down: bp, ac_voltmeter_horz: gp, ac_voltmeter_left: vp, ac_voltmeter_right: Ap, ac_voltmeter_up: Sp, ac_voltmeter_vert: Fp, avalanche_diode_down: Ep, avalanche_diode_horz: Yp, avalanche_diode_left: Lp, avalanche_diode_right: Vp, avalanche_diode_up: kp, avalanche_diode_vert: Op, backward_diode_down: $p, backward_diode_left: Kt, backward_diode_right: Np, backward_diode_up: Ip, battery_horz: re, battery_vert: Gp, boxresistor_down: Hp, boxresistor_left: Kp, boxresistor_right: ra, boxresistor_small_down: ia, boxresistor_small_left: pa, boxresistor_small_right: ya, boxresistor_small_up: sa, boxresistor_up: fa, bridged_ground_down: da, bridged_ground_left: ga, bridged_ground_right: ae, bridged_ground_up: wa, capacitor_down: Pa, capacitor_left: Sa, capacitor_polarized_down: Fa, capacitor_polarized_left: Ta, capacitor_polarized_right: Ya, capacitor_polarized_up: La, capacitor_right: Va, capacitor_up: ka, constant_current_diode_down: Oa, constant_current_diode_horz: Ja, constant_current_diode_left: Ma, constant_current_diode_right: Ca, constant_current_diode_up: Ia, constant_current_diode_vert: qa, crystal_4pin_down: Da, crystal_4pin_left: Ga, crystal_4pin_right: Ua, crystal_4pin_up: Wa, crystal_down: Za, crystal_left: Qa, crystal_right: Ka, crystal_up: ey, current_source_down: ry, current_source_left: oy, current_source_right: iy, current_source_up: ly, darlington_pair_transistor_down: py, darlington_pair_transistor_horz: ay, darlington_pair_transistor_left: yy, darlington_pair_transistor_right: xy, darlington_pair_transistor_up: sy, darlington_pair_transistor_vert: my, dc_ammeter_horz: Et, dc_ammeter_vert: hy, dc_voltmeter_down: by, dc_voltmeter_horz: gy, dc_voltmeter_left: vy, dc_voltmeter_right: Ay, dc_voltmeter_up: Sy, dc_voltmeter_vert: Fy, diac_down: Ty, diac_horz: Ey, diac_left: Yy, diac_right: Xy7, diac_up: Ly, diac_vert: Vy, digital_ground_down: ky2, digital_ground_left: Oy, digital_ground_right: $y, digital_ground_up: Cy, diode_down: Iy, diode_left: By, diode_right: N, diode_up: qy, dpdt_normally_closed_switch_down: Gy, dpdt_normally_closed_switch_left: Uy, dpdt_normally_closed_switch_right: I, dpdt_normally_closed_switch_up: Wy, dpdt_switch_down: Zy, dpdt_switch_left: Qy, dpdt_switch_right: B, dpdt_switch_up: Ky2, dpst_normally_closed_switch_down: ex, dpst_normally_closed_switch_left: rx, dpst_normally_closed_switch_right: q, dpst_normally_closed_switch_up: ox, dpst_switch_down: lx, dpst_switch_left: px, dpst_switch_right: D, dpst_switch_up: ax, ferrite_bead_down: xx, ferrite_bead_left: sx, ferrite_bead_right: Ve, ferrite_bead_up: Le, filled_diode_down: nx, filled_diode_horz: cx, filled_diode_left: dx, filled_diode_right: _x, filled_diode_up: ux, filled_diode_vert: wx, frequency_meter_horz: Yt, frequency_meter_vert: Rx, fuse_horz: Ne, fuse_vert: Ex, ground_down: Yx, ground_horz: Xx, ground_left: Lx, ground_right: Vx, ground_up: jx, ground_vert: kx, gunn_diode_horz: zx, gunn_diode_vert: Ox, icled_down: $x, icled_left: Mx, icled_right: G, icled_up: Cx, igbt_transistor_horz: Ie, igbt_transistor_vert: Bx, illuminated_push_button_normally_open_horz: Be, illuminated_push_button_normally_open_vert: Ux, inductor_down: Qx, inductor_left: Kx, inductor_right: vt, inductor_up: De, laser_diode_down: ts, laser_diode_left: es, laser_diode_right: U, laser_diode_up: rs, led_down: ps, led_left: as, led_right: wt, led_up: Ue, light_dependent_resistor_horz: He, light_dependent_resistor_vert: fs41, mosfet_depletion_normally_on_horz: Qe, mosfet_depletion_normally_on_vert: bs, mushroom_head_normally_open_momentary_horz: t0, mushroom_head_normally_open_momentary_vert: vs, n_channel_d_mosfet_transistor_horz: o0, n_channel_d_mosfet_transistor_vert: Rs, n_channel_e_mosfet_transistor_horz: l0, n_channel_e_mosfet_transistor_vert: Xs, njfet_transistor_horz: a0, njfet_transistor_vert: zs, not_connected_down: $s, not_connected_left: Ms, not_connected_right: W, not_connected_up: Cs, npn_bipolar_transistor_down: Ns, npn_bipolar_transistor_horz: Is, npn_bipolar_transistor_left: Bs, npn_bipolar_transistor_right: qs, npn_bipolar_transistor_up: Ds, npn_bipolar_transistor_vert: Gs, opamp_no_power_down: Ws, opamp_no_power_left: Hs, opamp_no_power_right: H, opamp_no_power_up: Zs, opamp_with_power_down: Ks, opamp_with_power_left: tm, opamp_with_power_right: Z, opamp_with_power_up: em, p_channel_d_mosfet_transistor_horz: c0, p_channel_d_mosfet_transistor_vert: pm, p_channel_e_mosfet_transistor_horz: d0, p_channel_e_mosfet_transistor_vert: mm, photodiode_horz: b0, photodiode_vert: hm, pjfet_transistor_horz: g0, pjfet_transistor_vert: um, pnp_bipolar_transistor_down: vm, pnp_bipolar_transistor_horz: wm, pnp_bipolar_transistor_left: Am, pnp_bipolar_transistor_right: Pm, pnp_bipolar_transistor_up: Sm, pnp_bipolar_transistor_vert: Rm, potentiometer_horz: R0, potentiometer_vert: Ym, potentiometer2_down: jm, potentiometer2_left: km, potentiometer2_right: Q, potentiometer2_up: zm, potentiometer3_down: Om, potentiometer3_left: Jm, potentiometer3_right: $m, potentiometer3_up: Mm, power_factor_meter_horz: L0, power_factor_meter_vert: Bm, push_button_normally_closed_momentary_horz: j0, push_button_normally_closed_momentary_vert: Um, push_button_normally_open_momentary_down: Zm, push_button_normally_open_momentary_horz: tn, push_button_normally_open_momentary_left: en, push_button_normally_open_momentary_right: X, push_button_normally_open_momentary_up: rn, push_button_normally_open_momentary_vert: on2, rail_down: pn, rail_left: yn, rail_right: sn, rail_up: nn, rectifier_diode_horz: M0, rectifier_diode_vert: hn, resistor_down: bn, resistor_left: gn, resistor_right: vn, resistor_up: An, resonator_down: Sn, resonator_horz: U0, resonator_left: Rn, resonator_right: rt, resonator_up: Fn, resonator_vert: Tn, schottky_diode_down: Yn, schottky_diode_left: Xn, schottky_diode_right: ot, schottky_diode_up: Ln, silicon_controlled_rectifier_horz: W0, silicon_controlled_rectifier_vert: kn, solderjumper2_bridged12_down: zn, solderjumper2_bridged12_left: On, solderjumper2_bridged12_right: Jn, solderjumper2_bridged12_up: $n, solderjumper2_down: Mn, solderjumper2_left: Cn, solderjumper2_right: Nn, solderjumper2_up: In, solderjumper3_bridged12_down: Bn, solderjumper3_bridged12_left: qn, solderjumper3_bridged12_right: Dn, solderjumper3_bridged12_up: Gn, solderjumper3_bridged123_down: Un, solderjumper3_bridged123_left: Wn, solderjumper3_bridged123_right: Hn, solderjumper3_bridged123_up: Zn, solderjumper3_bridged23_down: Qn, solderjumper3_bridged23_left: Kn, solderjumper3_bridged23_right: t1, solderjumper3_bridged23_up: e1, solderjumper3_down: r1, solderjumper3_left: o1, solderjumper3_right: i1, solderjumper3_up: l1, spdt_normally_closed_switch_down: a1, spdt_normally_closed_switch_left: y1, spdt_normally_closed_switch_right: st, spdt_normally_closed_switch_up: x1, spdt_switch_down: m1, spdt_switch_left: n1, spdt_switch_right: mt, spdt_switch_up: f1, spst_normally_closed_switch_down: c1, spst_normally_closed_switch_left: h1, spst_normally_closed_switch_right: nt, spst_normally_closed_switch_up: d1, spst_switch_down: b1, spst_switch_left: _1, spst_switch_right: ft, spst_switch_up: g1, square_wave_down: u1, square_wave_left: v1, square_wave_right: w1, square_wave_up: A1, step_recovery_diode_horz: H0, step_recovery_diode_vert: P1, tachometer_horz: kt, tachometer_vert: T1, testpoint_down: X1, testpoint_left: L1, testpoint_right: ht, testpoint_up: k1, tilted_ground_down: O1, tilted_ground_left: J1, tilted_ground_right: At5, tilted_ground_up: Q0, triac_horz: K0, triac_vert: C1, tunnel_diode_horz: er, tunnel_diode_vert: q1, unijunction_transistor_horz: or, unijunction_transistor_vert: Z1, usbc: K1, var_meter_horz: lr, var_meter_vert: rf, varactor_diode_horz: ar, varactor_diode_vert: af, varistor_horz: xr, varistor_vert: mf, varmeter_horz: zt, varmeter_vert: hf, vcc_down: df, vcc_left: bf, vcc_right: _f, vcc_up: gf, volt_meter_horz: mr, volt_meter_vert: uf, watt_hour_meter_horz: Ot, watt_hour_meter_vert: Pf, wattmeter_horz: Jt, wattmeter_vert: Tf, zener_diode_horz: hr, zener_diode_vert: Lf };
|
|
39738
39738
|
YC = Object.fromEntries(Object.keys(Vf).map((t) => [t, t]));
|
|
39739
39739
|
cju5.unparsed = cju5;
|
|
39740
39740
|
su4 = cju5;
|
|
@@ -49772,10 +49772,10 @@ function convertCircuitJsonToSimulationGraphSvg2({
|
|
|
49772
49772
|
}
|
|
49773
49773
|
const timeAxis = buildAxisInfo(allPoints.map((point) => point.timeMs));
|
|
49774
49774
|
const voltageAxis = buildAxisInfo(allPoints.map((point) => point.voltage), true);
|
|
49775
|
-
const plotWidth = Math.max(1, width -
|
|
49776
|
-
const plotHeight = Math.max(1, height -
|
|
49777
|
-
const scaleX = createLinearScale(timeAxis.domainMin, timeAxis.domainMax,
|
|
49778
|
-
const scaleY = createLinearScale(voltageAxis.domainMin, voltageAxis.domainMax,
|
|
49775
|
+
const plotWidth = Math.max(1, width - MARGIN2.left - MARGIN2.right);
|
|
49776
|
+
const plotHeight = Math.max(1, height - MARGIN2.top - MARGIN2.bottom);
|
|
49777
|
+
const scaleX = createLinearScale(timeAxis.domainMin, timeAxis.domainMax, MARGIN2.left, MARGIN2.left + plotWidth);
|
|
49778
|
+
const scaleY = createLinearScale(voltageAxis.domainMin, voltageAxis.domainMax, MARGIN2.top + plotHeight, MARGIN2.top);
|
|
49779
49779
|
const clipPathId = createClipPathId(simulation_experiment_id);
|
|
49780
49780
|
const softwareUsedString = getSoftwareUsedString(circuitJson);
|
|
49781
49781
|
const version2 = CIRCUIT_TO_SVG_VERSION;
|
|
@@ -49986,8 +49986,8 @@ function createDefsNode(clipPathId, plotWidth, plotHeight) {
|
|
|
49986
49986
|
return svgElement("defs", {}, [
|
|
49987
49987
|
svgElement("clipPath", { id: clipPathId }, [
|
|
49988
49988
|
svgElement("rect", {
|
|
49989
|
-
x: formatNumber(
|
|
49990
|
-
y: formatNumber(
|
|
49989
|
+
x: formatNumber(MARGIN2.left),
|
|
49990
|
+
y: formatNumber(MARGIN2.top),
|
|
49991
49991
|
width: formatNumber(plotWidth),
|
|
49992
49992
|
height: formatNumber(plotHeight)
|
|
49993
49993
|
})
|
|
@@ -49997,8 +49997,8 @@ function createDefsNode(clipPathId, plotWidth, plotHeight) {
|
|
|
49997
49997
|
function createPlotBackground(plotWidth, plotHeight) {
|
|
49998
49998
|
return svgElement("rect", {
|
|
49999
49999
|
class: "plot-background",
|
|
50000
|
-
x: formatNumber(
|
|
50001
|
-
y: formatNumber(
|
|
50000
|
+
x: formatNumber(MARGIN2.left),
|
|
50001
|
+
y: formatNumber(MARGIN2.top),
|
|
50002
50002
|
width: formatNumber(plotWidth),
|
|
50003
50003
|
height: formatNumber(plotHeight)
|
|
50004
50004
|
});
|
|
@@ -50011,10 +50011,10 @@ function createGridLines({
|
|
|
50011
50011
|
plotWidth,
|
|
50012
50012
|
plotHeight
|
|
50013
50013
|
}) {
|
|
50014
|
-
const top =
|
|
50015
|
-
const bottom =
|
|
50016
|
-
const left =
|
|
50017
|
-
const right =
|
|
50014
|
+
const top = MARGIN2.top;
|
|
50015
|
+
const bottom = MARGIN2.top + plotHeight;
|
|
50016
|
+
const left = MARGIN2.left;
|
|
50017
|
+
const right = MARGIN2.left + plotWidth;
|
|
50018
50018
|
const children = [];
|
|
50019
50019
|
for (const tick of timeAxis.ticks) {
|
|
50020
50020
|
const x3 = formatNumber(scaleX(tick));
|
|
@@ -50046,9 +50046,9 @@ function createAxes({
|
|
|
50046
50046
|
plotWidth,
|
|
50047
50047
|
plotHeight
|
|
50048
50048
|
}) {
|
|
50049
|
-
const bottom =
|
|
50050
|
-
const left =
|
|
50051
|
-
const right =
|
|
50049
|
+
const bottom = MARGIN2.top + plotHeight;
|
|
50050
|
+
const left = MARGIN2.left;
|
|
50051
|
+
const right = MARGIN2.left + plotWidth;
|
|
50052
50052
|
const children = [
|
|
50053
50053
|
svgElement("line", {
|
|
50054
50054
|
class: "axis axis-x",
|
|
@@ -50060,7 +50060,7 @@ function createAxes({
|
|
|
50060
50060
|
svgElement("line", {
|
|
50061
50061
|
class: "axis axis-y",
|
|
50062
50062
|
x1: formatNumber(left),
|
|
50063
|
-
y1: formatNumber(
|
|
50063
|
+
y1: formatNumber(MARGIN2.top),
|
|
50064
50064
|
x2: formatNumber(left),
|
|
50065
50065
|
y2: formatNumber(bottom)
|
|
50066
50066
|
})
|
|
@@ -50106,16 +50106,16 @@ function createAxes({
|
|
|
50106
50106
|
}, [textNode("Time (ms)")]), svgElement("text", {
|
|
50107
50107
|
class: "axis-title axis-title-y",
|
|
50108
50108
|
x: formatNumber(left - 64),
|
|
50109
|
-
y: formatNumber(
|
|
50110
|
-
transform: `rotate(-90 ${formatNumber(left - 64)} ${formatNumber(
|
|
50109
|
+
y: formatNumber(MARGIN2.top + plotHeight / 2),
|
|
50110
|
+
transform: `rotate(-90 ${formatNumber(left - 64)} ${formatNumber(MARGIN2.top + plotHeight / 2)})`,
|
|
50111
50111
|
"text-anchor": "middle"
|
|
50112
50112
|
}, [textNode("Voltage (V)")]));
|
|
50113
50113
|
return svgElement("g", { class: "axes" }, children);
|
|
50114
50114
|
}
|
|
50115
50115
|
function createLegend(graphs, width) {
|
|
50116
|
-
let currentY =
|
|
50116
|
+
let currentY = MARGIN2.top;
|
|
50117
50117
|
const children = graphs.map((entry) => {
|
|
50118
|
-
const x3 = width -
|
|
50118
|
+
const x3 = width - MARGIN2.right + 10;
|
|
50119
50119
|
const lines = wrapLegendText(entry.label);
|
|
50120
50120
|
const legendItem = createLegendItem(entry, x3, currentY, lines);
|
|
50121
50121
|
const itemHeight = lines.length * LEGEND_LINE_HEIGHT;
|
|
@@ -50245,7 +50245,7 @@ function createTitleNode(experiment, width) {
|
|
|
50245
50245
|
return svgElement("text", {
|
|
50246
50246
|
class: "chart-title",
|
|
50247
50247
|
x: formatNumber(width / 2),
|
|
50248
|
-
y: formatNumber(
|
|
50248
|
+
y: formatNumber(MARGIN2.top - 40),
|
|
50249
50249
|
"text-anchor": "middle"
|
|
50250
50250
|
}, [textNode(experiment.name)]);
|
|
50251
50251
|
}
|
|
@@ -52255,7 +52255,7 @@ var import_debug2, svgAlphabet, lineAlphabet, debug2, debugPcb, debugSch, DEFAUL
|
|
|
52255
52255
|
});
|
|
52256
52256
|
}
|
|
52257
52257
|
return svgObjects;
|
|
52258
|
-
}, circuitJsonToSchematicSvg, DEFAULT_WIDTH = 1200, DEFAULT_HEIGHT = 600,
|
|
52258
|
+
}, circuitJsonToSchematicSvg, DEFAULT_WIDTH = 1200, DEFAULT_HEIGHT = 600, MARGIN2, FALLBACK_LINE_COLOR = "#1f77b4", MAX_LEGEND_LINE_LENGTH = 15, LEGEND_LINE_HEIGHT = 16, LEGEND_MIN_SPACING = 24, DEFAULT_WIDTH2 = 1200, DEFAULT_HEIGHT2 = 1200, DEFAULT_SCHEMATIC_RATIO = 0.55, OBJECT_ORDER3;
|
|
52259
52259
|
var init_dist_3YR26ALR = __esm(() => {
|
|
52260
52260
|
init_chunk_4ISXDEM5();
|
|
52261
52261
|
import_debug2 = __toESM3(require_src2(), 1);
|
|
@@ -53612,7 +53612,7 @@ var init_dist_3YR26ALR = __esm(() => {
|
|
|
53612
53612
|
middle_bottom: "ideographic"
|
|
53613
53613
|
};
|
|
53614
53614
|
circuitJsonToSchematicSvg = convertCircuitJsonToSchematicSvg3;
|
|
53615
|
-
|
|
53615
|
+
MARGIN2 = { top: 64, right: 100, bottom: 80, left: 100 };
|
|
53616
53616
|
OBJECT_ORDER3 = [
|
|
53617
53617
|
"pcb_board",
|
|
53618
53618
|
"pcb_solder_paste"
|
|
@@ -93667,7 +93667,7 @@ var package_default = {
|
|
|
93667
93667
|
"circuit-json-to-3d-png": "^0.0.6",
|
|
93668
93668
|
"circuit-json-to-bom-csv": "^0.0.7",
|
|
93669
93669
|
"circuit-json-to-gerber": "^0.0.51",
|
|
93670
|
-
"circuit-json-to-kicad": "0.0.
|
|
93670
|
+
"circuit-json-to-kicad": "0.0.157",
|
|
93671
93671
|
"circuit-json-to-pnp-csv": "^0.0.7",
|
|
93672
93672
|
"circuit-json-to-readable-netlist": "^0.0.15",
|
|
93673
93673
|
"circuit-json-to-spice": "^0.0.40",
|
|
@@ -97768,11 +97768,28 @@ __export2(exports_dist, {
|
|
|
97768
97768
|
CircuitJsonToKicadSchConverter: () => CircuitJsonToKicadSchConverter,
|
|
97769
97769
|
CircuitJsonToKicadProConverter: () => CircuitJsonToKicadProConverter,
|
|
97770
97770
|
CircuitJsonToKicadPcbConverter: () => CircuitJsonToKicadPcbConverter,
|
|
97771
|
+
CircuitJsonToKicadModConverter: () => CircuitJsonToKicadModConverter,
|
|
97771
97772
|
CircuitJsonToKicadLibraryConverter: () => CircuitJsonToKicadLibraryConverter
|
|
97772
97773
|
});
|
|
97773
97774
|
import { cju } from "@tscircuit/circuit-json-util";
|
|
97774
97775
|
import { KicadSch } from "kicadts";
|
|
97775
97776
|
import { compose as compose2, scale, translate as translate2 } from "transformation-matrix";
|
|
97777
|
+
import {
|
|
97778
|
+
At,
|
|
97779
|
+
Color,
|
|
97780
|
+
Sheet,
|
|
97781
|
+
SheetFill,
|
|
97782
|
+
SheetInstancePage,
|
|
97783
|
+
SheetInstancePath,
|
|
97784
|
+
SheetInstancesForSheet,
|
|
97785
|
+
SheetInstancesProject,
|
|
97786
|
+
SheetProperty,
|
|
97787
|
+
SheetSize,
|
|
97788
|
+
Stroke,
|
|
97789
|
+
TextEffects,
|
|
97790
|
+
TextEffectsFont,
|
|
97791
|
+
TextEffectsJustify
|
|
97792
|
+
} from "kicadts";
|
|
97776
97793
|
import {
|
|
97777
97794
|
EmbeddedFonts,
|
|
97778
97795
|
LibSymbols,
|
|
@@ -97788,36 +97805,36 @@ import {
|
|
|
97788
97805
|
scale as createScaleMatrix,
|
|
97789
97806
|
translate
|
|
97790
97807
|
} from "transformation-matrix";
|
|
97791
|
-
import { Pts, Stroke, SymbolPolyline, SymbolPolylineFill, Xy } from "kicadts";
|
|
97808
|
+
import { Pts, Stroke as Stroke2, SymbolPolyline, SymbolPolylineFill, Xy } from "kicadts";
|
|
97792
97809
|
import { applyToPoint } from "transformation-matrix";
|
|
97793
97810
|
import {
|
|
97794
|
-
Stroke as
|
|
97811
|
+
Stroke as Stroke3,
|
|
97795
97812
|
SymbolCircle,
|
|
97796
97813
|
SymbolCircleCenter,
|
|
97797
97814
|
SymbolCircleFill,
|
|
97798
97815
|
SymbolCircleRadius
|
|
97799
97816
|
} from "kicadts";
|
|
97800
97817
|
import { applyToPoint as applyToPoint2 } from "transformation-matrix";
|
|
97801
|
-
import { SymbolText, TextEffects, TextEffectsFont } from "kicadts";
|
|
97818
|
+
import { SymbolText, TextEffects as TextEffects2, TextEffectsFont as TextEffectsFont2 } from "kicadts";
|
|
97802
97819
|
import { applyToPoint as applyToPoint3 } from "transformation-matrix";
|
|
97803
97820
|
import { SymbolProperty } from "kicadts";
|
|
97804
|
-
import { TextEffects as
|
|
97821
|
+
import { TextEffects as TextEffects3, TextEffectsFont as TextEffectsFont3 } from "kicadts";
|
|
97805
97822
|
import {
|
|
97806
97823
|
SchematicSymbol as SchematicSymbol3,
|
|
97807
97824
|
SymbolPin,
|
|
97808
97825
|
SymbolPinName,
|
|
97809
97826
|
SymbolPinNumber,
|
|
97810
|
-
TextEffects as
|
|
97811
|
-
TextEffectsFont as
|
|
97827
|
+
TextEffects as TextEffects4,
|
|
97828
|
+
TextEffectsFont as TextEffectsFont4
|
|
97812
97829
|
} from "kicadts";
|
|
97813
97830
|
import { applyToPoint as applyToPoint4, scale as createScaleMatrix2 } from "transformation-matrix";
|
|
97814
97831
|
import {
|
|
97815
97832
|
Polyline,
|
|
97816
97833
|
Pts as Pts2,
|
|
97817
97834
|
SchematicText,
|
|
97818
|
-
Stroke as
|
|
97819
|
-
TextEffects as
|
|
97820
|
-
TextEffectsFont as
|
|
97835
|
+
Stroke as Stroke4,
|
|
97836
|
+
TextEffects as TextEffects5,
|
|
97837
|
+
TextEffectsFont as TextEffectsFont5,
|
|
97821
97838
|
Uuid,
|
|
97822
97839
|
Xy as Xy2
|
|
97823
97840
|
} from "kicadts";
|
|
@@ -97830,9 +97847,9 @@ import {
|
|
|
97830
97847
|
SymbolInstances,
|
|
97831
97848
|
SymbolInstancesProject,
|
|
97832
97849
|
SymbolInstancePath,
|
|
97833
|
-
TextEffects as
|
|
97834
|
-
TextEffectsFont as
|
|
97835
|
-
TextEffectsJustify,
|
|
97850
|
+
TextEffects as TextEffects6,
|
|
97851
|
+
TextEffectsFont as TextEffectsFont6,
|
|
97852
|
+
TextEffectsJustify as TextEffectsJustify2,
|
|
97836
97853
|
GlobalLabel
|
|
97837
97854
|
} from "kicadts";
|
|
97838
97855
|
import { applyToPoint as applyToPoint6 } from "transformation-matrix";
|
|
@@ -97844,16 +97861,16 @@ import {
|
|
|
97844
97861
|
SymbolInstances as SymbolInstances2,
|
|
97845
97862
|
SymbolInstancesProject as SymbolInstancesProject2,
|
|
97846
97863
|
SymbolInstancePath as SymbolInstancePath2,
|
|
97847
|
-
TextEffects as
|
|
97848
|
-
TextEffectsFont as
|
|
97849
|
-
TextEffectsJustify as
|
|
97864
|
+
TextEffects as TextEffects7,
|
|
97865
|
+
TextEffectsFont as TextEffectsFont7,
|
|
97866
|
+
TextEffectsJustify as TextEffectsJustify3,
|
|
97850
97867
|
EmbeddedFonts as EmbeddedFonts2,
|
|
97851
97868
|
SymbolPinNames as SymbolPinNames2,
|
|
97852
97869
|
SymbolPinNumbers as SymbolPinNumbers2
|
|
97853
97870
|
} from "kicadts";
|
|
97854
97871
|
import { applyToPoint as applyToPoint7 } from "transformation-matrix";
|
|
97855
97872
|
import { symbols as symbols3 } from "schematic-symbols";
|
|
97856
|
-
import { Wire, Pts as Pts3, Xy as Xy3, Stroke as
|
|
97873
|
+
import { Wire, Pts as Pts3, Xy as Xy3, Stroke as Stroke5, Junction } from "kicadts";
|
|
97857
97874
|
import { applyToPoint as applyToPoint8 } from "transformation-matrix";
|
|
97858
97875
|
import {
|
|
97859
97876
|
SheetInstances,
|
|
@@ -98347,28 +98364,28 @@ import {
|
|
|
98347
98364
|
parseKicadSexpr,
|
|
98348
98365
|
KicadPcb,
|
|
98349
98366
|
FootprintModel,
|
|
98350
|
-
At,
|
|
98367
|
+
At as At2,
|
|
98351
98368
|
EmbeddedFonts as EmbeddedFonts4,
|
|
98352
98369
|
FootprintAttr,
|
|
98353
98370
|
Property,
|
|
98354
|
-
TextEffects as
|
|
98355
|
-
TextEffectsFont as
|
|
98371
|
+
TextEffects as TextEffects8,
|
|
98372
|
+
TextEffectsFont as TextEffectsFont8
|
|
98356
98373
|
} from "kicadts";
|
|
98357
98374
|
import { applyToPoint as applyToPoint17 } from "transformation-matrix";
|
|
98358
98375
|
import {
|
|
98359
98376
|
Property as Property2,
|
|
98360
|
-
TextEffects as
|
|
98361
|
-
TextEffectsFont as
|
|
98377
|
+
TextEffects as TextEffects9,
|
|
98378
|
+
TextEffectsFont as TextEffectsFont9,
|
|
98362
98379
|
EmbeddedFonts as EmbeddedFonts5,
|
|
98363
98380
|
FootprintModel as FootprintModel2,
|
|
98364
98381
|
FootprintAttr as FootprintAttr2
|
|
98365
98382
|
} from "kicadts";
|
|
98366
|
-
import { FpCircle, Stroke as
|
|
98367
|
-
import { FpCircle as FpCircle2, Stroke as
|
|
98368
|
-
import { FpRect, Stroke as
|
|
98369
|
-
import { FpRect as FpRect2, Stroke as
|
|
98370
|
-
import { FpRect as FpRect3, Stroke as
|
|
98371
|
-
import { FpPoly, Pts as Pts5, Stroke as
|
|
98383
|
+
import { FpCircle, Stroke as Stroke6 } from "kicadts";
|
|
98384
|
+
import { FpCircle as FpCircle2, Stroke as Stroke7 } from "kicadts";
|
|
98385
|
+
import { FpRect, Stroke as Stroke8 } from "kicadts";
|
|
98386
|
+
import { FpRect as FpRect2, Stroke as Stroke9 } from "kicadts";
|
|
98387
|
+
import { FpRect as FpRect3, Stroke as Stroke10 } from "kicadts";
|
|
98388
|
+
import { FpPoly, Pts as Pts5, Stroke as Stroke11, Xy as Xy5 } from "kicadts";
|
|
98372
98389
|
import {
|
|
98373
98390
|
applyToPoint as applyToPoint10,
|
|
98374
98391
|
compose as compose4,
|
|
@@ -98377,11 +98394,11 @@ import {
|
|
|
98377
98394
|
translate as translate4
|
|
98378
98395
|
} from "transformation-matrix";
|
|
98379
98396
|
import"kicadts";
|
|
98380
|
-
import { FpText, TextEffects as
|
|
98397
|
+
import { FpText, TextEffects as TextEffects10, TextEffectsFont as TextEffectsFont10 } from "kicadts";
|
|
98381
98398
|
import { applyToPoint as applyToPoint11, rotate as rotate3, identity } from "transformation-matrix";
|
|
98382
|
-
import { FpLine, Stroke as
|
|
98399
|
+
import { FpLine, Stroke as Stroke12 } from "kicadts";
|
|
98383
98400
|
import { applyToPoint as applyToPoint12, identity as identity2, rotate as rotate4 } from "transformation-matrix";
|
|
98384
|
-
import { FpText as FpText3, TextEffects as
|
|
98401
|
+
import { FpText as FpText3, TextEffects as TextEffects11, TextEffectsFont as TextEffectsFont11 } from "kicadts";
|
|
98385
98402
|
import { applyToPoint as applyToPoint13, rotate as rotate5, identity as identity3 } from "transformation-matrix";
|
|
98386
98403
|
import { FootprintModel as FootprintModel3 } from "kicadts";
|
|
98387
98404
|
import {
|
|
@@ -98412,20 +98429,20 @@ import { Footprint as Footprint4 } from "kicadts";
|
|
|
98412
98429
|
import { applyToPoint as applyToPoint20 } from "transformation-matrix";
|
|
98413
98430
|
import { GrCircle, GrLine, GrPoly } from "kicadts";
|
|
98414
98431
|
import {
|
|
98415
|
-
At as
|
|
98432
|
+
At as At3,
|
|
98416
98433
|
GrText,
|
|
98417
|
-
TextEffects as
|
|
98418
|
-
TextEffectsFont as
|
|
98419
|
-
TextEffectsJustify as
|
|
98434
|
+
TextEffects as TextEffects12,
|
|
98435
|
+
TextEffectsFont as TextEffectsFont12,
|
|
98436
|
+
TextEffectsJustify as TextEffectsJustify4
|
|
98420
98437
|
} from "kicadts";
|
|
98421
98438
|
import { applyToPoint as applyToPoint21 } from "transformation-matrix";
|
|
98422
98439
|
import { applyToPoint as applyToPoint23, rotate as rotate9 } from "transformation-matrix";
|
|
98423
98440
|
import {
|
|
98424
98441
|
GrText as GrText2,
|
|
98425
|
-
TextEffects as
|
|
98426
|
-
TextEffectsFont as
|
|
98427
|
-
TextEffectsJustify as
|
|
98428
|
-
At as
|
|
98442
|
+
TextEffects as TextEffects13,
|
|
98443
|
+
TextEffectsFont as TextEffectsFont13,
|
|
98444
|
+
TextEffectsJustify as TextEffectsJustify5,
|
|
98445
|
+
At as At4
|
|
98429
98446
|
} from "kicadts";
|
|
98430
98447
|
import { applyToPoint as applyToPoint22 } from "transformation-matrix";
|
|
98431
98448
|
import { cju as cju3 } from "@tscircuit/circuit-json-util";
|
|
@@ -98437,8 +98454,8 @@ import {
|
|
|
98437
98454
|
parseKicadSexpr as parseKicadSexpr3,
|
|
98438
98455
|
Footprint as Footprint5,
|
|
98439
98456
|
Property as Property3,
|
|
98440
|
-
TextEffects as
|
|
98441
|
-
TextEffectsFont as
|
|
98457
|
+
TextEffects as TextEffects14,
|
|
98458
|
+
TextEffectsFont as TextEffectsFont14
|
|
98442
98459
|
} from "kicadts";
|
|
98443
98460
|
import { parseKicadMod as parseKicadMod2 } from "kicadts";
|
|
98444
98461
|
import {
|
|
@@ -98446,11 +98463,89 @@ import {
|
|
|
98446
98463
|
SymbolPinNames as SymbolPinNames3,
|
|
98447
98464
|
SymbolPinNumbers as SymbolPinNumbers3,
|
|
98448
98465
|
SymbolProperty as SymbolProperty4,
|
|
98449
|
-
TextEffects as
|
|
98450
|
-
TextEffectsFont as
|
|
98451
|
-
TextEffectsJustify as
|
|
98466
|
+
TextEffects as TextEffects15,
|
|
98467
|
+
TextEffectsFont as TextEffectsFont15,
|
|
98468
|
+
TextEffectsJustify as TextEffectsJustify6
|
|
98452
98469
|
} from "kicadts";
|
|
98453
98470
|
import { KicadSymbolLib as KicadSymbolLib2 } from "kicadts";
|
|
98471
|
+
var BOX_WIDTH = 40;
|
|
98472
|
+
var BOX_HEIGHT = 25;
|
|
98473
|
+
var GUTTER_X = 20;
|
|
98474
|
+
var GUTTER_Y = 30;
|
|
98475
|
+
var MARGIN = 25.4;
|
|
98476
|
+
var PROPERTY_FONT_SIZE = 1.524;
|
|
98477
|
+
var SHEET_BORDER_WIDTH = 0.1524;
|
|
98478
|
+
function createSheetPropertyEffects(vertical) {
|
|
98479
|
+
const font = new TextEffectsFont;
|
|
98480
|
+
font.size = { height: PROPERTY_FONT_SIZE, width: PROPERTY_FONT_SIZE };
|
|
98481
|
+
return new TextEffects({
|
|
98482
|
+
font,
|
|
98483
|
+
justify: new TextEffectsJustify({ horizontal: "left", vertical })
|
|
98484
|
+
});
|
|
98485
|
+
}
|
|
98486
|
+
function buildSheetNode(entry, rootUuid, x, y) {
|
|
98487
|
+
const stroke = new Stroke;
|
|
98488
|
+
stroke.width = SHEET_BORDER_WIDTH;
|
|
98489
|
+
stroke.type = "solid";
|
|
98490
|
+
const fill = new SheetFill;
|
|
98491
|
+
fill.color = new Color([0, 0, 0, 0]);
|
|
98492
|
+
const sheetnameProperty = new SheetProperty({
|
|
98493
|
+
key: "Sheetname",
|
|
98494
|
+
value: entry.sheetName,
|
|
98495
|
+
id: 0,
|
|
98496
|
+
at: At.from([x, y - 0.7, 0]),
|
|
98497
|
+
effects: createSheetPropertyEffects("bottom")
|
|
98498
|
+
});
|
|
98499
|
+
const sheetfileProperty = new SheetProperty({
|
|
98500
|
+
key: "Sheetfile",
|
|
98501
|
+
value: entry.filename,
|
|
98502
|
+
id: 1,
|
|
98503
|
+
at: At.from([x, y + BOX_HEIGHT + 0.7, 0]),
|
|
98504
|
+
effects: createSheetPropertyEffects("top")
|
|
98505
|
+
});
|
|
98506
|
+
const instancePath = new SheetInstancePath(`/${rootUuid}`);
|
|
98507
|
+
instancePath.pages = [new SheetInstancePage(entry.pageNumber)];
|
|
98508
|
+
const instancesProject = new SheetInstancesProject("");
|
|
98509
|
+
instancesProject.paths = [instancePath];
|
|
98510
|
+
const instances = new SheetInstancesForSheet;
|
|
98511
|
+
instances.projects = [instancesProject];
|
|
98512
|
+
return new Sheet({
|
|
98513
|
+
position: [x, y],
|
|
98514
|
+
size: new SheetSize(BOX_WIDTH, BOX_HEIGHT),
|
|
98515
|
+
excludeFromSim: false,
|
|
98516
|
+
inBom: true,
|
|
98517
|
+
onBoard: true,
|
|
98518
|
+
dnp: false,
|
|
98519
|
+
fieldsAutoplaced: true,
|
|
98520
|
+
stroke,
|
|
98521
|
+
fill,
|
|
98522
|
+
uuid: entry.sheetNodeUuid,
|
|
98523
|
+
properties: [sheetnameProperty, sheetfileProperty],
|
|
98524
|
+
instances
|
|
98525
|
+
});
|
|
98526
|
+
}
|
|
98527
|
+
function buildChildSheetNodes(children, rootUuid) {
|
|
98528
|
+
const count = children.length;
|
|
98529
|
+
const cols = Math.max(1, Math.ceil(Math.sqrt(count)));
|
|
98530
|
+
const rows = Math.max(1, Math.ceil(count / cols));
|
|
98531
|
+
const nodes = [];
|
|
98532
|
+
for (let index = 0;index < children.length; index++) {
|
|
98533
|
+
const col = index % cols;
|
|
98534
|
+
const row = Math.floor(index / cols);
|
|
98535
|
+
const x = MARGIN + col * (BOX_WIDTH + GUTTER_X);
|
|
98536
|
+
const y = MARGIN + row * (BOX_HEIGHT + GUTTER_Y);
|
|
98537
|
+
nodes.push(buildSheetNode(children[index], rootUuid, x, y));
|
|
98538
|
+
}
|
|
98539
|
+
const spanW = cols * BOX_WIDTH + (cols - 1) * GUTTER_X;
|
|
98540
|
+
const spanH = rows * BOX_HEIGHT + (rows - 1) * GUTTER_Y;
|
|
98541
|
+
return {
|
|
98542
|
+
nodes,
|
|
98543
|
+
extentMm: {
|
|
98544
|
+
width: 2 * MARGIN + spanW,
|
|
98545
|
+
height: 2 * MARGIN + spanH
|
|
98546
|
+
}
|
|
98547
|
+
};
|
|
98548
|
+
}
|
|
98454
98549
|
function getSchematicBoundsAndCenter(db) {
|
|
98455
98550
|
const schematicComponents = db.schematic_component.list();
|
|
98456
98551
|
const schematicTraces = db.schematic_trace.list();
|
|
@@ -98495,6 +98590,86 @@ function getSchematicBoundsAndCenter(db) {
|
|
|
98495
98590
|
}
|
|
98496
98591
|
};
|
|
98497
98592
|
}
|
|
98593
|
+
function isSchematicElement(el) {
|
|
98594
|
+
return typeof el.type === "string" && el.type.startsWith("schematic_");
|
|
98595
|
+
}
|
|
98596
|
+
function keepElementForSheet(el, sheetId, componentIdsOnSheet) {
|
|
98597
|
+
if (!isSchematicElement(el))
|
|
98598
|
+
return true;
|
|
98599
|
+
if (el.type === "schematic_sheet")
|
|
98600
|
+
return false;
|
|
98601
|
+
const hasSheetIdField = "schematic_sheet_id" in el;
|
|
98602
|
+
const hasComponentIdField = "schematic_component_id" in el;
|
|
98603
|
+
if (!hasSheetIdField && !hasComponentIdField)
|
|
98604
|
+
return true;
|
|
98605
|
+
if ((el.schematic_sheet_id ?? null) === sheetId)
|
|
98606
|
+
return true;
|
|
98607
|
+
return el.schematic_component_id != null && componentIdsOnSheet.has(el.schematic_component_id);
|
|
98608
|
+
}
|
|
98609
|
+
function partitionCircuitJsonBySheet(circuitJson, sheetId) {
|
|
98610
|
+
const elements = circuitJson;
|
|
98611
|
+
const componentIdsOnSheet = /* @__PURE__ */ new Set;
|
|
98612
|
+
for (const el of elements) {
|
|
98613
|
+
if (el.type !== "schematic_component")
|
|
98614
|
+
continue;
|
|
98615
|
+
if ((el.schematic_sheet_id ?? null) === sheetId) {
|
|
98616
|
+
componentIdsOnSheet.add(el.schematic_component_id);
|
|
98617
|
+
}
|
|
98618
|
+
}
|
|
98619
|
+
const subset = [];
|
|
98620
|
+
for (const el of elements) {
|
|
98621
|
+
if (keepElementForSheet(el, sheetId, componentIdsOnSheet)) {
|
|
98622
|
+
subset.push(el);
|
|
98623
|
+
}
|
|
98624
|
+
}
|
|
98625
|
+
return subset;
|
|
98626
|
+
}
|
|
98627
|
+
var DEFAULT_ROOT_FILENAME = "schematic.kicad_sch";
|
|
98628
|
+
function toFileBaseName(sheetName, fallbackIndex) {
|
|
98629
|
+
const baseName = sheetName.trim().toLowerCase().replace(/[^a-z0-9]+/g, "_").replace(/^_+|_+$/g, "");
|
|
98630
|
+
return baseName.length > 0 ? baseName : `sheet_${fallbackIndex + 1}`;
|
|
98631
|
+
}
|
|
98632
|
+
function buildSchematicSheetPlan(circuitJson) {
|
|
98633
|
+
const rootUuid = crypto.randomUUID();
|
|
98634
|
+
const root = {
|
|
98635
|
+
schematicSheetId: null,
|
|
98636
|
+
sheetName: "Root",
|
|
98637
|
+
fileBaseName: "root",
|
|
98638
|
+
filename: DEFAULT_ROOT_FILENAME,
|
|
98639
|
+
pageNumber: "1",
|
|
98640
|
+
fileUuid: rootUuid
|
|
98641
|
+
};
|
|
98642
|
+
const schematicSheets = circuitJson.filter((el) => el.type === "schematic_sheet").slice().sort((a, b) => (a.sheet_index ?? 0) - (b.sheet_index ?? 0));
|
|
98643
|
+
const usedFileBaseNames = /* @__PURE__ */ new Set(["root"]);
|
|
98644
|
+
const children = [];
|
|
98645
|
+
for (let index = 0;index < schematicSheets.length; index++) {
|
|
98646
|
+
const sheet = schematicSheets[index];
|
|
98647
|
+
const sheetName = sheet.display_name ?? sheet.name ?? `Sheet ${index + 1}`;
|
|
98648
|
+
let fileBaseName = toFileBaseName(sheet.name ?? sheetName, index);
|
|
98649
|
+
if (usedFileBaseNames.has(fileBaseName)) {
|
|
98650
|
+
let suffix = 2;
|
|
98651
|
+
while (usedFileBaseNames.has(`${fileBaseName}_${suffix}`))
|
|
98652
|
+
suffix++;
|
|
98653
|
+
fileBaseName = `${fileBaseName}_${suffix}`;
|
|
98654
|
+
}
|
|
98655
|
+
usedFileBaseNames.add(fileBaseName);
|
|
98656
|
+
children.push({
|
|
98657
|
+
schematicSheetId: sheet.schematic_sheet_id,
|
|
98658
|
+
sheetName,
|
|
98659
|
+
fileBaseName,
|
|
98660
|
+
filename: `${fileBaseName}.kicad_sch`,
|
|
98661
|
+
pageNumber: `${index + 2}`,
|
|
98662
|
+
sheetNodeUuid: crypto.randomUUID(),
|
|
98663
|
+
fileUuid: crypto.randomUUID()
|
|
98664
|
+
});
|
|
98665
|
+
}
|
|
98666
|
+
return {
|
|
98667
|
+
rootUuid,
|
|
98668
|
+
root,
|
|
98669
|
+
children,
|
|
98670
|
+
isHierarchical: children.length > 0
|
|
98671
|
+
};
|
|
98672
|
+
}
|
|
98498
98673
|
var PAPER_SIZES = [
|
|
98499
98674
|
{ name: "A4", width: 297, height: 210 },
|
|
98500
98675
|
{ name: "A3", width: 420, height: 297 },
|
|
@@ -98768,7 +98943,7 @@ function createPolylineFromPoints({
|
|
|
98768
98943
|
});
|
|
98769
98944
|
const pts = new Pts(xyPoints);
|
|
98770
98945
|
polyline.points = pts;
|
|
98771
|
-
const stroke = new
|
|
98946
|
+
const stroke = new Stroke2;
|
|
98772
98947
|
stroke.width = 0.254;
|
|
98773
98948
|
stroke.type = "default";
|
|
98774
98949
|
polyline.stroke = stroke;
|
|
@@ -98790,7 +98965,7 @@ function createCircleFromPrimitive({
|
|
|
98790
98965
|
const c = circle;
|
|
98791
98966
|
c._sxCenter = new SymbolCircleCenter(scaledPos.x, scaledPos.y);
|
|
98792
98967
|
c._sxRadius = new SymbolCircleRadius(primitive.radius * scale5);
|
|
98793
|
-
const stroke = new
|
|
98968
|
+
const stroke = new Stroke3;
|
|
98794
98969
|
stroke.width = 0.254;
|
|
98795
98970
|
stroke.type = "default";
|
|
98796
98971
|
c._sxStroke = stroke;
|
|
@@ -98815,9 +98990,9 @@ function createTextFromPrimitive({
|
|
|
98815
98990
|
symbolText.value = schText.text;
|
|
98816
98991
|
symbolText.at = [scaledPos.x, scaledPos.y, 0];
|
|
98817
98992
|
const scaledFontSize = schText.fontSize * scale5;
|
|
98818
|
-
const font = new
|
|
98993
|
+
const font = new TextEffectsFont2;
|
|
98819
98994
|
font.size = { height: scaledFontSize, width: scaledFontSize };
|
|
98820
|
-
symbolText.effects = new
|
|
98995
|
+
symbolText.effects = new TextEffects2({ font });
|
|
98821
98996
|
return symbolText;
|
|
98822
98997
|
}
|
|
98823
98998
|
function createDrawingSubsymbol({
|
|
@@ -98901,9 +99076,9 @@ function createGenericChipSymbolData(schematicComp, db) {
|
|
|
98901
99076
|
};
|
|
98902
99077
|
}
|
|
98903
99078
|
function createTextEffects(size, hide) {
|
|
98904
|
-
const font = new
|
|
99079
|
+
const font = new TextEffectsFont3;
|
|
98905
99080
|
font.size = { height: size, width: size };
|
|
98906
|
-
return new
|
|
99081
|
+
return new TextEffects3({
|
|
98907
99082
|
font,
|
|
98908
99083
|
hiddenText: hide
|
|
98909
99084
|
});
|
|
@@ -99087,14 +99262,14 @@ function createPinSubsymbol({
|
|
|
99087
99262
|
});
|
|
99088
99263
|
pin.at = [x, y, angle];
|
|
99089
99264
|
pin.length = isChip ? CHIP_PIN_LENGTH : CUSTOM_SYMBOL_PIN_LENGTH;
|
|
99090
|
-
const nameFont = new
|
|
99265
|
+
const nameFont = new TextEffectsFont4;
|
|
99091
99266
|
nameFont.size = { height: 1.27, width: 1.27 };
|
|
99092
|
-
const nameEffects = new
|
|
99267
|
+
const nameEffects = new TextEffects4({ font: nameFont });
|
|
99093
99268
|
const pinName = port.labels?.[0] || "~";
|
|
99094
99269
|
pin._sxName = new SymbolPinName({ value: pinName, effects: nameEffects });
|
|
99095
|
-
const numFont = new
|
|
99270
|
+
const numFont = new TextEffectsFont4;
|
|
99096
99271
|
numFont.size = { height: 1.27, width: 1.27 };
|
|
99097
|
-
const numEffects = new
|
|
99272
|
+
const numEffects = new TextEffects4({ font: numFont });
|
|
99098
99273
|
const pinNum = port.pinNumber?.toString() || `${i + 1}`;
|
|
99099
99274
|
pin._sxNumber = new SymbolPinNumber({
|
|
99100
99275
|
value: pinNum,
|
|
@@ -99440,7 +99615,7 @@ var AddSchematicGraphicsStage = class extends ConverterStage {
|
|
|
99440
99615
|
new Xy2(start.x, start.y),
|
|
99441
99616
|
new Xy2(end.x, end.y)
|
|
99442
99617
|
]);
|
|
99443
|
-
const stroke = new
|
|
99618
|
+
const stroke = new Stroke4;
|
|
99444
99619
|
stroke.width = 0;
|
|
99445
99620
|
stroke.type = "default";
|
|
99446
99621
|
stroke.color = DEFAULT_SECTION_LINE_COLOR;
|
|
@@ -99461,13 +99636,13 @@ var AddSchematicGraphicsStage = class extends ConverterStage {
|
|
|
99461
99636
|
x: (text.position?.x ?? 0) + DEFAULT_SECTION_TEXT_PADDING_X_MM,
|
|
99462
99637
|
y: sourceY
|
|
99463
99638
|
});
|
|
99464
|
-
const font = new
|
|
99639
|
+
const font = new TextEffectsFont5;
|
|
99465
99640
|
font.size = {
|
|
99466
99641
|
height: DEFAULT_SECTION_TEXT_SIZE_MM,
|
|
99467
99642
|
width: DEFAULT_SECTION_TEXT_SIZE_MM
|
|
99468
99643
|
};
|
|
99469
99644
|
font.color = DEFAULT_SECTION_TEXT_COLOR;
|
|
99470
|
-
const effects = new
|
|
99645
|
+
const effects = new TextEffects5({
|
|
99471
99646
|
font,
|
|
99472
99647
|
hiddenText: false
|
|
99473
99648
|
});
|
|
@@ -99596,7 +99771,8 @@ var AddSchematicNetLabelsStage = class extends ConverterStage {
|
|
|
99596
99771
|
const { kicadSch } = this.ctx;
|
|
99597
99772
|
const instances = new SymbolInstances;
|
|
99598
99773
|
const project = new SymbolInstancesProject("");
|
|
99599
|
-
const
|
|
99774
|
+
const instancePathPrefix = this.ctx.symbolInstancePathPrefix ?? `/${kicadSch?.uuid?.value || ""}`;
|
|
99775
|
+
const path16 = new SymbolInstancePath(instancePathPrefix);
|
|
99600
99776
|
path16.reference = labelText;
|
|
99601
99777
|
path16.unit = 1;
|
|
99602
99778
|
project.paths.push(path16);
|
|
@@ -99637,7 +99813,7 @@ var AddSchematicNetLabelsStage = class extends ConverterStage {
|
|
|
99637
99813
|
const orientation = orientationMap[anchorSide] || orientationMap["left"];
|
|
99638
99814
|
const effects = this.createTextEffects(1.27, false);
|
|
99639
99815
|
if (Object.keys(orientation.justify).length > 0) {
|
|
99640
|
-
effects.justify = new
|
|
99816
|
+
effects.justify = new TextEffectsJustify2(orientation.justify);
|
|
99641
99817
|
}
|
|
99642
99818
|
const globalLabel = new GlobalLabel({
|
|
99643
99819
|
value: labelText,
|
|
@@ -99650,9 +99826,9 @@ var AddSchematicNetLabelsStage = class extends ConverterStage {
|
|
|
99650
99826
|
return globalLabel;
|
|
99651
99827
|
}
|
|
99652
99828
|
createTextEffects(size, hide = false) {
|
|
99653
|
-
const font = new
|
|
99829
|
+
const font = new TextEffectsFont6;
|
|
99654
99830
|
font.size = { height: size, width: size };
|
|
99655
|
-
return new
|
|
99831
|
+
return new TextEffects6({
|
|
99656
99832
|
font,
|
|
99657
99833
|
hiddenText: hide
|
|
99658
99834
|
});
|
|
@@ -99843,7 +100019,8 @@ var AddSchematicSymbolsStage = class extends ConverterStage {
|
|
|
99843
100019
|
}
|
|
99844
100020
|
const instances = new SymbolInstances2;
|
|
99845
100021
|
const project = new SymbolInstancesProject2("");
|
|
99846
|
-
const
|
|
100022
|
+
const instancePathPrefix = this.ctx.symbolInstancePathPrefix ?? `/${kicadSch?.uuid?.value || ""}`;
|
|
100023
|
+
const path16 = new SymbolInstancePath2(instancePathPrefix);
|
|
99847
100024
|
path16.reference = reference;
|
|
99848
100025
|
path16.unit = 1;
|
|
99849
100026
|
project.paths.push(path16);
|
|
@@ -100018,10 +100195,10 @@ var AddSchematicSymbolsStage = class extends ConverterStage {
|
|
|
100018
100195
|
};
|
|
100019
100196
|
}
|
|
100020
100197
|
createTextEffects(size, hide = false, justify) {
|
|
100021
|
-
const font = new
|
|
100198
|
+
const font = new TextEffectsFont7;
|
|
100022
100199
|
font.size = { height: size, width: size };
|
|
100023
|
-
const justifyObj = justify ? new
|
|
100024
|
-
const effects = new
|
|
100200
|
+
const justifyObj = justify ? new TextEffectsJustify3({ horizontal: justify }) : undefined;
|
|
100201
|
+
const effects = new TextEffects7({
|
|
100025
100202
|
font,
|
|
100026
100203
|
hiddenText: hide,
|
|
100027
100204
|
justify: justifyObj
|
|
@@ -100082,7 +100259,7 @@ var AddSchematicTracesStage = class extends ConverterStage {
|
|
|
100082
100259
|
const y2 = to.y;
|
|
100083
100260
|
const pts = new Pts3([new Xy3(x1, y1), new Xy3(x2, y2)]);
|
|
100084
100261
|
wire.points = pts;
|
|
100085
|
-
const stroke = new
|
|
100262
|
+
const stroke = new Stroke5;
|
|
100086
100263
|
stroke.width = DEFAULT_LINE_WIDTH_MM;
|
|
100087
100264
|
stroke.type = "default";
|
|
100088
100265
|
wire.stroke = stroke;
|
|
@@ -100138,7 +100315,7 @@ var InitializeSchematicStage = class extends ConverterStage {
|
|
|
100138
100315
|
const paper = new Paper;
|
|
100139
100316
|
paper.size = schematicPaperSize?.name ?? "A4";
|
|
100140
100317
|
kicadSch.paper = paper;
|
|
100141
|
-
kicadSch.uuid = new Uuid4(crypto.randomUUID());
|
|
100318
|
+
kicadSch.uuid = new Uuid4(this.ctx.schematicFileUuid ?? crypto.randomUUID());
|
|
100142
100319
|
this.finished = true;
|
|
100143
100320
|
}
|
|
100144
100321
|
getOutput() {
|
|
@@ -100146,15 +100323,22 @@ var InitializeSchematicStage = class extends ConverterStage {
|
|
|
100146
100323
|
}
|
|
100147
100324
|
};
|
|
100148
100325
|
var DEFAULT_SCHEMATIC_SCALE_FACTOR = 15;
|
|
100326
|
+
var DEFAULT_PAPER_PADDING_MM = 20;
|
|
100149
100327
|
var CircuitJsonToKicadSchConverter = class {
|
|
100150
100328
|
ctx;
|
|
100151
100329
|
pipeline;
|
|
100152
100330
|
currentStageIndex = 0;
|
|
100153
100331
|
finished = false;
|
|
100332
|
+
circuitJson;
|
|
100333
|
+
schematicSheetPlan;
|
|
100334
|
+
files = [];
|
|
100335
|
+
built = false;
|
|
100154
100336
|
get currentStage() {
|
|
100155
100337
|
return this.pipeline[this.currentStageIndex];
|
|
100156
100338
|
}
|
|
100157
100339
|
constructor(circuitJson) {
|
|
100340
|
+
this.circuitJson = circuitJson;
|
|
100341
|
+
this.schematicSheetPlan = buildSchematicSheetPlan(circuitJson);
|
|
100158
100342
|
const kicadSchematicScaleFactor = DEFAULT_SCHEMATIC_SCALE_FACTOR;
|
|
100159
100343
|
const db = cju(circuitJson);
|
|
100160
100344
|
const { center, bounds } = getSchematicBoundsAndCenter(db);
|
|
@@ -100185,6 +100369,11 @@ var CircuitJsonToKicadSchConverter = class {
|
|
|
100185
100369
|
];
|
|
100186
100370
|
}
|
|
100187
100371
|
step() {
|
|
100372
|
+
if (this.schematicSheetPlan.isHierarchical) {
|
|
100373
|
+
this.buildAll();
|
|
100374
|
+
this.finished = true;
|
|
100375
|
+
return;
|
|
100376
|
+
}
|
|
100188
100377
|
if (!this.currentStage) {
|
|
100189
100378
|
this.finished = true;
|
|
100190
100379
|
return;
|
|
@@ -100200,11 +100389,112 @@ var CircuitJsonToKicadSchConverter = class {
|
|
|
100200
100389
|
}
|
|
100201
100390
|
}
|
|
100202
100391
|
getOutput() {
|
|
100392
|
+
if (this.schematicSheetPlan.isHierarchical) {
|
|
100393
|
+
this.buildAll();
|
|
100394
|
+
return this.files[0].kicadSch;
|
|
100395
|
+
}
|
|
100203
100396
|
return this.ctx.kicadSch;
|
|
100204
100397
|
}
|
|
100205
100398
|
getOutputString() {
|
|
100399
|
+
if (this.schematicSheetPlan.isHierarchical) {
|
|
100400
|
+
this.buildAll();
|
|
100401
|
+
return this.files[0].content;
|
|
100402
|
+
}
|
|
100206
100403
|
return this.ctx.kicadSch.getString();
|
|
100207
100404
|
}
|
|
100405
|
+
getOutputFiles(options) {
|
|
100406
|
+
if (!this.schematicSheetPlan.isHierarchical) {
|
|
100407
|
+
return [
|
|
100408
|
+
{
|
|
100409
|
+
filename: options.schematicFilename,
|
|
100410
|
+
content: this.getOutputString()
|
|
100411
|
+
}
|
|
100412
|
+
];
|
|
100413
|
+
}
|
|
100414
|
+
this.buildAll();
|
|
100415
|
+
return this.files.map((file, index) => ({
|
|
100416
|
+
filename: index === 0 ? options.schematicFilename : file.entry.filename,
|
|
100417
|
+
content: file.content
|
|
100418
|
+
}));
|
|
100419
|
+
}
|
|
100420
|
+
buildAll() {
|
|
100421
|
+
if (this.built)
|
|
100422
|
+
return;
|
|
100423
|
+
this.built = true;
|
|
100424
|
+
const { rootUuid, root, children } = this.schematicSheetPlan;
|
|
100425
|
+
const { nodes: childSheetNodes, extentMm } = buildChildSheetNodes(children, rootUuid);
|
|
100426
|
+
const rootSch = this.buildSheetFile({
|
|
100427
|
+
circuitJson: partitionCircuitJsonBySheet(this.circuitJson, null),
|
|
100428
|
+
fileUuid: rootUuid,
|
|
100429
|
+
symbolInstancePathPrefix: `/${rootUuid}`,
|
|
100430
|
+
emitSheetInstances: true,
|
|
100431
|
+
childSheetNodes,
|
|
100432
|
+
extraPaperExtentMm: extentMm
|
|
100433
|
+
});
|
|
100434
|
+
this.files.push({
|
|
100435
|
+
entry: root,
|
|
100436
|
+
kicadSch: rootSch,
|
|
100437
|
+
content: rootSch.getString()
|
|
100438
|
+
});
|
|
100439
|
+
for (const child of children) {
|
|
100440
|
+
const childSch = this.buildSheetFile({
|
|
100441
|
+
circuitJson: partitionCircuitJsonBySheet(this.circuitJson, child.schematicSheetId),
|
|
100442
|
+
fileUuid: child.fileUuid,
|
|
100443
|
+
symbolInstancePathPrefix: `/${rootUuid}/${child.sheetNodeUuid}`,
|
|
100444
|
+
emitSheetInstances: false
|
|
100445
|
+
});
|
|
100446
|
+
this.files.push({
|
|
100447
|
+
entry: child,
|
|
100448
|
+
kicadSch: childSch,
|
|
100449
|
+
content: childSch.getString()
|
|
100450
|
+
});
|
|
100451
|
+
}
|
|
100452
|
+
}
|
|
100453
|
+
buildSheetFile(options) {
|
|
100454
|
+
const {
|
|
100455
|
+
circuitJson,
|
|
100456
|
+
fileUuid,
|
|
100457
|
+
symbolInstancePathPrefix,
|
|
100458
|
+
emitSheetInstances,
|
|
100459
|
+
childSheetNodes,
|
|
100460
|
+
extraPaperExtentMm
|
|
100461
|
+
} = options;
|
|
100462
|
+
const kicadSchematicScaleFactor = DEFAULT_SCHEMATIC_SCALE_FACTOR;
|
|
100463
|
+
const db = cju(circuitJson);
|
|
100464
|
+
const { center, bounds } = getSchematicBoundsAndCenter(db);
|
|
100465
|
+
const paperSize = selectSchematicPaperSize(Math.max((bounds.maxX - bounds.minX) * kicadSchematicScaleFactor + 2 * DEFAULT_PAPER_PADDING_MM, extraPaperExtentMm?.width ?? 0), Math.max((bounds.maxY - bounds.minY) * kicadSchematicScaleFactor + 2 * DEFAULT_PAPER_PADDING_MM, extraPaperExtentMm?.height ?? 0), 0);
|
|
100466
|
+
const ctx = {
|
|
100467
|
+
db,
|
|
100468
|
+
circuitJson,
|
|
100469
|
+
kicadSch: new KicadSch({
|
|
100470
|
+
generator: "circuit-json-to-kicad",
|
|
100471
|
+
generatorVersion: "0.0.1"
|
|
100472
|
+
}),
|
|
100473
|
+
kicadSchematicScaleFactor,
|
|
100474
|
+
schematicPaperSize: paperSize,
|
|
100475
|
+
c2kMatSch: compose2(translate2(paperSize.width / 2, paperSize.height / 2), scale(kicadSchematicScaleFactor, -kicadSchematicScaleFactor), translate2(-center.x, -center.y)),
|
|
100476
|
+
schematicFileUuid: fileUuid,
|
|
100477
|
+
symbolInstancePathPrefix
|
|
100478
|
+
};
|
|
100479
|
+
const stages = [
|
|
100480
|
+
new InitializeSchematicStage(circuitJson, ctx),
|
|
100481
|
+
new AddLibrarySymbolsStage(circuitJson, ctx),
|
|
100482
|
+
new AddSchematicSymbolsStage(circuitJson, ctx),
|
|
100483
|
+
new AddSchematicNetLabelsStage(circuitJson, ctx),
|
|
100484
|
+
new AddSchematicTracesStage(circuitJson, ctx),
|
|
100485
|
+
new AddSchematicGraphicsStage(circuitJson, ctx)
|
|
100486
|
+
];
|
|
100487
|
+
if (emitSheetInstances) {
|
|
100488
|
+
stages.push(new AddSheetInstancesStage(circuitJson, ctx));
|
|
100489
|
+
}
|
|
100490
|
+
for (const stage of stages)
|
|
100491
|
+
stage.runUntilFinished();
|
|
100492
|
+
const kicadSch = ctx.kicadSch;
|
|
100493
|
+
if (childSheetNodes && childSheetNodes.length > 0) {
|
|
100494
|
+
kicadSch.sheets = childSheetNodes;
|
|
100495
|
+
}
|
|
100496
|
+
return kicadSch;
|
|
100497
|
+
}
|
|
100208
100498
|
};
|
|
100209
100499
|
var circuitJsonLayerToKicadLayer = {
|
|
100210
100500
|
top: "F.Cu",
|
|
@@ -100221,6 +100511,17 @@ function getKicadLayer(circuitJsonLayer) {
|
|
|
100221
100511
|
return "F.Cu";
|
|
100222
100512
|
return circuitJsonLayerToKicadLayer[circuitJsonLayer] || circuitJsonLayer || "F.Cu";
|
|
100223
100513
|
}
|
|
100514
|
+
function getKicadCopperLayerIndex(layerName, numLayers) {
|
|
100515
|
+
if (layerName === "F.Cu")
|
|
100516
|
+
return 0;
|
|
100517
|
+
if (layerName === "B.Cu")
|
|
100518
|
+
return 31;
|
|
100519
|
+
const match = layerName.match(/^In(\d+)\.Cu$/);
|
|
100520
|
+
if (match?.[1]) {
|
|
100521
|
+
return parseInt(match[1], 10);
|
|
100522
|
+
}
|
|
100523
|
+
return 0;
|
|
100524
|
+
}
|
|
100224
100525
|
function getViaLayers(numLayers) {
|
|
100225
100526
|
const layers = ["F.Cu"];
|
|
100226
100527
|
for (let i = 1;i < numLayers - 1; i++) {
|
|
@@ -100229,6 +100530,26 @@ function getViaLayers(numLayers) {
|
|
|
100229
100530
|
layers.push("B.Cu");
|
|
100230
100531
|
return layers;
|
|
100231
100532
|
}
|
|
100533
|
+
function getViaLayerSpan(kicadLayers, numLayers) {
|
|
100534
|
+
if (kicadLayers.length <= 1)
|
|
100535
|
+
return kicadLayers;
|
|
100536
|
+
let top = kicadLayers[0];
|
|
100537
|
+
let bottom = kicadLayers[0];
|
|
100538
|
+
let topIndex = getKicadCopperLayerIndex(top, numLayers);
|
|
100539
|
+
let bottomIndex = topIndex;
|
|
100540
|
+
for (const layer of kicadLayers) {
|
|
100541
|
+
const index = getKicadCopperLayerIndex(layer, numLayers);
|
|
100542
|
+
if (index < topIndex) {
|
|
100543
|
+
topIndex = index;
|
|
100544
|
+
top = layer;
|
|
100545
|
+
}
|
|
100546
|
+
if (index > bottomIndex) {
|
|
100547
|
+
bottomIndex = index;
|
|
100548
|
+
bottom = layer;
|
|
100549
|
+
}
|
|
100550
|
+
}
|
|
100551
|
+
return top === bottom ? [top] : [top, bottom];
|
|
100552
|
+
}
|
|
100232
100553
|
function simpleHash(str) {
|
|
100233
100554
|
let hash = 0;
|
|
100234
100555
|
for (let i = 0;i < str.length; i++) {
|
|
@@ -100609,7 +100930,7 @@ var ExtractFootprintsStage = class extends ConverterStage {
|
|
|
100609
100930
|
const footprintName = (parts.length > 1 ? parts[1] : parts[0])?.replace(/[\\\/]/g, "-").trim() || "footprint";
|
|
100610
100931
|
const isBuiltin = !customFootprintNames.has(footprintName);
|
|
100611
100932
|
footprint.libraryLink = footprintName;
|
|
100612
|
-
footprint.position =
|
|
100933
|
+
footprint.position = At2.from([0, 0, 0]);
|
|
100613
100934
|
footprint.locked = false;
|
|
100614
100935
|
footprint.placed = false;
|
|
100615
100936
|
footprint.version = KICAD_FP_VERSION;
|
|
@@ -100638,10 +100959,10 @@ var ExtractFootprintsStage = class extends ConverterStage {
|
|
|
100638
100959
|
footprint.path = undefined;
|
|
100639
100960
|
footprint.sheetfile = undefined;
|
|
100640
100961
|
footprint.sheetname = undefined;
|
|
100641
|
-
const defaultFont = new
|
|
100962
|
+
const defaultFont = new TextEffectsFont8;
|
|
100642
100963
|
defaultFont.size = { width: 1.27, height: 1.27 };
|
|
100643
100964
|
defaultFont.thickness = 0.15;
|
|
100644
|
-
const defaultEffects = new
|
|
100965
|
+
const defaultEffects = new TextEffects8({ font: defaultFont });
|
|
100645
100966
|
const fpPads = footprint.fpPads ?? [];
|
|
100646
100967
|
let minY = 0;
|
|
100647
100968
|
let maxY = 0;
|
|
@@ -100757,7 +101078,7 @@ var ExtractFootprintsStage = class extends ConverterStage {
|
|
|
100757
101078
|
}
|
|
100758
101079
|
};
|
|
100759
101080
|
function createTextEffects2(metadataEffects) {
|
|
100760
|
-
const font = new
|
|
101081
|
+
const font = new TextEffectsFont9;
|
|
100761
101082
|
if (metadataEffects?.font?.size) {
|
|
100762
101083
|
font.size = {
|
|
100763
101084
|
width: Number(metadataEffects.font.size.x),
|
|
@@ -100771,7 +101092,7 @@ function createTextEffects2(metadataEffects) {
|
|
|
100771
101092
|
} else {
|
|
100772
101093
|
font.thickness = 0.15;
|
|
100773
101094
|
}
|
|
100774
|
-
return new
|
|
101095
|
+
return new TextEffects9({ font });
|
|
100775
101096
|
}
|
|
100776
101097
|
function applyMetadataToFootprint({
|
|
100777
101098
|
footprint,
|
|
@@ -100986,7 +101307,7 @@ function convertSilkscreenCircles(silkscreenCircles, componentCenter) {
|
|
|
100986
101307
|
center: { x: relX, y: relY },
|
|
100987
101308
|
end: { x: relX + circle.radius, y: relY },
|
|
100988
101309
|
layer: kicadLayer,
|
|
100989
|
-
stroke: new
|
|
101310
|
+
stroke: new Stroke6,
|
|
100990
101311
|
fill: false
|
|
100991
101312
|
});
|
|
100992
101313
|
if (fpCircle.stroke) {
|
|
@@ -101011,7 +101332,7 @@ function convertCourtyardCircles(courtyardCircles, componentCenter) {
|
|
|
101011
101332
|
center: { x: relX, y: relY },
|
|
101012
101333
|
end: { x: relX + circle.radius, y: relY },
|
|
101013
101334
|
layer: kicadLayer,
|
|
101014
|
-
stroke: new
|
|
101335
|
+
stroke: new Stroke7,
|
|
101015
101336
|
fill: false
|
|
101016
101337
|
});
|
|
101017
101338
|
if (fpCircle.stroke) {
|
|
@@ -101038,7 +101359,7 @@ function convertFabricationNoteRects(fabRects, componentCenter) {
|
|
|
101038
101359
|
start: { x: relX - halfW, y: relY - halfH },
|
|
101039
101360
|
end: { x: relX + halfW, y: relY + halfH },
|
|
101040
101361
|
layer: kicadLayer,
|
|
101041
|
-
stroke: new
|
|
101362
|
+
stroke: new Stroke8,
|
|
101042
101363
|
fill: false
|
|
101043
101364
|
});
|
|
101044
101365
|
if (fpRect.stroke) {
|
|
@@ -101061,7 +101382,7 @@ function convertNoteRects(noteRects, componentCenter) {
|
|
|
101061
101382
|
start: { x: relX - halfW, y: relY - halfH },
|
|
101062
101383
|
end: { x: relX + halfW, y: relY + halfH },
|
|
101063
101384
|
layer: kicadLayer,
|
|
101064
|
-
stroke: new
|
|
101385
|
+
stroke: new Stroke9,
|
|
101065
101386
|
fill: false
|
|
101066
101387
|
});
|
|
101067
101388
|
if (fpRect.stroke) {
|
|
@@ -101088,7 +101409,7 @@ function convertCourtyardRects(courtyardRects, componentCenter) {
|
|
|
101088
101409
|
start: { x: relX - halfW, y: relY - halfH },
|
|
101089
101410
|
end: { x: relX + halfW, y: relY + halfH },
|
|
101090
101411
|
layer: kicadLayer,
|
|
101091
|
-
stroke: new
|
|
101412
|
+
stroke: new Stroke10,
|
|
101092
101413
|
fill: false
|
|
101093
101414
|
});
|
|
101094
101415
|
if (fpRect.stroke) {
|
|
@@ -101120,7 +101441,7 @@ function convertCourtyardOutlines(params2) {
|
|
|
101120
101441
|
fpPoly.layer = kicadLayer;
|
|
101121
101442
|
fpPoly.fill = false;
|
|
101122
101443
|
fpPoly.uuid = generateDeterministicUuid(outline.pcb_courtyard_outline_id);
|
|
101123
|
-
const stroke = new
|
|
101444
|
+
const stroke = new Stroke11;
|
|
101124
101445
|
stroke.width = 0.05;
|
|
101125
101446
|
stroke.type = "default";
|
|
101126
101447
|
fpPoly.stroke = stroke;
|
|
@@ -101153,9 +101474,9 @@ function createFpTextFromCircuitJson({
|
|
|
101153
101474
|
};
|
|
101154
101475
|
const kicadLayer = layerMap[textElement.layer] || textElement.layer || "F.SilkS";
|
|
101155
101476
|
const fontSize = (textElement.font_size || 1) / 1.5;
|
|
101156
|
-
const font = new
|
|
101477
|
+
const font = new TextEffectsFont10;
|
|
101157
101478
|
font.size = { width: fontSize, height: fontSize };
|
|
101158
|
-
const textEffects = new
|
|
101479
|
+
const textEffects = new TextEffects10({
|
|
101159
101480
|
font
|
|
101160
101481
|
});
|
|
101161
101482
|
const rotation = textElement.ccw_rotation || 0;
|
|
@@ -101222,7 +101543,7 @@ function convertSilkscreenPaths(silkscreenPaths, { componentCenter, componentRot
|
|
|
101222
101543
|
start: { x: startRelative.x, y: startRelative.y },
|
|
101223
101544
|
end: { x: endRelative.x, y: endRelative.y },
|
|
101224
101545
|
layer: kicadLayer,
|
|
101225
|
-
stroke: new
|
|
101546
|
+
stroke: new Stroke12
|
|
101226
101547
|
});
|
|
101227
101548
|
if (fpLine.stroke) {
|
|
101228
101549
|
fpLine.stroke.width = path16.stroke_width || 0.15;
|
|
@@ -101242,9 +101563,9 @@ function convertNoteTexts(params2) {
|
|
|
101242
101563
|
const rotationMatrix = componentRotation !== 0 ? rotate5(componentRotation * Math.PI / 180) : identity3();
|
|
101243
101564
|
const rotatedPos = applyToPoint13(rotationMatrix, { x: relX, y: relY });
|
|
101244
101565
|
const fontSize = textElement.font_size || 1;
|
|
101245
|
-
const font = new
|
|
101566
|
+
const font = new TextEffectsFont11;
|
|
101246
101567
|
font.size = { width: fontSize, height: fontSize };
|
|
101247
|
-
const textEffects = new
|
|
101568
|
+
const textEffects = new TextEffects11({ font });
|
|
101248
101569
|
const fpText = new FpText3({
|
|
101249
101570
|
type: "user",
|
|
101250
101571
|
text: textElement.text,
|
|
@@ -101978,8 +102299,8 @@ var AddViasStage = class extends ConverterStage {
|
|
|
101978
102299
|
const routeDefinedVias = (this.ctx.db.pcb_trace?.list() || []).flatMap((trace) => (trace.route || []).filter((point) => point.route_type === "via").map((point) => ({
|
|
101979
102300
|
x: point.x,
|
|
101980
102301
|
y: point.y,
|
|
101981
|
-
outer_diameter: point.outer_diameter,
|
|
101982
|
-
hole_diameter: point.hole_diameter,
|
|
102302
|
+
outer_diameter: point.outer_diameter ?? point.via_diameter,
|
|
102303
|
+
hole_diameter: point.hole_diameter ?? point.via_hole_diameter,
|
|
101983
102304
|
from_layer: point.from_layer,
|
|
101984
102305
|
to_layer: point.to_layer,
|
|
101985
102306
|
pcb_trace_id: trace.pcb_trace_id,
|
|
@@ -101996,8 +102317,8 @@ var AddViasStage = class extends ConverterStage {
|
|
|
101996
102317
|
return [...standaloneVias, ...routeDefinedVias];
|
|
101997
102318
|
}
|
|
101998
102319
|
getViaDedupeKey(via) {
|
|
101999
|
-
const
|
|
102000
|
-
return `${via.
|
|
102320
|
+
const span = [...this.getKicadViaLayers(via)].sort().join(",");
|
|
102321
|
+
return `${via.x}:${via.y}:${span}`;
|
|
102001
102322
|
}
|
|
102002
102323
|
getRawViaLayers(via) {
|
|
102003
102324
|
if (via.layers?.length) {
|
|
@@ -102007,10 +102328,9 @@ var AddViasStage = class extends ConverterStage {
|
|
|
102007
102328
|
}
|
|
102008
102329
|
getKicadViaLayers(via) {
|
|
102009
102330
|
const rawLayers = this.getRawViaLayers(via);
|
|
102010
|
-
|
|
102011
|
-
|
|
102012
|
-
|
|
102013
|
-
return getViaLayers(this.ctx.numLayers ?? 2);
|
|
102331
|
+
const numLayers = this.ctx.numLayers ?? 2;
|
|
102332
|
+
const kicadLayers = rawLayers.length > 0 ? rawLayers.map((layer) => getKicadLayer(layer)) : getViaLayers(numLayers);
|
|
102333
|
+
return getViaLayerSpan(kicadLayers, numLayers);
|
|
102014
102334
|
}
|
|
102015
102335
|
_step() {
|
|
102016
102336
|
const { kicadPcb, c2kMatPcb, pcbNetMap } = this.ctx;
|
|
@@ -102277,9 +102597,9 @@ function createFabricationNoteTextFromCircuitJson({
|
|
|
102277
102597
|
};
|
|
102278
102598
|
const kicadLayer = layerMap[textElement.layer] || textElement.layer || "F.Fab";
|
|
102279
102599
|
const fontSize = (textElement.font_size || 1) / 1.5;
|
|
102280
|
-
const font = new
|
|
102600
|
+
const font = new TextEffectsFont12;
|
|
102281
102601
|
font.size = { width: fontSize, height: fontSize };
|
|
102282
|
-
const justify = new
|
|
102602
|
+
const justify = new TextEffectsJustify4;
|
|
102283
102603
|
const anchorAlignment = textElement.anchor_alignment || "center";
|
|
102284
102604
|
switch (anchorAlignment) {
|
|
102285
102605
|
case "top_left":
|
|
@@ -102301,13 +102621,13 @@ function createFabricationNoteTextFromCircuitJson({
|
|
|
102301
102621
|
case "center":
|
|
102302
102622
|
break;
|
|
102303
102623
|
}
|
|
102304
|
-
const textEffects = new
|
|
102624
|
+
const textEffects = new TextEffects12({
|
|
102305
102625
|
font
|
|
102306
102626
|
});
|
|
102307
102627
|
if (anchorAlignment !== "center") {
|
|
102308
102628
|
textEffects.justify = justify;
|
|
102309
102629
|
}
|
|
102310
|
-
const position = new
|
|
102630
|
+
const position = new At3([transformedPos.x, transformedPos.y, 0]);
|
|
102311
102631
|
const grText = new GrText({
|
|
102312
102632
|
text: textElement.text,
|
|
102313
102633
|
layer: kicadLayer,
|
|
@@ -102334,9 +102654,9 @@ function createGrTextFromCircuitJson({
|
|
|
102334
102654
|
};
|
|
102335
102655
|
const kicadLayer = layerMap[textElement.layer] || textElement.layer || "F.SilkS";
|
|
102336
102656
|
const fontSize = (textElement.font_size || 1) / 1.5;
|
|
102337
|
-
const font = new
|
|
102657
|
+
const font = new TextEffectsFont13;
|
|
102338
102658
|
font.size = { width: fontSize, height: fontSize };
|
|
102339
|
-
const justify = new
|
|
102659
|
+
const justify = new TextEffectsJustify5;
|
|
102340
102660
|
const anchorAlignment = textElement.anchor_alignment || "center";
|
|
102341
102661
|
switch (anchorAlignment) {
|
|
102342
102662
|
case "top_left":
|
|
@@ -102358,14 +102678,14 @@ function createGrTextFromCircuitJson({
|
|
|
102358
102678
|
case "center":
|
|
102359
102679
|
break;
|
|
102360
102680
|
}
|
|
102361
|
-
const textEffects = new
|
|
102681
|
+
const textEffects = new TextEffects13({
|
|
102362
102682
|
font
|
|
102363
102683
|
});
|
|
102364
102684
|
if (anchorAlignment !== "center") {
|
|
102365
102685
|
textEffects.justify = justify;
|
|
102366
102686
|
}
|
|
102367
102687
|
const rotation = textElement.ccw_rotation || 0;
|
|
102368
|
-
const position = new
|
|
102688
|
+
const position = new At4([transformedPos.x, transformedPos.y, rotation]);
|
|
102369
102689
|
const grText = new GrText2({
|
|
102370
102690
|
text: textElement.text,
|
|
102371
102691
|
layer: kicadLayer,
|
|
@@ -102674,6 +102994,11 @@ var CircuitJsonToKicadProConverter = class {
|
|
|
102674
102994
|
circuitJson
|
|
102675
102995
|
};
|
|
102676
102996
|
const pcbBoard = circuitJson.filter((component) => component.type === "pcb_board")[0];
|
|
102997
|
+
const schematicSheetPlan = options.schematicSheetPlan ?? buildSchematicSheetPlan(circuitJson);
|
|
102998
|
+
const sheets = [[schematicSheetPlan.rootUuid, "Root"]];
|
|
102999
|
+
for (const child of schematicSheetPlan.children) {
|
|
103000
|
+
sheets.push([child.sheetNodeUuid, child.sheetName]);
|
|
103001
|
+
}
|
|
102677
103002
|
const minViaDiameter = pcbBoard?.min_via_pad_diameter ?? 0.3;
|
|
102678
103003
|
const minViaDrill = pcbBoard?.min_via_hole_diameter ?? 0.2;
|
|
102679
103004
|
const minViaAnnularWidth = (minViaDiameter - minViaDrill) / 2;
|
|
@@ -102750,7 +103075,7 @@ var CircuitJsonToKicadProConverter = class {
|
|
|
102750
103075
|
},
|
|
102751
103076
|
last_opened_board: pcbFilename
|
|
102752
103077
|
},
|
|
102753
|
-
sheets
|
|
103078
|
+
sheets
|
|
102754
103079
|
};
|
|
102755
103080
|
}
|
|
102756
103081
|
runUntilFinished() {}
|
|
@@ -102762,57 +103087,6 @@ var CircuitJsonToKicadProConverter = class {
|
|
|
102762
103087
|
`;
|
|
102763
103088
|
}
|
|
102764
103089
|
};
|
|
102765
|
-
var isRemotePath = (modelPath) => modelPath.startsWith("http://") || modelPath.startsWith("https://");
|
|
102766
|
-
var isBuiltinModelPath = (modelPath) => modelPath.startsWith("http://modelcdn.tscircuit.com") || modelPath.startsWith("https://modelcdn.tscircuit.com");
|
|
102767
|
-
var getModelFileName = (modelPath) => {
|
|
102768
|
-
const modelPathWithoutQuery = modelPath.split("?")[0] || modelPath;
|
|
102769
|
-
const modelPathWithoutHash = modelPathWithoutQuery.split("#")[0] || modelPathWithoutQuery;
|
|
102770
|
-
const normalizedModelPath = modelPathWithoutHash.replaceAll("\\", "/");
|
|
102771
|
-
return normalizedModelPath.split("/").pop() || modelPath;
|
|
102772
|
-
};
|
|
102773
|
-
var resolveAndLoadKicad3dModelFiles = async ({
|
|
102774
|
-
model3dSourcePaths,
|
|
102775
|
-
projectName,
|
|
102776
|
-
fetch: fetch2,
|
|
102777
|
-
readFile,
|
|
102778
|
-
onModelFile,
|
|
102779
|
-
onError
|
|
102780
|
-
}) => {
|
|
102781
|
-
for (const sourcePath of model3dSourcePaths) {
|
|
102782
|
-
let shapesDir = `${projectName}.3dshapes`;
|
|
102783
|
-
if (isBuiltinModelPath(sourcePath)) {
|
|
102784
|
-
shapesDir = "tscircuit_builtin.3dshapes";
|
|
102785
|
-
}
|
|
102786
|
-
const outputPath = `3dmodels/${shapesDir}/${getModelFileName(sourcePath)}`;
|
|
102787
|
-
let content;
|
|
102788
|
-
try {
|
|
102789
|
-
if (isRemotePath(sourcePath)) {
|
|
102790
|
-
const response = await fetch2(sourcePath);
|
|
102791
|
-
if (!response.ok) {
|
|
102792
|
-
throw new Error(`Failed to fetch 3D model from ${sourcePath}`);
|
|
102793
|
-
}
|
|
102794
|
-
content = new Uint8Array(await response.arrayBuffer());
|
|
102795
|
-
} else {
|
|
102796
|
-
if (!readFile) {
|
|
102797
|
-
throw new Error(`Cannot read local 3D model without readFile: ${sourcePath}`);
|
|
102798
|
-
}
|
|
102799
|
-
const fileContent = await readFile(sourcePath);
|
|
102800
|
-
if (fileContent instanceof Uint8Array) {
|
|
102801
|
-
content = fileContent;
|
|
102802
|
-
} else {
|
|
102803
|
-
content = new Uint8Array(fileContent);
|
|
102804
|
-
}
|
|
102805
|
-
}
|
|
102806
|
-
} catch (error) {
|
|
102807
|
-
if (!onError) {
|
|
102808
|
-
throw error;
|
|
102809
|
-
}
|
|
102810
|
-
await onError({ sourcePath, error });
|
|
102811
|
-
continue;
|
|
102812
|
-
}
|
|
102813
|
-
await onModelFile({ sourcePath, outputPath, content });
|
|
102814
|
-
}
|
|
102815
|
-
};
|
|
102816
103090
|
var GenerateKicadSchAndPcbStage = class extends ConverterStage {
|
|
102817
103091
|
_step() {
|
|
102818
103092
|
const schConverter = new CircuitJsonToKicadSchConverter(this.ctx.circuitJson);
|
|
@@ -103060,6 +103334,104 @@ var CircuitJsonToKicadLibraryConverter = class {
|
|
|
103060
103334
|
return this.getOutput().model3dSourcePaths;
|
|
103061
103335
|
}
|
|
103062
103336
|
};
|
|
103337
|
+
var CircuitJsonToKicadModConverter = class {
|
|
103338
|
+
libraryConverter;
|
|
103339
|
+
footprintName;
|
|
103340
|
+
constructor(circuitJson, options = {}) {
|
|
103341
|
+
this.footprintName = options.footprintName;
|
|
103342
|
+
this.libraryConverter = new CircuitJsonToKicadLibraryConverter(circuitJson, {
|
|
103343
|
+
libraryName: options.libraryName,
|
|
103344
|
+
footprintLibraryName: options.footprintLibraryName
|
|
103345
|
+
});
|
|
103346
|
+
}
|
|
103347
|
+
get finished() {
|
|
103348
|
+
return this.libraryConverter.finished;
|
|
103349
|
+
}
|
|
103350
|
+
get currentStage() {
|
|
103351
|
+
return this.libraryConverter.currentStage;
|
|
103352
|
+
}
|
|
103353
|
+
step() {
|
|
103354
|
+
this.libraryConverter.step();
|
|
103355
|
+
}
|
|
103356
|
+
runUntilFinished() {
|
|
103357
|
+
this.libraryConverter.runUntilFinished();
|
|
103358
|
+
}
|
|
103359
|
+
getOutput() {
|
|
103360
|
+
const footprints = this.libraryConverter.getFootprints();
|
|
103361
|
+
if (this.footprintName) {
|
|
103362
|
+
const matchingFootprint = footprints.find((footprint) => footprint.footprintName === this.footprintName);
|
|
103363
|
+
if (matchingFootprint) {
|
|
103364
|
+
return matchingFootprint;
|
|
103365
|
+
}
|
|
103366
|
+
throw new Error(`Footprint "${this.footprintName}" not found. Available footprints: ${footprints.map((footprint) => footprint.footprintName).join(", ")}`);
|
|
103367
|
+
}
|
|
103368
|
+
if (footprints.length === 1) {
|
|
103369
|
+
return footprints[0];
|
|
103370
|
+
}
|
|
103371
|
+
const customFootprints = footprints.filter((footprint) => !footprint.isBuiltin);
|
|
103372
|
+
if (customFootprints.length === 1) {
|
|
103373
|
+
return customFootprints[0];
|
|
103374
|
+
}
|
|
103375
|
+
throw new Error(`Multiple footprints were generated. Pass footprintName to CircuitJsonToKicadModConverter. Available footprints: ${footprints.map((footprint) => footprint.footprintName).join(", ")}`);
|
|
103376
|
+
}
|
|
103377
|
+
getOutputString() {
|
|
103378
|
+
return this.getOutput().kicadModString;
|
|
103379
|
+
}
|
|
103380
|
+
getModel3dSourcePaths() {
|
|
103381
|
+
return this.getOutput().model3dSourcePaths;
|
|
103382
|
+
}
|
|
103383
|
+
};
|
|
103384
|
+
var isRemotePath = (modelPath) => modelPath.startsWith("http://") || modelPath.startsWith("https://");
|
|
103385
|
+
var isBuiltinModelPath = (modelPath) => modelPath.startsWith("http://modelcdn.tscircuit.com") || modelPath.startsWith("https://modelcdn.tscircuit.com");
|
|
103386
|
+
var getModelFileName = (modelPath) => {
|
|
103387
|
+
const modelPathWithoutQuery = modelPath.split("?")[0] || modelPath;
|
|
103388
|
+
const modelPathWithoutHash = modelPathWithoutQuery.split("#")[0] || modelPathWithoutQuery;
|
|
103389
|
+
const normalizedModelPath = modelPathWithoutHash.replaceAll("\\", "/");
|
|
103390
|
+
return normalizedModelPath.split("/").pop() || modelPath;
|
|
103391
|
+
};
|
|
103392
|
+
var resolveAndLoadKicad3dModelFiles = async ({
|
|
103393
|
+
model3dSourcePaths,
|
|
103394
|
+
projectName,
|
|
103395
|
+
fetch: fetch2,
|
|
103396
|
+
readFile,
|
|
103397
|
+
onModelFile,
|
|
103398
|
+
onError
|
|
103399
|
+
}) => {
|
|
103400
|
+
for (const sourcePath of model3dSourcePaths) {
|
|
103401
|
+
let shapesDir = `${projectName}.3dshapes`;
|
|
103402
|
+
if (isBuiltinModelPath(sourcePath)) {
|
|
103403
|
+
shapesDir = "tscircuit_builtin.3dshapes";
|
|
103404
|
+
}
|
|
103405
|
+
const outputPath = `3dmodels/${shapesDir}/${getModelFileName(sourcePath)}`;
|
|
103406
|
+
let content;
|
|
103407
|
+
try {
|
|
103408
|
+
if (isRemotePath(sourcePath)) {
|
|
103409
|
+
const response = await fetch2(sourcePath);
|
|
103410
|
+
if (!response.ok) {
|
|
103411
|
+
throw new Error(`Failed to fetch 3D model from ${sourcePath}`);
|
|
103412
|
+
}
|
|
103413
|
+
content = new Uint8Array(await response.arrayBuffer());
|
|
103414
|
+
} else {
|
|
103415
|
+
if (!readFile) {
|
|
103416
|
+
throw new Error(`Cannot read local 3D model without readFile: ${sourcePath}`);
|
|
103417
|
+
}
|
|
103418
|
+
const fileContent = await readFile(sourcePath);
|
|
103419
|
+
if (fileContent instanceof Uint8Array) {
|
|
103420
|
+
content = fileContent;
|
|
103421
|
+
} else {
|
|
103422
|
+
content = new Uint8Array(fileContent);
|
|
103423
|
+
}
|
|
103424
|
+
}
|
|
103425
|
+
} catch (error) {
|
|
103426
|
+
if (!onError) {
|
|
103427
|
+
throw error;
|
|
103428
|
+
}
|
|
103429
|
+
await onError({ sourcePath, error });
|
|
103430
|
+
continue;
|
|
103431
|
+
}
|
|
103432
|
+
await onModelFile({ sourcePath, outputPath, content });
|
|
103433
|
+
}
|
|
103434
|
+
};
|
|
103063
103435
|
var KICAD_3RD_PARTY_PLACEHOLDER = "${KICAD_3RD_PARTY}";
|
|
103064
103436
|
function renameKicadFootprint(params2) {
|
|
103065
103437
|
const {
|
|
@@ -103092,7 +103464,7 @@ function renameKicadFootprint(params2) {
|
|
|
103092
103464
|
};
|
|
103093
103465
|
}
|
|
103094
103466
|
function createTextEffects3(metadataEffects) {
|
|
103095
|
-
const font = new
|
|
103467
|
+
const font = new TextEffectsFont14;
|
|
103096
103468
|
if (metadataEffects?.font?.size) {
|
|
103097
103469
|
font.size = {
|
|
103098
103470
|
width: Number(metadataEffects.font.size.x),
|
|
@@ -103106,7 +103478,7 @@ function createTextEffects3(metadataEffects) {
|
|
|
103106
103478
|
} else {
|
|
103107
103479
|
font.thickness = 0.15;
|
|
103108
103480
|
}
|
|
103109
|
-
return new
|
|
103481
|
+
return new TextEffects14({ font });
|
|
103110
103482
|
}
|
|
103111
103483
|
function applyKicadFootprintMetadata(kicadModString, metadata, footprintName) {
|
|
103112
103484
|
try {
|
|
@@ -103348,13 +103720,13 @@ var toNumber = (value, fallback) => {
|
|
|
103348
103720
|
var createTextEffects4 = (effectsMeta, fallback) => {
|
|
103349
103721
|
if (!effectsMeta)
|
|
103350
103722
|
return fallback;
|
|
103351
|
-
const effects = new
|
|
103723
|
+
const effects = new TextEffects15({
|
|
103352
103724
|
font: fallback?.font,
|
|
103353
103725
|
justify: fallback?.justify,
|
|
103354
103726
|
hiddenText: fallback?.hiddenText ?? false
|
|
103355
103727
|
});
|
|
103356
103728
|
if (!effects.font) {
|
|
103357
|
-
const defaultFont = new
|
|
103729
|
+
const defaultFont = new TextEffectsFont15;
|
|
103358
103730
|
defaultFont.size = { width: DEFAULT_TEXT_SIZE, height: DEFAULT_TEXT_SIZE };
|
|
103359
103731
|
effects.font = defaultFont;
|
|
103360
103732
|
}
|
|
@@ -103399,7 +103771,7 @@ var createJustify = (justifyInput) => {
|
|
|
103399
103771
|
if (!options.horizontal && !options.vertical && !options.mirror) {
|
|
103400
103772
|
return;
|
|
103401
103773
|
}
|
|
103402
|
-
return new
|
|
103774
|
+
return new TextEffectsJustify6(options);
|
|
103403
103775
|
};
|
|
103404
103776
|
var applySymbolProperty = (symbol, key, propertyMeta) => {
|
|
103405
103777
|
const existingProperty = symbol.properties.find((prop) => prop.key === key);
|
|
@@ -137052,7 +137424,7 @@ var Et2 = class {
|
|
|
137052
137424
|
Array.isArray(this.ids) && (this.ids.length = this.length), Array.isArray(this.values) && (this.values.length = this.length);
|
|
137053
137425
|
}
|
|
137054
137426
|
};
|
|
137055
|
-
var
|
|
137427
|
+
var At7 = [Int8Array, Uint8Array, Uint8ClampedArray, Int16Array, Uint16Array, Int32Array, Uint32Array, Float32Array, Float64Array];
|
|
137056
137428
|
var Ot2 = class t22 {
|
|
137057
137429
|
static from(e32, n3 = 0) {
|
|
137058
137430
|
if (n3 % 8 != 0)
|
|
@@ -137065,7 +137437,7 @@ var Ot2 = class t22 {
|
|
|
137065
137437
|
const s3 = i3 >> 4;
|
|
137066
137438
|
if (s3 !== 3)
|
|
137067
137439
|
throw new Error(`Got v${s3} data when expected v3.`);
|
|
137068
|
-
const r32 =
|
|
137440
|
+
const r32 = At7[15 & i3];
|
|
137069
137441
|
if (!r32)
|
|
137070
137442
|
throw new Error("Unrecognized array type.");
|
|
137071
137443
|
const [a3] = new Uint16Array(e32, n3 + 2, 1), [c3] = new Uint32Array(e32, n3 + 4, 1);
|
|
@@ -137083,7 +137455,7 @@ var Ot2 = class t22 {
|
|
|
137083
137455
|
r32 = Math.ceil(r32 / this.nodeSize), a3 += r32, this._levelBounds.push(4 * a3);
|
|
137084
137456
|
} while (r32 !== 1);
|
|
137085
137457
|
this.ArrayType = n3, this.IndexArrayType = a3 < 16384 ? Uint16Array : Uint32Array;
|
|
137086
|
-
const c3 =
|
|
137458
|
+
const c3 = At7.indexOf(n3), l3 = 4 * a3 * n3.BYTES_PER_ELEMENT;
|
|
137087
137459
|
if (c3 < 0)
|
|
137088
137460
|
throw new Error(`Unexpected typed array class: ${n3}.`);
|
|
137089
137461
|
const h32 = n3, d3 = this.IndexArrayType;
|