@tscircuit/cli 0.1.1499 → 0.1.1500
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 +808 -710
- package/dist/lib/index.js +497 -399
- package/package.json +2 -2
package/dist/cli/main.js
CHANGED
|
@@ -34536,7 +34536,7 @@ function parseAndConvertSiUnit(v3) {
|
|
|
34536
34536
|
value: conversionFactor * Number.parseFloat(numberPart)
|
|
34537
34537
|
};
|
|
34538
34538
|
}
|
|
34539
|
-
function
|
|
34539
|
+
function applyToPoint24(matrix, point2) {
|
|
34540
34540
|
return Array.isArray(point2) ? [
|
|
34541
34541
|
matrix.a * point2[0] + matrix.c * point2[1] + matrix.e,
|
|
34542
34542
|
matrix.b * point2[0] + matrix.d * point2[1] + matrix.f
|
|
@@ -36142,7 +36142,7 @@ var __create3, __defProp3, __getOwnPropDesc2, __getOwnPropNames3, __getProtoOf3,
|
|
|
36142
36142
|
}, e = (t) => {
|
|
36143
36143
|
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 };
|
|
36144
36144
|
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 });
|
|
36145
|
-
}, 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,
|
|
36145
|
+
}, 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, ms2, 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, At4, 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) => {
|
|
36146
36146
|
const result = [{
|
|
36147
36147
|
x: p12.x,
|
|
36148
36148
|
y: p12.y
|
|
@@ -37152,25 +37152,25 @@ var __create3, __defProp3, __getOwnPropDesc2, __getOwnPropNames3, __getProtoOf3,
|
|
|
37152
37152
|
throw new Error(`Invalid sideOrDir: ${sideOrDir}`);
|
|
37153
37153
|
}, transformSchematicElement = (elm, matrix) => {
|
|
37154
37154
|
if (elm.type === "schematic_component") {
|
|
37155
|
-
elm.center =
|
|
37155
|
+
elm.center = applyToPoint24(matrix, elm.center);
|
|
37156
37156
|
} else if (elm.type === "schematic_port") {
|
|
37157
|
-
elm.center =
|
|
37157
|
+
elm.center = applyToPoint24(matrix, elm.center);
|
|
37158
37158
|
if (elm.facing_direction) {
|
|
37159
37159
|
elm.facing_direction = rotateDirection(elm.facing_direction, -(Math.atan2(matrix.b, matrix.a) / Math.PI) * 2);
|
|
37160
37160
|
}
|
|
37161
37161
|
} else if (elm.type === "schematic_text") {
|
|
37162
|
-
elm.position =
|
|
37162
|
+
elm.position = applyToPoint24(matrix, elm.position);
|
|
37163
37163
|
} else if (elm.type === "schematic_trace") {
|
|
37164
37164
|
const anyElm = elm;
|
|
37165
37165
|
anyElm.route = (anyElm.route ?? []).map((rp2) => {
|
|
37166
|
-
const tp2 =
|
|
37166
|
+
const tp2 = applyToPoint24(matrix, rp2);
|
|
37167
37167
|
rp2.x = tp2.x;
|
|
37168
37168
|
rp2.y = tp2.y;
|
|
37169
37169
|
return rp2;
|
|
37170
37170
|
});
|
|
37171
37171
|
if (Array.isArray(anyElm.junctions)) {
|
|
37172
37172
|
anyElm.junctions = anyElm.junctions.map((j2) => {
|
|
37173
|
-
const tp2 =
|
|
37173
|
+
const tp2 = applyToPoint24(matrix, j2);
|
|
37174
37174
|
j2.x = tp2.x;
|
|
37175
37175
|
j2.y = tp2.y;
|
|
37176
37176
|
return j2;
|
|
@@ -37178,18 +37178,18 @@ var __create3, __defProp3, __getOwnPropDesc2, __getOwnPropNames3, __getProtoOf3,
|
|
|
37178
37178
|
}
|
|
37179
37179
|
if (Array.isArray(anyElm.edges)) {
|
|
37180
37180
|
anyElm.edges = anyElm.edges.map((e2) => {
|
|
37181
|
-
e2.from =
|
|
37182
|
-
e2.to =
|
|
37181
|
+
e2.from = applyToPoint24(matrix, e2.from);
|
|
37182
|
+
e2.to = applyToPoint24(matrix, e2.to);
|
|
37183
37183
|
return e2;
|
|
37184
37184
|
});
|
|
37185
37185
|
}
|
|
37186
37186
|
} else if (elm.type === "schematic_box") {
|
|
37187
|
-
const { x: x3, y } =
|
|
37187
|
+
const { x: x3, y } = applyToPoint24(matrix, { x: elm.x, y: elm.y });
|
|
37188
37188
|
elm.x = x3;
|
|
37189
37189
|
elm.y = y;
|
|
37190
37190
|
} else if (elm.type === "schematic_line") {
|
|
37191
|
-
const { x: x12, y: y12 } =
|
|
37192
|
-
const { x: x22, y: y22 } =
|
|
37191
|
+
const { x: x12, y: y12 } = applyToPoint24(matrix, { x: elm.x1, y: elm.y1 });
|
|
37192
|
+
const { x: x22, y: y22 } = applyToPoint24(matrix, { x: elm.x2, y: elm.y2 });
|
|
37193
37193
|
elm.x1 = x12;
|
|
37194
37194
|
elm.y1 = y12;
|
|
37195
37195
|
elm.x2 = x22;
|
|
@@ -37202,7 +37202,7 @@ var __create3, __defProp3, __getOwnPropDesc2, __getOwnPropNames3, __getProtoOf3,
|
|
|
37202
37202
|
const tsr = decomposeTSR(matrix);
|
|
37203
37203
|
const flipPadWidthHeight = Math.round(tsr.rotation.angle / (Math.PI / 2)) % 2 === 1;
|
|
37204
37204
|
if (elm.type === "pcb_plated_hole" || elm.type === "pcb_hole" || elm.type === "pcb_via" || elm.type === "pcb_smtpad" || elm.type === "pcb_port") {
|
|
37205
|
-
const { x: x3, y } =
|
|
37205
|
+
const { x: x3, y } = applyToPoint24(matrix, {
|
|
37206
37206
|
x: Number(elm.x),
|
|
37207
37207
|
y: Number(elm.y)
|
|
37208
37208
|
});
|
|
@@ -37210,7 +37210,7 @@ var __create3, __defProp3, __getOwnPropDesc2, __getOwnPropNames3, __getProtoOf3,
|
|
|
37210
37210
|
elm.y = y;
|
|
37211
37211
|
if (elm.type === "pcb_smtpad" && elm.shape === "polygon" && Array.isArray(elm.points)) {
|
|
37212
37212
|
elm.points = elm.points.map((point2) => {
|
|
37213
|
-
const tp2 =
|
|
37213
|
+
const tp2 = applyToPoint24(matrix, { x: point2.x, y: point2.y });
|
|
37214
37214
|
return {
|
|
37215
37215
|
x: tp2.x,
|
|
37216
37216
|
y: tp2.y
|
|
@@ -37218,13 +37218,13 @@ var __create3, __defProp3, __getOwnPropDesc2, __getOwnPropNames3, __getProtoOf3,
|
|
|
37218
37218
|
});
|
|
37219
37219
|
}
|
|
37220
37220
|
} else if (elm.type === "pcb_keepout" || elm.type === "pcb_board") {
|
|
37221
|
-
elm.center =
|
|
37221
|
+
elm.center = applyToPoint24(matrix, elm.center);
|
|
37222
37222
|
} else if (elm.type === "pcb_silkscreen_text" || elm.type === "pcb_fabrication_note_text" || elm.type === "pcb_note_text") {
|
|
37223
|
-
elm.anchor_position =
|
|
37223
|
+
elm.anchor_position = applyToPoint24(matrix, elm.anchor_position);
|
|
37224
37224
|
} else if (elm.type === "pcb_silkscreen_circle" || elm.type === "pcb_silkscreen_rect" || elm.type === "pcb_note_rect" || elm.type === "pcb_courtyard_rect" || elm.type === "pcb_courtyard_circle") {
|
|
37225
|
-
elm.center =
|
|
37225
|
+
elm.center = applyToPoint24(matrix, elm.center);
|
|
37226
37226
|
} else if (elm.type === "pcb_component") {
|
|
37227
|
-
elm.center =
|
|
37227
|
+
elm.center = applyToPoint24(matrix, elm.center);
|
|
37228
37228
|
elm.rotation = elm.rotation + tsr.rotation.angle / Math.PI * 180;
|
|
37229
37229
|
elm.rotation = elm.rotation % 360;
|
|
37230
37230
|
if (flipPadWidthHeight) {
|
|
@@ -37232,21 +37232,21 @@ var __create3, __defProp3, __getOwnPropDesc2, __getOwnPropNames3, __getProtoOf3,
|
|
|
37232
37232
|
}
|
|
37233
37233
|
} else if (elm.type === "pcb_courtyard_outline") {
|
|
37234
37234
|
elm.outline = elm.outline.map((p) => {
|
|
37235
|
-
const tp2 =
|
|
37235
|
+
const tp2 = applyToPoint24(matrix, p);
|
|
37236
37236
|
p.x = tp2.x;
|
|
37237
37237
|
p.y = tp2.y;
|
|
37238
37238
|
return p;
|
|
37239
37239
|
});
|
|
37240
37240
|
} else if (elm.type === "pcb_courtyard_polygon") {
|
|
37241
37241
|
elm.points = elm.points.map((p) => {
|
|
37242
|
-
const tp2 =
|
|
37242
|
+
const tp2 = applyToPoint24(matrix, p);
|
|
37243
37243
|
p.x = tp2.x;
|
|
37244
37244
|
p.y = tp2.y;
|
|
37245
37245
|
return p;
|
|
37246
37246
|
});
|
|
37247
37247
|
} else if (elm.type === "pcb_silkscreen_path" || elm.type === "pcb_trace" || elm.type === "pcb_fabrication_note_path" || elm.type === "pcb_note_path") {
|
|
37248
37248
|
elm.route = elm.route.map((rp2) => {
|
|
37249
|
-
const tp2 =
|
|
37249
|
+
const tp2 = applyToPoint24(matrix, rp2);
|
|
37250
37250
|
rp2.x = tp2.x;
|
|
37251
37251
|
rp2.y = tp2.y;
|
|
37252
37252
|
return rp2;
|
|
@@ -37254,14 +37254,14 @@ var __create3, __defProp3, __getOwnPropDesc2, __getOwnPropNames3, __getProtoOf3,
|
|
|
37254
37254
|
} else if (elm.type === "pcb_silkscreen_line" || elm.type === "pcb_note_line") {
|
|
37255
37255
|
const p12 = { x: elm.x1, y: elm.y1 };
|
|
37256
37256
|
const p22 = { x: elm.x2, y: elm.y2 };
|
|
37257
|
-
const p1t =
|
|
37258
|
-
const p2t =
|
|
37257
|
+
const p1t = applyToPoint24(matrix, p12);
|
|
37258
|
+
const p2t = applyToPoint24(matrix, p22);
|
|
37259
37259
|
elm.x1 = p1t.x;
|
|
37260
37260
|
elm.y1 = p1t.y;
|
|
37261
37261
|
elm.x2 = p2t.x;
|
|
37262
37262
|
elm.y2 = p2t.y;
|
|
37263
37263
|
} else if (elm.type === "cad_component") {
|
|
37264
|
-
const newPos =
|
|
37264
|
+
const newPos = applyToPoint24(matrix, {
|
|
37265
37265
|
x: elm.position.x,
|
|
37266
37266
|
y: elm.position.y
|
|
37267
37267
|
});
|
|
@@ -45888,7 +45888,7 @@ var init_chunk_SK323GHE = __esm(() => {
|
|
|
45888
45888
|
Ty = e(F).rotateRightFacingSymbol("down").labelPort("left1", ["1"]).labelPort("right1", ["2"]).changeTextAnchor("{REF}", "middle_left", { x: -0.03, y: 0.2 }).changeTextAnchor("{VAL}", "middle_left", { x: 0.8, y: -0.2 }).build();
|
|
45889
45889
|
Ey = e(F).rotateRightFacingSymbol("right").labelPort("left1", ["1"]).labelPort("right1", ["2"]).changeTextAnchor("{REF}", "middle_bottom", { x: 0, y: 0.1 }).changeTextAnchor("{VAL}", "middle_top").build();
|
|
45890
45890
|
Yy = e(F).rotateRightFacingSymbol("left").labelPort("left1", ["1"]).labelPort("right1", ["2"]).changeTextAnchor("{REF}", "middle_bottom", { x: 0, y: 0.8 }).changeTextAnchor("{VAL}", "middle_top", { x: 0, y: -0.9 }).build();
|
|
45891
|
-
|
|
45891
|
+
Xy7 = e(F).rotateRightFacingSymbol("right").labelPort("left1", ["1"]).labelPort("right1", ["2"]).changeTextAnchor("{REF}", "middle_bottom", { x: 0, y: 0.1 }).changeTextAnchor("{VAL}", "middle_top").build();
|
|
45892
45892
|
Ly = e(F).rotateRightFacingSymbol("up").labelPort("left1", ["1"]).labelPort("right1", ["2"]).changeTextAnchor("{REF}", "middle_left", { x: 0.7, y: 0.2 }).changeTextAnchor("{VAL}", "middle_left", { x: -0.13, y: -0.2 }).build();
|
|
45893
45893
|
Vy = e(F).rotateRightFacingSymbol("up").labelPort("left1", ["1"]).labelPort("right1", ["2"]).changeTextAnchor("{REF}", "middle_left", { x: 0.7, y: 0.2 }).changeTextAnchor("{VAL}", "middle_left", { x: -0.13, y: -0.2 }).build();
|
|
45894
45894
|
C = { paths: { triangle: { type: "path", points: [{ x: -0.06, y: -0.09 }, { x: -0.06, y: 0.09 }, { x: 0.06, y: 0 }, { x: -0.06, y: -0.09 }], color: "primary", fill: false }, stem: { type: "path", points: [{ x: -0.11, y: 0 }, { x: -0.06, y: 0 }], color: "primary", fill: false } }, texts: { top1: { type: "text", text: "{REF}", x: 0, y: 0.03 } }, refblocks: { left1: { x: -0.11, y: 0 } }, bounds: { minX: -0.57, maxX: 0.57, minY: -0.37, maxY: 0.37, width: 1.14, height: 0.74, centerX: 0, centerY: 0 }, circles: {} };
|
|
@@ -46878,7 +46878,7 @@ var init_chunk_SK323GHE = __esm(() => {
|
|
|
46878
46878
|
d_.anchor = "middle_left";
|
|
46879
46879
|
b_.anchor = "middle_right";
|
|
46880
46880
|
Lf = mp;
|
|
46881
|
-
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:
|
|
46881
|
+
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: At4, 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 };
|
|
46882
46882
|
YC = Object.fromEntries(Object.keys(Vf).map((t) => [t, t]));
|
|
46883
46883
|
cju5.unparsed = cju5;
|
|
46884
46884
|
su4 = cju5;
|
|
@@ -47043,7 +47043,7 @@ function createSvgObjectsFromPcbTraceError(pcbTraceError, circuitJson, ctx) {
|
|
|
47043
47043
|
return createSvgObjectsForViaTraceError(pcbTraceError, via, ctx);
|
|
47044
47044
|
}
|
|
47045
47045
|
if (pcbTraceError.center) {
|
|
47046
|
-
const screenCenter =
|
|
47046
|
+
const screenCenter = applyToPoint24(transform2, {
|
|
47047
47047
|
x: pcbTraceError.center.x,
|
|
47048
47048
|
y: pcbTraceError.center.y
|
|
47049
47049
|
});
|
|
@@ -47088,11 +47088,11 @@ function createSvgObjectsFromPcbTraceError(pcbTraceError, circuitJson, ctx) {
|
|
|
47088
47088
|
} else
|
|
47089
47089
|
return [];
|
|
47090
47090
|
}
|
|
47091
|
-
const screenPort1 =
|
|
47091
|
+
const screenPort1 = applyToPoint24(transform2, {
|
|
47092
47092
|
x: port1.x,
|
|
47093
47093
|
y: port1.y
|
|
47094
47094
|
});
|
|
47095
|
-
const screenPort2 =
|
|
47095
|
+
const screenPort2 = applyToPoint24(transform2, {
|
|
47096
47096
|
x: port2.x,
|
|
47097
47097
|
y: port2.y
|
|
47098
47098
|
});
|
|
@@ -47176,11 +47176,11 @@ function createSvgObjectsFromPcbTraceError(pcbTraceError, circuitJson, ctx) {
|
|
|
47176
47176
|
function createSvgObjectsForViaTraceError(pcbTraceError, via, ctx) {
|
|
47177
47177
|
const { transform: transform2 } = ctx;
|
|
47178
47178
|
if (pcbTraceError.center && via) {
|
|
47179
|
-
const screenCenter =
|
|
47179
|
+
const screenCenter = applyToPoint24(transform2, {
|
|
47180
47180
|
x: pcbTraceError.center.x,
|
|
47181
47181
|
y: pcbTraceError.center.y
|
|
47182
47182
|
});
|
|
47183
|
-
const screenVia =
|
|
47183
|
+
const screenVia = applyToPoint24(transform2, {
|
|
47184
47184
|
x: via.x,
|
|
47185
47185
|
y: via.y
|
|
47186
47186
|
});
|
|
@@ -47354,7 +47354,7 @@ function createSvgObjectsFromPcbFootprintOverlapError(error, circuitJson, ctx) {
|
|
|
47354
47354
|
if (filteredReferencedElements.length > 0) {
|
|
47355
47355
|
const centerX = filteredReferencedElements.reduce((sum, el2) => sum + el2.x, 0) / filteredReferencedElements.length;
|
|
47356
47356
|
const centerY = filteredReferencedElements.reduce((sum, el2) => sum + el2.y, 0) / filteredReferencedElements.length;
|
|
47357
|
-
const screenCenter =
|
|
47357
|
+
const screenCenter = applyToPoint24(transform2, { x: centerX, y: centerY });
|
|
47358
47358
|
svgObjects.push({
|
|
47359
47359
|
name: "rect",
|
|
47360
47360
|
type: "element",
|
|
@@ -47392,7 +47392,7 @@ function createSvgObjectsFromPcbFootprintOverlapError(error, circuitJson, ctx) {
|
|
|
47392
47392
|
value: ""
|
|
47393
47393
|
});
|
|
47394
47394
|
for (const element of filteredReferencedElements) {
|
|
47395
|
-
const screenPos =
|
|
47395
|
+
const screenPos = applyToPoint24(transform2, { x: element.x, y: element.y });
|
|
47396
47396
|
svgObjects.push({
|
|
47397
47397
|
name: "rect",
|
|
47398
47398
|
type: "element",
|
|
@@ -47444,7 +47444,7 @@ function createSvgObjectsFromPcbCourtyardOverlapError(error, circuitJson, ctx) {
|
|
|
47444
47444
|
return [];
|
|
47445
47445
|
const midX = componentCenters.reduce((s, c) => s + c.x, 0) / componentCenters.length;
|
|
47446
47446
|
const midY = componentCenters.reduce((s, c) => s + c.y, 0) / componentCenters.length;
|
|
47447
|
-
const screenMid =
|
|
47447
|
+
const screenMid = applyToPoint24(transform2, { x: midX, y: midY });
|
|
47448
47448
|
svgObjects.push({
|
|
47449
47449
|
name: "rect",
|
|
47450
47450
|
type: "element",
|
|
@@ -47486,7 +47486,7 @@ function createSvgObjectsFromPcbCourtyardOverlapError(error, circuitJson, ctx) {
|
|
|
47486
47486
|
value: ""
|
|
47487
47487
|
});
|
|
47488
47488
|
for (const center of componentCenters) {
|
|
47489
|
-
const screenPos =
|
|
47489
|
+
const screenPos = applyToPoint24(transform2, center);
|
|
47490
47490
|
svgObjects.push({
|
|
47491
47491
|
name: "rect",
|
|
47492
47492
|
type: "element",
|
|
@@ -47505,7 +47505,7 @@ function createSvgObjectsFromPcbCourtyardOverlapError(error, circuitJson, ctx) {
|
|
|
47505
47505
|
});
|
|
47506
47506
|
}
|
|
47507
47507
|
if (componentCenters.length === 2) {
|
|
47508
|
-
const mapped = componentCenters.map((c) =>
|
|
47508
|
+
const mapped = componentCenters.map((c) => applyToPoint24(transform2, c));
|
|
47509
47509
|
const s12 = mapped[0];
|
|
47510
47510
|
const s2 = mapped[1];
|
|
47511
47511
|
svgObjects.push({
|
|
@@ -47560,8 +47560,8 @@ function createSvgObjectsFromPcbComponentOutsideBoardError(error, circuitJson, c
|
|
|
47560
47560
|
const bounds = getComponentBounds(error, circuitJson);
|
|
47561
47561
|
if (!bounds)
|
|
47562
47562
|
return [];
|
|
47563
|
-
const topLeft =
|
|
47564
|
-
const bottomRight =
|
|
47563
|
+
const topLeft = applyToPoint24(transform2, { x: bounds.min_x, y: bounds.min_y });
|
|
47564
|
+
const bottomRight = applyToPoint24(transform2, {
|
|
47565
47565
|
x: bounds.max_x,
|
|
47566
47566
|
y: bounds.max_y
|
|
47567
47567
|
});
|
|
@@ -47635,7 +47635,7 @@ function createSvgObjectsFromPcbFabricationNotePath(fabNotePath, ctx) {
|
|
|
47635
47635
|
const lastPoint = fabNotePath.route[fabNotePath.route.length - 1];
|
|
47636
47636
|
const isClosed = firstPoint.x === lastPoint.x && firstPoint.y === lastPoint.y;
|
|
47637
47637
|
const path45 = fabNotePath.route.slice(0, isClosed ? -1 : undefined).map((point2, index) => {
|
|
47638
|
-
const [x3, y] =
|
|
47638
|
+
const [x3, y] = applyToPoint24(transform2, [point2.x, point2.y]);
|
|
47639
47639
|
return index === 0 ? `M ${x3} ${y}` : `L ${x3} ${y}`;
|
|
47640
47640
|
}).join(" ") + (isClosed ? " Z" : "");
|
|
47641
47641
|
return [
|
|
@@ -47674,7 +47674,7 @@ function createSvgObjectsFromPcbFabricationNoteText(pcbFabNoteText, ctx) {
|
|
|
47674
47674
|
debugPcb(`[pcb_fabrication_note_text] Invalid anchor_position for "${pcbFabNoteText.pcb_fabrication_note_text_id}": expected {x: number, y: number}, got ${JSON.stringify(anchor_position)}`);
|
|
47675
47675
|
return [];
|
|
47676
47676
|
}
|
|
47677
|
-
const [transformedX, transformedY] =
|
|
47677
|
+
const [transformedX, transformedY] = applyToPoint24(transform2, [
|
|
47678
47678
|
anchor_position.x,
|
|
47679
47679
|
anchor_position.y
|
|
47680
47680
|
]);
|
|
@@ -47753,11 +47753,11 @@ function createSvgObjectsFromPcbFabricationNoteRect(fabricationNoteRect, ctx) {
|
|
|
47753
47753
|
}
|
|
47754
47754
|
const halfWidth = width / 2;
|
|
47755
47755
|
const halfHeight = height / 2;
|
|
47756
|
-
const [topLeftX, topLeftY] =
|
|
47756
|
+
const [topLeftX, topLeftY] = applyToPoint24(transform2, [
|
|
47757
47757
|
center.x - halfWidth,
|
|
47758
47758
|
center.y + halfHeight
|
|
47759
47759
|
]);
|
|
47760
|
-
const [bottomRightX, bottomRightY] =
|
|
47760
|
+
const [bottomRightX, bottomRightY] = applyToPoint24(transform2, [
|
|
47761
47761
|
center.x + halfWidth,
|
|
47762
47762
|
center.y - halfHeight
|
|
47763
47763
|
]);
|
|
@@ -47904,11 +47904,11 @@ function createSvgObjectsFromPcbFabricationNoteDimension(dimension, ctx) {
|
|
|
47904
47904
|
y: toBase.y - perpendicular.y * arrowHalfWidth
|
|
47905
47905
|
})
|
|
47906
47906
|
];
|
|
47907
|
-
const [lineStartX, lineStartY] =
|
|
47907
|
+
const [lineStartX, lineStartY] = applyToPoint24(transform2, [
|
|
47908
47908
|
fromBase.x,
|
|
47909
47909
|
fromBase.y
|
|
47910
47910
|
]);
|
|
47911
|
-
const [lineEndX, lineEndY] =
|
|
47911
|
+
const [lineEndX, lineEndY] = applyToPoint24(transform2, [toBase.x, toBase.y]);
|
|
47912
47912
|
const strokeWidth = arrowSize / 5 * Math.abs(transform2.a);
|
|
47913
47913
|
const lineColor = color || "rgba(255,255,255,0.5)";
|
|
47914
47914
|
const extensionDirection = hasOffsetDirection && (Math.abs(normalizedOffsetDirection.x) > Number.EPSILON || Math.abs(normalizedOffsetDirection.y) > Number.EPSILON) ? normalizedOffsetDirection : perpendicular;
|
|
@@ -47918,8 +47918,8 @@ function createSvgObjectsFromPcbFabricationNoteDimension(dimension, ctx) {
|
|
|
47918
47918
|
x: anchor.x + extensionDirection.x * extensionLength,
|
|
47919
47919
|
y: anchor.y + extensionDirection.y * extensionLength
|
|
47920
47920
|
};
|
|
47921
|
-
const [startX, startY] =
|
|
47922
|
-
const [endX, endY] =
|
|
47921
|
+
const [startX, startY] = applyToPoint24(transform2, [anchor.x, anchor.y]);
|
|
47922
|
+
const [endX, endY] = applyToPoint24(transform2, [endPoint.x, endPoint.y]);
|
|
47923
47923
|
return {
|
|
47924
47924
|
name: "path",
|
|
47925
47925
|
type: "element",
|
|
@@ -47940,11 +47940,11 @@ function createSvgObjectsFromPcbFabricationNoteDimension(dimension, ctx) {
|
|
|
47940
47940
|
x: (from.x + to2.x) / 2 + offsetVector.x,
|
|
47941
47941
|
y: (from.y + to2.y) / 2 + offsetVector.y
|
|
47942
47942
|
};
|
|
47943
|
-
const [screenFromX, screenFromY] =
|
|
47943
|
+
const [screenFromX, screenFromY] = applyToPoint24(transform2, [
|
|
47944
47944
|
fromOffset.x,
|
|
47945
47945
|
fromOffset.y
|
|
47946
47946
|
]);
|
|
47947
|
-
const [screenToX, screenToY] =
|
|
47947
|
+
const [screenToX, screenToY] = applyToPoint24(transform2, [
|
|
47948
47948
|
toOffset.x,
|
|
47949
47949
|
toOffset.y
|
|
47950
47950
|
]);
|
|
@@ -47974,7 +47974,7 @@ function createSvgObjectsFromPcbFabricationNoteDimension(dimension, ctx) {
|
|
|
47974
47974
|
x: midPoint.x + perpendicular.x * textOffset,
|
|
47975
47975
|
y: midPoint.y + perpendicular.y * textOffset
|
|
47976
47976
|
};
|
|
47977
|
-
const [textX, textY] =
|
|
47977
|
+
const [textX, textY] = applyToPoint24(transform2, [textPoint.x, textPoint.y]);
|
|
47978
47978
|
const transformedFontSize = font_size * Math.abs(transform2.a);
|
|
47979
47979
|
const children = [
|
|
47980
47980
|
...extensionSegments,
|
|
@@ -48061,7 +48061,7 @@ function createSvgObjectsFromPcbFabricationNoteDimension(dimension, ctx) {
|
|
|
48061
48061
|
}
|
|
48062
48062
|
];
|
|
48063
48063
|
function toScreen(point2) {
|
|
48064
|
-
const [x3, y] =
|
|
48064
|
+
const [x3, y] = applyToPoint24(transform2, [point2.x, point2.y]);
|
|
48065
48065
|
return { x: x3, y };
|
|
48066
48066
|
}
|
|
48067
48067
|
}
|
|
@@ -48142,11 +48142,11 @@ function createSvgObjectsFromPcbNoteDimension(dimension, ctx) {
|
|
|
48142
48142
|
y: toBase.y - perpendicular.y * arrowHalfWidth
|
|
48143
48143
|
})
|
|
48144
48144
|
];
|
|
48145
|
-
const [lineStartX, lineStartY] =
|
|
48145
|
+
const [lineStartX, lineStartY] = applyToPoint24(transform2, [
|
|
48146
48146
|
fromBase.x,
|
|
48147
48147
|
fromBase.y
|
|
48148
48148
|
]);
|
|
48149
|
-
const [lineEndX, lineEndY] =
|
|
48149
|
+
const [lineEndX, lineEndY] = applyToPoint24(transform2, [toBase.x, toBase.y]);
|
|
48150
48150
|
const strokeWidth = arrow_size / 5 * Math.abs(transform2.a);
|
|
48151
48151
|
const lineColor = color || colorMap.board.user_2;
|
|
48152
48152
|
const extensionDirection = hasOffsetDirection && (Math.abs(normalizedOffsetDirection.x) > Number.EPSILON || Math.abs(normalizedOffsetDirection.y) > Number.EPSILON) ? normalizedOffsetDirection : perpendicular;
|
|
@@ -48156,8 +48156,8 @@ function createSvgObjectsFromPcbNoteDimension(dimension, ctx) {
|
|
|
48156
48156
|
x: anchor.x + extensionDirection.x * extensionLength,
|
|
48157
48157
|
y: anchor.y + extensionDirection.y * extensionLength
|
|
48158
48158
|
};
|
|
48159
|
-
const [startX, startY] =
|
|
48160
|
-
const [endX, endY] =
|
|
48159
|
+
const [startX, startY] = applyToPoint24(transform2, [anchor.x, anchor.y]);
|
|
48160
|
+
const [endX, endY] = applyToPoint24(transform2, [endPoint.x, endPoint.y]);
|
|
48161
48161
|
return {
|
|
48162
48162
|
name: "path",
|
|
48163
48163
|
type: "element",
|
|
@@ -48178,11 +48178,11 @@ function createSvgObjectsFromPcbNoteDimension(dimension, ctx) {
|
|
|
48178
48178
|
x: (from.x + to2.x) / 2 + offsetVector.x,
|
|
48179
48179
|
y: (from.y + to2.y) / 2 + offsetVector.y
|
|
48180
48180
|
};
|
|
48181
|
-
const [screenFromX, screenFromY] =
|
|
48181
|
+
const [screenFromX, screenFromY] = applyToPoint24(transform2, [
|
|
48182
48182
|
fromOffset.x,
|
|
48183
48183
|
fromOffset.y
|
|
48184
48184
|
]);
|
|
48185
|
-
const [screenToX, screenToY] =
|
|
48185
|
+
const [screenToX, screenToY] = applyToPoint24(transform2, [
|
|
48186
48186
|
toOffset.x,
|
|
48187
48187
|
toOffset.y
|
|
48188
48188
|
]);
|
|
@@ -48212,7 +48212,7 @@ function createSvgObjectsFromPcbNoteDimension(dimension, ctx) {
|
|
|
48212
48212
|
x: midPoint.x + perpendicular.x * textOffset,
|
|
48213
48213
|
y: midPoint.y + perpendicular.y * textOffset
|
|
48214
48214
|
};
|
|
48215
|
-
const [textX, textY] =
|
|
48215
|
+
const [textX, textY] = applyToPoint24(transform2, [textPoint.x, textPoint.y]);
|
|
48216
48216
|
const transformedFontSize = font_size * Math.abs(transform2.a);
|
|
48217
48217
|
const children = [
|
|
48218
48218
|
...extensionSegments,
|
|
@@ -48295,7 +48295,7 @@ function createSvgObjectsFromPcbNoteDimension(dimension, ctx) {
|
|
|
48295
48295
|
}
|
|
48296
48296
|
];
|
|
48297
48297
|
function toScreen(point2) {
|
|
48298
|
-
const [x3, y] =
|
|
48298
|
+
const [x3, y] = applyToPoint24(transform2, [point2.x, point2.y]);
|
|
48299
48299
|
return { x: x3, y };
|
|
48300
48300
|
}
|
|
48301
48301
|
}
|
|
@@ -48316,7 +48316,7 @@ function createSvgObjectsFromPcbNoteText(note, ctx) {
|
|
|
48316
48316
|
debugPcb(`[pcb_note_text] Invalid text for "${note.pcb_note_text_id}": expected non-empty string, got ${JSON.stringify(text)}`);
|
|
48317
48317
|
return [];
|
|
48318
48318
|
}
|
|
48319
|
-
const [x3, y] =
|
|
48319
|
+
const [x3, y] = applyToPoint24(transform2, [anchor_position.x, anchor_position.y]);
|
|
48320
48320
|
const transformedFontSize = font_size * Math.abs(transform2.a);
|
|
48321
48321
|
let textAnchor = "middle";
|
|
48322
48322
|
let dominantBaseline = "central";
|
|
@@ -48411,11 +48411,11 @@ function createSvgObjectsFromPcbNoteRect(noteRect, ctx) {
|
|
|
48411
48411
|
}
|
|
48412
48412
|
const halfWidth = width / 2;
|
|
48413
48413
|
const halfHeight = height / 2;
|
|
48414
|
-
const [topLeftX, topLeftY] =
|
|
48414
|
+
const [topLeftX, topLeftY] = applyToPoint24(transform2, [
|
|
48415
48415
|
center.x - halfWidth,
|
|
48416
48416
|
center.y + halfHeight
|
|
48417
48417
|
]);
|
|
48418
|
-
const [bottomRightX, bottomRightY] =
|
|
48418
|
+
const [bottomRightX, bottomRightY] = applyToPoint24(transform2, [
|
|
48419
48419
|
center.x + halfWidth,
|
|
48420
48420
|
center.y - halfHeight
|
|
48421
48421
|
]);
|
|
@@ -48484,7 +48484,7 @@ function createSvgObjectsFromPcbNotePath(notePath, ctx) {
|
|
|
48484
48484
|
}
|
|
48485
48485
|
}
|
|
48486
48486
|
const pathD = notePath.route.map((point2, index) => {
|
|
48487
|
-
const [x3, y] =
|
|
48487
|
+
const [x3, y] = applyToPoint24(transform2, [point2.x, point2.y]);
|
|
48488
48488
|
return index === 0 ? `M ${x3} ${y}` : `L ${x3} ${y}`;
|
|
48489
48489
|
}).join(" ");
|
|
48490
48490
|
const strokeWidth = notePath.stroke_width * Math.abs(transform2.a);
|
|
@@ -48513,8 +48513,8 @@ function createSvgObjectsFromPcbNoteLine(noteLine, ctx) {
|
|
|
48513
48513
|
debugPcb(`[pcb_note_line] Invalid coordinates for "${noteLine.pcb_note_line_id}": expected x1, y1, x2, y2 as numbers, got x1=${JSON.stringify(x12)}, y1=${JSON.stringify(y12)}, x2=${JSON.stringify(x22)}, y2=${JSON.stringify(y22)}`);
|
|
48514
48514
|
return [];
|
|
48515
48515
|
}
|
|
48516
|
-
const [startX, startY] =
|
|
48517
|
-
const [endX, endY] =
|
|
48516
|
+
const [startX, startY] = applyToPoint24(transform2, [x12, y12]);
|
|
48517
|
+
const [endX, endY] = applyToPoint24(transform2, [x22, y22]);
|
|
48518
48518
|
const baseStrokeWidth = typeof stroke_width === "number" ? stroke_width : 0;
|
|
48519
48519
|
const transformedStrokeWidth = baseStrokeWidth * Math.abs(transform2.a);
|
|
48520
48520
|
const attributes = {
|
|
@@ -48546,7 +48546,7 @@ function createSvgObjectsFromPcbNoteLine(noteLine, ctx) {
|
|
|
48546
48546
|
}
|
|
48547
48547
|
function createSvgObjectsFromPcbPlatedHole(hole, ctx) {
|
|
48548
48548
|
const { transform: transform2, colorMap: colorMap2, showSolderMask } = ctx;
|
|
48549
|
-
const [x3, y] =
|
|
48549
|
+
const [x3, y] = applyToPoint24(transform2, [hole.x, hole.y]);
|
|
48550
48550
|
const layer = Array.isArray(hole.layers) && hole.layers[0] || hole.layer || "top";
|
|
48551
48551
|
const maskLayer = layer;
|
|
48552
48552
|
const isCoveredWithSolderMask = Boolean(hole.is_covered_with_solder_mask);
|
|
@@ -48844,7 +48844,7 @@ function createSvgObjectsFromPcbPlatedHole(hole, ctx) {
|
|
|
48844
48844
|
const xStr = rotation2 ? (-scaledRectPadWidth / 2).toString() : (x3 - scaledRectPadWidth / 2).toString();
|
|
48845
48845
|
const yStr = rotation2 ? (-scaledRectPadHeight / 2).toString() : (y - scaledRectPadHeight / 2).toString();
|
|
48846
48846
|
const holeRadius = scaledHoleDiameter / 2;
|
|
48847
|
-
const [holeCx, holeCy] =
|
|
48847
|
+
const [holeCx, holeCy] = applyToPoint24(transform2, [
|
|
48848
48848
|
h.x + (h.hole_offset_x ?? 0),
|
|
48849
48849
|
h.y + (h.hole_offset_y ?? 0)
|
|
48850
48850
|
]);
|
|
@@ -49007,7 +49007,7 @@ function createSvgObjectsFromPcbPlatedHole(hole, ctx) {
|
|
|
49007
49007
|
const pillHoleWithOffsets = pillHole;
|
|
49008
49008
|
const holeOffsetX = pillHoleWithOffsets.hole_offset_x ?? 0;
|
|
49009
49009
|
const holeOffsetY = pillHoleWithOffsets.hole_offset_y ?? 0;
|
|
49010
|
-
const [holeCenterX, holeCenterY] =
|
|
49010
|
+
const [holeCenterX, holeCenterY] = applyToPoint24(transform2, [
|
|
49011
49011
|
pillHole.x + holeOffsetX,
|
|
49012
49012
|
pillHole.y + holeOffsetY
|
|
49013
49013
|
]);
|
|
@@ -49146,7 +49146,7 @@ function createSvgObjectsFromPcbPlatedHole(hole, ctx) {
|
|
|
49146
49146
|
const rotatedHoleWithOffsets = rotatedHole;
|
|
49147
49147
|
const holeOffsetX = rotatedHoleWithOffsets.hole_offset_x ?? 0;
|
|
49148
49148
|
const holeOffsetY = rotatedHoleWithOffsets.hole_offset_y ?? 0;
|
|
49149
|
-
const [holeCenterX, holeCenterY] =
|
|
49149
|
+
const [holeCenterX, holeCenterY] = applyToPoint24(transform2, [
|
|
49150
49150
|
rotatedHole.x + holeOffsetX,
|
|
49151
49151
|
rotatedHole.y + holeOffsetY
|
|
49152
49152
|
]);
|
|
@@ -49285,9 +49285,9 @@ function createSvgObjectsFromPcbPlatedHole(hole, ctx) {
|
|
|
49285
49285
|
const padOutline = polygonHole.pad_outline || [];
|
|
49286
49286
|
const holeX = polygonHole.x ?? 0;
|
|
49287
49287
|
const holeY = polygonHole.y ?? 0;
|
|
49288
|
-
const padPoints = padOutline.map((point2) =>
|
|
49288
|
+
const padPoints = padOutline.map((point2) => applyToPoint24(transform2, [holeX + point2.x, holeY + point2.y]));
|
|
49289
49289
|
const padPointsString = padPoints.map((p) => p.join(",")).join(" ");
|
|
49290
|
-
const [holeCenterX, holeCenterY] =
|
|
49290
|
+
const [holeCenterX, holeCenterY] = applyToPoint24(transform2, [
|
|
49291
49291
|
holeX + polygonHole.hole_offset_x,
|
|
49292
49292
|
holeY + polygonHole.hole_offset_y
|
|
49293
49293
|
]);
|
|
@@ -49398,7 +49398,7 @@ function createSvgObjectsFromPcbSilkscreenPath(silkscreenPath, ctx) {
|
|
|
49398
49398
|
if (!silkscreenPath.route || !Array.isArray(silkscreenPath.route))
|
|
49399
49399
|
return [];
|
|
49400
49400
|
let path45 = silkscreenPath.route.map((point2, index) => {
|
|
49401
|
-
const [x3, y] =
|
|
49401
|
+
const [x3, y] = applyToPoint24(transform2, [point2.x, point2.y]);
|
|
49402
49402
|
return index === 0 ? `M ${x3} ${y}` : `L ${x3} ${y}`;
|
|
49403
49403
|
}).join(" ");
|
|
49404
49404
|
const firstPoint = silkscreenPath.route[0];
|
|
@@ -49508,7 +49508,7 @@ function createSvgObjectsFromPcbSilkscreenText(pcbSilkscreenText, ctx) {
|
|
|
49508
49508
|
debugPcb(`[pcb_silkscreen_text] Invalid anchor_position for "${pcbSilkscreenText.pcb_silkscreen_text_id}": expected {x: number, y: number}, got ${JSON.stringify(anchor_position)}`);
|
|
49509
49509
|
return [];
|
|
49510
49510
|
}
|
|
49511
|
-
const [transformedX, transformedY] =
|
|
49511
|
+
const [transformedX, transformedY] = applyToPoint24(transform2, [
|
|
49512
49512
|
anchor_position.x,
|
|
49513
49513
|
anchor_position.y
|
|
49514
49514
|
]);
|
|
@@ -49716,7 +49716,7 @@ function createSvgObjectsFromPcbSilkscreenRect(pcbSilkscreenRect, ctx) {
|
|
|
49716
49716
|
debugPcb(`[pcb_silkscreen_rect] Invalid data for "${pcb_silkscreen_rect_id}": expected center {x: number, y: number}, width: number, height: number, got center=${JSON.stringify(center)}, width=${JSON.stringify(width)}, height=${JSON.stringify(height)}`);
|
|
49717
49717
|
return [];
|
|
49718
49718
|
}
|
|
49719
|
-
const [transformedX, transformedY] =
|
|
49719
|
+
const [transformedX, transformedY] = applyToPoint24(transform2, [
|
|
49720
49720
|
center.x,
|
|
49721
49721
|
center.y
|
|
49722
49722
|
]);
|
|
@@ -49866,7 +49866,7 @@ function createSvgObjectsFromPcbCopperText(pcbCopperText, ctx) {
|
|
|
49866
49866
|
return [];
|
|
49867
49867
|
if (!anchor_position)
|
|
49868
49868
|
return [];
|
|
49869
|
-
const [ax2, ay2] =
|
|
49869
|
+
const [ax2, ay2] = applyToPoint24(transform2, [
|
|
49870
49870
|
anchor_position.x,
|
|
49871
49871
|
anchor_position.y
|
|
49872
49872
|
]);
|
|
@@ -50023,7 +50023,7 @@ function createSvgObjectsFromPcbSilkscreenCircle(pcbSilkscreenCircle, ctx) {
|
|
|
50023
50023
|
console.error("Invalid PCB Silkscreen Circle data:", { center, radius });
|
|
50024
50024
|
return [];
|
|
50025
50025
|
}
|
|
50026
|
-
const [transformedX, transformedY] =
|
|
50026
|
+
const [transformedX, transformedY] = applyToPoint24(transform2, [
|
|
50027
50027
|
center.x,
|
|
50028
50028
|
center.y
|
|
50029
50029
|
]);
|
|
@@ -50066,8 +50066,8 @@ function createSvgObjectsFromPcbSilkscreenLine(pcbSilkscreenLine, ctx) {
|
|
|
50066
50066
|
debugPcb(`[pcb_silkscreen_line] Invalid coordinates for "${pcb_silkscreen_line_id}": expected x1, y1, x2, y2 as numbers, got x1=${JSON.stringify(x12)}, y1=${JSON.stringify(y12)}, x2=${JSON.stringify(x22)}, y2=${JSON.stringify(y22)}`);
|
|
50067
50067
|
return [];
|
|
50068
50068
|
}
|
|
50069
|
-
const [transformedX1, transformedY1] =
|
|
50070
|
-
const [transformedX2, transformedY2] =
|
|
50069
|
+
const [transformedX1, transformedY1] = applyToPoint24(transform2, [x12, y12]);
|
|
50070
|
+
const [transformedX2, transformedY2] = applyToPoint24(transform2, [x22, y22]);
|
|
50071
50071
|
const transformedStrokeWidth = stroke_width * Math.abs(transform2.a);
|
|
50072
50072
|
const color = layer === "bottom" ? colorMap2.silkscreen.bottom : colorMap2.silkscreen.top;
|
|
50073
50073
|
return [
|
|
@@ -50102,7 +50102,7 @@ function createSvgObjectsFromPcbSilkscreenPill(pcbSilkscreenPill, ctx) {
|
|
|
50102
50102
|
} = pcbSilkscreenPill;
|
|
50103
50103
|
if (layerFilter && layer !== layerFilter)
|
|
50104
50104
|
return [];
|
|
50105
|
-
const [transformedX, transformedY] =
|
|
50105
|
+
const [transformedX, transformedY] = applyToPoint24(transform2, [
|
|
50106
50106
|
center.x,
|
|
50107
50107
|
center.y
|
|
50108
50108
|
]);
|
|
@@ -50152,7 +50152,7 @@ function createSvgObjectsFromPcbSilkscreenOval(pcbSilkscreenOval, ctx) {
|
|
|
50152
50152
|
debugPcb(`[pcb_silkscreen_oval] Invalid data for "${pcb_silkscreen_oval_id}": expected center {x: number, y: number}, radius_x: number, radius_y: number, got center=${JSON.stringify(center)}, radius_x=${JSON.stringify(radius_x)}, radius_y=${JSON.stringify(radius_y)}`);
|
|
50153
50153
|
return [];
|
|
50154
50154
|
}
|
|
50155
|
-
const [transformedX, transformedY] =
|
|
50155
|
+
const [transformedX, transformedY] = applyToPoint24(transform2, [
|
|
50156
50156
|
center.x,
|
|
50157
50157
|
center.y
|
|
50158
50158
|
]);
|
|
@@ -50199,7 +50199,7 @@ function createSvgObjectsFromPcbCourtyardRect(pcbCourtyardRect, ctx) {
|
|
|
50199
50199
|
debugPcb(`[pcb_courtyard_rect] Invalid data for "${pcb_courtyard_rect_id}": expected center {x: number, y: number}, width: number, height: number, got center=${JSON.stringify(center)}, width=${JSON.stringify(width)}, height=${JSON.stringify(height)}`);
|
|
50200
50200
|
return [];
|
|
50201
50201
|
}
|
|
50202
|
-
const [transformedX, transformedY] =
|
|
50202
|
+
const [transformedX, transformedY] = applyToPoint24(transform2, [
|
|
50203
50203
|
center.x,
|
|
50204
50204
|
center.y
|
|
50205
50205
|
]);
|
|
@@ -50249,7 +50249,7 @@ function createSvgObjectsFromPcbCourtyardPolygon(pcbCourtyardPolygon, ctx) {
|
|
|
50249
50249
|
debugPcb(`[pcb_courtyard_polygon] Invalid data for "${pcb_courtyard_polygon_id}": expected non-empty array of points, got ${JSON.stringify(points)}`);
|
|
50250
50250
|
return [];
|
|
50251
50251
|
}
|
|
50252
|
-
const transformedPoints = points.map((p) =>
|
|
50252
|
+
const transformedPoints = points.map((p) => applyToPoint24(transform2, [p.x, p.y]));
|
|
50253
50253
|
const pointsString = transformedPoints.map((p) => `${p[0]},${p[1]}`).join(" ");
|
|
50254
50254
|
const transformedStrokeWidth = 0.05 * Math.abs(transform2.a);
|
|
50255
50255
|
const strokeColor = color ?? (layer === "bottom" ? colorMap2.courtyard.bottom : colorMap2.courtyard.top);
|
|
@@ -50281,7 +50281,7 @@ function createSvgObjectsFromPcbCourtyardOutline(pcbCourtyardOutline, ctx) {
|
|
|
50281
50281
|
debugPcb(`[pcb_courtyard_outline] Invalid data for "${pcb_courtyard_outline_id}": expected non-empty array of points, got ${JSON.stringify(outline)}`);
|
|
50282
50282
|
return [];
|
|
50283
50283
|
}
|
|
50284
|
-
const transformedPoints = outline.map((p) =>
|
|
50284
|
+
const transformedPoints = outline.map((p) => applyToPoint24(transform2, [p.x, p.y]));
|
|
50285
50285
|
const pointsString = transformedPoints.map((p) => `${p[0]},${p[1]}`).join(" ");
|
|
50286
50286
|
const transformedStrokeWidth = 0.05 * Math.abs(transform2.a);
|
|
50287
50287
|
const strokeColor = layer === "bottom" ? colorMap2.courtyard.bottom : colorMap2.courtyard.top;
|
|
@@ -50318,7 +50318,7 @@ function createSvgObjectsFromPcbCourtyardCircle(pcbCourtyardCircle, ctx) {
|
|
|
50318
50318
|
console.error(`[pcb_courtyard_circle] Invalid data for "${pcb_courtyard_circle_id}": expected center {x: number, y: number}, radius: number, got center=${JSON.stringify(center)}, radius=${JSON.stringify(radius)}`);
|
|
50319
50319
|
return [];
|
|
50320
50320
|
}
|
|
50321
|
-
const [transformedX, transformedY] =
|
|
50321
|
+
const [transformedX, transformedY] = applyToPoint24(transform2, [
|
|
50322
50322
|
center.x,
|
|
50323
50323
|
center.y
|
|
50324
50324
|
]);
|
|
@@ -50363,8 +50363,8 @@ function createSvgObjectsFromPcbTrace(trace, ctx) {
|
|
|
50363
50363
|
if (start.is_inside_copper_pour === true && end.is_inside_copper_pour === true) {
|
|
50364
50364
|
continue;
|
|
50365
50365
|
}
|
|
50366
|
-
const startPoint =
|
|
50367
|
-
const endPoint =
|
|
50366
|
+
const startPoint = applyToPoint24(transform2, [start.x, start.y]);
|
|
50367
|
+
const endPoint = applyToPoint24(transform2, [end.x, end.y]);
|
|
50368
50368
|
const layer = "layer" in start ? start.layer : ("layer" in end) ? end.layer : null;
|
|
50369
50369
|
if (!layer)
|
|
50370
50370
|
continue;
|
|
@@ -50430,7 +50430,7 @@ function createSvgObjectsFromSmtPad(pad, ctx) {
|
|
|
50430
50430
|
if (pad.shape === "rect" || pad.shape === "rotated_rect") {
|
|
50431
50431
|
const width = pad.width * Math.abs(transform2.a);
|
|
50432
50432
|
const height = pad.height * Math.abs(transform2.d);
|
|
50433
|
-
const [x3, y] =
|
|
50433
|
+
const [x3, y] = applyToPoint24(transform2, [pad.x, pad.y]);
|
|
50434
50434
|
const cornerRadiusValue = pad.corner_radius ?? pad.rect_border_radius ?? 0;
|
|
50435
50435
|
const scaledBorderRadius = cornerRadiusValue * Math.abs(transform2.a);
|
|
50436
50436
|
const m = {
|
|
@@ -50680,7 +50680,7 @@ function createSvgObjectsFromSmtPad(pad, ctx) {
|
|
|
50680
50680
|
const width = pad.width * Math.abs(transform2.a);
|
|
50681
50681
|
const height = pad.height * Math.abs(transform2.d);
|
|
50682
50682
|
const radius = pad.radius * Math.abs(transform2.a);
|
|
50683
|
-
const [x3, y] =
|
|
50683
|
+
const [x3, y] = applyToPoint24(transform2, [pad.x, pad.y]);
|
|
50684
50684
|
const rotationTransformAttributes = isRotated ? {
|
|
50685
50685
|
transform: `translate(${x3} ${y}) rotate(${-(pad.ccw_rotation ?? 0)})`
|
|
50686
50686
|
} : undefined;
|
|
@@ -50798,7 +50798,7 @@ function createSvgObjectsFromSmtPad(pad, ctx) {
|
|
|
50798
50798
|
}
|
|
50799
50799
|
if (pad.shape === "circle") {
|
|
50800
50800
|
const radius = pad.radius * Math.abs(transform2.a);
|
|
50801
|
-
const [x3, y] =
|
|
50801
|
+
const [x3, y] = applyToPoint24(transform2, [pad.x, pad.y]);
|
|
50802
50802
|
const padElement = {
|
|
50803
50803
|
name: "circle",
|
|
50804
50804
|
type: "element",
|
|
@@ -50887,7 +50887,7 @@ function createSvgObjectsFromSmtPad(pad, ctx) {
|
|
|
50887
50887
|
return [substrateElement, padElement];
|
|
50888
50888
|
}
|
|
50889
50889
|
if (pad.shape === "polygon") {
|
|
50890
|
-
const points = (pad.points ?? []).map((point2) =>
|
|
50890
|
+
const points = (pad.points ?? []).map((point2) => applyToPoint24(transform2, [point2.x, point2.y]));
|
|
50891
50891
|
const padElement = {
|
|
50892
50892
|
name: "polygon",
|
|
50893
50893
|
type: "element",
|
|
@@ -50995,11 +50995,11 @@ function createAnchorOffsetIndicators(params2) {
|
|
|
50995
50995
|
displayYOffset
|
|
50996
50996
|
} = params2;
|
|
50997
50997
|
const objects = [];
|
|
50998
|
-
const [screenGroupAnchorX, screenGroupAnchorY] =
|
|
50998
|
+
const [screenGroupAnchorX, screenGroupAnchorY] = applyToPoint24(transform2, [
|
|
50999
50999
|
groupAnchorPosition.x,
|
|
51000
51000
|
groupAnchorPosition.y
|
|
51001
51001
|
]);
|
|
51002
|
-
const [screenComponentX, screenComponentY] =
|
|
51002
|
+
const [screenComponentX, screenComponentY] = applyToPoint24(transform2, [
|
|
51003
51003
|
componentPosition.x,
|
|
51004
51004
|
componentPosition.y
|
|
51005
51005
|
]);
|
|
@@ -51335,25 +51335,25 @@ function createSvgObjectsFromPcbBoard(pcbBoard, ctx) {
|
|
|
51335
51335
|
let path45;
|
|
51336
51336
|
if (outline && Array.isArray(outline) && outline.length >= 3) {
|
|
51337
51337
|
path45 = outline.map((point2, index) => {
|
|
51338
|
-
const [x3, y] =
|
|
51338
|
+
const [x3, y] = applyToPoint24(transform2, [point2.x, point2.y]);
|
|
51339
51339
|
return index === 0 ? `M ${x3} ${y}` : `L ${x3} ${y}`;
|
|
51340
51340
|
}).join(" ");
|
|
51341
51341
|
} else {
|
|
51342
51342
|
const halfWidth = width / 2;
|
|
51343
51343
|
const halfHeight = height / 2;
|
|
51344
|
-
const topLeft =
|
|
51344
|
+
const topLeft = applyToPoint24(transform2, [
|
|
51345
51345
|
center.x - halfWidth,
|
|
51346
51346
|
center.y - halfHeight
|
|
51347
51347
|
]);
|
|
51348
|
-
const topRight =
|
|
51348
|
+
const topRight = applyToPoint24(transform2, [
|
|
51349
51349
|
center.x + halfWidth,
|
|
51350
51350
|
center.y - halfHeight
|
|
51351
51351
|
]);
|
|
51352
|
-
const bottomRight =
|
|
51352
|
+
const bottomRight = applyToPoint24(transform2, [
|
|
51353
51353
|
center.x + halfWidth,
|
|
51354
51354
|
center.y + halfHeight
|
|
51355
51355
|
]);
|
|
51356
|
-
const bottomLeft =
|
|
51356
|
+
const bottomLeft = applyToPoint24(transform2, [
|
|
51357
51357
|
center.x - halfWidth,
|
|
51358
51358
|
center.y + halfHeight
|
|
51359
51359
|
]);
|
|
@@ -51421,19 +51421,19 @@ function createSvgObjectsFromPcbPanel(pcbPanel, ctx) {
|
|
|
51421
51421
|
const center = pcbPanel.center ?? { x: width / 2, y: height / 2 };
|
|
51422
51422
|
const halfWidth = width / 2;
|
|
51423
51423
|
const halfHeight = height / 2;
|
|
51424
|
-
const topLeft =
|
|
51424
|
+
const topLeft = applyToPoint24(transform2, [
|
|
51425
51425
|
center.x - halfWidth,
|
|
51426
51426
|
center.y - halfHeight
|
|
51427
51427
|
]);
|
|
51428
|
-
const topRight =
|
|
51428
|
+
const topRight = applyToPoint24(transform2, [
|
|
51429
51429
|
center.x + halfWidth,
|
|
51430
51430
|
center.y - halfHeight
|
|
51431
51431
|
]);
|
|
51432
|
-
const bottomRight =
|
|
51432
|
+
const bottomRight = applyToPoint24(transform2, [
|
|
51433
51433
|
center.x + halfWidth,
|
|
51434
51434
|
center.y + halfHeight
|
|
51435
51435
|
]);
|
|
51436
|
-
const bottomLeft =
|
|
51436
|
+
const bottomLeft = applyToPoint24(transform2, [
|
|
51437
51437
|
center.x - halfWidth,
|
|
51438
51438
|
center.y + halfHeight
|
|
51439
51439
|
]);
|
|
@@ -51460,7 +51460,7 @@ function createSvgObjectsFromPcbPanel(pcbPanel, ctx) {
|
|
|
51460
51460
|
}
|
|
51461
51461
|
function createSvgObjectsFromPcbVia(hole, ctx) {
|
|
51462
51462
|
const { transform: transform2, colorMap: colorMap2 } = ctx;
|
|
51463
|
-
const [x3, y] =
|
|
51463
|
+
const [x3, y] = applyToPoint24(transform2, [hole.x, hole.y]);
|
|
51464
51464
|
const scaledOuterWidth = hole.outer_diameter * Math.abs(transform2.a);
|
|
51465
51465
|
const scaledOuterHeight = hole.outer_diameter * Math.abs(transform2.a);
|
|
51466
51466
|
const scaledHoleWidth = hole.hole_diameter * Math.abs(transform2.a);
|
|
@@ -51507,7 +51507,7 @@ function createSvgObjectsFromPcbVia(hole, ctx) {
|
|
|
51507
51507
|
function createSvgObjectsFromPcbHole(hole, ctx) {
|
|
51508
51508
|
const { transform: transform2, colorMap: colorMap2, showSolderMask } = ctx;
|
|
51509
51509
|
const layer = ctx.layer ?? "top";
|
|
51510
|
-
const [x3, y] =
|
|
51510
|
+
const [x3, y] = applyToPoint24(transform2, [hole.x, hole.y]);
|
|
51511
51511
|
const isCoveredWithSolderMask = Boolean(hole.is_covered_with_solder_mask);
|
|
51512
51512
|
const soldermaskMargin = (hole.soldermask_margin ?? 0) * Math.abs(transform2.a);
|
|
51513
51513
|
const shouldShowSolderMask = showSolderMask && isCoveredWithSolderMask && soldermaskMargin !== 0;
|
|
@@ -52005,11 +52005,11 @@ function createSvgObjectsForRatsNest(circuitJson, ctx) {
|
|
|
52005
52005
|
});
|
|
52006
52006
|
const svgObjects = [];
|
|
52007
52007
|
for (const line of ratsNestLines) {
|
|
52008
|
-
const transformedStart =
|
|
52008
|
+
const transformedStart = applyToPoint24(transform2, [
|
|
52009
52009
|
line.startPoint.x,
|
|
52010
52010
|
line.startPoint.y
|
|
52011
52011
|
]);
|
|
52012
|
-
const transformedEnd =
|
|
52012
|
+
const transformedEnd = applyToPoint24(transform2, [
|
|
52013
52013
|
line.endPoint.x,
|
|
52014
52014
|
line.endPoint.y
|
|
52015
52015
|
]);
|
|
@@ -52038,7 +52038,7 @@ function createSvgObjectsFromPcbCutout(cutout, ctx) {
|
|
|
52038
52038
|
const { transform: transform2, colorMap: colorMap2 } = ctx;
|
|
52039
52039
|
if (cutout.shape === "rect") {
|
|
52040
52040
|
const rectCutout = cutout;
|
|
52041
|
-
const [cx2, cy2] =
|
|
52041
|
+
const [cx2, cy2] = applyToPoint24(transform2, [
|
|
52042
52042
|
rectCutout.center.x,
|
|
52043
52043
|
rectCutout.center.y
|
|
52044
52044
|
]);
|
|
@@ -52078,7 +52078,7 @@ function createSvgObjectsFromPcbCutout(cutout, ctx) {
|
|
|
52078
52078
|
}
|
|
52079
52079
|
if (cutout.shape === "circle") {
|
|
52080
52080
|
const circleCutout = cutout;
|
|
52081
|
-
const [cx2, cy2] =
|
|
52081
|
+
const [cx2, cy2] = applyToPoint24(transform2, [
|
|
52082
52082
|
circleCutout.center.x,
|
|
52083
52083
|
circleCutout.center.y
|
|
52084
52084
|
]);
|
|
@@ -52105,7 +52105,7 @@ function createSvgObjectsFromPcbCutout(cutout, ctx) {
|
|
|
52105
52105
|
const polygonCutout = cutout;
|
|
52106
52106
|
if (!polygonCutout.points || polygonCutout.points.length === 0)
|
|
52107
52107
|
return [];
|
|
52108
|
-
const transformedPoints = polygonCutout.points.map((p) =>
|
|
52108
|
+
const transformedPoints = polygonCutout.points.map((p) => applyToPoint24(transform2, [p.x, p.y]));
|
|
52109
52109
|
const pointsString = transformedPoints.map((p) => `${p[0]},${p[1]}`).join(" ");
|
|
52110
52110
|
return [
|
|
52111
52111
|
{
|
|
@@ -52133,7 +52133,7 @@ function createSvgObjectsFromPcbCutoutPath(cutoutPath, ctx) {
|
|
|
52133
52133
|
const lastPoint = cutoutPath.route[cutoutPath.route.length - 1];
|
|
52134
52134
|
const isClosed = firstPoint && lastPoint && firstPoint.x === lastPoint.x && firstPoint.y === lastPoint.y;
|
|
52135
52135
|
const path45 = cutoutPath.route.slice(0, isClosed ? -1 : undefined).map((point2, index) => {
|
|
52136
|
-
const [x3, y] =
|
|
52136
|
+
const [x3, y] = applyToPoint24(transform2, [point2.x, point2.y]);
|
|
52137
52137
|
return index === 0 ? `M ${x3} ${y}` : `L ${x3} ${y}`;
|
|
52138
52138
|
}).join(" ") + (isClosed ? " Z" : "");
|
|
52139
52139
|
return [
|
|
@@ -52235,7 +52235,7 @@ function createSvgObjectsFromPcbKeepout(keepout, ctx) {
|
|
|
52235
52235
|
}
|
|
52236
52236
|
if (keepout.shape === "rect") {
|
|
52237
52237
|
const rectKeepout = keepout;
|
|
52238
|
-
const [cx2, cy2] =
|
|
52238
|
+
const [cx2, cy2] = applyToPoint24(transform2, [
|
|
52239
52239
|
rectKeepout.center.x,
|
|
52240
52240
|
rectKeepout.center.y
|
|
52241
52241
|
]);
|
|
@@ -52274,7 +52274,7 @@ function createSvgObjectsFromPcbKeepout(keepout, ctx) {
|
|
|
52274
52274
|
});
|
|
52275
52275
|
} else if (keepout.shape === "circle") {
|
|
52276
52276
|
const circleKeepout = keepout;
|
|
52277
|
-
const [cx2, cy2] =
|
|
52277
|
+
const [cx2, cy2] = applyToPoint24(transform2, [
|
|
52278
52278
|
circleKeepout.center.x,
|
|
52279
52279
|
circleKeepout.center.y
|
|
52280
52280
|
]);
|
|
@@ -52313,7 +52313,7 @@ function ringToPathD(vertices, transform2) {
|
|
|
52313
52313
|
if (vertices.length === 0)
|
|
52314
52314
|
return "";
|
|
52315
52315
|
const transformedVertices = vertices.map((v3) => {
|
|
52316
|
-
const [x3, y] =
|
|
52316
|
+
const [x3, y] = applyToPoint24(transform2, [v3.x, v3.y]);
|
|
52317
52317
|
return { ...v3, x: x3, y };
|
|
52318
52318
|
});
|
|
52319
52319
|
let d = `M ${transformedVertices[0].x} ${transformedVertices[0].y}`;
|
|
@@ -52398,7 +52398,7 @@ function createSvgObjectsFromPcbCopperPour(pour, ctx) {
|
|
|
52398
52398
|
const maskOverlayColor = layer === "bottom" ? colorMap2.soldermaskOverCopper.bottom : colorMap2.soldermaskOverCopper.top;
|
|
52399
52399
|
const maskOverlayOpacity = "0.9";
|
|
52400
52400
|
if (pour.shape === "rect") {
|
|
52401
|
-
const [cx2, cy2] =
|
|
52401
|
+
const [cx2, cy2] = applyToPoint24(transform2, [pour.center.x, pour.center.y]);
|
|
52402
52402
|
const scaledWidth = pour.width * Math.abs(transform2.a);
|
|
52403
52403
|
const scaledHeight = pour.height * Math.abs(transform2.d);
|
|
52404
52404
|
const svgRotation = -(pour.rotation ?? 0);
|
|
@@ -52448,7 +52448,7 @@ function createSvgObjectsFromPcbCopperPour(pour, ctx) {
|
|
|
52448
52448
|
if (pour.shape === "polygon") {
|
|
52449
52449
|
if (!pour.points || pour.points.length === 0)
|
|
52450
52450
|
return [];
|
|
52451
|
-
const transformedPoints = pour.points.map((p) =>
|
|
52451
|
+
const transformedPoints = pour.points.map((p) => applyToPoint24(transform2, [p.x, p.y]));
|
|
52452
52452
|
const pointsString = transformedPoints.map((p) => `${p[0]},${p[1]}`).join(" ");
|
|
52453
52453
|
const copperPolygon = {
|
|
52454
52454
|
name: "polygon",
|
|
@@ -52657,7 +52657,7 @@ function createMajorGridPatternChildren(cellSize, majorCellSize, lineColor, majo
|
|
|
52657
52657
|
function createSvgObjectsFromPcbComponent(component, ctx) {
|
|
52658
52658
|
const { transform: transform2, circuitJson } = ctx;
|
|
52659
52659
|
const { center, width, height, rotation: rotation2 = 0 } = component;
|
|
52660
|
-
const [x3, y] =
|
|
52660
|
+
const [x3, y] = applyToPoint24(transform2, [center.x, center.y]);
|
|
52661
52661
|
const scaledWidth = width * Math.abs(transform2.a);
|
|
52662
52662
|
const scaledHeight = height * Math.abs(transform2.d);
|
|
52663
52663
|
const transformStr = `translate(${x3}, ${y}) rotate(${-rotation2}) scale(1, -1)`;
|
|
@@ -52760,7 +52760,7 @@ function createSvgObjectsFromPcbGroup(pcbGroup, ctx) {
|
|
|
52760
52760
|
}
|
|
52761
52761
|
if (outline && outline.length >= 3 && outline.every((point2) => point2 && typeof point2.x === "number" && typeof point2.y === "number")) {
|
|
52762
52762
|
const path45 = outline.map((point2, index) => {
|
|
52763
|
-
const [x3, y] =
|
|
52763
|
+
const [x3, y] = applyToPoint24(transform2, [point2.x, point2.y]);
|
|
52764
52764
|
return index === 0 ? `M ${x3} ${y}` : `L ${x3} ${y}`;
|
|
52765
52765
|
}).join(" ");
|
|
52766
52766
|
svgObjects.push({
|
|
@@ -52781,11 +52781,11 @@ function createSvgObjectsFromPcbGroup(pcbGroup, ctx) {
|
|
|
52781
52781
|
}
|
|
52782
52782
|
const halfWidth = width / 2;
|
|
52783
52783
|
const halfHeight = height / 2;
|
|
52784
|
-
const [topLeftX, topLeftY] =
|
|
52784
|
+
const [topLeftX, topLeftY] = applyToPoint24(transform2, [
|
|
52785
52785
|
center.x - halfWidth,
|
|
52786
52786
|
center.y + halfHeight
|
|
52787
52787
|
]);
|
|
52788
|
-
const [bottomRightX, bottomRightY] =
|
|
52788
|
+
const [bottomRightX, bottomRightY] = applyToPoint24(transform2, [
|
|
52789
52789
|
center.x + halfWidth,
|
|
52790
52790
|
center.y - halfHeight
|
|
52791
52791
|
]);
|
|
@@ -53687,8 +53687,8 @@ function createSvgObjects({
|
|
|
53687
53687
|
}
|
|
53688
53688
|
}
|
|
53689
53689
|
function createSvgObjectFromPcbBoundary(transform2, minX, minY, maxX, maxY) {
|
|
53690
|
-
const [x12, y12] =
|
|
53691
|
-
const [x22, y22] =
|
|
53690
|
+
const [x12, y12] = applyToPoint24(transform2, [minX, minY]);
|
|
53691
|
+
const [x22, y22] = applyToPoint24(transform2, [maxX, maxY]);
|
|
53692
53692
|
const width = Math.abs(x22 - x12);
|
|
53693
53693
|
const height = Math.abs(y22 - y12);
|
|
53694
53694
|
const x3 = Math.min(x12, x22);
|
|
@@ -53717,25 +53717,25 @@ function createSvgObjectsFromAssemblyBoard(pcbBoard, transform2, style = {}) {
|
|
|
53717
53717
|
let path45;
|
|
53718
53718
|
if (outline && Array.isArray(outline) && outline.length >= 3) {
|
|
53719
53719
|
path45 = outline.map((point2, index) => {
|
|
53720
|
-
const [x3, y] =
|
|
53720
|
+
const [x3, y] = applyToPoint24(transform2, [point2.x, point2.y]);
|
|
53721
53721
|
return index === 0 ? `M ${x3} ${y}` : `L ${x3} ${y}`;
|
|
53722
53722
|
}).join(" ");
|
|
53723
53723
|
} else {
|
|
53724
53724
|
const halfWidth = width / 2;
|
|
53725
53725
|
const halfHeight = height / 2;
|
|
53726
|
-
const topLeft =
|
|
53726
|
+
const topLeft = applyToPoint24(transform2, [
|
|
53727
53727
|
center.x - halfWidth,
|
|
53728
53728
|
center.y - halfHeight
|
|
53729
53729
|
]);
|
|
53730
|
-
const topRight =
|
|
53730
|
+
const topRight = applyToPoint24(transform2, [
|
|
53731
53731
|
center.x + halfWidth,
|
|
53732
53732
|
center.y - halfHeight
|
|
53733
53733
|
]);
|
|
53734
|
-
const bottomRight =
|
|
53734
|
+
const bottomRight = applyToPoint24(transform2, [
|
|
53735
53735
|
center.x + halfWidth,
|
|
53736
53736
|
center.y + halfHeight
|
|
53737
53737
|
]);
|
|
53738
|
-
const bottomLeft =
|
|
53738
|
+
const bottomLeft = applyToPoint24(transform2, [
|
|
53739
53739
|
center.x - halfWidth,
|
|
53740
53740
|
center.y + halfHeight
|
|
53741
53741
|
]);
|
|
@@ -53765,8 +53765,8 @@ function createSvgObjectsFromAssemblyComponent(params2, ctx) {
|
|
|
53765
53765
|
const { center, width, height, rotation: rotation2 = 0, layer = "top" } = elm;
|
|
53766
53766
|
if (!center || typeof width !== "number" || typeof height !== "number")
|
|
53767
53767
|
return null;
|
|
53768
|
-
const [x3, y] =
|
|
53769
|
-
const [pinX, pinY] =
|
|
53768
|
+
const [x3, y] = applyToPoint24(transform2, [center.x, center.y]);
|
|
53769
|
+
const [pinX, pinY] = applyToPoint24(transform2, [portPosition.x, portPosition.y]);
|
|
53770
53770
|
const scaledWidth = width * Math.abs(transform2.a);
|
|
53771
53771
|
const scaledHeight = height * Math.abs(transform2.d);
|
|
53772
53772
|
const isTopLayer = layer === "top";
|
|
@@ -53904,7 +53904,7 @@ function getRectPathData(w3, h, rotation2) {
|
|
|
53904
53904
|
}
|
|
53905
53905
|
function createSvgObjectsFromAssemblyHole(hole, ctx) {
|
|
53906
53906
|
const { transform: transform2 } = ctx;
|
|
53907
|
-
const [x3, y] =
|
|
53907
|
+
const [x3, y] = applyToPoint24(transform2, [hole.x, hole.y]);
|
|
53908
53908
|
if (hole.hole_shape === "circle" || hole.hole_shape === "square") {
|
|
53909
53909
|
const scaledDiameter = hole.hole_diameter * Math.abs(transform2.a);
|
|
53910
53910
|
const radius = scaledDiameter / 2;
|
|
@@ -53968,7 +53968,7 @@ function createSvgObjectsFromAssemblyHole(hole, ctx) {
|
|
|
53968
53968
|
}
|
|
53969
53969
|
function createSvgObjectsFromAssemblyPlatedHole(hole, ctx) {
|
|
53970
53970
|
const { transform: transform2 } = ctx;
|
|
53971
|
-
const [x3, y] =
|
|
53971
|
+
const [x3, y] = applyToPoint24(transform2, [hole.x, hole.y]);
|
|
53972
53972
|
if (hole.shape === "pill") {
|
|
53973
53973
|
const scaledOuterWidth = hole.outer_width * Math.abs(transform2.a);
|
|
53974
53974
|
const scaledOuterHeight = hole.outer_height * Math.abs(transform2.a);
|
|
@@ -54062,7 +54062,7 @@ function createSvgObjectsFromAssemblyPlatedHole(hole, ctx) {
|
|
|
54062
54062
|
const scaledRectBorderRadius = (circularHole.rect_border_radius ?? 0) * Math.abs(transform2.a);
|
|
54063
54063
|
const rectCcwRotation = circularHole.rect_ccw_rotation ?? 0;
|
|
54064
54064
|
const holeRadius = scaledHoleDiameter / 2;
|
|
54065
|
-
const [holeCx, holeCy] =
|
|
54065
|
+
const [holeCx, holeCy] = applyToPoint24(transform2, [
|
|
54066
54066
|
circularHole.x + circularHole.hole_offset_x,
|
|
54067
54067
|
circularHole.y + circularHole.hole_offset_y
|
|
54068
54068
|
]);
|
|
@@ -54124,7 +54124,7 @@ function createSvgObjectsFromAssemblyPlatedHole(hole, ctx) {
|
|
|
54124
54124
|
const pillHoleWithOffsets = pillHole;
|
|
54125
54125
|
const holeOffsetX = pillHoleWithOffsets.hole_offset_x ?? 0;
|
|
54126
54126
|
const holeOffsetY = pillHoleWithOffsets.hole_offset_y ?? 0;
|
|
54127
|
-
const [holeCenterX, holeCenterY] =
|
|
54127
|
+
const [holeCenterX, holeCenterY] = applyToPoint24(transform2, [
|
|
54128
54128
|
pillHole.x + holeOffsetX,
|
|
54129
54129
|
pillHole.y + holeOffsetY
|
|
54130
54130
|
]);
|
|
@@ -54184,7 +54184,7 @@ function createSvgObjectsFromAssemblyPlatedHole(hole, ctx) {
|
|
|
54184
54184
|
const rotatedHoleWithOffsets = rotatedHole;
|
|
54185
54185
|
const holeOffsetX = rotatedHoleWithOffsets.hole_offset_x ?? 0;
|
|
54186
54186
|
const holeOffsetY = rotatedHoleWithOffsets.hole_offset_y ?? 0;
|
|
54187
|
-
const [holeCenterX, holeCenterY] =
|
|
54187
|
+
const [holeCenterX, holeCenterY] = applyToPoint24(transform2, [
|
|
54188
54188
|
rotatedHole.x + holeOffsetX,
|
|
54189
54189
|
rotatedHole.y + holeOffsetY
|
|
54190
54190
|
]);
|
|
@@ -54243,7 +54243,7 @@ function createSvgObjectsFromAssemblySmtPad(pad, ctx) {
|
|
|
54243
54243
|
if (pad.shape === "rect" || pad.shape === "rotated_rect") {
|
|
54244
54244
|
const width = pad.width * Math.abs(transform2.a);
|
|
54245
54245
|
const height = pad.height * Math.abs(transform2.d);
|
|
54246
|
-
const [x3, y] =
|
|
54246
|
+
const [x3, y] = applyToPoint24(transform2, [pad.x, pad.y]);
|
|
54247
54247
|
const scaledBorderRadius = (pad.rect_border_radius ?? 0) * Math.abs(transform2.a);
|
|
54248
54248
|
if (pad.shape === "rotated_rect" && pad.ccw_rotation) {
|
|
54249
54249
|
return [
|
|
@@ -54295,7 +54295,7 @@ function createSvgObjectsFromAssemblySmtPad(pad, ctx) {
|
|
|
54295
54295
|
const width = pad.width * Math.abs(transform2.a);
|
|
54296
54296
|
const height = pad.height * Math.abs(transform2.d);
|
|
54297
54297
|
const radius = pad.radius * Math.abs(transform2.a);
|
|
54298
|
-
const [x3, y] =
|
|
54298
|
+
const [x3, y] = applyToPoint24(transform2, [pad.x, pad.y]);
|
|
54299
54299
|
return [
|
|
54300
54300
|
{
|
|
54301
54301
|
name: "rect",
|
|
@@ -54318,7 +54318,7 @@ function createSvgObjectsFromAssemblySmtPad(pad, ctx) {
|
|
|
54318
54318
|
}
|
|
54319
54319
|
if (pad.shape === "circle") {
|
|
54320
54320
|
const radius = pad.radius * Math.abs(transform2.a);
|
|
54321
|
-
const [x3, y] =
|
|
54321
|
+
const [x3, y] = applyToPoint24(transform2, [pad.x, pad.y]);
|
|
54322
54322
|
return [
|
|
54323
54323
|
{
|
|
54324
54324
|
name: "circle",
|
|
@@ -54337,7 +54337,7 @@ function createSvgObjectsFromAssemblySmtPad(pad, ctx) {
|
|
|
54337
54337
|
];
|
|
54338
54338
|
}
|
|
54339
54339
|
if (pad.shape === "polygon") {
|
|
54340
|
-
const points = (pad.points ?? []).map((point2) =>
|
|
54340
|
+
const points = (pad.points ?? []).map((point2) => applyToPoint24(transform2, [point2.x, point2.y]));
|
|
54341
54341
|
return [
|
|
54342
54342
|
{
|
|
54343
54343
|
name: "polygon",
|
|
@@ -54497,8 +54497,8 @@ function createSvgObjects2(elm, ctx, soup) {
|
|
|
54497
54497
|
}
|
|
54498
54498
|
}
|
|
54499
54499
|
function createSvgObjectFromAssemblyBoundary(transform2, minX, minY, maxX, maxY) {
|
|
54500
|
-
const [x12, y12] =
|
|
54501
|
-
const [x22, y22] =
|
|
54500
|
+
const [x12, y12] = applyToPoint24(transform2, [minX, minY]);
|
|
54501
|
+
const [x22, y22] = applyToPoint24(transform2, [maxX, maxY]);
|
|
54502
54502
|
const width = Math.abs(x22 - x12);
|
|
54503
54503
|
const height = Math.abs(y22 - y12);
|
|
54504
54504
|
const x3 = Math.min(x12, x22);
|
|
@@ -54525,25 +54525,25 @@ function createSvgObjectsFromPinoutBoard(pcbBoard, ctx) {
|
|
|
54525
54525
|
let path45;
|
|
54526
54526
|
if (outline && Array.isArray(outline) && outline.length >= 3) {
|
|
54527
54527
|
path45 = outline.map((point2, index) => {
|
|
54528
|
-
const [x3, y] =
|
|
54528
|
+
const [x3, y] = applyToPoint24(transform2, [point2.x, point2.y]);
|
|
54529
54529
|
return index === 0 ? `M ${x3} ${y}` : `L ${x3} ${y}`;
|
|
54530
54530
|
}).join(" ");
|
|
54531
54531
|
} else {
|
|
54532
54532
|
const halfWidth = width / 2;
|
|
54533
54533
|
const halfHeight = height / 2;
|
|
54534
|
-
const topLeft =
|
|
54534
|
+
const topLeft = applyToPoint24(transform2, [
|
|
54535
54535
|
center.x - halfWidth,
|
|
54536
54536
|
center.y - halfHeight
|
|
54537
54537
|
]);
|
|
54538
|
-
const topRight =
|
|
54538
|
+
const topRight = applyToPoint24(transform2, [
|
|
54539
54539
|
center.x + halfWidth,
|
|
54540
54540
|
center.y - halfHeight
|
|
54541
54541
|
]);
|
|
54542
|
-
const bottomRight =
|
|
54542
|
+
const bottomRight = applyToPoint24(transform2, [
|
|
54543
54543
|
center.x + halfWidth,
|
|
54544
54544
|
center.y + halfHeight
|
|
54545
54545
|
]);
|
|
54546
|
-
const bottomLeft =
|
|
54546
|
+
const bottomLeft = applyToPoint24(transform2, [
|
|
54547
54547
|
center.x - halfWidth,
|
|
54548
54548
|
center.y + halfHeight
|
|
54549
54549
|
]);
|
|
@@ -54561,10 +54561,10 @@ function createSvgObjectsFromPinoutBoard(pcbBoard, ctx) {
|
|
|
54561
54561
|
const halfWidth = width2 / 2;
|
|
54562
54562
|
const halfHeight = height2 / 2;
|
|
54563
54563
|
const [tl2, tr2, br2, bl2] = [
|
|
54564
|
-
|
|
54565
|
-
|
|
54566
|
-
|
|
54567
|
-
|
|
54564
|
+
applyToPoint24(transform2, [x3 - halfWidth, y - halfHeight]),
|
|
54565
|
+
applyToPoint24(transform2, [x3 + halfWidth, y - halfHeight]),
|
|
54566
|
+
applyToPoint24(transform2, [x3 + halfWidth, y + halfHeight]),
|
|
54567
|
+
applyToPoint24(transform2, [x3 - halfWidth, y + halfHeight])
|
|
54568
54568
|
];
|
|
54569
54569
|
path45 += ` M ${tl2[0]} ${tl2[1]} L ${tr2[0]} ${tr2[1]} L ${br2[0]} ${br2[1]} L ${bl2[0]} ${bl2[1]} Z`;
|
|
54570
54570
|
} else if (cutout.shape === "circle") {}
|
|
@@ -54617,7 +54617,7 @@ function createSvgObjectsFromPinoutComponent(elm, ctx) {
|
|
|
54617
54617
|
if (!center || typeof width !== "number" || typeof height !== "number" || width === 0 || height === 0) {
|
|
54618
54618
|
return [];
|
|
54619
54619
|
}
|
|
54620
|
-
const [x3, y] =
|
|
54620
|
+
const [x3, y] = applyToPoint24(transform2, [center.x, center.y]);
|
|
54621
54621
|
const scaledWidth = width * Math.abs(transform2.a);
|
|
54622
54622
|
const scaledHeight = height * Math.abs(transform2.d);
|
|
54623
54623
|
const transformStr = `translate(${x3}, ${y})`;
|
|
@@ -54678,7 +54678,7 @@ function createSvgObjectsFromPinoutComponent(elm, ctx) {
|
|
|
54678
54678
|
}
|
|
54679
54679
|
function createSvgObjectsFromPinoutHole(hole, ctx) {
|
|
54680
54680
|
const { transform: transform2 } = ctx;
|
|
54681
|
-
const [x3, y] =
|
|
54681
|
+
const [x3, y] = applyToPoint24(transform2, [hole.x, hole.y]);
|
|
54682
54682
|
if (hole.hole_shape === "circle" || hole.hole_shape === "square") {
|
|
54683
54683
|
const scaledDiameter = hole.hole_diameter * Math.abs(transform2.a);
|
|
54684
54684
|
const radius = scaledDiameter / 2;
|
|
@@ -54742,7 +54742,7 @@ function createSvgObjectsFromPinoutHole(hole, ctx) {
|
|
|
54742
54742
|
}
|
|
54743
54743
|
function createSvgObjectsFromPinoutPlatedHole(hole, ctx) {
|
|
54744
54744
|
const { transform: transform2 } = ctx;
|
|
54745
|
-
const [x3, y] =
|
|
54745
|
+
const [x3, y] = applyToPoint24(transform2, [hole.x, hole.y]);
|
|
54746
54746
|
if (hole.shape === "pill") {
|
|
54747
54747
|
const scaledOuterWidth = hole.outer_width * Math.abs(transform2.a);
|
|
54748
54748
|
const scaledOuterHeight = hole.outer_height * Math.abs(transform2.a);
|
|
@@ -54974,7 +54974,7 @@ function createSvgObjectsFromPinoutSmtPad(pad, ctx) {
|
|
|
54974
54974
|
if (pad.shape === "rect" || pad.shape === "rotated_rect") {
|
|
54975
54975
|
const width = pad.width * Math.abs(transform2.a);
|
|
54976
54976
|
const height = pad.height * Math.abs(transform2.d);
|
|
54977
|
-
const [x3, y] =
|
|
54977
|
+
const [x3, y] = applyToPoint24(transform2, [pad.x, pad.y]);
|
|
54978
54978
|
if (pad.shape === "rotated_rect" && pad.ccw_rotation) {
|
|
54979
54979
|
return [
|
|
54980
54980
|
{
|
|
@@ -55017,7 +55017,7 @@ function createSvgObjectsFromPinoutSmtPad(pad, ctx) {
|
|
|
55017
55017
|
const width = pad.width * Math.abs(transform2.a);
|
|
55018
55018
|
const height = pad.height * Math.abs(transform2.d);
|
|
55019
55019
|
const radius = pad.radius * Math.abs(transform2.a);
|
|
55020
|
-
const [x3, y] =
|
|
55020
|
+
const [x3, y] = applyToPoint24(transform2, [pad.x, pad.y]);
|
|
55021
55021
|
return [
|
|
55022
55022
|
{
|
|
55023
55023
|
name: "rect",
|
|
@@ -55040,7 +55040,7 @@ function createSvgObjectsFromPinoutSmtPad(pad, ctx) {
|
|
|
55040
55040
|
}
|
|
55041
55041
|
if (pad.shape === "circle") {
|
|
55042
55042
|
const radius = pad.radius * Math.abs(transform2.a);
|
|
55043
|
-
const [x3, y] =
|
|
55043
|
+
const [x3, y] = applyToPoint24(transform2, [pad.x, pad.y]);
|
|
55044
55044
|
return [
|
|
55045
55045
|
{
|
|
55046
55046
|
name: "circle",
|
|
@@ -55059,7 +55059,7 @@ function createSvgObjectsFromPinoutSmtPad(pad, ctx) {
|
|
|
55059
55059
|
];
|
|
55060
55060
|
}
|
|
55061
55061
|
if (pad.shape === "polygon") {
|
|
55062
|
-
const points = (pad.points ?? []).map((point2) =>
|
|
55062
|
+
const points = (pad.points ?? []).map((point2) => applyToPoint24(transform2, [point2.x, point2.y]));
|
|
55063
55063
|
return [
|
|
55064
55064
|
{
|
|
55065
55065
|
name: "polygon",
|
|
@@ -55144,7 +55144,7 @@ function createSvgObjectsFromPinoutPort(pcb_port2, ctx) {
|
|
|
55144
55144
|
if (!label_info)
|
|
55145
55145
|
return [];
|
|
55146
55146
|
const { text: label, aliases, elbow_end, label_pos, edge } = label_info;
|
|
55147
|
-
const [port_x, port_y] =
|
|
55147
|
+
const [port_x, port_y] = applyToPoint24(ctx.transform, [pcb_port2.x, pcb_port2.y]);
|
|
55148
55148
|
const start_facing_direction = edge === "left" ? "x-" : edge === "right" ? "x+" : edge === "top" ? "y-" : "y+";
|
|
55149
55149
|
const end_facing_direction = edge === "left" ? "x+" : edge === "right" ? "x-" : edge === "top" ? "y+" : "y-";
|
|
55150
55150
|
const elbow_path = calculateElbow({
|
|
@@ -55294,7 +55294,7 @@ function calculateVerticalEdgeLabels(edge, pinout_labels, {
|
|
|
55294
55294
|
const other_pins = pinout_labels.filter((l) => Math.abs(l.pcb_port.x - primary_x) >= 0.2);
|
|
55295
55295
|
const mapToEdgePort = (pinout_label) => ({
|
|
55296
55296
|
pcb_port: pinout_label.pcb_port,
|
|
55297
|
-
y:
|
|
55297
|
+
y: applyToPoint24(transform2, [
|
|
55298
55298
|
pinout_label.pcb_port.x,
|
|
55299
55299
|
pinout_label.pcb_port.y
|
|
55300
55300
|
])[1],
|
|
@@ -55309,7 +55309,7 @@ function calculateVerticalEdgeLabels(edge, pinout_labels, {
|
|
|
55309
55309
|
} else {
|
|
55310
55310
|
edge_ports = pinout_labels.map((pinout_label) => ({
|
|
55311
55311
|
pcb_port: pinout_label.pcb_port,
|
|
55312
|
-
y:
|
|
55312
|
+
y: applyToPoint24(transform2, [
|
|
55313
55313
|
pinout_label.pcb_port.x,
|
|
55314
55314
|
pinout_label.pcb_port.y
|
|
55315
55315
|
])[1],
|
|
@@ -55318,7 +55318,7 @@ function calculateVerticalEdgeLabels(edge, pinout_labels, {
|
|
|
55318
55318
|
}
|
|
55319
55319
|
if (edge_ports.length === 0)
|
|
55320
55320
|
return;
|
|
55321
|
-
const board_edge_x =
|
|
55321
|
+
const board_edge_x = applyToPoint24(transform2, [
|
|
55322
55322
|
edge === "left" ? board_bounds.minX : board_bounds.maxX,
|
|
55323
55323
|
0
|
|
55324
55324
|
])[0];
|
|
@@ -55665,7 +55665,7 @@ function drawSchematicGrid(params2) {
|
|
|
55665
55665
|
const labelCells = params2.labelCells ?? false;
|
|
55666
55666
|
const gridLines = [];
|
|
55667
55667
|
const transformPoint = (x3, y) => {
|
|
55668
|
-
const [transformedX, transformedY] =
|
|
55668
|
+
const [transformedX, transformedY] = applyToPoint24(params2.transform, [x3, y]);
|
|
55669
55669
|
return { x: transformedX, y: transformedY };
|
|
55670
55670
|
};
|
|
55671
55671
|
for (let x3 = Math.floor(minX);x3 <= Math.ceil(maxX); x3 += cellSize) {
|
|
@@ -55749,10 +55749,10 @@ function drawSchematicLabeledPoints(params2) {
|
|
|
55749
55749
|
const { points, transform: transform2 } = params2;
|
|
55750
55750
|
const labeledPointsGroup = [];
|
|
55751
55751
|
for (const point2 of points) {
|
|
55752
|
-
const [x12, y12] =
|
|
55753
|
-
const [x22, y22] =
|
|
55754
|
-
const [x3, y32] =
|
|
55755
|
-
const [x4, y4] =
|
|
55752
|
+
const [x12, y12] = applyToPoint24(transform2, [point2.x - 0.1, point2.y - 0.1]);
|
|
55753
|
+
const [x22, y22] = applyToPoint24(transform2, [point2.x + 0.1, point2.y + 0.1]);
|
|
55754
|
+
const [x3, y32] = applyToPoint24(transform2, [point2.x - 0.1, point2.y + 0.1]);
|
|
55755
|
+
const [x4, y4] = applyToPoint24(transform2, [point2.x + 0.1, point2.y - 0.1]);
|
|
55756
55756
|
labeledPointsGroup.push({
|
|
55757
55757
|
name: "path",
|
|
55758
55758
|
type: "element",
|
|
@@ -55763,7 +55763,7 @@ function drawSchematicLabeledPoints(params2) {
|
|
|
55763
55763
|
"stroke-opacity": "0.7"
|
|
55764
55764
|
}
|
|
55765
55765
|
});
|
|
55766
|
-
const [labelX, labelY] =
|
|
55766
|
+
const [labelX, labelY] = applyToPoint24(transform2, [
|
|
55767
55767
|
point2.x + 0.15,
|
|
55768
55768
|
point2.y - 0.15
|
|
55769
55769
|
]);
|
|
@@ -55980,7 +55980,7 @@ function createSvgObjectsFromSchVoltageProbe({
|
|
|
55980
55980
|
transform: transform2,
|
|
55981
55981
|
colorMap: colorMap2
|
|
55982
55982
|
}) {
|
|
55983
|
-
const [screenX, screenY] =
|
|
55983
|
+
const [screenX, screenY] = applyToPoint24(transform2, [
|
|
55984
55984
|
probe.position.x,
|
|
55985
55985
|
probe.position.y
|
|
55986
55986
|
]);
|
|
@@ -56157,11 +56157,11 @@ function createSvgObjectsFromSchDebugObject({
|
|
|
56157
56157
|
transform: transform2
|
|
56158
56158
|
}) {
|
|
56159
56159
|
if (debugObject.shape === "rect") {
|
|
56160
|
-
let [screenLeft, screenTop] =
|
|
56160
|
+
let [screenLeft, screenTop] = applyToPoint24(transform2, [
|
|
56161
56161
|
debugObject.center.x - debugObject.size.width / 2,
|
|
56162
56162
|
debugObject.center.y - debugObject.size.height / 2
|
|
56163
56163
|
]);
|
|
56164
|
-
let [screenRight, screenBottom] =
|
|
56164
|
+
let [screenRight, screenBottom] = applyToPoint24(transform2, [
|
|
56165
56165
|
debugObject.center.x + debugObject.size.width / 2,
|
|
56166
56166
|
debugObject.center.y + debugObject.size.height / 2
|
|
56167
56167
|
]);
|
|
@@ -56171,7 +56171,7 @@ function createSvgObjectsFromSchDebugObject({
|
|
|
56171
56171
|
];
|
|
56172
56172
|
const width = Math.abs(screenRight - screenLeft);
|
|
56173
56173
|
const height = Math.abs(screenBottom - screenTop);
|
|
56174
|
-
const [screenCenterX, screenCenterY] =
|
|
56174
|
+
const [screenCenterX, screenCenterY] = applyToPoint24(transform2, [
|
|
56175
56175
|
debugObject.center.x,
|
|
56176
56176
|
debugObject.center.y
|
|
56177
56177
|
]);
|
|
@@ -56217,11 +56217,11 @@ function createSvgObjectsFromSchDebugObject({
|
|
|
56217
56217
|
];
|
|
56218
56218
|
}
|
|
56219
56219
|
if (debugObject.shape === "line") {
|
|
56220
|
-
const [screenStartX, screenStartY] =
|
|
56220
|
+
const [screenStartX, screenStartY] = applyToPoint24(transform2, [
|
|
56221
56221
|
debugObject.start.x,
|
|
56222
56222
|
debugObject.start.y
|
|
56223
56223
|
]);
|
|
56224
|
-
const [screenEndX, screenEndY] =
|
|
56224
|
+
const [screenEndX, screenEndY] = applyToPoint24(transform2, [
|
|
56225
56225
|
debugObject.end.x,
|
|
56226
56226
|
debugObject.end.y
|
|
56227
56227
|
]);
|
|
@@ -56284,11 +56284,11 @@ function createSchematicTrace({
|
|
|
56284
56284
|
const edge = edges[edgeIndex];
|
|
56285
56285
|
if (edge.is_crossing)
|
|
56286
56286
|
continue;
|
|
56287
|
-
const [screenFromX, screenFromY] =
|
|
56287
|
+
const [screenFromX, screenFromY] = applyToPoint24(transform2, [
|
|
56288
56288
|
edge.from.x,
|
|
56289
56289
|
edge.from.y
|
|
56290
56290
|
]);
|
|
56291
|
-
const [screenToX, screenToY] =
|
|
56291
|
+
const [screenToX, screenToY] = applyToPoint24(transform2, [
|
|
56292
56292
|
edge.to.x,
|
|
56293
56293
|
edge.to.y
|
|
56294
56294
|
]);
|
|
@@ -56333,11 +56333,11 @@ function createSchematicTrace({
|
|
|
56333
56333
|
for (const edge of edges) {
|
|
56334
56334
|
if (!edge.is_crossing)
|
|
56335
56335
|
continue;
|
|
56336
|
-
const [screenFromX, screenFromY] =
|
|
56336
|
+
const [screenFromX, screenFromY] = applyToPoint24(transform2, [
|
|
56337
56337
|
edge.from.x,
|
|
56338
56338
|
edge.from.y
|
|
56339
56339
|
]);
|
|
56340
|
-
const [screenToX, screenToY] =
|
|
56340
|
+
const [screenToX, screenToY] = applyToPoint24(transform2, [
|
|
56341
56341
|
edge.to.x,
|
|
56342
56342
|
edge.to.y
|
|
56343
56343
|
]);
|
|
@@ -56381,7 +56381,7 @@ function createSchematicTrace({
|
|
|
56381
56381
|
}
|
|
56382
56382
|
if (trace.junctions) {
|
|
56383
56383
|
for (const junction of trace.junctions) {
|
|
56384
|
-
const [screenX, screenY] =
|
|
56384
|
+
const [screenX, screenY] = applyToPoint24(transform2, [
|
|
56385
56385
|
junction.x,
|
|
56386
56386
|
junction.y
|
|
56387
56387
|
]);
|
|
@@ -56438,8 +56438,8 @@ function createSvgObjectsFromSchematicLine({
|
|
|
56438
56438
|
transform: transform2,
|
|
56439
56439
|
colorMap: colorMap2
|
|
56440
56440
|
}) {
|
|
56441
|
-
const p12 =
|
|
56442
|
-
const p22 =
|
|
56441
|
+
const p12 = applyToPoint24(transform2, { x: schLine.x1, y: schLine.y1 });
|
|
56442
|
+
const p22 = applyToPoint24(transform2, { x: schLine.x2, y: schLine.y2 });
|
|
56443
56443
|
const strokeWidth = schLine.stroke_width ?? 0.02;
|
|
56444
56444
|
const transformedStrokeWidth = Math.abs(transform2.a) * strokeWidth;
|
|
56445
56445
|
return [
|
|
@@ -56471,7 +56471,7 @@ function createSvgObjectsFromSchematicCircle({
|
|
|
56471
56471
|
transform: transform2,
|
|
56472
56472
|
colorMap: colorMap2
|
|
56473
56473
|
}) {
|
|
56474
|
-
const center =
|
|
56474
|
+
const center = applyToPoint24(transform2, schCircle.center);
|
|
56475
56475
|
const transformedRadius = Math.abs(transform2.a) * schCircle.radius;
|
|
56476
56476
|
const strokeWidth = schCircle.stroke_width ?? 0.02;
|
|
56477
56477
|
const transformedStrokeWidth = Math.abs(transform2.a) * strokeWidth;
|
|
@@ -56504,7 +56504,7 @@ function createSvgObjectsFromSchematicRect({
|
|
|
56504
56504
|
transform: transform2,
|
|
56505
56505
|
colorMap: colorMap2
|
|
56506
56506
|
}) {
|
|
56507
|
-
const center =
|
|
56507
|
+
const center = applyToPoint24(transform2, schRect.center);
|
|
56508
56508
|
const transformedWidth = Math.abs(transform2.a) * schRect.width;
|
|
56509
56509
|
const transformedHeight = Math.abs(transform2.d) * schRect.height;
|
|
56510
56510
|
const strokeWidth = schRect.stroke_width ?? 0.02;
|
|
@@ -56543,7 +56543,7 @@ function createSvgObjectsFromSchematicArc({
|
|
|
56543
56543
|
transform: transform2,
|
|
56544
56544
|
colorMap: colorMap2
|
|
56545
56545
|
}) {
|
|
56546
|
-
const center =
|
|
56546
|
+
const center = applyToPoint24(transform2, schArc.center);
|
|
56547
56547
|
const transformedRadius = Math.abs(transform2.a) * schArc.radius;
|
|
56548
56548
|
const strokeWidth = schArc.stroke_width ?? 0.02;
|
|
56549
56549
|
const transformedStrokeWidth = Math.abs(transform2.a) * strokeWidth;
|
|
@@ -56596,7 +56596,7 @@ function createSvgObjectsFromSchematicPath({
|
|
|
56596
56596
|
if (!schPath.points || schPath.points.length < 2) {
|
|
56597
56597
|
return [];
|
|
56598
56598
|
}
|
|
56599
|
-
const transformedPoints = schPath.points.map((p) =>
|
|
56599
|
+
const transformedPoints = schPath.points.map((p) => applyToPoint24(transform2, { x: p.x, y: p.y }));
|
|
56600
56600
|
const pathD = transformedPoints.map((p, i) => `${i === 0 ? "M" : "L"} ${p.x} ${p.y}`).join(" ");
|
|
56601
56601
|
return [
|
|
56602
56602
|
{
|
|
@@ -57543,7 +57543,7 @@ function createSvgObjectsFromSolderPaste(solderPaste, ctx) {
|
|
|
57543
57543
|
const { transform: transform2, layer: layerFilter } = ctx;
|
|
57544
57544
|
if (layerFilter && solderPaste.layer !== layerFilter)
|
|
57545
57545
|
return [];
|
|
57546
|
-
const [x3, y] =
|
|
57546
|
+
const [x3, y] = applyToPoint24(transform2, [solderPaste.x, solderPaste.y]);
|
|
57547
57547
|
if (solderPaste.shape === "rect" || solderPaste.shape === "rotated_rect") {
|
|
57548
57548
|
const width = solderPaste.width * Math.abs(transform2.a);
|
|
57549
57549
|
const height = solderPaste.height * Math.abs(transform2.d);
|
|
@@ -57752,8 +57752,8 @@ function createSvgObjects4({ elm, ctx }) {
|
|
|
57752
57752
|
}
|
|
57753
57753
|
}
|
|
57754
57754
|
function createSvgObjectFromPcbBoundary2(transform2, minX, minY, maxX, maxY) {
|
|
57755
|
-
const [x12, y12] =
|
|
57756
|
-
const [x22, y22] =
|
|
57755
|
+
const [x12, y12] = applyToPoint24(transform2, [minX, minY]);
|
|
57756
|
+
const [x22, y22] = applyToPoint24(transform2, [maxX, maxY]);
|
|
57757
57757
|
const width = Math.abs(x22 - x12);
|
|
57758
57758
|
const height = Math.abs(y22 - y12);
|
|
57759
57759
|
const x3 = Math.min(x12, x22);
|
|
@@ -58070,7 +58070,7 @@ var import_debug2, svgAlphabet, lineAlphabet, debug2, debugPcb, debugSch, DEFAUL
|
|
|
58070
58070
|
realCenter,
|
|
58071
58071
|
realToScreenTransform
|
|
58072
58072
|
}) => {
|
|
58073
|
-
const screenCenter =
|
|
58073
|
+
const screenCenter = applyToPoint24(realToScreenTransform, realCenter);
|
|
58074
58074
|
return {
|
|
58075
58075
|
type: "element",
|
|
58076
58076
|
name: "text",
|
|
@@ -58156,8 +58156,8 @@ var import_debug2, svgAlphabet, lineAlphabet, debug2, debugPcb, debugSch, DEFAUL
|
|
|
58156
58156
|
minY: Math.min(...paths.flatMap((p) => p.points.map((pt2) => pt2.y))),
|
|
58157
58157
|
maxY: Math.max(...paths.flatMap((p) => p.points.map((pt2) => pt2.y)))
|
|
58158
58158
|
};
|
|
58159
|
-
const [screenMinX, screenMinY] =
|
|
58160
|
-
const [screenMaxX, screenMaxY] =
|
|
58159
|
+
const [screenMinX, screenMinY] = applyToPoint24(compose7(realToScreenTransform, transformFromSymbolToReal), [bounds.minX, bounds.minY]);
|
|
58160
|
+
const [screenMaxX, screenMaxY] = applyToPoint24(compose7(realToScreenTransform, transformFromSymbolToReal), [bounds.maxX, bounds.maxY]);
|
|
58161
58161
|
const rectHeight = Math.abs(screenMaxY - screenMinY);
|
|
58162
58162
|
const rectY = Math.min(screenMinY, screenMaxY);
|
|
58163
58163
|
const rectWidth = Math.abs(screenMaxX - screenMinX);
|
|
@@ -58183,7 +58183,7 @@ var import_debug2, svgAlphabet, lineAlphabet, debug2, debugPcb, debugSch, DEFAUL
|
|
|
58183
58183
|
name: "path",
|
|
58184
58184
|
attributes: {
|
|
58185
58185
|
d: points.map((p, i) => {
|
|
58186
|
-
const [x3, y] =
|
|
58186
|
+
const [x3, y] = applyToPoint24(compose7(realToScreenTransform, transformFromSymbolToReal), [p.x, p.y]);
|
|
58187
58187
|
return `${i === 0 ? "M" : "L"} ${x3} ${y}`;
|
|
58188
58188
|
}).join(" ") + (closed ? " Z" : ""),
|
|
58189
58189
|
stroke: colorMap2.schematic.component_outline,
|
|
@@ -58196,7 +58196,7 @@ var import_debug2, svgAlphabet, lineAlphabet, debug2, debugPcb, debugSch, DEFAUL
|
|
|
58196
58196
|
});
|
|
58197
58197
|
}
|
|
58198
58198
|
for (const text of texts) {
|
|
58199
|
-
const screenTextPos =
|
|
58199
|
+
const screenTextPos = applyToPoint24(compose7(realToScreenTransform, transformFromSymbolToReal), text);
|
|
58200
58200
|
let textValue = "";
|
|
58201
58201
|
const isReferenceText = text.text === "{REF}";
|
|
58202
58202
|
if (isReferenceText) {
|
|
@@ -58235,7 +58235,7 @@ var import_debug2, svgAlphabet, lineAlphabet, debug2, debugPcb, debugSch, DEFAUL
|
|
|
58235
58235
|
});
|
|
58236
58236
|
}
|
|
58237
58237
|
for (const box of boxes) {
|
|
58238
|
-
const screenBoxPos =
|
|
58238
|
+
const screenBoxPos = applyToPoint24(compose7(realToScreenTransform, transformFromSymbolToReal), box);
|
|
58239
58239
|
const symbolToScreenScale = compose7(realToScreenTransform, transformFromSymbolToReal).a;
|
|
58240
58240
|
svgObjects.push({
|
|
58241
58241
|
name: "rect",
|
|
@@ -58254,7 +58254,7 @@ var import_debug2, svgAlphabet, lineAlphabet, debug2, debugPcb, debugSch, DEFAUL
|
|
|
58254
58254
|
for (const port of symbol.ports) {
|
|
58255
58255
|
if (connectedSymbolPorts.has(port))
|
|
58256
58256
|
continue;
|
|
58257
|
-
const screenPortPos =
|
|
58257
|
+
const screenPortPos = applyToPoint24(compose7(realToScreenTransform, transformFromSymbolToReal), port);
|
|
58258
58258
|
svgObjects.push({
|
|
58259
58259
|
type: "element",
|
|
58260
58260
|
name: "circle",
|
|
@@ -58271,7 +58271,7 @@ var import_debug2, svgAlphabet, lineAlphabet, debug2, debugPcb, debugSch, DEFAUL
|
|
|
58271
58271
|
});
|
|
58272
58272
|
}
|
|
58273
58273
|
for (const circle of circles) {
|
|
58274
|
-
const screenCirclePos =
|
|
58274
|
+
const screenCirclePos = applyToPoint24(compose7(realToScreenTransform, transformFromSymbolToReal), circle);
|
|
58275
58275
|
const screenRadius = Math.abs(circle.radius * realToScreenTransform.a);
|
|
58276
58276
|
svgObjects.push({
|
|
58277
58277
|
type: "element",
|
|
@@ -58338,8 +58338,8 @@ var import_debug2, svgAlphabet, lineAlphabet, debug2, debugPcb, debugSch, DEFAUL
|
|
|
58338
58338
|
realEdgePos.y += realPinLineLength;
|
|
58339
58339
|
break;
|
|
58340
58340
|
}
|
|
58341
|
-
const screenSchPortPos =
|
|
58342
|
-
const screenRealEdgePos =
|
|
58341
|
+
const screenSchPortPos = applyToPoint24(transform2, schPort.center);
|
|
58342
|
+
const screenRealEdgePos = applyToPoint24(transform2, realEdgePos);
|
|
58343
58343
|
const isConnected = isSourcePortConnected(circuitJson, schPort.source_port_id);
|
|
58344
58344
|
const is_drawn_with_inversion_circle = schPort.is_drawn_with_inversion_circle ?? false;
|
|
58345
58345
|
const BUBBLE_RADIUS_MM = 0.06;
|
|
@@ -58360,7 +58360,7 @@ var import_debug2, svgAlphabet, lineAlphabet, debug2, debugPcb, debugSch, DEFAUL
|
|
|
58360
58360
|
break;
|
|
58361
58361
|
}
|
|
58362
58362
|
}
|
|
58363
|
-
const screenLineEnd =
|
|
58363
|
+
const screenLineEnd = applyToPoint24(transform2, realLineEnd);
|
|
58364
58364
|
if (is_drawn_with_inversion_circle) {
|
|
58365
58365
|
const bubbleRadiusPx = Math.abs(transform2.a) * BUBBLE_RADIUS_MM;
|
|
58366
58366
|
const bubbleCenter = { ...screenRealEdgePos };
|
|
@@ -58517,7 +58517,7 @@ var import_debug2, svgAlphabet, lineAlphabet, debug2, debugPcb, debugSch, DEFAUL
|
|
|
58517
58517
|
} else {
|
|
58518
58518
|
realPinNumberPos.y += 0.02;
|
|
58519
58519
|
}
|
|
58520
|
-
const screenPinNumberTextPos =
|
|
58520
|
+
const screenPinNumberTextPos = applyToPoint24(transform2, realPinNumberPos);
|
|
58521
58521
|
svgObjects.push({
|
|
58522
58522
|
name: "text",
|
|
58523
58523
|
type: "element",
|
|
@@ -58557,7 +58557,7 @@ var import_debug2, svgAlphabet, lineAlphabet, debug2, debugPcb, debugSch, DEFAUL
|
|
|
58557
58557
|
const realPinEdgeDistance = schPort.distance_from_component_edge ?? 0.4;
|
|
58558
58558
|
realPinNumberPos.x += vecToEdge.x * (realPinEdgeDistance + LABEL_DIST_FROM_EDGE_MM);
|
|
58559
58559
|
realPinNumberPos.y += vecToEdge.y * (realPinEdgeDistance + LABEL_DIST_FROM_EDGE_MM);
|
|
58560
|
-
const screenPinNumberTextPos =
|
|
58560
|
+
const screenPinNumberTextPos = applyToPoint24(transform2, realPinNumberPos);
|
|
58561
58561
|
const label = schPort.display_pin_label ?? schComponent.port_labels?.[`${schPort.pin_number}`];
|
|
58562
58562
|
if (!label)
|
|
58563
58563
|
return [];
|
|
@@ -58603,7 +58603,7 @@ var import_debug2, svgAlphabet, lineAlphabet, debug2, debugPcb, debugSch, DEFAUL
|
|
|
58603
58603
|
transform: transform2,
|
|
58604
58604
|
colorMap: colorMap2
|
|
58605
58605
|
}) => {
|
|
58606
|
-
const center =
|
|
58606
|
+
const center = applyToPoint24(transform2, elm.position);
|
|
58607
58607
|
const textAnchorMap = {
|
|
58608
58608
|
center: "middle",
|
|
58609
58609
|
center_right: "end",
|
|
@@ -58685,11 +58685,11 @@ var import_debug2, svgAlphabet, lineAlphabet, debug2, debugPcb, debugSch, DEFAUL
|
|
|
58685
58685
|
colorMap: colorMap2
|
|
58686
58686
|
}) => {
|
|
58687
58687
|
const svgObjects = [];
|
|
58688
|
-
const componentScreenTopLeft =
|
|
58688
|
+
const componentScreenTopLeft = applyToPoint24(transform2, {
|
|
58689
58689
|
x: schComponent.center.x - schComponent.size.width / 2,
|
|
58690
58690
|
y: schComponent.center.y + schComponent.size.height / 2
|
|
58691
58691
|
});
|
|
58692
|
-
const componentScreenBottomRight =
|
|
58692
|
+
const componentScreenBottomRight = applyToPoint24(transform2, {
|
|
58693
58693
|
x: schComponent.center.x + schComponent.size.width / 2,
|
|
58694
58694
|
y: schComponent.center.y - schComponent.size.height / 2
|
|
58695
58695
|
});
|
|
@@ -58796,10 +58796,10 @@ var import_debug2, svgAlphabet, lineAlphabet, debug2, debugPcb, debugSch, DEFAUL
|
|
|
58796
58796
|
x: symbolBounds.minX,
|
|
58797
58797
|
y: (symbolBounds.minY + symbolBounds.maxY) / 2
|
|
58798
58798
|
};
|
|
58799
|
-
const rotatedSymbolEnd =
|
|
58799
|
+
const rotatedSymbolEnd = applyToPoint24(rotationMatrix, symbolEndPoint);
|
|
58800
58800
|
const symbolToRealTransform = compose7(translate7(realAnchorPosition.x - rotatedSymbolEnd.x, realAnchorPosition.y - rotatedSymbolEnd.y), rotationMatrix, scale5(1));
|
|
58801
|
-
const [screenMinX, screenMinY] =
|
|
58802
|
-
const [screenMaxX, screenMaxY] =
|
|
58801
|
+
const [screenMinX, screenMinY] = applyToPoint24(compose7(realToScreenTransform, symbolToRealTransform), [bounds.minX, bounds.minY]);
|
|
58802
|
+
const [screenMaxX, screenMaxY] = applyToPoint24(compose7(realToScreenTransform, symbolToRealTransform), [bounds.maxX, bounds.maxY]);
|
|
58803
58803
|
const rectHeight = Math.abs(screenMaxY - screenMinY);
|
|
58804
58804
|
const rectY = Math.min(screenMinY, screenMaxY);
|
|
58805
58805
|
const rectWidth = Math.abs(screenMaxX - screenMinX);
|
|
@@ -58820,7 +58820,7 @@ var import_debug2, svgAlphabet, lineAlphabet, debug2, debugPcb, debugSch, DEFAUL
|
|
|
58820
58820
|
});
|
|
58821
58821
|
for (const path45 of symbolPaths) {
|
|
58822
58822
|
const symbolPath = path45.points.map((p, i) => {
|
|
58823
|
-
const [x3, y] =
|
|
58823
|
+
const [x3, y] = applyToPoint24(compose7(realToScreenTransform, symbolToRealTransform), [p.x, p.y]);
|
|
58824
58824
|
return `${i === 0 ? "M" : "L"} ${x3} ${y}`;
|
|
58825
58825
|
}).join(" ");
|
|
58826
58826
|
svgObjects.push({
|
|
@@ -58838,7 +58838,7 @@ var import_debug2, svgAlphabet, lineAlphabet, debug2, debugPcb, debugSch, DEFAUL
|
|
|
58838
58838
|
});
|
|
58839
58839
|
}
|
|
58840
58840
|
for (const text of symbolTexts) {
|
|
58841
|
-
const screenTextPos =
|
|
58841
|
+
const screenTextPos = applyToPoint24(compose7(realToScreenTransform, symbolToRealTransform), text);
|
|
58842
58842
|
let textValue = text.text;
|
|
58843
58843
|
if (textValue === "{REF}") {
|
|
58844
58844
|
textValue = labelText || "";
|
|
@@ -58877,7 +58877,7 @@ var import_debug2, svgAlphabet, lineAlphabet, debug2, debugPcb, debugSch, DEFAUL
|
|
|
58877
58877
|
});
|
|
58878
58878
|
}
|
|
58879
58879
|
for (const box of symbolBoxes) {
|
|
58880
|
-
const screenBoxPos =
|
|
58880
|
+
const screenBoxPos = applyToPoint24(compose7(realToScreenTransform, symbolToRealTransform), box);
|
|
58881
58881
|
const symbolToScreenScale = compose7(realToScreenTransform, symbolToRealTransform).a;
|
|
58882
58882
|
svgObjects.push({
|
|
58883
58883
|
name: "rect",
|
|
@@ -58894,7 +58894,7 @@ var import_debug2, svgAlphabet, lineAlphabet, debug2, debugPcb, debugSch, DEFAUL
|
|
|
58894
58894
|
});
|
|
58895
58895
|
}
|
|
58896
58896
|
for (const circle of symbolCircles) {
|
|
58897
|
-
const screenCirclePos =
|
|
58897
|
+
const screenCirclePos = applyToPoint24(compose7(realToScreenTransform, symbolToRealTransform), circle);
|
|
58898
58898
|
const symbolToScreenScale = compose7(realToScreenTransform, symbolToRealTransform).a;
|
|
58899
58899
|
svgObjects.push({
|
|
58900
58900
|
name: "circle",
|
|
@@ -58931,12 +58931,12 @@ var import_debug2, svgAlphabet, lineAlphabet, debug2, debugPcb, debugSch, DEFAUL
|
|
|
58931
58931
|
const fontSizePx = getSchScreenFontSize(realToScreenTransform, "net_label");
|
|
58932
58932
|
const fontSizeMm = getSchMmFontSize("net_label");
|
|
58933
58933
|
const textWidthFSR = estimateTextWidth(labelText || "");
|
|
58934
|
-
const screenCenter =
|
|
58934
|
+
const screenCenter = applyToPoint24(realToScreenTransform, schNetLabel.center);
|
|
58935
58935
|
const realTextGrowthVec = getUnitVectorFromOutsideToEdge(schNetLabel.anchor_side);
|
|
58936
58936
|
const screenTextGrowthVec = { ...realTextGrowthVec };
|
|
58937
58937
|
screenTextGrowthVec.y *= -1;
|
|
58938
58938
|
const fullWidthFsr = textWidthFSR + ARROW_POINT_WIDTH_FSR * 2 + END_PADDING_EXTRA_PER_CHARACTER_FSR * labelText.length + END_PADDING_FSR;
|
|
58939
|
-
const screenAnchorPosition = schNetLabel.anchor_position ?
|
|
58939
|
+
const screenAnchorPosition = schNetLabel.anchor_position ? applyToPoint24(realToScreenTransform, schNetLabel.anchor_position) : {
|
|
58940
58940
|
x: screenCenter.x - screenTextGrowthVec.x * fullWidthFsr * fontSizePx / 2,
|
|
58941
58941
|
y: screenCenter.y - screenTextGrowthVec.y * fullWidthFsr * fontSizePx / 2
|
|
58942
58942
|
};
|
|
@@ -58971,7 +58971,7 @@ var import_debug2, svgAlphabet, lineAlphabet, debug2, debugPcb, debugSch, DEFAUL
|
|
|
58971
58971
|
x: ARROW_POINT_WIDTH_FSR,
|
|
58972
58972
|
y: -0.6
|
|
58973
58973
|
}
|
|
58974
|
-
].map((fontRelativePoint) =>
|
|
58974
|
+
].map((fontRelativePoint) => applyToPoint24(compose7(realToScreenTransform, translate7(realAnchorPosition.x, realAnchorPosition.y), scale5(fontSizeMm), rotate10(pathRotation / 180 * Math.PI)), fontRelativePoint));
|
|
58975
58975
|
const pathD = `
|
|
58976
58976
|
M ${screenOutlinePoints[0].x},${screenOutlinePoints[0].y}
|
|
58977
58977
|
L ${screenOutlinePoints[1].x},${screenOutlinePoints[1].y}
|
|
@@ -59041,11 +59041,11 @@ var import_debug2, svgAlphabet, lineAlphabet, debug2, debugPcb, debugSch, DEFAUL
|
|
|
59041
59041
|
transform: transform2,
|
|
59042
59042
|
colorMap: colorMap2
|
|
59043
59043
|
}) => {
|
|
59044
|
-
const topLeft =
|
|
59044
|
+
const topLeft = applyToPoint24(transform2, {
|
|
59045
59045
|
x: schematicBox.x,
|
|
59046
59046
|
y: schematicBox.y
|
|
59047
59047
|
});
|
|
59048
|
-
const bottomRight =
|
|
59048
|
+
const bottomRight = applyToPoint24(transform2, {
|
|
59049
59049
|
x: schematicBox.x + schematicBox.width,
|
|
59050
59050
|
y: schematicBox.y + schematicBox.height
|
|
59051
59051
|
});
|
|
@@ -59107,11 +59107,11 @@ var import_debug2, svgAlphabet, lineAlphabet, debug2, debugPcb, debugSch, DEFAUL
|
|
|
59107
59107
|
const svgObjects = [];
|
|
59108
59108
|
const borderStrokeWidth = border_width * Math.abs(transform2.a);
|
|
59109
59109
|
const gridStrokeWidth = getSchStrokeSize(transform2);
|
|
59110
|
-
const [screenTopLeftX, screenTopLeftY] =
|
|
59110
|
+
const [screenTopLeftX, screenTopLeftY] = applyToPoint24(transform2, [
|
|
59111
59111
|
topLeftX,
|
|
59112
59112
|
topLeftY
|
|
59113
59113
|
]);
|
|
59114
|
-
const [screenBottomRightX, screenBottomRightY] =
|
|
59114
|
+
const [screenBottomRightX, screenBottomRightY] = applyToPoint24(transform2, [
|
|
59115
59115
|
topLeftX + totalWidth,
|
|
59116
59116
|
topLeftY - totalHeight
|
|
59117
59117
|
]);
|
|
@@ -59139,8 +59139,8 @@ var import_debug2, svgAlphabet, lineAlphabet, debug2, debugPcb, debugSch, DEFAUL
|
|
|
59139
59139
|
const segmentEndY = segmentStartY - row_heights[j2];
|
|
59140
59140
|
const isMerged = cells.some((cell) => cell.start_column_index <= i && cell.end_column_index > i && cell.start_row_index <= j2 && cell.end_row_index >= j2);
|
|
59141
59141
|
if (!isMerged) {
|
|
59142
|
-
const start =
|
|
59143
|
-
const end =
|
|
59142
|
+
const start = applyToPoint24(transform2, { x: currentX, y: segmentStartY });
|
|
59143
|
+
const end = applyToPoint24(transform2, { x: currentX, y: segmentEndY });
|
|
59144
59144
|
svgObjects.push({
|
|
59145
59145
|
name: "line",
|
|
59146
59146
|
type: "element",
|
|
@@ -59167,11 +59167,11 @@ var import_debug2, svgAlphabet, lineAlphabet, debug2, debugPcb, debugSch, DEFAUL
|
|
|
59167
59167
|
const segmentEndX = segmentStartX + column_widths[j2];
|
|
59168
59168
|
const isMerged = cells.some((cell) => cell.start_row_index <= i && cell.end_row_index > i && cell.start_column_index <= j2 && cell.end_column_index >= j2);
|
|
59169
59169
|
if (!isMerged) {
|
|
59170
|
-
const start =
|
|
59170
|
+
const start = applyToPoint24(transform2, {
|
|
59171
59171
|
x: segmentStartX,
|
|
59172
59172
|
y: currentY
|
|
59173
59173
|
});
|
|
59174
|
-
const end =
|
|
59174
|
+
const end = applyToPoint24(transform2, { x: segmentEndX, y: currentY });
|
|
59175
59175
|
svgObjects.push({
|
|
59176
59176
|
name: "line",
|
|
59177
59177
|
type: "element",
|
|
@@ -59213,7 +59213,7 @@ var import_debug2, svgAlphabet, lineAlphabet, debug2, debugPcb, debugSch, DEFAUL
|
|
|
59213
59213
|
} else if (vertical_align === "bottom") {
|
|
59214
59214
|
realTextAnchorPos.y = cellTopLeftY - cellHeight + cell_padding;
|
|
59215
59215
|
}
|
|
59216
|
-
const screenTextAnchorPos =
|
|
59216
|
+
const screenTextAnchorPos = applyToPoint24(transform2, realTextAnchorPos);
|
|
59217
59217
|
const fontSize = getSchScreenFontSize(transform2, "reference_designator", cell.font_size);
|
|
59218
59218
|
const textAnchorMap = {
|
|
59219
59219
|
left: "start",
|
|
@@ -59265,7 +59265,7 @@ var import_debug2, svgAlphabet, lineAlphabet, debug2, debugPcb, debugSch, DEFAUL
|
|
|
59265
59265
|
schPort,
|
|
59266
59266
|
transform: transform2
|
|
59267
59267
|
}) => {
|
|
59268
|
-
const screenSchPortPos =
|
|
59268
|
+
const screenSchPortPos = applyToPoint24(transform2, schPort.center);
|
|
59269
59269
|
const pinRadiusPx = Math.abs(transform2.a) * PIN_CIRCLE_RADIUS_MM2 * 2;
|
|
59270
59270
|
return [
|
|
59271
59271
|
{
|
|
@@ -59315,7 +59315,7 @@ var import_debug2, svgAlphabet, lineAlphabet, debug2, debugPcb, debugSch, DEFAUL
|
|
|
59315
59315
|
const svgObjects = [];
|
|
59316
59316
|
const radiusPx = Math.abs(transform2.a) * PIN_CIRCLE_RADIUS_MM3;
|
|
59317
59317
|
const strokeWidth = Math.abs(transform2.a) * PIN_CIRCLE_RADIUS_MM3;
|
|
59318
|
-
const screenPos =
|
|
59318
|
+
const screenPos = applyToPoint24(transform2, schPort.center);
|
|
59319
59319
|
svgObjects.push({
|
|
59320
59320
|
name: "circle",
|
|
59321
59321
|
type: "element",
|
|
@@ -59362,7 +59362,7 @@ var import_debug2, svgAlphabet, lineAlphabet, debug2, debugPcb, debugSch, DEFAUL
|
|
|
59362
59362
|
textAnchor = "middle";
|
|
59363
59363
|
break;
|
|
59364
59364
|
}
|
|
59365
|
-
const screenLabelPos =
|
|
59365
|
+
const screenLabelPos = applyToPoint24(transform2, labelPos);
|
|
59366
59366
|
const fontSizePx = getSchScreenFontSize(transform2, "pin_number");
|
|
59367
59367
|
if (schPort.facing_direction === "up" || schPort.facing_direction === "down") {
|
|
59368
59368
|
rotation2 = `rotate(-90 ${screenLabelPos.x} ${screenLabelPos.y})`;
|
|
@@ -100763,7 +100763,7 @@ var import_perfect_cli = __toESM2(require_dist2(), 1);
|
|
|
100763
100763
|
// lib/getVersion.ts
|
|
100764
100764
|
import { createRequire as createRequire2 } from "node:module";
|
|
100765
100765
|
// package.json
|
|
100766
|
-
var version = "0.1.
|
|
100766
|
+
var version = "0.1.1499";
|
|
100767
100767
|
var package_default = {
|
|
100768
100768
|
name: "@tscircuit/cli",
|
|
100769
100769
|
version,
|
|
@@ -100803,7 +100803,7 @@ var package_default = {
|
|
|
100803
100803
|
"circuit-json": "^0.0.425",
|
|
100804
100804
|
"circuit-json-to-bom-csv": "^0.0.7",
|
|
100805
100805
|
"circuit-json-to-gerber": "^0.0.51",
|
|
100806
|
-
"circuit-json-to-kicad": "0.0.
|
|
100806
|
+
"circuit-json-to-kicad": "0.0.153",
|
|
100807
100807
|
"circuit-json-to-pnp-csv": "^0.0.7",
|
|
100808
100808
|
"circuit-json-to-readable-netlist": "^0.0.15",
|
|
100809
100809
|
"circuit-json-to-spice": "^0.0.10",
|
|
@@ -104756,10 +104756,9 @@ __export2(exports_dist, {
|
|
|
104756
104756
|
CircuitJsonToKicadPcbConverter: () => CircuitJsonToKicadPcbConverter,
|
|
104757
104757
|
CircuitJsonToKicadLibraryConverter: () => CircuitJsonToKicadLibraryConverter
|
|
104758
104758
|
});
|
|
104759
|
-
import { KicadSch } from "kicadts";
|
|
104760
104759
|
import { cju } from "@tscircuit/circuit-json-util";
|
|
104761
|
-
import {
|
|
104762
|
-
import {
|
|
104760
|
+
import { KicadSch } from "kicadts";
|
|
104761
|
+
import { compose as compose2, scale, translate as translate2 } from "transformation-matrix";
|
|
104763
104762
|
import {
|
|
104764
104763
|
EmbeddedFonts,
|
|
104765
104764
|
LibSymbols,
|
|
@@ -104798,6 +104797,17 @@ import {
|
|
|
104798
104797
|
TextEffectsFont as TextEffectsFont3
|
|
104799
104798
|
} from "kicadts";
|
|
104800
104799
|
import { applyToPoint as applyToPoint4, scale as createScaleMatrix2 } from "transformation-matrix";
|
|
104800
|
+
import {
|
|
104801
|
+
Polyline,
|
|
104802
|
+
Pts as Pts2,
|
|
104803
|
+
SchematicText,
|
|
104804
|
+
Stroke as Stroke3,
|
|
104805
|
+
TextEffects as TextEffects4,
|
|
104806
|
+
TextEffectsFont as TextEffectsFont4,
|
|
104807
|
+
Uuid,
|
|
104808
|
+
Xy as Xy2
|
|
104809
|
+
} from "kicadts";
|
|
104810
|
+
import { applyToPoint as applyToPoint5 } from "transformation-matrix";
|
|
104801
104811
|
import {
|
|
104802
104812
|
SchematicSymbol as SchematicSymbol5,
|
|
104803
104813
|
SymbolLibId,
|
|
@@ -104806,15 +104816,12 @@ import {
|
|
|
104806
104816
|
SymbolInstances,
|
|
104807
104817
|
SymbolInstancesProject,
|
|
104808
104818
|
SymbolInstancePath,
|
|
104809
|
-
TextEffects as
|
|
104810
|
-
TextEffectsFont as
|
|
104819
|
+
TextEffects as TextEffects5,
|
|
104820
|
+
TextEffectsFont as TextEffectsFont5,
|
|
104811
104821
|
TextEffectsJustify,
|
|
104812
|
-
|
|
104813
|
-
SymbolPinNames as SymbolPinNames2,
|
|
104814
|
-
SymbolPinNumbers as SymbolPinNumbers2
|
|
104822
|
+
GlobalLabel
|
|
104815
104823
|
} from "kicadts";
|
|
104816
|
-
import { applyToPoint as
|
|
104817
|
-
import { symbols as symbols3 } from "schematic-symbols";
|
|
104824
|
+
import { applyToPoint as applyToPoint6 } from "transformation-matrix";
|
|
104818
104825
|
import {
|
|
104819
104826
|
SchematicSymbol as SchematicSymbol6,
|
|
104820
104827
|
SymbolLibId as SymbolLibId2,
|
|
@@ -104823,20 +104830,24 @@ import {
|
|
|
104823
104830
|
SymbolInstances as SymbolInstances2,
|
|
104824
104831
|
SymbolInstancesProject as SymbolInstancesProject2,
|
|
104825
104832
|
SymbolInstancePath as SymbolInstancePath2,
|
|
104826
|
-
TextEffects as
|
|
104827
|
-
TextEffectsFont as
|
|
104833
|
+
TextEffects as TextEffects6,
|
|
104834
|
+
TextEffectsFont as TextEffectsFont6,
|
|
104828
104835
|
TextEffectsJustify as TextEffectsJustify2,
|
|
104829
|
-
|
|
104836
|
+
EmbeddedFonts as EmbeddedFonts2,
|
|
104837
|
+
SymbolPinNames as SymbolPinNames2,
|
|
104838
|
+
SymbolPinNumbers as SymbolPinNumbers2
|
|
104830
104839
|
} from "kicadts";
|
|
104831
|
-
import { applyToPoint as applyToPoint6 } from "transformation-matrix";
|
|
104832
|
-
import { Wire, Pts as Pts2, Xy as Xy2, Stroke as Stroke3, Junction } from "kicadts";
|
|
104833
104840
|
import { applyToPoint as applyToPoint7 } from "transformation-matrix";
|
|
104841
|
+
import { symbols as symbols3 } from "schematic-symbols";
|
|
104842
|
+
import { Wire, Pts as Pts3, Xy as Xy3, Stroke as Stroke4, Junction } from "kicadts";
|
|
104843
|
+
import { applyToPoint as applyToPoint8 } from "transformation-matrix";
|
|
104834
104844
|
import {
|
|
104835
104845
|
SheetInstances,
|
|
104836
104846
|
SheetInstancesRootPath,
|
|
104837
104847
|
SheetInstancesRootPage,
|
|
104838
104848
|
EmbeddedFonts as EmbeddedFonts3
|
|
104839
104849
|
} from "kicadts";
|
|
104850
|
+
import { Paper, Uuid as Uuid4 } from "kicadts";
|
|
104840
104851
|
import { KicadPcb as KicadPcb2 } from "kicadts";
|
|
104841
104852
|
import { cju as cju2 } from "@tscircuit/circuit-json-util";
|
|
104842
104853
|
import { compose as compose6, translate as translate6, scale as scale4 } from "transformation-matrix";
|
|
@@ -105294,8 +105305,8 @@ function signedArea(data, start, end, dim) {
|
|
|
105294
105305
|
// node_modules/circuit-json-to-kicad/dist/index.js
|
|
105295
105306
|
import {
|
|
105296
105307
|
Layer,
|
|
105297
|
-
Pts as
|
|
105298
|
-
Xy as
|
|
105308
|
+
Pts as Pts4,
|
|
105309
|
+
Xy as Xy4,
|
|
105299
105310
|
Zone,
|
|
105300
105311
|
ZoneConnectPads,
|
|
105301
105312
|
ZoneFill,
|
|
@@ -105304,7 +105315,7 @@ import {
|
|
|
105304
105315
|
ZonePolygon
|
|
105305
105316
|
} from "kicadts";
|
|
105306
105317
|
import {
|
|
105307
|
-
applyToPoint as
|
|
105318
|
+
applyToPoint as applyToPoint9,
|
|
105308
105319
|
compose as compose3,
|
|
105309
105320
|
rotate,
|
|
105310
105321
|
translate as translate3
|
|
@@ -105326,83 +105337,83 @@ import {
|
|
|
105326
105337
|
EmbeddedFonts as EmbeddedFonts4,
|
|
105327
105338
|
FootprintAttr,
|
|
105328
105339
|
Property,
|
|
105329
|
-
TextEffects as
|
|
105330
|
-
TextEffectsFont as
|
|
105340
|
+
TextEffects as TextEffects7,
|
|
105341
|
+
TextEffectsFont as TextEffectsFont7
|
|
105331
105342
|
} from "kicadts";
|
|
105332
|
-
import { applyToPoint as
|
|
105343
|
+
import { applyToPoint as applyToPoint17 } from "transformation-matrix";
|
|
105333
105344
|
import {
|
|
105334
105345
|
Property as Property2,
|
|
105335
|
-
TextEffects as
|
|
105336
|
-
TextEffectsFont as
|
|
105346
|
+
TextEffects as TextEffects8,
|
|
105347
|
+
TextEffectsFont as TextEffectsFont8,
|
|
105337
105348
|
EmbeddedFonts as EmbeddedFonts5,
|
|
105338
105349
|
FootprintModel as FootprintModel2,
|
|
105339
105350
|
FootprintAttr as FootprintAttr2
|
|
105340
105351
|
} from "kicadts";
|
|
105341
|
-
import { FpCircle, Stroke as
|
|
105342
|
-
import { FpCircle as FpCircle2, Stroke as
|
|
105343
|
-
import { FpRect, Stroke as
|
|
105344
|
-
import { FpRect as FpRect2, Stroke as
|
|
105345
|
-
import { FpRect as FpRect3, Stroke as
|
|
105346
|
-
import { FpPoly, Pts as
|
|
105352
|
+
import { FpCircle, Stroke as Stroke5 } from "kicadts";
|
|
105353
|
+
import { FpCircle as FpCircle2, Stroke as Stroke6 } from "kicadts";
|
|
105354
|
+
import { FpRect, Stroke as Stroke7 } from "kicadts";
|
|
105355
|
+
import { FpRect as FpRect2, Stroke as Stroke8 } from "kicadts";
|
|
105356
|
+
import { FpRect as FpRect3, Stroke as Stroke9 } from "kicadts";
|
|
105357
|
+
import { FpPoly, Pts as Pts5, Stroke as Stroke10, Xy as Xy5 } from "kicadts";
|
|
105347
105358
|
import {
|
|
105348
|
-
applyToPoint as
|
|
105359
|
+
applyToPoint as applyToPoint10,
|
|
105349
105360
|
compose as compose4,
|
|
105350
105361
|
rotate as rotate2,
|
|
105351
105362
|
scale as scale2,
|
|
105352
105363
|
translate as translate4
|
|
105353
105364
|
} from "transformation-matrix";
|
|
105354
105365
|
import"kicadts";
|
|
105355
|
-
import { FpText, TextEffects as
|
|
105356
|
-
import { applyToPoint as
|
|
105357
|
-
import { FpLine, Stroke as
|
|
105358
|
-
import { applyToPoint as
|
|
105359
|
-
import { FpText as FpText3, TextEffects as
|
|
105360
|
-
import { applyToPoint as
|
|
105366
|
+
import { FpText, TextEffects as TextEffects9, TextEffectsFont as TextEffectsFont9 } from "kicadts";
|
|
105367
|
+
import { applyToPoint as applyToPoint11, rotate as rotate3, identity } from "transformation-matrix";
|
|
105368
|
+
import { FpLine, Stroke as Stroke11 } from "kicadts";
|
|
105369
|
+
import { applyToPoint as applyToPoint12, identity as identity2, rotate as rotate4 } from "transformation-matrix";
|
|
105370
|
+
import { FpText as FpText3, TextEffects as TextEffects10, TextEffectsFont as TextEffectsFont10 } from "kicadts";
|
|
105371
|
+
import { applyToPoint as applyToPoint13, rotate as rotate5, identity as identity3 } from "transformation-matrix";
|
|
105361
105372
|
import { FootprintModel as FootprintModel3 } from "kicadts";
|
|
105362
105373
|
import {
|
|
105363
105374
|
FootprintPad,
|
|
105364
105375
|
PadPrimitives,
|
|
105365
105376
|
PadPrimitiveGrPoly,
|
|
105366
|
-
Pts as
|
|
105367
|
-
Xy as
|
|
105377
|
+
Pts as Pts6,
|
|
105378
|
+
Xy as Xy6,
|
|
105368
105379
|
PadOptions,
|
|
105369
105380
|
PadNet
|
|
105370
105381
|
} from "kicadts";
|
|
105371
105382
|
import {
|
|
105372
|
-
applyToPoint as
|
|
105383
|
+
applyToPoint as applyToPoint14,
|
|
105373
105384
|
compose as compose5,
|
|
105374
105385
|
translate as translate5,
|
|
105375
105386
|
scale as scale3,
|
|
105376
105387
|
rotate as rotate6
|
|
105377
105388
|
} from "transformation-matrix";
|
|
105378
105389
|
import { FootprintPad as FootprintPad2, PadDrill, PadNet as PadNet2 } from "kicadts";
|
|
105379
|
-
import { applyToPoint as
|
|
105390
|
+
import { applyToPoint as applyToPoint15, rotate as rotate7, identity as identity4 } from "transformation-matrix";
|
|
105380
105391
|
import { FootprintPad as FootprintPad3, PadDrill as PadDrill2 } from "kicadts";
|
|
105381
|
-
import { applyToPoint as
|
|
105392
|
+
import { applyToPoint as applyToPoint16, rotate as rotate8, identity as identity5 } from "transformation-matrix";
|
|
105382
105393
|
import { Segment, SegmentNet } from "kicadts";
|
|
105383
|
-
import { applyToPoint as applyToPoint17 } from "transformation-matrix";
|
|
105384
|
-
import { Via, ViaNet } from "kicadts";
|
|
105385
105394
|
import { applyToPoint as applyToPoint18 } from "transformation-matrix";
|
|
105386
|
-
import {
|
|
105395
|
+
import { Via, ViaNet } from "kicadts";
|
|
105387
105396
|
import { applyToPoint as applyToPoint19 } from "transformation-matrix";
|
|
105397
|
+
import { Footprint as Footprint4 } from "kicadts";
|
|
105398
|
+
import { applyToPoint as applyToPoint20 } from "transformation-matrix";
|
|
105388
105399
|
import { GrCircle, GrLine, GrPoly } from "kicadts";
|
|
105389
105400
|
import {
|
|
105390
105401
|
At as At2,
|
|
105391
105402
|
GrText,
|
|
105392
|
-
TextEffects as
|
|
105393
|
-
TextEffectsFont as
|
|
105403
|
+
TextEffects as TextEffects11,
|
|
105404
|
+
TextEffectsFont as TextEffectsFont11,
|
|
105394
105405
|
TextEffectsJustify as TextEffectsJustify3
|
|
105395
105406
|
} from "kicadts";
|
|
105396
|
-
import { applyToPoint as
|
|
105397
|
-
import { applyToPoint as
|
|
105407
|
+
import { applyToPoint as applyToPoint21 } from "transformation-matrix";
|
|
105408
|
+
import { applyToPoint as applyToPoint23, rotate as rotate9 } from "transformation-matrix";
|
|
105398
105409
|
import {
|
|
105399
105410
|
GrText as GrText2,
|
|
105400
|
-
TextEffects as
|
|
105401
|
-
TextEffectsFont as
|
|
105411
|
+
TextEffects as TextEffects12,
|
|
105412
|
+
TextEffectsFont as TextEffectsFont12,
|
|
105402
105413
|
TextEffectsJustify as TextEffectsJustify4,
|
|
105403
105414
|
At as At3
|
|
105404
105415
|
} from "kicadts";
|
|
105405
|
-
import { applyToPoint as
|
|
105416
|
+
import { applyToPoint as applyToPoint22 } from "transformation-matrix";
|
|
105406
105417
|
import { cju as cju3 } from "@tscircuit/circuit-json-util";
|
|
105407
105418
|
import { cju as cju4 } from "@tscircuit/circuit-json-util";
|
|
105408
105419
|
import { parseKicadSexpr as parseKicadSexpr2, KicadSch as KicadSch2 } from "kicadts";
|
|
@@ -105412,8 +105423,8 @@ import {
|
|
|
105412
105423
|
parseKicadSexpr as parseKicadSexpr3,
|
|
105413
105424
|
Footprint as Footprint5,
|
|
105414
105425
|
Property as Property3,
|
|
105415
|
-
TextEffects as
|
|
105416
|
-
TextEffectsFont as
|
|
105426
|
+
TextEffects as TextEffects13,
|
|
105427
|
+
TextEffectsFont as TextEffectsFont13
|
|
105417
105428
|
} from "kicadts";
|
|
105418
105429
|
import { parseKicadMod as parseKicadMod2 } from "kicadts";
|
|
105419
105430
|
import {
|
|
@@ -105421,11 +105432,73 @@ import {
|
|
|
105421
105432
|
SymbolPinNames as SymbolPinNames3,
|
|
105422
105433
|
SymbolPinNumbers as SymbolPinNumbers3,
|
|
105423
105434
|
SymbolProperty as SymbolProperty4,
|
|
105424
|
-
TextEffects as
|
|
105425
|
-
TextEffectsFont as
|
|
105435
|
+
TextEffects as TextEffects14,
|
|
105436
|
+
TextEffectsFont as TextEffectsFont14,
|
|
105426
105437
|
TextEffectsJustify as TextEffectsJustify5
|
|
105427
105438
|
} from "kicadts";
|
|
105428
105439
|
import { KicadSymbolLib as KicadSymbolLib2 } from "kicadts";
|
|
105440
|
+
function getSchematicBoundsAndCenter(db) {
|
|
105441
|
+
const schematicComponents = db.schematic_component.list();
|
|
105442
|
+
const schematicTraces = db.schematic_trace.list();
|
|
105443
|
+
let minX = Infinity;
|
|
105444
|
+
let minY = Infinity;
|
|
105445
|
+
let maxX = -Infinity;
|
|
105446
|
+
let maxY = -Infinity;
|
|
105447
|
+
for (const component of schematicComponents) {
|
|
105448
|
+
const width = component.size?.width ?? 0;
|
|
105449
|
+
const height = component.size?.height ?? 0;
|
|
105450
|
+
minX = Math.min(minX, component.center.x - width / 2);
|
|
105451
|
+
minY = Math.min(minY, component.center.y - height / 2);
|
|
105452
|
+
maxX = Math.max(maxX, component.center.x + width / 2);
|
|
105453
|
+
maxY = Math.max(maxY, component.center.y + height / 2);
|
|
105454
|
+
}
|
|
105455
|
+
for (const trace of schematicTraces) {
|
|
105456
|
+
for (const edge of trace.edges) {
|
|
105457
|
+
minX = Math.min(minX, edge.from.x, edge.to.x);
|
|
105458
|
+
minY = Math.min(minY, edge.from.y, edge.to.y);
|
|
105459
|
+
maxX = Math.max(maxX, edge.from.x, edge.to.x);
|
|
105460
|
+
maxY = Math.max(maxY, edge.from.y, edge.to.y);
|
|
105461
|
+
}
|
|
105462
|
+
}
|
|
105463
|
+
if (minX === Infinity) {
|
|
105464
|
+
minX = 0;
|
|
105465
|
+
minY = 0;
|
|
105466
|
+
maxX = 0;
|
|
105467
|
+
maxY = 0;
|
|
105468
|
+
}
|
|
105469
|
+
const centerX = (minX + maxX) / 2;
|
|
105470
|
+
const centerY = (minY + maxY) / 2;
|
|
105471
|
+
return {
|
|
105472
|
+
center: {
|
|
105473
|
+
x: centerX,
|
|
105474
|
+
y: centerY
|
|
105475
|
+
},
|
|
105476
|
+
bounds: {
|
|
105477
|
+
minX,
|
|
105478
|
+
minY,
|
|
105479
|
+
maxX,
|
|
105480
|
+
maxY
|
|
105481
|
+
}
|
|
105482
|
+
};
|
|
105483
|
+
}
|
|
105484
|
+
var PAPER_SIZES = [
|
|
105485
|
+
{ name: "A4", width: 297, height: 210 },
|
|
105486
|
+
{ name: "A3", width: 420, height: 297 },
|
|
105487
|
+
{ name: "A2", width: 594, height: 420 },
|
|
105488
|
+
{ name: "A1", width: 841, height: 594 },
|
|
105489
|
+
{ name: "A0", width: 1189, height: 841 }
|
|
105490
|
+
];
|
|
105491
|
+
function selectSchematicPaperSize(contentWidth, contentHeight, paddingMm = 20) {
|
|
105492
|
+
const requiredWidth = contentWidth + 2 * paddingMm;
|
|
105493
|
+
const requiredHeight = contentHeight + 2 * paddingMm;
|
|
105494
|
+
for (let i = 0;i < PAPER_SIZES.length; i++) {
|
|
105495
|
+
const paperSize = PAPER_SIZES[i];
|
|
105496
|
+
if (requiredWidth <= paperSize.width && requiredHeight <= paperSize.height) {
|
|
105497
|
+
return paperSize;
|
|
105498
|
+
}
|
|
105499
|
+
}
|
|
105500
|
+
return PAPER_SIZES[PAPER_SIZES.length - 1];
|
|
105501
|
+
}
|
|
105429
105502
|
var ConverterStage = class {
|
|
105430
105503
|
MAX_ITERATIONS = 1000;
|
|
105431
105504
|
iteration = 0;
|
|
@@ -105455,23 +105528,6 @@ var ConverterStage = class {
|
|
|
105455
105528
|
throw new Error("Not implemented");
|
|
105456
105529
|
}
|
|
105457
105530
|
};
|
|
105458
|
-
var InitializeSchematicStage = class extends ConverterStage {
|
|
105459
|
-
_step() {
|
|
105460
|
-
const { kicadSch, schematicPaperSize } = this.ctx;
|
|
105461
|
-
if (!kicadSch) {
|
|
105462
|
-
throw new Error("KicadSch instance not initialized in context");
|
|
105463
|
-
}
|
|
105464
|
-
kicadSch.version = 20250114;
|
|
105465
|
-
const paper = new Paper;
|
|
105466
|
-
paper.size = schematicPaperSize?.name ?? "A4";
|
|
105467
|
-
kicadSch.paper = paper;
|
|
105468
|
-
kicadSch.uuid = new Uuid(crypto.randomUUID());
|
|
105469
|
-
this.finished = true;
|
|
105470
|
-
}
|
|
105471
|
-
getOutput() {
|
|
105472
|
-
return this.ctx.kicadSch;
|
|
105473
|
-
}
|
|
105474
|
-
};
|
|
105475
105531
|
function getKicadCompatibleComponentName(sourceComponent, cadComponent) {
|
|
105476
105532
|
if (sourceComponent.manufacturer_part_number) {
|
|
105477
105533
|
return sanitizeName(sourceComponent.manufacturer_part_number);
|
|
@@ -106332,6 +106388,268 @@ var AddLibrarySymbolsStage = class extends ConverterStage {
|
|
|
106332
106388
|
return this.ctx.kicadSch;
|
|
106333
106389
|
}
|
|
106334
106390
|
};
|
|
106391
|
+
var DEFAULT_SECTION_TEXT_SIZE_MM = 1.27;
|
|
106392
|
+
var DEFAULT_SECTION_LINE_COLOR = { r: 0, g: 0, b: 0, a: 1 };
|
|
106393
|
+
var DEFAULT_SECTION_TEXT_COLOR = { r: 0, g: 0, b: 0, a: 1 };
|
|
106394
|
+
var DEFAULT_SECTION_TEXT_PADDING_X_MM = 0.22;
|
|
106395
|
+
var DEFAULT_SECTION_TEXT_PADDING_Y_MM = 0.18;
|
|
106396
|
+
var isStandaloneSchematicElement = (element) => !element.schematic_component_id;
|
|
106397
|
+
var AddSchematicGraphicsStage = class extends ConverterStage {
|
|
106398
|
+
_step() {
|
|
106399
|
+
const { kicadSch, db } = this.ctx;
|
|
106400
|
+
if (!kicadSch) {
|
|
106401
|
+
throw new Error("KicadSch instance not initialized in context");
|
|
106402
|
+
}
|
|
106403
|
+
if (!this.ctx.c2kMatSch) {
|
|
106404
|
+
this.finished = true;
|
|
106405
|
+
return;
|
|
106406
|
+
}
|
|
106407
|
+
const schematicLines = (db.schematic_line?.list() || []).filter(isStandaloneSchematicElement);
|
|
106408
|
+
const schematicTexts = (db.schematic_text?.list() || []).filter(isStandaloneSchematicElement);
|
|
106409
|
+
if (schematicLines.length === 0 && schematicTexts.length === 0) {
|
|
106410
|
+
this.finished = true;
|
|
106411
|
+
return;
|
|
106412
|
+
}
|
|
106413
|
+
if (schematicLines.length > 0) {
|
|
106414
|
+
const polylines = kicadSch.polylines || [];
|
|
106415
|
+
for (const line of schematicLines) {
|
|
106416
|
+
const start = applyToPoint5(this.ctx.c2kMatSch, {
|
|
106417
|
+
x: line.x1,
|
|
106418
|
+
y: line.y1
|
|
106419
|
+
});
|
|
106420
|
+
const end = applyToPoint5(this.ctx.c2kMatSch, {
|
|
106421
|
+
x: line.x2,
|
|
106422
|
+
y: line.y2
|
|
106423
|
+
});
|
|
106424
|
+
const polyline = new Polyline;
|
|
106425
|
+
polyline.points = new Pts2([
|
|
106426
|
+
new Xy2(start.x, start.y),
|
|
106427
|
+
new Xy2(end.x, end.y)
|
|
106428
|
+
]);
|
|
106429
|
+
const stroke = new Stroke3;
|
|
106430
|
+
stroke.width = 0;
|
|
106431
|
+
stroke.type = "default";
|
|
106432
|
+
stroke.color = DEFAULT_SECTION_LINE_COLOR;
|
|
106433
|
+
polyline.stroke = stroke;
|
|
106434
|
+
polyline.uuid = new Uuid(crypto.randomUUID());
|
|
106435
|
+
polylines.push(polyline);
|
|
106436
|
+
}
|
|
106437
|
+
kicadSch.polylines = polylines;
|
|
106438
|
+
}
|
|
106439
|
+
if (schematicTexts.length > 0) {
|
|
106440
|
+
const texts = kicadSch.texts || [];
|
|
106441
|
+
for (const text of schematicTexts) {
|
|
106442
|
+
let sourceY = text.position?.y ?? 0;
|
|
106443
|
+
if (text.position?.y !== undefined && text.position.y < 2) {
|
|
106444
|
+
sourceY = text.position.y - DEFAULT_SECTION_TEXT_PADDING_Y_MM;
|
|
106445
|
+
}
|
|
106446
|
+
const position = applyToPoint5(this.ctx.c2kMatSch, {
|
|
106447
|
+
x: (text.position?.x ?? 0) + DEFAULT_SECTION_TEXT_PADDING_X_MM,
|
|
106448
|
+
y: sourceY
|
|
106449
|
+
});
|
|
106450
|
+
const font = new TextEffectsFont4;
|
|
106451
|
+
font.size = {
|
|
106452
|
+
height: DEFAULT_SECTION_TEXT_SIZE_MM,
|
|
106453
|
+
width: DEFAULT_SECTION_TEXT_SIZE_MM
|
|
106454
|
+
};
|
|
106455
|
+
font.color = DEFAULT_SECTION_TEXT_COLOR;
|
|
106456
|
+
const effects = new TextEffects4({
|
|
106457
|
+
font,
|
|
106458
|
+
hiddenText: false
|
|
106459
|
+
});
|
|
106460
|
+
const schematicText = new SchematicText({
|
|
106461
|
+
value: text.text || "",
|
|
106462
|
+
at: [position.x, position.y, text.rotation || 0],
|
|
106463
|
+
excludeFromSim: false,
|
|
106464
|
+
effects,
|
|
106465
|
+
uuid: new Uuid(crypto.randomUUID())
|
|
106466
|
+
});
|
|
106467
|
+
texts.push(schematicText);
|
|
106468
|
+
}
|
|
106469
|
+
kicadSch.texts = texts;
|
|
106470
|
+
}
|
|
106471
|
+
this.finished = true;
|
|
106472
|
+
}
|
|
106473
|
+
getOutput() {
|
|
106474
|
+
return this.ctx.kicadSch;
|
|
106475
|
+
}
|
|
106476
|
+
};
|
|
106477
|
+
var AddSchematicNetLabelsStage = class extends ConverterStage {
|
|
106478
|
+
_step() {
|
|
106479
|
+
const { kicadSch, db } = this.ctx;
|
|
106480
|
+
const netLabels = db.schematic_net_label?.list?.() || [];
|
|
106481
|
+
if (netLabels.length === 0) {
|
|
106482
|
+
this.finished = true;
|
|
106483
|
+
return;
|
|
106484
|
+
}
|
|
106485
|
+
if (!this.ctx.c2kMatSch) {
|
|
106486
|
+
this.finished = true;
|
|
106487
|
+
return;
|
|
106488
|
+
}
|
|
106489
|
+
const symbols4 = [];
|
|
106490
|
+
const globalLabels = [];
|
|
106491
|
+
for (const netLabel of netLabels) {
|
|
106492
|
+
const labelText = netLabel.text || "";
|
|
106493
|
+
const symbolName = netLabel.symbol_name;
|
|
106494
|
+
if (symbolName) {
|
|
106495
|
+
const symbol = this.createSymbolFromNetLabel(netLabel, labelText, symbolName);
|
|
106496
|
+
if (symbol) {
|
|
106497
|
+
symbols4.push(symbol);
|
|
106498
|
+
}
|
|
106499
|
+
} else {
|
|
106500
|
+
const label = this.createGlobalLabel(netLabel, labelText);
|
|
106501
|
+
if (label) {
|
|
106502
|
+
globalLabels.push(label);
|
|
106503
|
+
}
|
|
106504
|
+
}
|
|
106505
|
+
}
|
|
106506
|
+
if (kicadSch && symbols4.length > 0) {
|
|
106507
|
+
const existingSymbols = kicadSch.symbols || [];
|
|
106508
|
+
kicadSch.symbols = [...existingSymbols, ...symbols4];
|
|
106509
|
+
}
|
|
106510
|
+
if (kicadSch && globalLabels.length > 0) {
|
|
106511
|
+
kicadSch.globalLabels = [
|
|
106512
|
+
...kicadSch.globalLabels || [],
|
|
106513
|
+
...globalLabels
|
|
106514
|
+
];
|
|
106515
|
+
}
|
|
106516
|
+
this.finished = true;
|
|
106517
|
+
}
|
|
106518
|
+
createSymbolFromNetLabel(netLabel, labelText, symbolName) {
|
|
106519
|
+
if (!this.ctx.c2kMatSch)
|
|
106520
|
+
return null;
|
|
106521
|
+
const { x, y } = applyToPoint6(this.ctx.c2kMatSch, {
|
|
106522
|
+
x: netLabel.anchor_position?.x ?? netLabel.center?.x ?? 0,
|
|
106523
|
+
y: netLabel.anchor_position?.y ?? netLabel.center?.y ?? 0
|
|
106524
|
+
});
|
|
106525
|
+
const uuid = crypto.randomUUID();
|
|
106526
|
+
const symbol = new SchematicSymbol5({
|
|
106527
|
+
at: [x, y, 0],
|
|
106528
|
+
unit: 1,
|
|
106529
|
+
excludeFromSim: false,
|
|
106530
|
+
inBom: true,
|
|
106531
|
+
onBoard: true,
|
|
106532
|
+
dnp: false,
|
|
106533
|
+
uuid,
|
|
106534
|
+
fieldsAutoplaced: true
|
|
106535
|
+
});
|
|
106536
|
+
const libId = `Custom:${symbolName}`;
|
|
106537
|
+
const symLibId = new SymbolLibId(libId);
|
|
106538
|
+
symbol._sxLibId = symLibId;
|
|
106539
|
+
const isUpSymbol = symbolName.includes("_up") || symbolName.toLowerCase().includes("vcc");
|
|
106540
|
+
const referenceOffset = isUpSymbol ? -4 : 4;
|
|
106541
|
+
const valueOffset = isUpSymbol ? -6 : 6;
|
|
106542
|
+
const referenceProperty = new SymbolProperty2({
|
|
106543
|
+
key: "Reference",
|
|
106544
|
+
value: labelText,
|
|
106545
|
+
id: 0,
|
|
106546
|
+
at: [x, y + referenceOffset, 0],
|
|
106547
|
+
effects: this.createTextEffects(1.27, false)
|
|
106548
|
+
});
|
|
106549
|
+
const valueProperty = new SymbolProperty2({
|
|
106550
|
+
key: "Value",
|
|
106551
|
+
value: labelText,
|
|
106552
|
+
id: 1,
|
|
106553
|
+
at: [x, y + valueOffset, 0],
|
|
106554
|
+
effects: this.createTextEffects(1.27, true)
|
|
106555
|
+
});
|
|
106556
|
+
const footprintProperty = new SymbolProperty2({
|
|
106557
|
+
key: "Footprint",
|
|
106558
|
+
value: "",
|
|
106559
|
+
id: 2,
|
|
106560
|
+
at: [x - 1.778, y, 90],
|
|
106561
|
+
effects: this.createTextEffects(1.27, true)
|
|
106562
|
+
});
|
|
106563
|
+
const datasheetProperty = new SymbolProperty2({
|
|
106564
|
+
key: "Datasheet",
|
|
106565
|
+
value: "~",
|
|
106566
|
+
id: 3,
|
|
106567
|
+
at: [x, y, 0],
|
|
106568
|
+
effects: this.createTextEffects(1.27, true)
|
|
106569
|
+
});
|
|
106570
|
+
const descriptionProperty = new SymbolProperty2({
|
|
106571
|
+
key: "Description",
|
|
106572
|
+
value: `Power/Net symbol: ${labelText}`,
|
|
106573
|
+
id: 4,
|
|
106574
|
+
at: [x, y, 0],
|
|
106575
|
+
effects: this.createTextEffects(1.27, true)
|
|
106576
|
+
});
|
|
106577
|
+
symbol.properties.push(referenceProperty, valueProperty, footprintProperty, datasheetProperty, descriptionProperty);
|
|
106578
|
+
const pin = new SymbolPin2;
|
|
106579
|
+
pin.numberString = "1";
|
|
106580
|
+
pin.uuid = crypto.randomUUID();
|
|
106581
|
+
symbol.pins.push(pin);
|
|
106582
|
+
const { kicadSch } = this.ctx;
|
|
106583
|
+
const instances = new SymbolInstances;
|
|
106584
|
+
const project = new SymbolInstancesProject("");
|
|
106585
|
+
const path16 = new SymbolInstancePath(`/${kicadSch?.uuid?.value || ""}`);
|
|
106586
|
+
path16.reference = labelText;
|
|
106587
|
+
path16.unit = 1;
|
|
106588
|
+
project.paths.push(path16);
|
|
106589
|
+
instances.projects.push(project);
|
|
106590
|
+
symbol._sxInstances = instances;
|
|
106591
|
+
return symbol;
|
|
106592
|
+
}
|
|
106593
|
+
createGlobalLabel(netLabel, labelText) {
|
|
106594
|
+
if (!this.ctx.c2kMatSch || !this.ctx.kicadSch)
|
|
106595
|
+
return null;
|
|
106596
|
+
const { x, y } = applyToPoint6(this.ctx.c2kMatSch, {
|
|
106597
|
+
x: netLabel.anchor_position?.x ?? netLabel.center?.x ?? 0,
|
|
106598
|
+
y: netLabel.anchor_position?.y ?? netLabel.center?.y ?? 0
|
|
106599
|
+
});
|
|
106600
|
+
const anchorSide = netLabel.anchor_side || "left";
|
|
106601
|
+
const orientationMap = {
|
|
106602
|
+
left: {
|
|
106603
|
+
angle: 0,
|
|
106604
|
+
shape: "input",
|
|
106605
|
+
justify: { horizontal: "left" }
|
|
106606
|
+
},
|
|
106607
|
+
right: {
|
|
106608
|
+
angle: 180,
|
|
106609
|
+
shape: "input",
|
|
106610
|
+
justify: { horizontal: "right" }
|
|
106611
|
+
},
|
|
106612
|
+
top: {
|
|
106613
|
+
angle: 270,
|
|
106614
|
+
shape: "input",
|
|
106615
|
+
justify: { horizontal: "right" }
|
|
106616
|
+
},
|
|
106617
|
+
bottom: {
|
|
106618
|
+
angle: 90,
|
|
106619
|
+
shape: "input",
|
|
106620
|
+
justify: { horizontal: "left" }
|
|
106621
|
+
}
|
|
106622
|
+
};
|
|
106623
|
+
const orientation = orientationMap[anchorSide] || orientationMap["left"];
|
|
106624
|
+
const effects = this.createTextEffects(1.27, false);
|
|
106625
|
+
if (Object.keys(orientation.justify).length > 0) {
|
|
106626
|
+
effects.justify = new TextEffectsJustify(orientation.justify);
|
|
106627
|
+
}
|
|
106628
|
+
const globalLabel = new GlobalLabel({
|
|
106629
|
+
value: labelText,
|
|
106630
|
+
shape: orientation.shape,
|
|
106631
|
+
at: [x, y, orientation.angle],
|
|
106632
|
+
effects,
|
|
106633
|
+
uuid: crypto.randomUUID(),
|
|
106634
|
+
fieldsAutoplaced: true
|
|
106635
|
+
});
|
|
106636
|
+
return globalLabel;
|
|
106637
|
+
}
|
|
106638
|
+
createTextEffects(size, hide = false) {
|
|
106639
|
+
const font = new TextEffectsFont5;
|
|
106640
|
+
font.size = { height: size, width: size };
|
|
106641
|
+
return new TextEffects5({
|
|
106642
|
+
font,
|
|
106643
|
+
hiddenText: hide
|
|
106644
|
+
});
|
|
106645
|
+
}
|
|
106646
|
+
getOutput() {
|
|
106647
|
+
if (!this.ctx.kicadSch) {
|
|
106648
|
+
throw new Error("kicadSch is not initialized");
|
|
106649
|
+
}
|
|
106650
|
+
return this.ctx.kicadSch;
|
|
106651
|
+
}
|
|
106652
|
+
};
|
|
106335
106653
|
var AddSchematicSymbolsStage = class extends ConverterStage {
|
|
106336
106654
|
_step() {
|
|
106337
106655
|
const { kicadSch, db } = this.ctx;
|
|
@@ -106347,12 +106665,12 @@ var AddSchematicSymbolsStage = class extends ConverterStage {
|
|
|
106347
106665
|
continue;
|
|
106348
106666
|
if (!this.ctx.c2kMatSch)
|
|
106349
106667
|
continue;
|
|
106350
|
-
const { x, y } =
|
|
106668
|
+
const { x, y } = applyToPoint7(this.ctx.c2kMatSch, {
|
|
106351
106669
|
x: schematicComponent.center.x,
|
|
106352
106670
|
y: schematicComponent.center.y
|
|
106353
106671
|
});
|
|
106354
106672
|
const uuid = crypto.randomUUID();
|
|
106355
|
-
const symbol = new
|
|
106673
|
+
const symbol = new SchematicSymbol6({
|
|
106356
106674
|
at: [x, y, 0],
|
|
106357
106675
|
unit: 1,
|
|
106358
106676
|
excludeFromSim: false,
|
|
@@ -106385,7 +106703,7 @@ var AddSchematicSymbolsStage = class extends ConverterStage {
|
|
|
106385
106703
|
}
|
|
106386
106704
|
}
|
|
106387
106705
|
const libId = getLibraryId(sourceComponent, schematicComponent, cadComponent, schematicSymbolName);
|
|
106388
|
-
const symLibId = new
|
|
106706
|
+
const symLibId = new SymbolLibId2(libId);
|
|
106389
106707
|
symbol._sxLibId = symLibId;
|
|
106390
106708
|
const { reference, value, description } = this.getComponentMetadata(sourceComponent);
|
|
106391
106709
|
const hasManufacturerValueForValuePlacement = (sourceComponent.ftype === "simple_chip" || sourceComponent.ftype === "simple_connector") && Boolean(sourceComponent.manufacturer_part_number);
|
|
@@ -106398,7 +106716,7 @@ var AddSchematicSymbolsStage = class extends ConverterStage {
|
|
|
106398
106716
|
}
|
|
106399
106717
|
}
|
|
106400
106718
|
const refMeta = symbolMetadata?.properties?.Reference;
|
|
106401
|
-
const referenceProperty = new
|
|
106719
|
+
const referenceProperty = new SymbolProperty3({
|
|
106402
106720
|
key: "Reference",
|
|
106403
106721
|
value: refMeta?.value ?? reference,
|
|
106404
106722
|
id: 0,
|
|
@@ -106407,7 +106725,7 @@ var AddSchematicSymbolsStage = class extends ConverterStage {
|
|
|
106407
106725
|
});
|
|
106408
106726
|
const hideValue = sourceComponent.ftype === "simple_chip" && !hasManufacturerValueForValuePlacement || sourceComponent.ftype === "simple_pin_header";
|
|
106409
106727
|
const valMeta = symbolMetadata?.properties?.Value;
|
|
106410
|
-
const valueProperty = new
|
|
106728
|
+
const valueProperty = new SymbolProperty3({
|
|
106411
106729
|
key: "Value",
|
|
106412
106730
|
value: valMeta?.value ?? value,
|
|
106413
106731
|
id: 1,
|
|
@@ -106415,7 +106733,7 @@ var AddSchematicSymbolsStage = class extends ConverterStage {
|
|
|
106415
106733
|
effects: this.createTextEffects(Number(valMeta?.effects?.font?.size?.x ?? 1.27), valMeta?.effects?.hide ?? hideValue)
|
|
106416
106734
|
});
|
|
106417
106735
|
const fpMeta = symbolMetadata?.properties?.Footprint;
|
|
106418
|
-
const footprintProperty = new
|
|
106736
|
+
const footprintProperty = new SymbolProperty3({
|
|
106419
106737
|
key: "Footprint",
|
|
106420
106738
|
value: fpMeta?.value ?? "",
|
|
106421
106739
|
id: 2,
|
|
@@ -106423,7 +106741,7 @@ var AddSchematicSymbolsStage = class extends ConverterStage {
|
|
|
106423
106741
|
effects: this.createTextEffects(1.27, fpMeta?.effects?.hide ?? true)
|
|
106424
106742
|
});
|
|
106425
106743
|
const dsMeta = symbolMetadata?.properties?.Datasheet;
|
|
106426
|
-
const datasheetProperty = new
|
|
106744
|
+
const datasheetProperty = new SymbolProperty3({
|
|
106427
106745
|
key: "Datasheet",
|
|
106428
106746
|
value: dsMeta?.value ?? "~",
|
|
106429
106747
|
id: 3,
|
|
@@ -106431,7 +106749,7 @@ var AddSchematicSymbolsStage = class extends ConverterStage {
|
|
|
106431
106749
|
effects: this.createTextEffects(1.27, dsMeta?.effects?.hide ?? true)
|
|
106432
106750
|
});
|
|
106433
106751
|
const descMeta = symbolMetadata?.properties?.Description;
|
|
106434
|
-
const descriptionProperty = new
|
|
106752
|
+
const descriptionProperty = new SymbolProperty3({
|
|
106435
106753
|
key: "Description",
|
|
106436
106754
|
value: descMeta?.value ?? description,
|
|
106437
106755
|
id: 4,
|
|
@@ -106441,7 +106759,7 @@ var AddSchematicSymbolsStage = class extends ConverterStage {
|
|
|
106441
106759
|
symbol.properties.push(referenceProperty, valueProperty, footprintProperty, datasheetProperty, descriptionProperty);
|
|
106442
106760
|
const kwMeta = symbolMetadata?.properties?.ki_keywords;
|
|
106443
106761
|
if (kwMeta?.value) {
|
|
106444
|
-
const keywordsProperty = new
|
|
106762
|
+
const keywordsProperty = new SymbolProperty3({
|
|
106445
106763
|
key: "ki_keywords",
|
|
106446
106764
|
value: kwMeta.value,
|
|
106447
106765
|
id: 5,
|
|
@@ -106452,7 +106770,7 @@ var AddSchematicSymbolsStage = class extends ConverterStage {
|
|
|
106452
106770
|
}
|
|
106453
106771
|
const fpFilterMeta = symbolMetadata?.properties?.ki_fp_filters;
|
|
106454
106772
|
if (fpFilterMeta?.value) {
|
|
106455
|
-
const fpFiltersProperty = new
|
|
106773
|
+
const fpFiltersProperty = new SymbolProperty3({
|
|
106456
106774
|
key: "ki_fp_filters",
|
|
106457
106775
|
value: fpFilterMeta.value,
|
|
106458
106776
|
id: 6,
|
|
@@ -106504,14 +106822,14 @@ var AddSchematicSymbolsStage = class extends ConverterStage {
|
|
|
106504
106822
|
const port = schematicPorts[i];
|
|
106505
106823
|
if (!port)
|
|
106506
106824
|
continue;
|
|
106507
|
-
const pin = new
|
|
106825
|
+
const pin = new SymbolPin3;
|
|
106508
106826
|
pin.numberString = `${port.pin_number || i + 1}`;
|
|
106509
106827
|
pin.uuid = crypto.randomUUID();
|
|
106510
106828
|
symbol.pins.push(pin);
|
|
106511
106829
|
}
|
|
106512
|
-
const instances = new
|
|
106513
|
-
const project = new
|
|
106514
|
-
const path16 = new
|
|
106830
|
+
const instances = new SymbolInstances2;
|
|
106831
|
+
const project = new SymbolInstancesProject2("");
|
|
106832
|
+
const path16 = new SymbolInstancePath2(`/${kicadSch?.uuid?.value || ""}`);
|
|
106515
106833
|
path16.reference = reference;
|
|
106516
106834
|
path16.unit = 1;
|
|
106517
106835
|
project.paths.push(path16);
|
|
@@ -106527,7 +106845,7 @@ var AddSchematicSymbolsStage = class extends ConverterStage {
|
|
|
106527
106845
|
getTextPositions(schematicComponent, placeValueAtNamePosition) {
|
|
106528
106846
|
const c2kMatSch = this.ctx.c2kMatSch;
|
|
106529
106847
|
const schematicScale = c2kMatSch.a;
|
|
106530
|
-
const symbolKicadPos =
|
|
106848
|
+
const symbolKicadPos = applyToPoint7(c2kMatSch, {
|
|
106531
106849
|
x: schematicComponent.center.x,
|
|
106532
106850
|
y: schematicComponent.center.y
|
|
106533
106851
|
});
|
|
@@ -106555,7 +106873,7 @@ var AddSchematicSymbolsStage = class extends ConverterStage {
|
|
|
106555
106873
|
const schematicTexts = this.ctx.db.schematic_text?.list?.()?.filter((t) => t.schematic_component_id === schematicComponent.schematic_component_id) || [];
|
|
106556
106874
|
const refText = schematicTexts.find((t) => t.text && t.text.length > 0);
|
|
106557
106875
|
if (refText) {
|
|
106558
|
-
const nameTextPos =
|
|
106876
|
+
const nameTextPos = applyToPoint7(c2kMatSch, {
|
|
106559
106877
|
x: refText.position.x,
|
|
106560
106878
|
y: refText.position.y
|
|
106561
106879
|
});
|
|
@@ -106597,11 +106915,11 @@ var AddSchematicSymbolsStage = class extends ConverterStage {
|
|
|
106597
106915
|
const symbolCenter = symbol.center || { x: 0, y: 0 };
|
|
106598
106916
|
const isVertical = symbolName.includes("_down") || symbolName.includes("_up");
|
|
106599
106917
|
const horizontalTextOffset = isVertical ? 0.15 : 0;
|
|
106600
|
-
const refTextPos = refTextPrimitive ?
|
|
106918
|
+
const refTextPos = refTextPrimitive ? applyToPoint7(c2kMatSch, {
|
|
106601
106919
|
x: schematicComponent.center.x + (refTextPrimitive.x - symbolCenter.x) + horizontalTextOffset,
|
|
106602
106920
|
y: schematicComponent.center.y + (refTextPrimitive.y - symbolCenter.y)
|
|
106603
106921
|
}) : { x: symbolKicadPos.x, y: referenceAboveBodyY };
|
|
106604
|
-
const valTextPos = valTextPrimitive ?
|
|
106922
|
+
const valTextPos = valTextPrimitive ? applyToPoint7(c2kMatSch, {
|
|
106605
106923
|
x: schematicComponent.center.x + (valTextPrimitive.x - symbolCenter.x) + horizontalTextOffset,
|
|
106606
106924
|
y: schematicComponent.center.y + (valTextPrimitive.y - symbolCenter.y)
|
|
106607
106925
|
}) : { x: symbolKicadPos.x, y: symbolKicadPos.y + 6 };
|
|
@@ -106686,10 +107004,10 @@ var AddSchematicSymbolsStage = class extends ConverterStage {
|
|
|
106686
107004
|
};
|
|
106687
107005
|
}
|
|
106688
107006
|
createTextEffects(size, hide = false, justify) {
|
|
106689
|
-
const font = new
|
|
107007
|
+
const font = new TextEffectsFont6;
|
|
106690
107008
|
font.size = { height: size, width: size };
|
|
106691
|
-
const justifyObj = justify ? new
|
|
106692
|
-
const effects = new
|
|
107009
|
+
const justifyObj = justify ? new TextEffectsJustify2({ horizontal: justify }) : undefined;
|
|
107010
|
+
const effects = new TextEffects6({
|
|
106693
107011
|
font,
|
|
106694
107012
|
hiddenText: hide,
|
|
106695
107013
|
justify: justifyObj
|
|
@@ -106703,182 +107021,6 @@ var AddSchematicSymbolsStage = class extends ConverterStage {
|
|
|
106703
107021
|
return this.ctx.kicadSch;
|
|
106704
107022
|
}
|
|
106705
107023
|
};
|
|
106706
|
-
var AddSchematicNetLabelsStage = class extends ConverterStage {
|
|
106707
|
-
_step() {
|
|
106708
|
-
const { kicadSch, db } = this.ctx;
|
|
106709
|
-
const netLabels = db.schematic_net_label?.list?.() || [];
|
|
106710
|
-
if (netLabels.length === 0) {
|
|
106711
|
-
this.finished = true;
|
|
106712
|
-
return;
|
|
106713
|
-
}
|
|
106714
|
-
if (!this.ctx.c2kMatSch) {
|
|
106715
|
-
this.finished = true;
|
|
106716
|
-
return;
|
|
106717
|
-
}
|
|
106718
|
-
const symbols4 = [];
|
|
106719
|
-
const globalLabels = [];
|
|
106720
|
-
for (const netLabel of netLabels) {
|
|
106721
|
-
const labelText = netLabel.text || "";
|
|
106722
|
-
const symbolName = netLabel.symbol_name;
|
|
106723
|
-
if (symbolName) {
|
|
106724
|
-
const symbol = this.createSymbolFromNetLabel(netLabel, labelText, symbolName);
|
|
106725
|
-
if (symbol) {
|
|
106726
|
-
symbols4.push(symbol);
|
|
106727
|
-
}
|
|
106728
|
-
} else {
|
|
106729
|
-
const label = this.createGlobalLabel(netLabel, labelText);
|
|
106730
|
-
if (label) {
|
|
106731
|
-
globalLabels.push(label);
|
|
106732
|
-
}
|
|
106733
|
-
}
|
|
106734
|
-
}
|
|
106735
|
-
if (kicadSch && symbols4.length > 0) {
|
|
106736
|
-
const existingSymbols = kicadSch.symbols || [];
|
|
106737
|
-
kicadSch.symbols = [...existingSymbols, ...symbols4];
|
|
106738
|
-
}
|
|
106739
|
-
if (kicadSch && globalLabels.length > 0) {
|
|
106740
|
-
kicadSch.globalLabels = [
|
|
106741
|
-
...kicadSch.globalLabels || [],
|
|
106742
|
-
...globalLabels
|
|
106743
|
-
];
|
|
106744
|
-
}
|
|
106745
|
-
this.finished = true;
|
|
106746
|
-
}
|
|
106747
|
-
createSymbolFromNetLabel(netLabel, labelText, symbolName) {
|
|
106748
|
-
if (!this.ctx.c2kMatSch)
|
|
106749
|
-
return null;
|
|
106750
|
-
const { x, y } = applyToPoint6(this.ctx.c2kMatSch, {
|
|
106751
|
-
x: netLabel.anchor_position?.x ?? netLabel.center?.x ?? 0,
|
|
106752
|
-
y: netLabel.anchor_position?.y ?? netLabel.center?.y ?? 0
|
|
106753
|
-
});
|
|
106754
|
-
const uuid = crypto.randomUUID();
|
|
106755
|
-
const symbol = new SchematicSymbol6({
|
|
106756
|
-
at: [x, y, 0],
|
|
106757
|
-
unit: 1,
|
|
106758
|
-
excludeFromSim: false,
|
|
106759
|
-
inBom: true,
|
|
106760
|
-
onBoard: true,
|
|
106761
|
-
dnp: false,
|
|
106762
|
-
uuid,
|
|
106763
|
-
fieldsAutoplaced: true
|
|
106764
|
-
});
|
|
106765
|
-
const libId = `Custom:${symbolName}`;
|
|
106766
|
-
const symLibId = new SymbolLibId2(libId);
|
|
106767
|
-
symbol._sxLibId = symLibId;
|
|
106768
|
-
const isUpSymbol = symbolName.includes("_up") || symbolName.toLowerCase().includes("vcc");
|
|
106769
|
-
const referenceOffset = isUpSymbol ? -4 : 4;
|
|
106770
|
-
const valueOffset = isUpSymbol ? -6 : 6;
|
|
106771
|
-
const referenceProperty = new SymbolProperty3({
|
|
106772
|
-
key: "Reference",
|
|
106773
|
-
value: labelText,
|
|
106774
|
-
id: 0,
|
|
106775
|
-
at: [x, y + referenceOffset, 0],
|
|
106776
|
-
effects: this.createTextEffects(1.27, false)
|
|
106777
|
-
});
|
|
106778
|
-
const valueProperty = new SymbolProperty3({
|
|
106779
|
-
key: "Value",
|
|
106780
|
-
value: labelText,
|
|
106781
|
-
id: 1,
|
|
106782
|
-
at: [x, y + valueOffset, 0],
|
|
106783
|
-
effects: this.createTextEffects(1.27, true)
|
|
106784
|
-
});
|
|
106785
|
-
const footprintProperty = new SymbolProperty3({
|
|
106786
|
-
key: "Footprint",
|
|
106787
|
-
value: "",
|
|
106788
|
-
id: 2,
|
|
106789
|
-
at: [x - 1.778, y, 90],
|
|
106790
|
-
effects: this.createTextEffects(1.27, true)
|
|
106791
|
-
});
|
|
106792
|
-
const datasheetProperty = new SymbolProperty3({
|
|
106793
|
-
key: "Datasheet",
|
|
106794
|
-
value: "~",
|
|
106795
|
-
id: 3,
|
|
106796
|
-
at: [x, y, 0],
|
|
106797
|
-
effects: this.createTextEffects(1.27, true)
|
|
106798
|
-
});
|
|
106799
|
-
const descriptionProperty = new SymbolProperty3({
|
|
106800
|
-
key: "Description",
|
|
106801
|
-
value: `Power/Net symbol: ${labelText}`,
|
|
106802
|
-
id: 4,
|
|
106803
|
-
at: [x, y, 0],
|
|
106804
|
-
effects: this.createTextEffects(1.27, true)
|
|
106805
|
-
});
|
|
106806
|
-
symbol.properties.push(referenceProperty, valueProperty, footprintProperty, datasheetProperty, descriptionProperty);
|
|
106807
|
-
const pin = new SymbolPin3;
|
|
106808
|
-
pin.numberString = "1";
|
|
106809
|
-
pin.uuid = crypto.randomUUID();
|
|
106810
|
-
symbol.pins.push(pin);
|
|
106811
|
-
const { kicadSch } = this.ctx;
|
|
106812
|
-
const instances = new SymbolInstances2;
|
|
106813
|
-
const project = new SymbolInstancesProject2("");
|
|
106814
|
-
const path16 = new SymbolInstancePath2(`/${kicadSch?.uuid?.value || ""}`);
|
|
106815
|
-
path16.reference = labelText;
|
|
106816
|
-
path16.unit = 1;
|
|
106817
|
-
project.paths.push(path16);
|
|
106818
|
-
instances.projects.push(project);
|
|
106819
|
-
symbol._sxInstances = instances;
|
|
106820
|
-
return symbol;
|
|
106821
|
-
}
|
|
106822
|
-
createGlobalLabel(netLabel, labelText) {
|
|
106823
|
-
if (!this.ctx.c2kMatSch || !this.ctx.kicadSch)
|
|
106824
|
-
return null;
|
|
106825
|
-
const { x, y } = applyToPoint6(this.ctx.c2kMatSch, {
|
|
106826
|
-
x: netLabel.anchor_position?.x ?? netLabel.center?.x ?? 0,
|
|
106827
|
-
y: netLabel.anchor_position?.y ?? netLabel.center?.y ?? 0
|
|
106828
|
-
});
|
|
106829
|
-
const anchorSide = netLabel.anchor_side || "left";
|
|
106830
|
-
const orientationMap = {
|
|
106831
|
-
left: {
|
|
106832
|
-
angle: 0,
|
|
106833
|
-
shape: "input",
|
|
106834
|
-
justify: { horizontal: "left" }
|
|
106835
|
-
},
|
|
106836
|
-
right: {
|
|
106837
|
-
angle: 180,
|
|
106838
|
-
shape: "input",
|
|
106839
|
-
justify: { horizontal: "right" }
|
|
106840
|
-
},
|
|
106841
|
-
top: {
|
|
106842
|
-
angle: 270,
|
|
106843
|
-
shape: "input",
|
|
106844
|
-
justify: { horizontal: "right" }
|
|
106845
|
-
},
|
|
106846
|
-
bottom: {
|
|
106847
|
-
angle: 90,
|
|
106848
|
-
shape: "input",
|
|
106849
|
-
justify: { horizontal: "left" }
|
|
106850
|
-
}
|
|
106851
|
-
};
|
|
106852
|
-
const orientation = orientationMap[anchorSide] || orientationMap["left"];
|
|
106853
|
-
const effects = this.createTextEffects(1.27, false);
|
|
106854
|
-
if (Object.keys(orientation.justify).length > 0) {
|
|
106855
|
-
effects.justify = new TextEffectsJustify2(orientation.justify);
|
|
106856
|
-
}
|
|
106857
|
-
const globalLabel = new GlobalLabel({
|
|
106858
|
-
value: labelText,
|
|
106859
|
-
shape: orientation.shape,
|
|
106860
|
-
at: [x, y, orientation.angle],
|
|
106861
|
-
effects,
|
|
106862
|
-
uuid: crypto.randomUUID(),
|
|
106863
|
-
fieldsAutoplaced: true
|
|
106864
|
-
});
|
|
106865
|
-
return globalLabel;
|
|
106866
|
-
}
|
|
106867
|
-
createTextEffects(size, hide = false) {
|
|
106868
|
-
const font = new TextEffectsFont5;
|
|
106869
|
-
font.size = { height: size, width: size };
|
|
106870
|
-
return new TextEffects5({
|
|
106871
|
-
font,
|
|
106872
|
-
hiddenText: hide
|
|
106873
|
-
});
|
|
106874
|
-
}
|
|
106875
|
-
getOutput() {
|
|
106876
|
-
if (!this.ctx.kicadSch) {
|
|
106877
|
-
throw new Error("kicadSch is not initialized");
|
|
106878
|
-
}
|
|
106879
|
-
return this.ctx.kicadSch;
|
|
106880
|
-
}
|
|
106881
|
-
};
|
|
106882
107024
|
var DEFAULT_LINE_WIDTH_MM = 0.254;
|
|
106883
107025
|
var AddSchematicTracesStage = class extends ConverterStage {
|
|
106884
107026
|
_step() {
|
|
@@ -106912,11 +107054,11 @@ var AddSchematicTracesStage = class extends ConverterStage {
|
|
|
106912
107054
|
if (!this.ctx.c2kMatSch) {
|
|
106913
107055
|
throw new Error("Schematic transformation matrix not initialized in context");
|
|
106914
107056
|
}
|
|
106915
|
-
const from =
|
|
107057
|
+
const from = applyToPoint8(this.ctx.c2kMatSch, {
|
|
106916
107058
|
x: edge.from.x,
|
|
106917
107059
|
y: edge.from.y
|
|
106918
107060
|
});
|
|
106919
|
-
const to =
|
|
107061
|
+
const to = applyToPoint8(this.ctx.c2kMatSch, {
|
|
106920
107062
|
x: edge.to.x,
|
|
106921
107063
|
y: edge.to.y
|
|
106922
107064
|
});
|
|
@@ -106924,9 +107066,9 @@ var AddSchematicTracesStage = class extends ConverterStage {
|
|
|
106924
107066
|
const y1 = from.y;
|
|
106925
107067
|
const x2 = to.x;
|
|
106926
107068
|
const y2 = to.y;
|
|
106927
|
-
const pts = new
|
|
107069
|
+
const pts = new Pts3([new Xy3(x1, y1), new Xy3(x2, y2)]);
|
|
106928
107070
|
wire.points = pts;
|
|
106929
|
-
const stroke = new
|
|
107071
|
+
const stroke = new Stroke4;
|
|
106930
107072
|
stroke.width = DEFAULT_LINE_WIDTH_MM;
|
|
106931
107073
|
stroke.type = "default";
|
|
106932
107074
|
wire.stroke = stroke;
|
|
@@ -106937,7 +107079,7 @@ var AddSchematicTracesStage = class extends ConverterStage {
|
|
|
106937
107079
|
if (!this.ctx.c2kMatSch) {
|
|
106938
107080
|
throw new Error("Schematic transformation matrix not initialized in context");
|
|
106939
107081
|
}
|
|
106940
|
-
const { x, y } =
|
|
107082
|
+
const { x, y } = applyToPoint8(this.ctx.c2kMatSch, {
|
|
106941
107083
|
x: junction.x,
|
|
106942
107084
|
y: junction.y
|
|
106943
107085
|
});
|
|
@@ -106972,68 +107114,23 @@ var AddSheetInstancesStage = class extends ConverterStage {
|
|
|
106972
107114
|
return this.ctx.kicadSch;
|
|
106973
107115
|
}
|
|
106974
107116
|
};
|
|
106975
|
-
|
|
106976
|
-
|
|
106977
|
-
|
|
106978
|
-
|
|
106979
|
-
|
|
106980
|
-
let maxX = -Infinity;
|
|
106981
|
-
let maxY = -Infinity;
|
|
106982
|
-
for (const component of schematicComponents) {
|
|
106983
|
-
const width = component.size?.width ?? 0;
|
|
106984
|
-
const height = component.size?.height ?? 0;
|
|
106985
|
-
minX = Math.min(minX, component.center.x - width / 2);
|
|
106986
|
-
minY = Math.min(minY, component.center.y - height / 2);
|
|
106987
|
-
maxX = Math.max(maxX, component.center.x + width / 2);
|
|
106988
|
-
maxY = Math.max(maxY, component.center.y + height / 2);
|
|
106989
|
-
}
|
|
106990
|
-
for (const trace of schematicTraces) {
|
|
106991
|
-
for (const edge of trace.edges) {
|
|
106992
|
-
minX = Math.min(minX, edge.from.x, edge.to.x);
|
|
106993
|
-
minY = Math.min(minY, edge.from.y, edge.to.y);
|
|
106994
|
-
maxX = Math.max(maxX, edge.from.x, edge.to.x);
|
|
106995
|
-
maxY = Math.max(maxY, edge.from.y, edge.to.y);
|
|
107117
|
+
var InitializeSchematicStage = class extends ConverterStage {
|
|
107118
|
+
_step() {
|
|
107119
|
+
const { kicadSch, schematicPaperSize } = this.ctx;
|
|
107120
|
+
if (!kicadSch) {
|
|
107121
|
+
throw new Error("KicadSch instance not initialized in context");
|
|
106996
107122
|
}
|
|
107123
|
+
kicadSch.version = 20250114;
|
|
107124
|
+
const paper = new Paper;
|
|
107125
|
+
paper.size = schematicPaperSize?.name ?? "A4";
|
|
107126
|
+
kicadSch.paper = paper;
|
|
107127
|
+
kicadSch.uuid = new Uuid4(crypto.randomUUID());
|
|
107128
|
+
this.finished = true;
|
|
106997
107129
|
}
|
|
106998
|
-
|
|
106999
|
-
|
|
107000
|
-
minY = 0;
|
|
107001
|
-
maxX = 0;
|
|
107002
|
-
maxY = 0;
|
|
107003
|
-
}
|
|
107004
|
-
const centerX = (minX + maxX) / 2;
|
|
107005
|
-
const centerY = (minY + maxY) / 2;
|
|
107006
|
-
return {
|
|
107007
|
-
center: {
|
|
107008
|
-
x: centerX,
|
|
107009
|
-
y: centerY
|
|
107010
|
-
},
|
|
107011
|
-
bounds: {
|
|
107012
|
-
minX,
|
|
107013
|
-
minY,
|
|
107014
|
-
maxX,
|
|
107015
|
-
maxY
|
|
107016
|
-
}
|
|
107017
|
-
};
|
|
107018
|
-
}
|
|
107019
|
-
var PAPER_SIZES = [
|
|
107020
|
-
{ name: "A4", width: 297, height: 210 },
|
|
107021
|
-
{ name: "A3", width: 420, height: 297 },
|
|
107022
|
-
{ name: "A2", width: 594, height: 420 },
|
|
107023
|
-
{ name: "A1", width: 841, height: 594 },
|
|
107024
|
-
{ name: "A0", width: 1189, height: 841 }
|
|
107025
|
-
];
|
|
107026
|
-
function selectSchematicPaperSize(contentWidth, contentHeight, paddingMm = 20) {
|
|
107027
|
-
const requiredWidth = contentWidth + 2 * paddingMm;
|
|
107028
|
-
const requiredHeight = contentHeight + 2 * paddingMm;
|
|
107029
|
-
for (let i = 0;i < PAPER_SIZES.length; i++) {
|
|
107030
|
-
const paperSize = PAPER_SIZES[i];
|
|
107031
|
-
if (requiredWidth <= paperSize.width && requiredHeight <= paperSize.height) {
|
|
107032
|
-
return paperSize;
|
|
107033
|
-
}
|
|
107130
|
+
getOutput() {
|
|
107131
|
+
return this.ctx.kicadSch;
|
|
107034
107132
|
}
|
|
107035
|
-
|
|
107036
|
-
}
|
|
107133
|
+
};
|
|
107037
107134
|
var DEFAULT_SCHEMATIC_SCALE_FACTOR = 15;
|
|
107038
107135
|
var CircuitJsonToKicadSchConverter = class {
|
|
107039
107136
|
ctx;
|
|
@@ -107069,6 +107166,7 @@ var CircuitJsonToKicadSchConverter = class {
|
|
|
107069
107166
|
new AddSchematicSymbolsStage(circuitJson, this.ctx),
|
|
107070
107167
|
new AddSchematicNetLabelsStage(circuitJson, this.ctx),
|
|
107071
107168
|
new AddSchematicTracesStage(circuitJson, this.ctx),
|
|
107169
|
+
new AddSchematicGraphicsStage(circuitJson, this.ctx),
|
|
107072
107170
|
new AddSheetInstancesStage(circuitJson, this.ctx)
|
|
107073
107171
|
];
|
|
107074
107172
|
}
|
|
@@ -107153,8 +107251,8 @@ var getCopperPourNetInfo = (pour, ctx) => {
|
|
|
107153
107251
|
};
|
|
107154
107252
|
var convertPointsToKicadXy = (points, c2kMatPcb) => {
|
|
107155
107253
|
return (points ?? []).map((point) => {
|
|
107156
|
-
const transformedPoint =
|
|
107157
|
-
return new
|
|
107254
|
+
const transformedPoint = applyToPoint9(c2kMatPcb, point);
|
|
107255
|
+
return new Xy4(transformedPoint.x, transformedPoint.y);
|
|
107158
107256
|
});
|
|
107159
107257
|
};
|
|
107160
107258
|
var rotateRingToStartAtTopRight = (points) => {
|
|
@@ -107202,7 +107300,7 @@ var getRectRingPoints = (pour, c2kMatPcb) => {
|
|
|
107202
107300
|
{ x: halfWidth, y: -halfHeight },
|
|
107203
107301
|
{ x: halfWidth, y: halfHeight },
|
|
107204
107302
|
{ x: -halfWidth, y: halfHeight }
|
|
107205
|
-
].map((corner) =>
|
|
107303
|
+
].map((corner) => applyToPoint9(cornerTransform, corner));
|
|
107206
107304
|
return convertPointsToKicadXy(corners, c2kMatPcb);
|
|
107207
107305
|
};
|
|
107208
107306
|
var getPolygonRingPoints = (pour, c2kMatPcb) => removeRepeatedClosingPoint(removeConsecutiveDuplicatePoints(rotateRingToStartAtTopRight(convertPointsToKicadXy(pour.points, c2kMatPcb))));
|
|
@@ -107226,12 +107324,12 @@ var getCopperPourZoneRings = (pour, c2kMatPcb) => {
|
|
|
107226
107324
|
var createZonePolygons = (outerRing, innerRings) => {
|
|
107227
107325
|
const polygons = [];
|
|
107228
107326
|
if (outerRing.length >= 3) {
|
|
107229
|
-
polygons.push(new ZonePolygon(new
|
|
107327
|
+
polygons.push(new ZonePolygon(new Pts4(outerRing)));
|
|
107230
107328
|
}
|
|
107231
107329
|
for (const innerRing of innerRings) {
|
|
107232
107330
|
if (innerRing.length < 3)
|
|
107233
107331
|
continue;
|
|
107234
|
-
polygons.push(new ZonePolygon(new
|
|
107332
|
+
polygons.push(new ZonePolygon(new Pts4(innerRing)));
|
|
107235
107333
|
}
|
|
107236
107334
|
return polygons;
|
|
107237
107335
|
};
|
|
@@ -107245,7 +107343,7 @@ var createZoneFilledPolygons = (outerRing, innerRings, kicadLayer) => {
|
|
|
107245
107343
|
return [
|
|
107246
107344
|
new ZoneFilledPolygon({
|
|
107247
107345
|
layer,
|
|
107248
|
-
pts: new
|
|
107346
|
+
pts: new Pts4(outerRing)
|
|
107249
107347
|
})
|
|
107250
107348
|
];
|
|
107251
107349
|
}
|
|
@@ -107273,14 +107371,14 @@ var createZoneFilledPolygons = (outerRing, innerRings, kicadLayer) => {
|
|
|
107273
107371
|
const y = flattenedPoints[pointOffset + 1];
|
|
107274
107372
|
if (x === undefined || y === undefined)
|
|
107275
107373
|
continue;
|
|
107276
|
-
trianglePoints.push(new
|
|
107374
|
+
trianglePoints.push(new Xy4(x, y));
|
|
107277
107375
|
}
|
|
107278
107376
|
if (trianglePoints.length !== 3 || getTriangleArea(trianglePoints[0], trianglePoints[1], trianglePoints[2]) === 0) {
|
|
107279
107377
|
continue;
|
|
107280
107378
|
}
|
|
107281
107379
|
filledPolygons.push(new ZoneFilledPolygon({
|
|
107282
107380
|
layer,
|
|
107283
|
-
pts: new
|
|
107381
|
+
pts: new Pts4(trianglePoints)
|
|
107284
107382
|
}));
|
|
107285
107383
|
}
|
|
107286
107384
|
return filledPolygons;
|
|
@@ -107526,10 +107624,10 @@ var ExtractFootprintsStage = class extends ConverterStage {
|
|
|
107526
107624
|
footprint.path = undefined;
|
|
107527
107625
|
footprint.sheetfile = undefined;
|
|
107528
107626
|
footprint.sheetname = undefined;
|
|
107529
|
-
const defaultFont = new
|
|
107627
|
+
const defaultFont = new TextEffectsFont7;
|
|
107530
107628
|
defaultFont.size = { width: 1.27, height: 1.27 };
|
|
107531
107629
|
defaultFont.thickness = 0.15;
|
|
107532
|
-
const defaultEffects = new
|
|
107630
|
+
const defaultEffects = new TextEffects7({ font: defaultFont });
|
|
107533
107631
|
const fpPads = footprint.fpPads ?? [];
|
|
107534
107632
|
let minY = 0;
|
|
107535
107633
|
let maxY = 0;
|
|
@@ -107645,7 +107743,7 @@ var ExtractFootprintsStage = class extends ConverterStage {
|
|
|
107645
107743
|
}
|
|
107646
107744
|
};
|
|
107647
107745
|
function createTextEffects2(metadataEffects) {
|
|
107648
|
-
const font = new
|
|
107746
|
+
const font = new TextEffectsFont8;
|
|
107649
107747
|
if (metadataEffects?.font?.size) {
|
|
107650
107748
|
font.size = {
|
|
107651
107749
|
width: Number(metadataEffects.font.size.x),
|
|
@@ -107659,7 +107757,7 @@ function createTextEffects2(metadataEffects) {
|
|
|
107659
107757
|
} else {
|
|
107660
107758
|
font.thickness = 0.15;
|
|
107661
107759
|
}
|
|
107662
|
-
return new
|
|
107760
|
+
return new TextEffects8({ font });
|
|
107663
107761
|
}
|
|
107664
107762
|
function applyMetadataToFootprint({
|
|
107665
107763
|
footprint,
|
|
@@ -107874,7 +107972,7 @@ function convertSilkscreenCircles(silkscreenCircles, componentCenter) {
|
|
|
107874
107972
|
center: { x: relX, y: relY },
|
|
107875
107973
|
end: { x: relX + circle.radius, y: relY },
|
|
107876
107974
|
layer: kicadLayer,
|
|
107877
|
-
stroke: new
|
|
107975
|
+
stroke: new Stroke5,
|
|
107878
107976
|
fill: false
|
|
107879
107977
|
});
|
|
107880
107978
|
if (fpCircle.stroke) {
|
|
@@ -107899,7 +107997,7 @@ function convertCourtyardCircles(courtyardCircles, componentCenter) {
|
|
|
107899
107997
|
center: { x: relX, y: relY },
|
|
107900
107998
|
end: { x: relX + circle.radius, y: relY },
|
|
107901
107999
|
layer: kicadLayer,
|
|
107902
|
-
stroke: new
|
|
108000
|
+
stroke: new Stroke6,
|
|
107903
108001
|
fill: false
|
|
107904
108002
|
});
|
|
107905
108003
|
if (fpCircle.stroke) {
|
|
@@ -107926,7 +108024,7 @@ function convertFabricationNoteRects(fabRects, componentCenter) {
|
|
|
107926
108024
|
start: { x: relX - halfW, y: relY - halfH },
|
|
107927
108025
|
end: { x: relX + halfW, y: relY + halfH },
|
|
107928
108026
|
layer: kicadLayer,
|
|
107929
|
-
stroke: new
|
|
108027
|
+
stroke: new Stroke7,
|
|
107930
108028
|
fill: false
|
|
107931
108029
|
});
|
|
107932
108030
|
if (fpRect.stroke) {
|
|
@@ -107949,7 +108047,7 @@ function convertNoteRects(noteRects, componentCenter) {
|
|
|
107949
108047
|
start: { x: relX - halfW, y: relY - halfH },
|
|
107950
108048
|
end: { x: relX + halfW, y: relY + halfH },
|
|
107951
108049
|
layer: kicadLayer,
|
|
107952
|
-
stroke: new
|
|
108050
|
+
stroke: new Stroke8,
|
|
107953
108051
|
fill: false
|
|
107954
108052
|
});
|
|
107955
108053
|
if (fpRect.stroke) {
|
|
@@ -107976,7 +108074,7 @@ function convertCourtyardRects(courtyardRects, componentCenter) {
|
|
|
107976
108074
|
start: { x: relX - halfW, y: relY - halfH },
|
|
107977
108075
|
end: { x: relX + halfW, y: relY + halfH },
|
|
107978
108076
|
layer: kicadLayer,
|
|
107979
|
-
stroke: new
|
|
108077
|
+
stroke: new Stroke9,
|
|
107980
108078
|
fill: false
|
|
107981
108079
|
});
|
|
107982
108080
|
if (fpRect.stroke) {
|
|
@@ -108000,15 +108098,15 @@ function convertCourtyardOutlines(params2) {
|
|
|
108000
108098
|
};
|
|
108001
108099
|
const kicadLayer = layerMap[outline.layer] || "F.CrtYd";
|
|
108002
108100
|
const xyPoints = outline.outline.map((point) => {
|
|
108003
|
-
const transformedPoint =
|
|
108004
|
-
return new
|
|
108101
|
+
const transformedPoint = applyToPoint10(cj2kicadMatrix, point);
|
|
108102
|
+
return new Xy5(transformedPoint.x, transformedPoint.y);
|
|
108005
108103
|
});
|
|
108006
108104
|
const fpPoly = new FpPoly;
|
|
108007
|
-
fpPoly.points = new
|
|
108105
|
+
fpPoly.points = new Pts5(xyPoints);
|
|
108008
108106
|
fpPoly.layer = kicadLayer;
|
|
108009
108107
|
fpPoly.fill = false;
|
|
108010
108108
|
fpPoly.uuid = generateDeterministicUuid(outline.pcb_courtyard_outline_id);
|
|
108011
|
-
const stroke = new
|
|
108109
|
+
const stroke = new Stroke10;
|
|
108012
108110
|
stroke.width = 0.05;
|
|
108013
108111
|
stroke.type = "default";
|
|
108014
108112
|
fpPoly.stroke = stroke;
|
|
@@ -108027,7 +108125,7 @@ function createFpTextFromCircuitJson({
|
|
|
108027
108125
|
const relativeX = textElement.anchor_position.x - componentCenter.x;
|
|
108028
108126
|
const relativeY = -(textElement.anchor_position.y - componentCenter.y);
|
|
108029
108127
|
const rotationMatrix = componentRotation !== 0 ? rotate3(componentRotation * Math.PI / 180) : identity();
|
|
108030
|
-
const rotatedPos =
|
|
108128
|
+
const rotatedPos = applyToPoint11(rotationMatrix, {
|
|
108031
108129
|
x: relativeX,
|
|
108032
108130
|
y: relativeY
|
|
108033
108131
|
});
|
|
@@ -108041,9 +108139,9 @@ function createFpTextFromCircuitJson({
|
|
|
108041
108139
|
};
|
|
108042
108140
|
const kicadLayer = layerMap[textElement.layer] || textElement.layer || "F.SilkS";
|
|
108043
108141
|
const fontSize = (textElement.font_size || 1) / 1.5;
|
|
108044
|
-
const font = new
|
|
108142
|
+
const font = new TextEffectsFont9;
|
|
108045
108143
|
font.size = { width: fontSize, height: fontSize };
|
|
108046
|
-
const textEffects = new
|
|
108144
|
+
const textEffects = new TextEffects9({
|
|
108047
108145
|
font
|
|
108048
108146
|
});
|
|
108049
108147
|
const rotation = textElement.ccw_rotation || 0;
|
|
@@ -108098,11 +108196,11 @@ function convertSilkscreenPaths(silkscreenPaths, { componentCenter, componentRot
|
|
|
108098
108196
|
const endPoint = path16.route[i + 1];
|
|
108099
108197
|
if (!startPoint || !endPoint)
|
|
108100
108198
|
continue;
|
|
108101
|
-
const startRelative =
|
|
108199
|
+
const startRelative = applyToPoint12(rotationMatrix, {
|
|
108102
108200
|
x: startPoint.x - componentCenter.x,
|
|
108103
108201
|
y: -(startPoint.y - componentCenter.y)
|
|
108104
108202
|
});
|
|
108105
|
-
const endRelative =
|
|
108203
|
+
const endRelative = applyToPoint12(rotationMatrix, {
|
|
108106
108204
|
x: endPoint.x - componentCenter.x,
|
|
108107
108205
|
y: -(endPoint.y - componentCenter.y)
|
|
108108
108206
|
});
|
|
@@ -108110,7 +108208,7 @@ function convertSilkscreenPaths(silkscreenPaths, { componentCenter, componentRot
|
|
|
108110
108208
|
start: { x: startRelative.x, y: startRelative.y },
|
|
108111
108209
|
end: { x: endRelative.x, y: endRelative.y },
|
|
108112
108210
|
layer: kicadLayer,
|
|
108113
|
-
stroke: new
|
|
108211
|
+
stroke: new Stroke11
|
|
108114
108212
|
});
|
|
108115
108213
|
if (fpLine.stroke) {
|
|
108116
108214
|
fpLine.stroke.width = path16.stroke_width || 0.15;
|
|
@@ -108128,11 +108226,11 @@ function convertNoteTexts(params2) {
|
|
|
108128
108226
|
const relX = textElement.anchor_position.x - componentCenter.x;
|
|
108129
108227
|
const relY = -(textElement.anchor_position.y - componentCenter.y);
|
|
108130
108228
|
const rotationMatrix = componentRotation !== 0 ? rotate5(componentRotation * Math.PI / 180) : identity3();
|
|
108131
|
-
const rotatedPos =
|
|
108229
|
+
const rotatedPos = applyToPoint13(rotationMatrix, { x: relX, y: relY });
|
|
108132
108230
|
const fontSize = textElement.font_size || 1;
|
|
108133
|
-
const font = new
|
|
108231
|
+
const font = new TextEffectsFont10;
|
|
108134
108232
|
font.size = { width: fontSize, height: fontSize };
|
|
108135
|
-
const textEffects = new
|
|
108233
|
+
const textEffects = new TextEffects10({ font });
|
|
108136
108234
|
const fpText = new FpText3({
|
|
108137
108235
|
type: "user",
|
|
108138
108236
|
text: textElement.text,
|
|
@@ -108195,7 +108293,7 @@ function createSmdPadFromCircuitJson({
|
|
|
108195
108293
|
throw new Error("Pad must have either x/y coordinates or points array");
|
|
108196
108294
|
}
|
|
108197
108295
|
const cj2kicadMatrix = compose5(componentRotation !== 0 ? rotate6(componentRotation * Math.PI / 180) : { a: 1, b: 0, c: 0, d: 1, e: 0, f: 0 }, scale3(1, -1), translate5(-componentCenter.x, -componentCenter.y));
|
|
108198
|
-
const rotatedPos =
|
|
108296
|
+
const rotatedPos = applyToPoint14(cj2kicadMatrix, {
|
|
108199
108297
|
x: padX,
|
|
108200
108298
|
y: padY
|
|
108201
108299
|
});
|
|
@@ -108220,11 +108318,11 @@ function createSmdPadFromCircuitJson({
|
|
|
108220
108318
|
const points = pcbPad.points;
|
|
108221
108319
|
const pointTransformMatrix = compose5(scale3(1, -1), translate5(-padX, -padY));
|
|
108222
108320
|
const relativePoints = points.map((p) => {
|
|
108223
|
-
const transformed =
|
|
108224
|
-
return new
|
|
108321
|
+
const transformed = applyToPoint14(pointTransformMatrix, { x: p.x, y: p.y });
|
|
108322
|
+
return new Xy6(transformed.x, transformed.y);
|
|
108225
108323
|
});
|
|
108226
108324
|
const grPoly = new PadPrimitiveGrPoly;
|
|
108227
|
-
grPoly.contours = [new
|
|
108325
|
+
grPoly.contours = [new Pts6(relativePoints)];
|
|
108228
108326
|
grPoly.width = 0;
|
|
108229
108327
|
grPoly.filled = true;
|
|
108230
108328
|
padPrimitives = new PadPrimitives;
|
|
@@ -108333,7 +108431,7 @@ function createThruHolePadFromCircuitJson({
|
|
|
108333
108431
|
const relativeX = platedHole.x - componentCenter.x;
|
|
108334
108432
|
const relativeY = -(platedHole.y - componentCenter.y);
|
|
108335
108433
|
const rotationMatrix = componentRotation !== 0 ? rotate7(componentRotation * Math.PI / 180) : identity4();
|
|
108336
|
-
const rotatedPos =
|
|
108434
|
+
const rotatedPos = applyToPoint15(rotationMatrix, {
|
|
108337
108435
|
x: relativeX,
|
|
108338
108436
|
y: relativeY
|
|
108339
108437
|
});
|
|
@@ -108349,7 +108447,7 @@ function createThruHolePadFromCircuitJson({
|
|
|
108349
108447
|
y: platedHole.hole_offset_y ?? 0
|
|
108350
108448
|
};
|
|
108351
108449
|
if (rawOffset.x !== 0 || rawOffset.y !== 0) {
|
|
108352
|
-
const rotatedOffset =
|
|
108450
|
+
const rotatedOffset = applyToPoint15(rotationMatrix, {
|
|
108353
108451
|
x: -rawOffset.x,
|
|
108354
108452
|
y: rawOffset.y
|
|
108355
108453
|
});
|
|
@@ -108465,7 +108563,7 @@ function createNpthPadFromCircuitJson({
|
|
|
108465
108563
|
const relativeX = pcbHole.x - componentCenter.x;
|
|
108466
108564
|
const relativeY = -(pcbHole.y - componentCenter.y);
|
|
108467
108565
|
const rotationMatrix = componentRotation !== 0 ? rotate8(componentRotation * Math.PI / 180) : identity5();
|
|
108468
|
-
const rotatedPos =
|
|
108566
|
+
const rotatedPos = applyToPoint16(rotationMatrix, {
|
|
108469
108567
|
x: relativeX,
|
|
108470
108568
|
y: relativeY
|
|
108471
108569
|
});
|
|
@@ -108580,7 +108678,7 @@ var AddFootprintsStage = class extends ConverterStage {
|
|
|
108580
108678
|
const sourceComponent = component.source_component_id ? this.ctx.db.source_component.get(component.source_component_id) : null;
|
|
108581
108679
|
const cadComponent = this.getCadComponentForPcbComponent(component.pcb_component_id);
|
|
108582
108680
|
const footprintName = sourceComponent ? getKicadCompatibleComponentName(sourceComponent, cadComponent) : "Unknown";
|
|
108583
|
-
const transformedPos =
|
|
108681
|
+
const transformedPos = applyToPoint17(c2kMatPcb, {
|
|
108584
108682
|
x: component.center.x,
|
|
108585
108683
|
y: component.center.y
|
|
108586
108684
|
});
|
|
@@ -108791,8 +108889,8 @@ var AddTracesStage = class extends ConverterStage {
|
|
|
108791
108889
|
if (!startPosition || !endPosition) {
|
|
108792
108890
|
throw new Error(`Unable to convert pcb_trace route segment ${trace.pcb_trace_id ?? this.tracesProcessed}:${i} to KiCad segment`);
|
|
108793
108891
|
}
|
|
108794
|
-
const transformedStart =
|
|
108795
|
-
const transformedEnd =
|
|
108892
|
+
const transformedStart = applyToPoint18(c2kMatPcb, startPosition);
|
|
108893
|
+
const transformedEnd = applyToPoint18(c2kMatPcb, endPosition);
|
|
108796
108894
|
if (transformedStart.x === transformedEnd.x && transformedStart.y === transformedEnd.y) {
|
|
108797
108895
|
continue;
|
|
108798
108896
|
}
|
|
@@ -108917,7 +109015,7 @@ var AddViasStage = class extends ConverterStage {
|
|
|
108917
109015
|
this.finished = true;
|
|
108918
109016
|
return;
|
|
108919
109017
|
}
|
|
108920
|
-
const transformedPos =
|
|
109018
|
+
const transformedPos = applyToPoint19(c2kMatPcb, {
|
|
108921
109019
|
x: via.x,
|
|
108922
109020
|
y: via.y
|
|
108923
109021
|
});
|
|
@@ -109013,7 +109111,7 @@ var AddStandalonePcbElements = class extends ConverterStage {
|
|
|
109013
109111
|
const pcbPad = elm;
|
|
109014
109112
|
const padCenter = this.getPcbSmtPadCenter(pcbPad);
|
|
109015
109113
|
const footprintSeed = `standalone_smtpad:${pcbPad.pcb_smtpad_id}:${padCenter.x},${padCenter.y}`;
|
|
109016
|
-
const kicadPos =
|
|
109114
|
+
const kicadPos = applyToPoint20(c2kMatPcb, padCenter);
|
|
109017
109115
|
const footprint = new Footprint4({
|
|
109018
109116
|
libraryLink: this.getSmtPadLibraryLink(pcbPad),
|
|
109019
109117
|
layer: "F.Cu",
|
|
@@ -109035,7 +109133,7 @@ var AddStandalonePcbElements = class extends ConverterStage {
|
|
|
109035
109133
|
} else if (elm.type === "pcb_hole") {
|
|
109036
109134
|
const hole = elm;
|
|
109037
109135
|
const footprintSeed = `standalone_hole:${hole.pcb_hole_id}:${hole.x},${hole.y}`;
|
|
109038
|
-
const kicadPos =
|
|
109136
|
+
const kicadPos = applyToPoint20(c2kMatPcb, { x: hole.x, y: hole.y });
|
|
109039
109137
|
const libraryLink = this.getHoleLibraryLink(hole);
|
|
109040
109138
|
const footprint = new Footprint4({
|
|
109041
109139
|
libraryLink,
|
|
@@ -109058,7 +109156,7 @@ var AddStandalonePcbElements = class extends ConverterStage {
|
|
|
109058
109156
|
} else if (elm.type === "pcb_plated_hole") {
|
|
109059
109157
|
const hole = elm;
|
|
109060
109158
|
const footprintSeed = `standalone_plated_hole:${hole.pcb_plated_hole_id}:${hole.x},${hole.y}`;
|
|
109061
|
-
const kicadPos =
|
|
109159
|
+
const kicadPos = applyToPoint20(c2kMatPcb, { x: hole.x, y: hole.y });
|
|
109062
109160
|
const libraryLink = this.getPlatedHoleLibraryLink(hole);
|
|
109063
109161
|
const footprint = new Footprint4({
|
|
109064
109162
|
libraryLink,
|
|
@@ -109155,7 +109253,7 @@ function createFabricationNoteTextFromCircuitJson({
|
|
|
109155
109253
|
if (!textElement.text || !textElement.anchor_position) {
|
|
109156
109254
|
return null;
|
|
109157
109255
|
}
|
|
109158
|
-
const transformedPos =
|
|
109256
|
+
const transformedPos = applyToPoint21(c2kMatPcb, {
|
|
109159
109257
|
x: textElement.anchor_position.x,
|
|
109160
109258
|
y: textElement.anchor_position.y
|
|
109161
109259
|
});
|
|
@@ -109165,7 +109263,7 @@ function createFabricationNoteTextFromCircuitJson({
|
|
|
109165
109263
|
};
|
|
109166
109264
|
const kicadLayer = layerMap[textElement.layer] || textElement.layer || "F.Fab";
|
|
109167
109265
|
const fontSize = (textElement.font_size || 1) / 1.5;
|
|
109168
|
-
const font = new
|
|
109266
|
+
const font = new TextEffectsFont11;
|
|
109169
109267
|
font.size = { width: fontSize, height: fontSize };
|
|
109170
109268
|
const justify = new TextEffectsJustify3;
|
|
109171
109269
|
const anchorAlignment = textElement.anchor_alignment || "center";
|
|
@@ -109189,7 +109287,7 @@ function createFabricationNoteTextFromCircuitJson({
|
|
|
109189
109287
|
case "center":
|
|
109190
109288
|
break;
|
|
109191
109289
|
}
|
|
109192
|
-
const textEffects = new
|
|
109290
|
+
const textEffects = new TextEffects11({
|
|
109193
109291
|
font
|
|
109194
109292
|
});
|
|
109195
109293
|
if (anchorAlignment !== "center") {
|
|
@@ -109212,7 +109310,7 @@ function createGrTextFromCircuitJson({
|
|
|
109212
109310
|
if (!textElement.text || !textElement.anchor_position) {
|
|
109213
109311
|
return null;
|
|
109214
109312
|
}
|
|
109215
|
-
const transformedPos =
|
|
109313
|
+
const transformedPos = applyToPoint22(c2kMatPcb, {
|
|
109216
109314
|
x: textElement.anchor_position.x,
|
|
109217
109315
|
y: textElement.anchor_position.y
|
|
109218
109316
|
});
|
|
@@ -109222,7 +109320,7 @@ function createGrTextFromCircuitJson({
|
|
|
109222
109320
|
};
|
|
109223
109321
|
const kicadLayer = layerMap[textElement.layer] || textElement.layer || "F.SilkS";
|
|
109224
109322
|
const fontSize = (textElement.font_size || 1) / 1.5;
|
|
109225
|
-
const font = new
|
|
109323
|
+
const font = new TextEffectsFont12;
|
|
109226
109324
|
font.size = { width: fontSize, height: fontSize };
|
|
109227
109325
|
const justify = new TextEffectsJustify4;
|
|
109228
109326
|
const anchorAlignment = textElement.anchor_alignment || "center";
|
|
@@ -109246,7 +109344,7 @@ function createGrTextFromCircuitJson({
|
|
|
109246
109344
|
case "center":
|
|
109247
109345
|
break;
|
|
109248
109346
|
}
|
|
109249
|
-
const textEffects = new
|
|
109347
|
+
const textEffects = new TextEffects12({
|
|
109250
109348
|
font
|
|
109251
109349
|
});
|
|
109252
109350
|
if (anchorAlignment !== "center") {
|
|
@@ -109296,7 +109394,7 @@ var appendGraphicPoly = (kicadPcb, grPoly) => {
|
|
|
109296
109394
|
var rotatePointAroundOrigin = (point, rotationDegrees = 0) => {
|
|
109297
109395
|
if (!rotationDegrees)
|
|
109298
109396
|
return point;
|
|
109299
|
-
return
|
|
109397
|
+
return applyToPoint23(rotate9(rotationDegrees * Math.PI / 180), point);
|
|
109300
109398
|
};
|
|
109301
109399
|
var getRectCutoutCorners = (cutout) => {
|
|
109302
109400
|
const halfWidth = cutout.width / 2;
|
|
@@ -109333,11 +109431,11 @@ var AddGraphicsStage = class extends ConverterStage {
|
|
|
109333
109431
|
const endPoint = path16.route[i + 1];
|
|
109334
109432
|
if (!startPoint || !endPoint)
|
|
109335
109433
|
continue;
|
|
109336
|
-
const transformedStart =
|
|
109434
|
+
const transformedStart = applyToPoint23(c2kMatPcb, {
|
|
109337
109435
|
x: startPoint.x,
|
|
109338
109436
|
y: startPoint.y
|
|
109339
109437
|
});
|
|
109340
|
-
const transformedEnd =
|
|
109438
|
+
const transformedEnd = applyToPoint23(c2kMatPcb, {
|
|
109341
109439
|
x: endPoint.x,
|
|
109342
109440
|
y: endPoint.y
|
|
109343
109441
|
});
|
|
@@ -109399,7 +109497,7 @@ var AddGraphicsStage = class extends ConverterStage {
|
|
|
109399
109497
|
{ x: board.center.x - halfWidth, y: board.center.y + halfHeight }
|
|
109400
109498
|
];
|
|
109401
109499
|
}
|
|
109402
|
-
const transformedCorners = corners.map((corner) =>
|
|
109500
|
+
const transformedCorners = corners.map((corner) => applyToPoint23(c2kMatPcb, corner));
|
|
109403
109501
|
if (transformedCorners.length < 2) {
|
|
109404
109502
|
this.finished = true;
|
|
109405
109503
|
return;
|
|
@@ -109423,8 +109521,8 @@ var AddGraphicsStage = class extends ConverterStage {
|
|
|
109423
109521
|
const pcbCutouts = this.ctx.db.pcb_cutout?.list() || [];
|
|
109424
109522
|
for (const cutout of pcbCutouts) {
|
|
109425
109523
|
if (cutout.shape === "circle") {
|
|
109426
|
-
const transformedCenter =
|
|
109427
|
-
const transformedEnd =
|
|
109524
|
+
const transformedCenter = applyToPoint23(c2kMatPcb, cutout.center);
|
|
109525
|
+
const transformedEnd = applyToPoint23(c2kMatPcb, {
|
|
109428
109526
|
x: cutout.center.x + cutout.radius,
|
|
109429
109527
|
y: cutout.center.y
|
|
109430
109528
|
});
|
|
@@ -109439,7 +109537,7 @@ var AddGraphicsStage = class extends ConverterStage {
|
|
|
109439
109537
|
if (corners.length < 3)
|
|
109440
109538
|
continue;
|
|
109441
109539
|
appendGraphicPoly(kicadPcb, new GrPoly({
|
|
109442
|
-
points: corners.map((point) =>
|
|
109540
|
+
points: corners.map((point) => applyToPoint23(c2kMatPcb, point)),
|
|
109443
109541
|
layer: "Edge.Cuts",
|
|
109444
109542
|
width: EDGE_CUTS_WIDTH,
|
|
109445
109543
|
fill: false
|
|
@@ -109449,7 +109547,7 @@ var AddGraphicsStage = class extends ConverterStage {
|
|
|
109449
109547
|
if (corners.length < 3)
|
|
109450
109548
|
continue;
|
|
109451
109549
|
appendGraphicPoly(kicadPcb, new GrPoly({
|
|
109452
|
-
points: corners.map((point) =>
|
|
109550
|
+
points: corners.map((point) => applyToPoint23(c2kMatPcb, point)),
|
|
109453
109551
|
layer: "Edge.Cuts",
|
|
109454
109552
|
width: EDGE_CUTS_WIDTH,
|
|
109455
109553
|
fill: false
|
|
@@ -109462,8 +109560,8 @@ var AddGraphicsStage = class extends ConverterStage {
|
|
|
109462
109560
|
const endPoint = cutout.route[i + 1];
|
|
109463
109561
|
if (!startPoint || !endPoint)
|
|
109464
109562
|
continue;
|
|
109465
|
-
const transformedStart =
|
|
109466
|
-
const transformedEnd =
|
|
109563
|
+
const transformedStart = applyToPoint23(c2kMatPcb, startPoint);
|
|
109564
|
+
const transformedEnd = applyToPoint23(c2kMatPcb, endPoint);
|
|
109467
109565
|
appendGraphicLine(kicadPcb, new GrLine({
|
|
109468
109566
|
start: transformedStart,
|
|
109469
109567
|
end: transformedEnd,
|
|
@@ -109980,7 +110078,7 @@ function renameKicadFootprint(params2) {
|
|
|
109980
110078
|
};
|
|
109981
110079
|
}
|
|
109982
110080
|
function createTextEffects3(metadataEffects) {
|
|
109983
|
-
const font = new
|
|
110081
|
+
const font = new TextEffectsFont13;
|
|
109984
110082
|
if (metadataEffects?.font?.size) {
|
|
109985
110083
|
font.size = {
|
|
109986
110084
|
width: Number(metadataEffects.font.size.x),
|
|
@@ -109994,7 +110092,7 @@ function createTextEffects3(metadataEffects) {
|
|
|
109994
110092
|
} else {
|
|
109995
110093
|
font.thickness = 0.15;
|
|
109996
110094
|
}
|
|
109997
|
-
return new
|
|
110095
|
+
return new TextEffects13({ font });
|
|
109998
110096
|
}
|
|
109999
110097
|
function applyKicadFootprintMetadata(kicadModString, metadata, footprintName) {
|
|
110000
110098
|
try {
|
|
@@ -110236,13 +110334,13 @@ var toNumber = (value, fallback) => {
|
|
|
110236
110334
|
var createTextEffects4 = (effectsMeta, fallback) => {
|
|
110237
110335
|
if (!effectsMeta)
|
|
110238
110336
|
return fallback;
|
|
110239
|
-
const effects = new
|
|
110337
|
+
const effects = new TextEffects14({
|
|
110240
110338
|
font: fallback?.font,
|
|
110241
110339
|
justify: fallback?.justify,
|
|
110242
110340
|
hiddenText: fallback?.hiddenText ?? false
|
|
110243
110341
|
});
|
|
110244
110342
|
if (!effects.font) {
|
|
110245
|
-
const defaultFont = new
|
|
110343
|
+
const defaultFont = new TextEffectsFont14;
|
|
110246
110344
|
defaultFont.size = { width: DEFAULT_TEXT_SIZE, height: DEFAULT_TEXT_SIZE };
|
|
110247
110345
|
effects.font = defaultFont;
|
|
110248
110346
|
}
|
|
@@ -205893,7 +205991,7 @@ function rectanglePolygon({
|
|
|
205893
205991
|
if (rotationDeg) {
|
|
205894
205992
|
const matrix2 = rotateDEG(rotationDeg, cx2, cy2);
|
|
205895
205993
|
const rotatedCorners = corners.map((pt3) => {
|
|
205896
|
-
const p3 =
|
|
205994
|
+
const p3 = applyToPoint24(matrix2, { x: pt3.x, y: pt3.y });
|
|
205897
205995
|
return new Point$3(p3.x, p3.y);
|
|
205898
205996
|
});
|
|
205899
205997
|
poly = new Polygon$1(rotatedCorners);
|
|
@@ -205958,7 +206056,7 @@ function computeOverlapDistance(compPoly, boardPoly, componentCenter, componentW
|
|
|
205958
206056
|
}
|
|
205959
206057
|
const matrix2 = rotateDEG(rotationDeg, componentCenter.x, componentCenter.y);
|
|
205960
206058
|
const rotatePoint32 = (pt3) => {
|
|
205961
|
-
const p3 =
|
|
206059
|
+
const p3 = applyToPoint24(matrix2, pt3);
|
|
205962
206060
|
return new Point$3(p3.x, p3.y);
|
|
205963
206061
|
};
|
|
205964
206062
|
const rotatedPoints = corners.concat(midpoints).map(rotatePoint32);
|
|
@@ -222890,7 +222988,7 @@ __export32(components_exports, {
|
|
|
222890
222988
|
SchematicRect: () => SchematicRect,
|
|
222891
222989
|
SchematicRow: () => SchematicRow,
|
|
222892
222990
|
SchematicTable: () => SchematicTable,
|
|
222893
|
-
SchematicText: () =>
|
|
222991
|
+
SchematicText: () => SchematicText2,
|
|
222894
222992
|
SilkscreenCircle: () => SilkscreenCircle,
|
|
222895
222993
|
SilkscreenLine: () => SilkscreenLine,
|
|
222896
222994
|
SilkscreenPath: () => SilkscreenPath,
|
|
@@ -224265,7 +224363,7 @@ var PrimitiveComponent2 = class extends Renderable {
|
|
|
224265
224363
|
return null;
|
|
224266
224364
|
for (const position2 of placementConfigPositions) {
|
|
224267
224365
|
if (isMatchingSelector(component, position2.selector) || component.props.name === position2.selector) {
|
|
224268
|
-
const center2 =
|
|
224366
|
+
const center2 = applyToPoint24(this._computePcbGlobalTransformBeforeLayout(), position2.center);
|
|
224269
224367
|
return center2;
|
|
224270
224368
|
}
|
|
224271
224369
|
}
|
|
@@ -224282,7 +224380,7 @@ var PrimitiveComponent2 = class extends Renderable {
|
|
|
224282
224380
|
return null;
|
|
224283
224381
|
for (const position2 of placementConfigPositions) {
|
|
224284
224382
|
if (isMatchingSelector(component, position2.selector) || component.props.name === position2.selector) {
|
|
224285
|
-
const center2 =
|
|
224383
|
+
const center2 = applyToPoint24(this.computeSchematicGlobalTransform(), position2.center);
|
|
224286
224384
|
return center2;
|
|
224287
224385
|
}
|
|
224288
224386
|
}
|
|
@@ -224302,13 +224400,13 @@ var PrimitiveComponent2 = class extends Renderable {
|
|
|
224302
224400
|
return null;
|
|
224303
224401
|
}
|
|
224304
224402
|
_getGlobalPcbPositionBeforeLayout() {
|
|
224305
|
-
return
|
|
224403
|
+
return applyToPoint24(this._computePcbGlobalTransformBeforeLayout(), {
|
|
224306
224404
|
x: 0,
|
|
224307
224405
|
y: 0
|
|
224308
224406
|
});
|
|
224309
224407
|
}
|
|
224310
224408
|
_getGlobalSchematicPositionBeforeLayout() {
|
|
224311
|
-
return
|
|
224409
|
+
return applyToPoint24(this.computeSchematicGlobalTransform(), { x: 0, y: 0 });
|
|
224312
224410
|
}
|
|
224313
224411
|
_getBoard() {
|
|
224314
224412
|
let current2 = this;
|
|
@@ -226785,7 +226883,7 @@ function Trace_doInitialPcbManualTraceRender(trace) {
|
|
|
226785
226883
|
viaToLayer = pt3.toLayer;
|
|
226786
226884
|
}
|
|
226787
226885
|
}
|
|
226788
|
-
const finalCoordinates = isGlobalPosition ? coordinates :
|
|
226886
|
+
const finalCoordinates = isGlobalPosition ? coordinates : applyToPoint24(transform2, coordinates);
|
|
226789
226887
|
if (isViaPoint) {
|
|
226790
226888
|
route.push({
|
|
226791
226889
|
route_type: "via",
|
|
@@ -227620,7 +227718,7 @@ var CourtyardOutline = class extends PrimitiveComponent2 {
|
|
|
227620
227718
|
pcb_component_id,
|
|
227621
227719
|
layer,
|
|
227622
227720
|
outline: props.outline.map((p3) => {
|
|
227623
|
-
const transformedPosition =
|
|
227721
|
+
const transformedPosition = applyToPoint24(transform2, {
|
|
227624
227722
|
x: p3.x,
|
|
227625
227723
|
y: p3.y
|
|
227626
227724
|
});
|
|
@@ -227797,7 +227895,7 @@ var Cutout = class extends PrimitiveComponent2 {
|
|
|
227797
227895
|
inserted_pcb_cutout = db.pcb_cutout.insert(circleData);
|
|
227798
227896
|
} else if (props.shape === "polygon") {
|
|
227799
227897
|
const transform2 = this._computePcbGlobalTransformBeforeLayout();
|
|
227800
|
-
const transformedPoints = props.points.map((p3) =>
|
|
227898
|
+
const transformedPoints = props.points.map((p3) => applyToPoint24(transform2, p3));
|
|
227801
227899
|
const polygonData = {
|
|
227802
227900
|
shape: "polygon",
|
|
227803
227901
|
points: transformedPoints,
|
|
@@ -227958,7 +228056,7 @@ var FabricationNotePath = class extends PrimitiveComponent2 {
|
|
|
227958
228056
|
layer,
|
|
227959
228057
|
color: props.color,
|
|
227960
228058
|
route: props.route.map((p3) => {
|
|
227961
|
-
const transformedPosition =
|
|
228059
|
+
const transformedPosition = applyToPoint24(transform2, {
|
|
227962
228060
|
x: p3.x,
|
|
227963
228061
|
y: p3.y
|
|
227964
228062
|
});
|
|
@@ -228451,8 +228549,8 @@ var PcbNoteLine = class extends PrimitiveComponent2 {
|
|
|
228451
228549
|
const subcircuit = this.getSubcircuit();
|
|
228452
228550
|
const group = this.getGroup();
|
|
228453
228551
|
const transform2 = this._computePcbGlobalTransformBeforeLayout();
|
|
228454
|
-
const start =
|
|
228455
|
-
const end =
|
|
228552
|
+
const start = applyToPoint24(transform2, { x: props.x1, y: props.y1 });
|
|
228553
|
+
const end = applyToPoint24(transform2, { x: props.x2, y: props.y2 });
|
|
228456
228554
|
const pcb_component_id = this.parent?.pcb_component_id ?? this.getPrimitiveContainer()?.pcb_component_id ?? undefined;
|
|
228457
228555
|
const pcb_note_line2 = db.pcb_note_line.insert({
|
|
228458
228556
|
pcb_component_id,
|
|
@@ -228517,7 +228615,7 @@ var PcbNotePath = class extends PrimitiveComponent2 {
|
|
|
228517
228615
|
const { x: x3, y: y32, ...rest } = point6;
|
|
228518
228616
|
const numericX = typeof x3 === "string" ? parseFloat(x3) : x3;
|
|
228519
228617
|
const numericY = typeof y32 === "string" ? parseFloat(y32) : y32;
|
|
228520
|
-
const transformed =
|
|
228618
|
+
const transformed = applyToPoint24(transform2, { x: numericX, y: numericY });
|
|
228521
228619
|
return { ...rest, x: transformed.x, y: transformed.y };
|
|
228522
228620
|
});
|
|
228523
228621
|
const pcb_note_path2 = db.pcb_note_path.insert({
|
|
@@ -228578,7 +228676,7 @@ var PcbNoteRect = class extends PrimitiveComponent2 {
|
|
|
228578
228676
|
const { db } = this.root;
|
|
228579
228677
|
const { _parsedProps: props } = this;
|
|
228580
228678
|
const transform2 = this._computePcbGlobalTransformBeforeLayout();
|
|
228581
|
-
const center2 =
|
|
228679
|
+
const center2 = applyToPoint24(transform2, { x: 0, y: 0 });
|
|
228582
228680
|
const subcircuit = this.getSubcircuit();
|
|
228583
228681
|
const group = this.getGroup();
|
|
228584
228682
|
const pcb_component_id = this.parent?.pcb_component_id ?? this.getPrimitiveContainer()?.pcb_component_id ?? undefined;
|
|
@@ -228639,7 +228737,7 @@ var PcbNoteText = class extends PrimitiveComponent2 {
|
|
|
228639
228737
|
const { db } = this.root;
|
|
228640
228738
|
const { _parsedProps: props } = this;
|
|
228641
228739
|
const transform2 = this._computePcbGlobalTransformBeforeLayout();
|
|
228642
|
-
const anchorPosition =
|
|
228740
|
+
const anchorPosition = applyToPoint24(transform2, { x: 0, y: 0 });
|
|
228643
228741
|
const subcircuit = this.getSubcircuit();
|
|
228644
228742
|
const group = this.getGroup();
|
|
228645
228743
|
const pcb_component_id = this.parent?.pcb_component_id ?? this.getPrimitiveContainer()?.pcb_component_id ?? undefined;
|
|
@@ -228708,7 +228806,7 @@ var PcbTrace = class extends PrimitiveComponent2 {
|
|
|
228708
228806
|
const parentTransform = this._computePcbGlobalTransformBeforeLayout();
|
|
228709
228807
|
const transformedRoute = props.route.map((point6) => {
|
|
228710
228808
|
const { x: x3, y: y32, ...restOfPoint } = point6;
|
|
228711
|
-
const transformedPoint =
|
|
228809
|
+
const transformedPoint = applyToPoint24(parentTransform, { x: x3, y: y32 });
|
|
228712
228810
|
if (point6.route_type === "wire" && point6.layer) {
|
|
228713
228811
|
return {
|
|
228714
228812
|
...transformedPoint,
|
|
@@ -229135,8 +229233,8 @@ var SilkscreenLine = class extends PrimitiveComponent2 {
|
|
|
229135
229233
|
}
|
|
229136
229234
|
const subcircuit = this.getSubcircuit();
|
|
229137
229235
|
const transform2 = this._computePcbGlobalTransformBeforeLayout();
|
|
229138
|
-
const p12 =
|
|
229139
|
-
const p222 =
|
|
229236
|
+
const p12 = applyToPoint24(transform2, { x: props.x1, y: props.y1 });
|
|
229237
|
+
const p222 = applyToPoint24(transform2, { x: props.x2, y: props.y2 });
|
|
229140
229238
|
const pcb_component_id = this.parent?.pcb_component_id ?? this.getPrimitiveContainer()?.pcb_component_id;
|
|
229141
229239
|
const pcb_silkscreen_line2 = db.pcb_silkscreen_line.insert({
|
|
229142
229240
|
pcb_component_id,
|
|
@@ -229203,7 +229301,7 @@ var SilkscreenPath = class extends PrimitiveComponent2 {
|
|
|
229203
229301
|
pcb_component_id,
|
|
229204
229302
|
layer,
|
|
229205
229303
|
route: props.route.map((p3) => {
|
|
229206
|
-
const transformedPosition =
|
|
229304
|
+
const transformedPosition = applyToPoint24(transform2, {
|
|
229207
229305
|
x: p3.x,
|
|
229208
229306
|
y: p3.y
|
|
229209
229307
|
});
|
|
@@ -229413,7 +229511,7 @@ var SilkscreenText = class extends PrimitiveComponent2 {
|
|
|
229413
229511
|
});
|
|
229414
229512
|
const fontSize = props.fontSize ?? resolvedPcbSxFontSize ?? this.getInheritedProperty("pcbStyle")?.silkscreenFontSize ?? this._footprinterFontSize ?? 1;
|
|
229415
229513
|
const hasResolvedPcbSxPosition = resolvedPcbSxPcbX !== undefined || resolvedPcbSxPcbY !== undefined;
|
|
229416
|
-
const position2 = hasResolvedPcbSxPosition && this._footprinterFontSize !== undefined ?
|
|
229514
|
+
const position2 = hasResolvedPcbSxPosition && this._footprinterFontSize !== undefined ? applyToPoint24(compose7(this.parent?._computePcbGlobalTransformBeforeLayout() ?? identity6(), isFlipped ? flipY() : identity6()), {
|
|
229417
229515
|
x: this.resolvePcbCoordinate({
|
|
229418
229516
|
rawValue: resolvedPcbSxPcbX ?? props.pcbX ?? 0,
|
|
229419
229517
|
axis: "pcbX"
|
|
@@ -229699,7 +229797,7 @@ var SmtPad = class extends PrimitiveComponent2 {
|
|
|
229699
229797
|
});
|
|
229700
229798
|
} else if (props.shape === "polygon") {
|
|
229701
229799
|
const transformedPoints = props.points.map((point6) => {
|
|
229702
|
-
const transformed =
|
|
229800
|
+
const transformed = applyToPoint24(globalTransform, {
|
|
229703
229801
|
x: distance.parse(point6.x),
|
|
229704
229802
|
y: distance.parse(point6.y)
|
|
229705
229803
|
});
|
|
@@ -230546,7 +230644,7 @@ var Port = class extends PrimitiveComponent2 {
|
|
|
230546
230644
|
}
|
|
230547
230645
|
}
|
|
230548
230646
|
const transform2 = compose7(parentNormalComponent.computeSchematicGlobalTransform(), translate7(-symbol.center.x, -symbol.center.y));
|
|
230549
|
-
return
|
|
230647
|
+
return applyToPoint24(transform2, schematicSymbolPortDef);
|
|
230550
230648
|
}
|
|
230551
230649
|
const parentBoxDim = parentNormalComponent?._getSchematicBoxDimensions();
|
|
230552
230650
|
if (parentBoxDim && this.props.pinNumber !== undefined) {
|
|
@@ -230554,7 +230652,7 @@ var Port = class extends PrimitiveComponent2 {
|
|
|
230554
230652
|
if (!localPortPosition) {
|
|
230555
230653
|
throw new Error(`Couldn't find position for schematic_port for port ${this.getString()} inside of the schematic box`);
|
|
230556
230654
|
}
|
|
230557
|
-
return
|
|
230655
|
+
return applyToPoint24(parentNormalComponent.computeSchematicGlobalTransform(), localPortPosition);
|
|
230558
230656
|
}
|
|
230559
230657
|
throw new Error(`Couldn't find position for schematic_port for port ${this.getString()}`);
|
|
230560
230658
|
}
|
|
@@ -230916,15 +231014,15 @@ var Port = class extends PrimitiveComponent2 {
|
|
|
230916
231014
|
const { db } = this.root;
|
|
230917
231015
|
const schPort = db.schematic_port.get(this.schematic_port_id);
|
|
230918
231016
|
if (schPort) {
|
|
230919
|
-
const newCenter =
|
|
231017
|
+
const newCenter = applyToPoint24(transform2, schPort.center);
|
|
230920
231018
|
db.schematic_port.update(this.schematic_port_id, {
|
|
230921
231019
|
center: newCenter
|
|
230922
231020
|
});
|
|
230923
231021
|
if (this.schematic_stem_line_id) {
|
|
230924
231022
|
const line2 = db.schematic_line.get(this.schematic_stem_line_id);
|
|
230925
231023
|
if (line2) {
|
|
230926
|
-
const p12 =
|
|
230927
|
-
const p222 =
|
|
231024
|
+
const p12 = applyToPoint24(transform2, { x: line2.x1, y: line2.y1 });
|
|
231025
|
+
const p222 = applyToPoint24(transform2, { x: line2.x2, y: line2.y2 });
|
|
230928
231026
|
db.schematic_line.update(this.schematic_stem_line_id, {
|
|
230929
231027
|
x1: p12.x,
|
|
230930
231028
|
y1: p12.y,
|
|
@@ -234487,7 +234585,7 @@ var TraceHint = class extends PrimitiveComponent2 {
|
|
|
234487
234585
|
return [];
|
|
234488
234586
|
const globalTransform = this._computePcbGlobalTransformBeforeLayout();
|
|
234489
234587
|
return offsets.map((offset) => ({
|
|
234490
|
-
...
|
|
234588
|
+
...applyToPoint24(globalTransform, offset),
|
|
234491
234589
|
via: offset.via,
|
|
234492
234590
|
to_layer: offset.to_layer,
|
|
234493
234591
|
trace_width: offset.trace_width
|
|
@@ -241931,13 +242029,13 @@ var FabricationNoteDimension = class extends PrimitiveComponent2 {
|
|
|
241931
242029
|
const target = this.getSubcircuit().selectOne(input);
|
|
241932
242030
|
if (!target) {
|
|
241933
242031
|
this.renderError(`FabricationNoteDimension could not find selector "${input}"`);
|
|
241934
|
-
return
|
|
242032
|
+
return applyToPoint24(transform2, { x: 0, y: 0 });
|
|
241935
242033
|
}
|
|
241936
242034
|
return target._getGlobalPcbPositionBeforeLayout();
|
|
241937
242035
|
}
|
|
241938
242036
|
const numericX = typeof input.x === "string" ? parseFloat(input.x) : input.x;
|
|
241939
242037
|
const numericY = typeof input.y === "string" ? parseFloat(input.y) : input.y;
|
|
241940
|
-
return
|
|
242038
|
+
return applyToPoint24(transform2, { x: numericX, y: numericY });
|
|
241941
242039
|
}
|
|
241942
242040
|
doInitialPcbPrimitiveRender() {
|
|
241943
242041
|
if (this.root?.pcbDisabled)
|
|
@@ -242037,7 +242135,7 @@ var PcbNoteDimension = class extends PrimitiveComponent2 {
|
|
|
242037
242135
|
const target = this.getSubcircuit().selectOne(`.${input}`);
|
|
242038
242136
|
if (!target) {
|
|
242039
242137
|
this.renderError(`PcbNoteDimension could not find selector "${input}"`);
|
|
242040
|
-
return
|
|
242138
|
+
return applyToPoint24(transform2, { x: 0, y: 0 });
|
|
242041
242139
|
}
|
|
242042
242140
|
const targetPcbComponentId = target.pcb_component_id;
|
|
242043
242141
|
const root = this.root;
|
|
@@ -242054,7 +242152,7 @@ var PcbNoteDimension = class extends PrimitiveComponent2 {
|
|
|
242054
242152
|
}
|
|
242055
242153
|
const numericX = typeof input.x === "string" ? parseFloat(input.x) : input.x;
|
|
242056
242154
|
const numericY = typeof input.y === "string" ? parseFloat(input.y) : input.y;
|
|
242057
|
-
return
|
|
242155
|
+
return applyToPoint24(transform2, { x: numericX, y: numericY });
|
|
242058
242156
|
}
|
|
242059
242157
|
doInitialPcbPrimitiveRender() {
|
|
242060
242158
|
if (this.root?.pcbDisabled)
|
|
@@ -242333,7 +242431,7 @@ var NetLabel = class extends PrimitiveComponent2 {
|
|
|
242333
242431
|
const connectedPorts = this._getConnectedPorts();
|
|
242334
242432
|
if (connectedPorts.length > 0) {
|
|
242335
242433
|
const portPos = connectedPorts[0]._getGlobalSchematicPositionBeforeLayout();
|
|
242336
|
-
const parentCenter =
|
|
242434
|
+
const parentCenter = applyToPoint24(this.parent?.computeSchematicGlobalTransform?.() ?? identity6(), { x: 0, y: 0 });
|
|
242337
242435
|
return translate7(portPos.x - parentCenter.x, portPos.y - parentCenter.y);
|
|
242338
242436
|
}
|
|
242339
242437
|
}
|
|
@@ -243563,7 +243661,7 @@ var TestPoint = class extends NormalComponent3 {
|
|
|
243563
243661
|
this.source_component_id = source_component.source_component_id;
|
|
243564
243662
|
}
|
|
243565
243663
|
};
|
|
243566
|
-
var
|
|
243664
|
+
var SchematicText2 = class extends PrimitiveComponent2 {
|
|
243567
243665
|
isSchematicPrimitive = true;
|
|
243568
243666
|
schematic_text_id;
|
|
243569
243667
|
get config() {
|
|
@@ -243606,7 +243704,7 @@ var SchematicText = class extends PrimitiveComponent2 {
|
|
|
243606
243704
|
const text = db.schematic_text.get(this.schematic_text_id);
|
|
243607
243705
|
if (!text)
|
|
243608
243706
|
return;
|
|
243609
|
-
const newPosition =
|
|
243707
|
+
const newPosition = applyToPoint24(transform2, text.position);
|
|
243610
243708
|
db.schematic_text.update(this.schematic_text_id, {
|
|
243611
243709
|
position: { x: newPosition.x, y: newPosition.y }
|
|
243612
243710
|
});
|
|
@@ -243656,8 +243754,8 @@ var SchematicLine = class extends PrimitiveComponent2 {
|
|
|
243656
243754
|
const line2 = db.schematic_line.get(this.schematic_line_id);
|
|
243657
243755
|
if (!line2)
|
|
243658
243756
|
return;
|
|
243659
|
-
const p12 =
|
|
243660
|
-
const p222 =
|
|
243757
|
+
const p12 = applyToPoint24(transform2, { x: line2.x1, y: line2.y1 });
|
|
243758
|
+
const p222 = applyToPoint24(transform2, { x: line2.x2, y: line2.y2 });
|
|
243661
243759
|
db.schematic_line.update(this.schematic_line_id, {
|
|
243662
243760
|
x1: p12.x,
|
|
243663
243761
|
y1: p12.y,
|
|
@@ -243714,11 +243812,11 @@ var SchematicRect = class extends PrimitiveComponent2 {
|
|
|
243714
243812
|
const rect = db.schematic_rect.get(this.schematic_rect_id);
|
|
243715
243813
|
if (!rect)
|
|
243716
243814
|
return;
|
|
243717
|
-
const topLeft =
|
|
243815
|
+
const topLeft = applyToPoint24(transform2, {
|
|
243718
243816
|
x: rect.center.x - rect.width / 2,
|
|
243719
243817
|
y: rect.center.y + rect.height / 2
|
|
243720
243818
|
});
|
|
243721
|
-
const bottomRight =
|
|
243819
|
+
const bottomRight = applyToPoint24(transform2, {
|
|
243722
243820
|
x: rect.center.x + rect.width / 2,
|
|
243723
243821
|
y: rect.center.y - rect.height / 2
|
|
243724
243822
|
});
|
|
@@ -243783,8 +243881,8 @@ var SchematicArc = class extends PrimitiveComponent2 {
|
|
|
243783
243881
|
const arc2 = db.schematic_arc.get(this.schematic_arc_id);
|
|
243784
243882
|
if (!arc2)
|
|
243785
243883
|
return;
|
|
243786
|
-
const newCenter =
|
|
243787
|
-
const edgePoint =
|
|
243884
|
+
const newCenter = applyToPoint24(transform2, arc2.center);
|
|
243885
|
+
const edgePoint = applyToPoint24(transform2, {
|
|
243788
243886
|
x: arc2.center.x + arc2.radius,
|
|
243789
243887
|
y: arc2.center.y
|
|
243790
243888
|
});
|
|
@@ -243842,8 +243940,8 @@ var SchematicCircle = class extends PrimitiveComponent2 {
|
|
|
243842
243940
|
const circle2 = db.schematic_circle.get(this.schematic_circle_id);
|
|
243843
243941
|
if (!circle2)
|
|
243844
243942
|
return;
|
|
243845
|
-
const newCenter =
|
|
243846
|
-
const edgePoint =
|
|
243943
|
+
const newCenter = applyToPoint24(transform2, circle2.center);
|
|
243944
|
+
const edgePoint = applyToPoint24(transform2, {
|
|
243847
243945
|
x: circle2.center.x + circle2.radius,
|
|
243848
243946
|
y: circle2.center.y
|
|
243849
243947
|
});
|
|
@@ -244048,7 +244146,7 @@ var SchematicPath = class extends PrimitiveComponent2 {
|
|
|
244048
244146
|
if (!path45)
|
|
244049
244147
|
continue;
|
|
244050
244148
|
const newPoints = path45.points.map((point6) => {
|
|
244051
|
-
const transformed =
|
|
244149
|
+
const transformed = applyToPoint24(transform2, point6);
|
|
244052
244150
|
return { x: transformed.x, y: transformed.y };
|
|
244053
244151
|
});
|
|
244054
244152
|
db.schematic_path.update(pathId, {
|
|
@@ -252973,12 +253071,12 @@ import {
|
|
|
252973
253071
|
// node_modules/dsn-converter/dist/index.js
|
|
252974
253072
|
import { su as su13 } from "@tscircuit/soup-util";
|
|
252975
253073
|
import { getBoundsFromPoints as getBoundsFromPoints3 } from "@tscircuit/math-utils";
|
|
252976
|
-
import { applyToPoint as
|
|
253074
|
+
import { applyToPoint as applyToPoint26, scale as scale7 } from "transformation-matrix";
|
|
252977
253075
|
import { su as su24 } from "@tscircuit/soup-util";
|
|
252978
253076
|
import { su as su34 } from "@tscircuit/soup-util";
|
|
252979
253077
|
import Debug4 from "debug";
|
|
252980
253078
|
import { su as su43 } from "@tscircuit/soup-util";
|
|
252981
|
-
import { applyToPoint as
|
|
253079
|
+
import { applyToPoint as applyToPoint25, scale as scale22 } from "transformation-matrix";
|
|
252982
253080
|
import Debug22 from "debug";
|
|
252983
253081
|
import { applyToPoint as applyToPoint92, scale as scale32 } from "transformation-matrix";
|
|
252984
253082
|
import { su as su52 } from "@tscircuit/soup-util";
|
|
@@ -253384,7 +253482,7 @@ function processComponentsAndPads(componentGroups, circuitElements, pcb) {
|
|
|
253384
253482
|
const sourceComponent = su13(circuitElements).source_component.list().find((e4) => e4.source_component_id === pcbComponent?.source_component_id);
|
|
253385
253483
|
const footprintName = getFootprintName(sourceComponent, pcbComponent);
|
|
253386
253484
|
const componentName = sourceComponent?.name || "Unknown";
|
|
253387
|
-
const circuitSpaceCoordinates =
|
|
253485
|
+
const circuitSpaceCoordinates = applyToPoint26(transformMmToUm, pcbComponent.center);
|
|
253388
253486
|
if (!componentsByFootprint.has(footprintName)) {
|
|
253389
253487
|
componentsByFootprint.set(footprintName, []);
|
|
253390
253488
|
}
|
|
@@ -253922,7 +254020,7 @@ function processPlatedHoles(componentGroups, circuitElements, pcb, numLayers = 2
|
|
|
253922
254020
|
componentsByFootprint.set(key, []);
|
|
253923
254021
|
componentsByFootprint.get(key).push({
|
|
253924
254022
|
componentName: sourceComponent?.name || "Unknown",
|
|
253925
|
-
coordinates:
|
|
254023
|
+
coordinates: applyToPoint25(transformMmToUm2, pcbComponent.center),
|
|
253926
254024
|
rotation: pcbComponent.rotation || 0,
|
|
253927
254025
|
value: getComponentValue(sourceComponent),
|
|
253928
254026
|
sourceComponent
|
|
@@ -254333,7 +254431,7 @@ import { z as z49 } from "zod";
|
|
|
254333
254431
|
import { z as z50 } from "zod";
|
|
254334
254432
|
import { lineAlphabet as lineAlphabet2 } from "@tscircuit/alphabet";
|
|
254335
254433
|
import {
|
|
254336
|
-
applyToPoint as
|
|
254434
|
+
applyToPoint as applyToPoint27,
|
|
254337
254435
|
compose as compose9,
|
|
254338
254436
|
identity as identity8,
|
|
254339
254437
|
rotate as rotate12,
|
|
@@ -255726,7 +255824,7 @@ var convertSoupToGerberCommands = (soup, opts = {}) => {
|
|
|
255726
255824
|
transforms.push(translate9(cx2, cy2), rotate12(rad), translate9(-cx2, -cy2));
|
|
255727
255825
|
}
|
|
255728
255826
|
const transformMatrix = transforms.length > 0 ? compose9(...transforms) : undefined;
|
|
255729
|
-
const applyTransform = (point5) => transformMatrix ?
|
|
255827
|
+
const applyTransform = (point5) => transformMatrix ? applyToPoint27(transformMatrix, point5) : point5;
|
|
255730
255828
|
if (layerType === "copper" && element.is_knockout) {
|
|
255731
255829
|
const padding = element.knockout_padding ?? {
|
|
255732
255830
|
left: 0.2,
|
|
@@ -255907,7 +256005,7 @@ var convertSoupToGerberCommands = (soup, opts = {}) => {
|
|
|
255907
256005
|
transformMatrix = rotate12(angle_rad);
|
|
255908
256006
|
}
|
|
255909
256007
|
transformMatrix = compose9(translate9(center2.x, center2.y), transformMatrix);
|
|
255910
|
-
const transformedPoints = points.map((p3) =>
|
|
256008
|
+
const transformedPoints = points.map((p3) => applyToPoint27(transformMatrix, p3));
|
|
255911
256009
|
const rect_builder = gerberBuilder().add("select_aperture", { aperture_number: 10 }).add("start_region_statement", {});
|
|
255912
256010
|
rect_builder.add("move_operation", {
|
|
255913
256011
|
x: transformedPoints[0].x,
|
|
@@ -256272,13 +256370,13 @@ var convertSoupToGerberCommands = (soup, opts = {}) => {
|
|
|
256272
256370
|
const transformMatrix = makeTransformMatrix();
|
|
256273
256371
|
if (r4 > 0) {
|
|
256274
256372
|
const startPoint = { x: -w4 + r4, y: h4 };
|
|
256275
|
-
let currentPoint =
|
|
256373
|
+
let currentPoint = applyToPoint27(transformMatrix, startPoint);
|
|
256276
256374
|
cutout_builder.add("move_operation", {
|
|
256277
256375
|
x: currentPoint.x,
|
|
256278
256376
|
y: mfy(currentPoint.y)
|
|
256279
256377
|
});
|
|
256280
256378
|
const addLine = (point5) => {
|
|
256281
|
-
const transformedPoint =
|
|
256379
|
+
const transformedPoint = applyToPoint27(transformMatrix, point5);
|
|
256282
256380
|
cutout_builder.add("plot_operation", {
|
|
256283
256381
|
x: transformedPoint.x,
|
|
256284
256382
|
y: mfy(transformedPoint.y)
|
|
@@ -256286,8 +256384,8 @@ var convertSoupToGerberCommands = (soup, opts = {}) => {
|
|
|
256286
256384
|
currentPoint = transformedPoint;
|
|
256287
256385
|
};
|
|
256288
256386
|
const addArc = (options) => {
|
|
256289
|
-
const transformedPoint =
|
|
256290
|
-
const transformedCenter =
|
|
256387
|
+
const transformedPoint = applyToPoint27(transformMatrix, options.point);
|
|
256388
|
+
const transformedCenter = applyToPoint27(transformMatrix, options.center);
|
|
256291
256389
|
cutout_builder.add("set_movement_mode_to_clockwise_circular", {}).add("plot_operation", {
|
|
256292
256390
|
x: transformedPoint.x,
|
|
256293
256391
|
y: mfy(transformedPoint.y),
|
|
@@ -256323,7 +256421,7 @@ var convertSoupToGerberCommands = (soup, opts = {}) => {
|
|
|
256323
256421
|
{ x: w4, y: -h4 },
|
|
256324
256422
|
{ x: -w4, y: -h4 }
|
|
256325
256423
|
];
|
|
256326
|
-
const transformedPoints = points.map((p3) =>
|
|
256424
|
+
const transformedPoints = points.map((p3) => applyToPoint27(transformMatrix, p3));
|
|
256327
256425
|
cutout_builder.add("move_operation", {
|
|
256328
256426
|
x: transformedPoints[0].x,
|
|
256329
256427
|
y: mfy(transformedPoints[0].y)
|
|
@@ -264176,7 +264274,7 @@ var any_circuit_element2 = external_exports2.union([
|
|
|
264176
264274
|
var any_soup_element2 = any_circuit_element2;
|
|
264177
264275
|
expectTypesMatch3(true);
|
|
264178
264276
|
expectStringUnionsMatch2(true);
|
|
264179
|
-
function
|
|
264277
|
+
function applyToPoint28(matrix2, point22) {
|
|
264180
264278
|
return Array.isArray(point22) ? [
|
|
264181
264279
|
matrix2.a * point22[0] + matrix2.c * point22[1] + matrix2.e,
|
|
264182
264280
|
matrix2.b * point22[0] + matrix2.d * point22[1] + matrix2.f
|
|
@@ -265140,7 +265238,7 @@ var transformPCBElement2 = (elm, matrix2) => {
|
|
|
265140
265238
|
const tsr = decomposeTSR2(matrix2);
|
|
265141
265239
|
const flipPadWidthHeight = Math.round(tsr.rotation.angle / (Math.PI / 2)) % 2 === 1;
|
|
265142
265240
|
if (elm.type === "pcb_plated_hole" || elm.type === "pcb_hole" || elm.type === "pcb_via" || elm.type === "pcb_smtpad" || elm.type === "pcb_port") {
|
|
265143
|
-
const { x: x3, y: y4 } =
|
|
265241
|
+
const { x: x3, y: y4 } = applyToPoint28(matrix2, {
|
|
265144
265242
|
x: Number(elm.x),
|
|
265145
265243
|
y: Number(elm.y)
|
|
265146
265244
|
});
|
|
@@ -265148,7 +265246,7 @@ var transformPCBElement2 = (elm, matrix2) => {
|
|
|
265148
265246
|
elm.y = y4;
|
|
265149
265247
|
if (elm.type === "pcb_smtpad" && elm.shape === "polygon" && Array.isArray(elm.points)) {
|
|
265150
265248
|
elm.points = elm.points.map((point22) => {
|
|
265151
|
-
const tp3 =
|
|
265249
|
+
const tp3 = applyToPoint28(matrix2, { x: point22.x, y: point22.y });
|
|
265152
265250
|
return {
|
|
265153
265251
|
x: tp3.x,
|
|
265154
265252
|
y: tp3.y
|
|
@@ -265156,13 +265254,13 @@ var transformPCBElement2 = (elm, matrix2) => {
|
|
|
265156
265254
|
});
|
|
265157
265255
|
}
|
|
265158
265256
|
} else if (elm.type === "pcb_keepout" || elm.type === "pcb_board") {
|
|
265159
|
-
elm.center =
|
|
265257
|
+
elm.center = applyToPoint28(matrix2, elm.center);
|
|
265160
265258
|
} else if (elm.type === "pcb_silkscreen_text" || elm.type === "pcb_fabrication_note_text" || elm.type === "pcb_note_text") {
|
|
265161
|
-
elm.anchor_position =
|
|
265259
|
+
elm.anchor_position = applyToPoint28(matrix2, elm.anchor_position);
|
|
265162
265260
|
} else if (elm.type === "pcb_silkscreen_circle" || elm.type === "pcb_silkscreen_rect" || elm.type === "pcb_note_rect" || elm.type === "pcb_courtyard_rect" || elm.type === "pcb_courtyard_circle") {
|
|
265163
|
-
elm.center =
|
|
265261
|
+
elm.center = applyToPoint28(matrix2, elm.center);
|
|
265164
265262
|
} else if (elm.type === "pcb_component") {
|
|
265165
|
-
elm.center =
|
|
265263
|
+
elm.center = applyToPoint28(matrix2, elm.center);
|
|
265166
265264
|
elm.rotation = elm.rotation + tsr.rotation.angle / Math.PI * 180;
|
|
265167
265265
|
elm.rotation = elm.rotation % 360;
|
|
265168
265266
|
if (flipPadWidthHeight) {
|
|
@@ -265170,21 +265268,21 @@ var transformPCBElement2 = (elm, matrix2) => {
|
|
|
265170
265268
|
}
|
|
265171
265269
|
} else if (elm.type === "pcb_courtyard_outline") {
|
|
265172
265270
|
elm.outline = elm.outline.map((p3) => {
|
|
265173
|
-
const tp3 =
|
|
265271
|
+
const tp3 = applyToPoint28(matrix2, p3);
|
|
265174
265272
|
p3.x = tp3.x;
|
|
265175
265273
|
p3.y = tp3.y;
|
|
265176
265274
|
return p3;
|
|
265177
265275
|
});
|
|
265178
265276
|
} else if (elm.type === "pcb_courtyard_polygon") {
|
|
265179
265277
|
elm.points = elm.points.map((p3) => {
|
|
265180
|
-
const tp3 =
|
|
265278
|
+
const tp3 = applyToPoint28(matrix2, p3);
|
|
265181
265279
|
p3.x = tp3.x;
|
|
265182
265280
|
p3.y = tp3.y;
|
|
265183
265281
|
return p3;
|
|
265184
265282
|
});
|
|
265185
265283
|
} else if (elm.type === "pcb_silkscreen_path" || elm.type === "pcb_trace" || elm.type === "pcb_fabrication_note_path" || elm.type === "pcb_note_path") {
|
|
265186
265284
|
elm.route = elm.route.map((rp3) => {
|
|
265187
|
-
const tp3 =
|
|
265285
|
+
const tp3 = applyToPoint28(matrix2, rp3);
|
|
265188
265286
|
rp3.x = tp3.x;
|
|
265189
265287
|
rp3.y = tp3.y;
|
|
265190
265288
|
return rp3;
|
|
@@ -265192,14 +265290,14 @@ var transformPCBElement2 = (elm, matrix2) => {
|
|
|
265192
265290
|
} else if (elm.type === "pcb_silkscreen_line" || elm.type === "pcb_note_line") {
|
|
265193
265291
|
const p12 = { x: elm.x1, y: elm.y1 };
|
|
265194
265292
|
const p23 = { x: elm.x2, y: elm.y2 };
|
|
265195
|
-
const p1t =
|
|
265196
|
-
const p2t =
|
|
265293
|
+
const p1t = applyToPoint28(matrix2, p12);
|
|
265294
|
+
const p2t = applyToPoint28(matrix2, p23);
|
|
265197
265295
|
elm.x1 = p1t.x;
|
|
265198
265296
|
elm.y1 = p1t.y;
|
|
265199
265297
|
elm.x2 = p2t.x;
|
|
265200
265298
|
elm.y2 = p2t.y;
|
|
265201
265299
|
} else if (elm.type === "cad_component") {
|
|
265202
|
-
const newPos =
|
|
265300
|
+
const newPos = applyToPoint28(matrix2, {
|
|
265203
265301
|
x: elm.position.x,
|
|
265204
265302
|
y: elm.position.y
|
|
265205
265303
|
});
|
|
@@ -266162,15 +266260,15 @@ var convertEasyEdaJsonToCircuitJson = (easyEdaJson, {
|
|
|
266162
266260
|
for (const e4 of circuitElements) {
|
|
266163
266261
|
if (e4.type === "pcb_cutout") {
|
|
266164
266262
|
if (e4.shape === "polygon") {
|
|
266165
|
-
e4.points = e4.points.map((p3) =>
|
|
266263
|
+
e4.points = e4.points.map((p3) => applyToPoint28(matrix2, p3));
|
|
266166
266264
|
} else if (e4.shape === "circle" || e4.shape === "rect") {
|
|
266167
|
-
e4.center =
|
|
266265
|
+
e4.center = applyToPoint28(matrix2, e4.center);
|
|
266168
266266
|
} else if ("route" in e4) {
|
|
266169
266267
|
const cutoutPath = e4;
|
|
266170
|
-
cutoutPath.route = cutoutPath.route.map((p3) =>
|
|
266268
|
+
cutoutPath.route = cutoutPath.route.map((p3) => applyToPoint28(matrix2, p3));
|
|
266171
266269
|
}
|
|
266172
266270
|
} else if (e4.type === "pcb_smtpad" && e4.shape === "polygon") {
|
|
266173
|
-
e4.points = e4.points.map((p3) =>
|
|
266271
|
+
e4.points = e4.points.map((p3) => applyToPoint28(matrix2, p3));
|
|
266174
266272
|
}
|
|
266175
266273
|
}
|
|
266176
266274
|
const cad = circuitElements.find((e4) => e4.type === "cad_component");
|
|
@@ -270963,7 +271061,7 @@ var any_circuit_element3 = z160.union([
|
|
|
270963
271061
|
var any_soup_element3 = any_circuit_element3;
|
|
270964
271062
|
expectTypesMatch4(true);
|
|
270965
271063
|
expectStringUnionsMatch3(true);
|
|
270966
|
-
function
|
|
271064
|
+
function applyToPoint29(matrix2, point22) {
|
|
270967
271065
|
return Array.isArray(point22) ? [
|
|
270968
271066
|
matrix2.a * point22[0] + matrix2.c * point22[1] + matrix2.e,
|
|
270969
271067
|
matrix2.b * point22[0] + matrix2.d * point22[1] + matrix2.f
|
|
@@ -271926,7 +272024,7 @@ var transformPCBElement3 = (elm, matrix2) => {
|
|
|
271926
272024
|
const tsr = decomposeTSR3(matrix2);
|
|
271927
272025
|
const flipPadWidthHeight = Math.round(tsr.rotation.angle / (Math.PI / 2)) % 2 === 1;
|
|
271928
272026
|
if (elm.type === "pcb_plated_hole" || elm.type === "pcb_hole" || elm.type === "pcb_via" || elm.type === "pcb_smtpad" || elm.type === "pcb_port") {
|
|
271929
|
-
const { x: x3, y: y4 } =
|
|
272027
|
+
const { x: x3, y: y4 } = applyToPoint29(matrix2, {
|
|
271930
272028
|
x: Number(elm.x),
|
|
271931
272029
|
y: Number(elm.y)
|
|
271932
272030
|
});
|
|
@@ -271934,7 +272032,7 @@ var transformPCBElement3 = (elm, matrix2) => {
|
|
|
271934
272032
|
elm.y = y4;
|
|
271935
272033
|
if (elm.type === "pcb_smtpad" && elm.shape === "polygon" && Array.isArray(elm.points)) {
|
|
271936
272034
|
elm.points = elm.points.map((point22) => {
|
|
271937
|
-
const tp3 =
|
|
272035
|
+
const tp3 = applyToPoint29(matrix2, { x: point22.x, y: point22.y });
|
|
271938
272036
|
return {
|
|
271939
272037
|
x: tp3.x,
|
|
271940
272038
|
y: tp3.y
|
|
@@ -271942,13 +272040,13 @@ var transformPCBElement3 = (elm, matrix2) => {
|
|
|
271942
272040
|
});
|
|
271943
272041
|
}
|
|
271944
272042
|
} else if (elm.type === "pcb_keepout" || elm.type === "pcb_board") {
|
|
271945
|
-
elm.center =
|
|
272043
|
+
elm.center = applyToPoint29(matrix2, elm.center);
|
|
271946
272044
|
} else if (elm.type === "pcb_silkscreen_text" || elm.type === "pcb_fabrication_note_text" || elm.type === "pcb_note_text") {
|
|
271947
|
-
elm.anchor_position =
|
|
272045
|
+
elm.anchor_position = applyToPoint29(matrix2, elm.anchor_position);
|
|
271948
272046
|
} else if (elm.type === "pcb_silkscreen_circle" || elm.type === "pcb_silkscreen_rect" || elm.type === "pcb_note_rect" || elm.type === "pcb_courtyard_rect" || elm.type === "pcb_courtyard_circle") {
|
|
271949
|
-
elm.center =
|
|
272047
|
+
elm.center = applyToPoint29(matrix2, elm.center);
|
|
271950
272048
|
} else if (elm.type === "pcb_component") {
|
|
271951
|
-
elm.center =
|
|
272049
|
+
elm.center = applyToPoint29(matrix2, elm.center);
|
|
271952
272050
|
elm.rotation = elm.rotation + tsr.rotation.angle / Math.PI * 180;
|
|
271953
272051
|
elm.rotation = elm.rotation % 360;
|
|
271954
272052
|
if (flipPadWidthHeight) {
|
|
@@ -271956,21 +272054,21 @@ var transformPCBElement3 = (elm, matrix2) => {
|
|
|
271956
272054
|
}
|
|
271957
272055
|
} else if (elm.type === "pcb_courtyard_outline") {
|
|
271958
272056
|
elm.outline = elm.outline.map((p3) => {
|
|
271959
|
-
const tp3 =
|
|
272057
|
+
const tp3 = applyToPoint29(matrix2, p3);
|
|
271960
272058
|
p3.x = tp3.x;
|
|
271961
272059
|
p3.y = tp3.y;
|
|
271962
272060
|
return p3;
|
|
271963
272061
|
});
|
|
271964
272062
|
} else if (elm.type === "pcb_courtyard_polygon") {
|
|
271965
272063
|
elm.points = elm.points.map((p3) => {
|
|
271966
|
-
const tp3 =
|
|
272064
|
+
const tp3 = applyToPoint29(matrix2, p3);
|
|
271967
272065
|
p3.x = tp3.x;
|
|
271968
272066
|
p3.y = tp3.y;
|
|
271969
272067
|
return p3;
|
|
271970
272068
|
});
|
|
271971
272069
|
} else if (elm.type === "pcb_silkscreen_path" || elm.type === "pcb_trace" || elm.type === "pcb_fabrication_note_path" || elm.type === "pcb_note_path") {
|
|
271972
272070
|
elm.route = elm.route.map((rp3) => {
|
|
271973
|
-
const tp3 =
|
|
272071
|
+
const tp3 = applyToPoint29(matrix2, rp3);
|
|
271974
272072
|
rp3.x = tp3.x;
|
|
271975
272073
|
rp3.y = tp3.y;
|
|
271976
272074
|
return rp3;
|
|
@@ -271978,14 +272076,14 @@ var transformPCBElement3 = (elm, matrix2) => {
|
|
|
271978
272076
|
} else if (elm.type === "pcb_silkscreen_line" || elm.type === "pcb_note_line") {
|
|
271979
272077
|
const p12 = { x: elm.x1, y: elm.y1 };
|
|
271980
272078
|
const p23 = { x: elm.x2, y: elm.y2 };
|
|
271981
|
-
const p1t =
|
|
271982
|
-
const p2t =
|
|
272079
|
+
const p1t = applyToPoint29(matrix2, p12);
|
|
272080
|
+
const p2t = applyToPoint29(matrix2, p23);
|
|
271983
272081
|
elm.x1 = p1t.x;
|
|
271984
272082
|
elm.y1 = p1t.y;
|
|
271985
272083
|
elm.x2 = p2t.x;
|
|
271986
272084
|
elm.y2 = p2t.y;
|
|
271987
272085
|
} else if (elm.type === "cad_component") {
|
|
271988
|
-
const newPos =
|
|
272086
|
+
const newPos = applyToPoint29(matrix2, {
|
|
271989
272087
|
x: elm.position.x,
|
|
271990
272088
|
y: elm.position.y
|
|
271991
272089
|
});
|
|
@@ -272931,15 +273029,15 @@ var convertEasyEdaJsonToCircuitJson2 = (easyEdaJson, {
|
|
|
272931
273029
|
for (const e4 of circuitElements) {
|
|
272932
273030
|
if (e4.type === "pcb_cutout") {
|
|
272933
273031
|
if (e4.shape === "polygon") {
|
|
272934
|
-
e4.points = e4.points.map((p3) =>
|
|
273032
|
+
e4.points = e4.points.map((p3) => applyToPoint29(matrix2, p3));
|
|
272935
273033
|
} else if (e4.shape === "circle" || e4.shape === "rect") {
|
|
272936
|
-
e4.center =
|
|
273034
|
+
e4.center = applyToPoint29(matrix2, e4.center);
|
|
272937
273035
|
} else if ("route" in e4) {
|
|
272938
273036
|
const cutoutPath = e4;
|
|
272939
|
-
cutoutPath.route = cutoutPath.route.map((p3) =>
|
|
273037
|
+
cutoutPath.route = cutoutPath.route.map((p3) => applyToPoint29(matrix2, p3));
|
|
272940
273038
|
}
|
|
272941
273039
|
} else if (e4.type === "pcb_smtpad" && e4.shape === "polygon") {
|
|
272942
|
-
e4.points = e4.points.map((p3) =>
|
|
273040
|
+
e4.points = e4.points.map((p3) => applyToPoint29(matrix2, p3));
|
|
272943
273041
|
}
|
|
272944
273042
|
}
|
|
272945
273043
|
const cad = circuitElements.find((e4) => e4.type === "cad_component");
|