await eda.dmt_EditorControl.openDocument('f126ffb29c92f9b2'); await new Promise(r=>setTimeout(r,1500)); const want = ['R721','R761','R711','C744','J23','U34','R717','U51','J71','C801','TP801','J31','J41']; const comps = await eda.pcb_PrimitiveComponent.getAll(); const out = {parts:{}, keys:{}}; for (const c of comps) { const d = c.getState_Designator(); if (!want.includes(d)) continue; const pins = await eda.pcb_PrimitiveComponent.getAllPinsByPrimitiveId(c.getState_PrimitiveId()); out.parts[d] = {x:c.getState_X()/39.3700787, y:c.getState_Y()/39.3700787, rot:c.getState_Rotation(), layer:c.getState_Layer(), pins: pins.slice(0,8).map(p=>[p.padNumber, +(p.x/39.3700787).toFixed(3), +(p.y/39.3700787).toFixed(3), p.layer])}; } const lines = await eda.pcb_PrimitiveLine.getAll(); const byLayer = {}; for (const l of lines) { const L=l.getState_Layer(); byLayer[L]=(byLayer[L]||0)+1; } out.lines = byLayer; out.lineKeys = Object.keys(lines[0]||{}); const vias = await eda.pcb_PrimitiveVia.getAll(); out.vias = vias.length; out.viaKeys = Object.keys(vias[0]||{}); const arcs = await eda.pcb_PrimitiveArc.getAll(); out.arcs = arcs.length; const pours = await eda.pcb_PrimitivePour.getAll(); out.pours = pours.map(p=>[p.getState_Layer(), p.getState_Net(), p.getState_Name ? p.getState_Name() : null]); out.pourKeys = Object.keys(pours[0]||{}); const fills = await eda.pcb_PrimitiveFill.getAll(); out.fills = fills.length; const polys = await eda.pcb_PrimitivePolyline.getAll(); out.polys = polys.map(p=>[p.getState_Layer()]); const pads = await eda.pcb_PrimitivePad.getAll(); out.pads = pads.length; out.compCount = comps.length; out.compKeys = Object.keys(comps[0]||{}); return out;