SimuPLC
Preparando entorno de diseño
SimuPLC Lab

Configurar temporizador

Circuito guardado
\n '); doc.close(); // Copy styles from current document so blocks/wires keep their appearance. document.querySelectorAll('style,link[rel="stylesheet"]').forEach(node=>{ try{ const c=node.cloneNode(true); if(c.tagName==='LINK'){ const href=c.getAttribute('href'); if(href)c.setAttribute('href',new URL(href,location.href).href); } doc.head.appendChild(c); }catch(_){} }); const printStyle=doc.createElement('style'); printStyle.textContent=` @page{size:A4 ${land?'landscape':'portrait'};margin:0} html,body{margin:0!important;padding:0!important;width:${pageW}px!important;height:${pageH}px!important;overflow:hidden!important;background:#fff!important;-webkit-print-color-adjust:exact!important;print-color-adjust:exact!important} body>*:not(#printRoot){display:none!important} #printRoot{display:block!important;position:absolute!important;left:0!important;top:0!important;width:${pageW}px!important;height:${pageH}px!important;overflow:hidden!important;background:#fff!important} #printBrand{position:absolute!important;left:24px!important;top:20px!important;width:150px!important;height:auto!important;z-index:99999!important;display:block!important} #printWorkspace{position:absolute!important;left:0!important;top:0!important;width:var(--workspace-size,5000px)!important;height:var(--workspace-size,5000px)!important;transform:translate(${tx}px,${ty}px) scale(${scale})!important;transform-origin:0 0!important;background:#fff!important;background-image:none!important;box-shadow:none!important;border:none!important;-webkit-print-color-adjust:exact!important;print-color-adjust:exact!important} #printWorkspace *{-webkit-print-color-adjust:exact!important;print-color-adjust:exact!important} #printWorkspace .selected{outline:none!important;box-shadow:none!important;transform:none!important} #topbar,#sidebar,#brand,#installBtn,#fabPalette,#paletteModal,#wireMenu,#timerModal,#splashOverlay,#lockOverlay,.toolbar,.status,.storage-panel,.branch-panel,.sim-panel{display:none!important} `; doc.head.appendChild(printStyle); const root=doc.createElement('div'); root.id='printRoot'; const brand=doc.createElement('img'); brand.id='printBrand'; brand.src=SIMUPLC_PDF_BRAND; brand.alt='SimuPLC'; root.appendChild(brand); clone.id='printWorkspace'; root.appendChild(clone); doc.body.appendChild(root); let cleaned=false; const cleanup=()=>{ if(cleaned)return; cleaned=true; try{iframe.remove();}catch(_){} }; const doPrint=()=>{ try{ const w=iframe.contentWindow; w.focus(); const after=()=>{try{w.removeEventListener('afterprint',after);}catch(_){}cleanup();}; try{w.addEventListener('afterprint',after,{once:true});}catch(_){} w.print(); setTimeout(cleanup,1800); }catch(e){ cleanup(); toast('No se pudo abrir la impresión PDF'); } }; // Give cloned styles/layout time to settle. setTimeout(doPrint,220); } function simuplcPdfHeadAssetsV25(doc){ try{ return Array.from(doc.querySelectorAll('style,link[rel="stylesheet"]')).map(node=>{ try{ if(node.tagName==='LINK'){ const c=node.cloneNode(true),href=c.getAttribute('href'); if(href)c.setAttribute('href',new URL(href,doc.baseURI).href); return c.outerHTML; } return node.outerHTML; }catch(_){return''} }).join('\n'); }catch(_){return''} } function fbdCaptureForComposerV25(){ const b=fbdBounds();if(!b)return null; const source=document.getElementById('workspace');if(!source)return null; const clone=source.cloneNode(true); try{ clone.querySelectorAll('.selected,.pin-selected,.pin-target').forEach(el=>el.classList.remove('selected','pin-selected','pin-target')); clone.querySelectorAll('.bend-handle,.wire-hit,.selection-handle,.resize-handle').forEach(el=>el.remove()); }catch(_){} return{ kind:'html',editor:'fbd', width:Math.max(1,Number(b.w)||1),height:Math.max(1,Number(b.h)||1), offsetX:Number(b.x)||0,offsetY:Number(b.y)||0, html:clone.outerHTML,headAssets:simuplcPdfHeadAssetsV25(document),baseHref:location.href,rootId:'workspace', extraCss:[ '#workspace{position:absolute!important;left:var(--capture-left)!important;top:var(--capture-top)!important;transform:none!important;transform-origin:0 0!important;background:#fff!important;background-image:none!important;box-shadow:none!important;border:none!important}', '#workspace *{-webkit-print-color-adjust:exact!important;print-color-adjust:exact!important}', '.selected,.pin-selected,.pin-target,.bend-handle,.wire-hit{outline:none!important;box-shadow:none!important}' ].join('\n') }; } window.SimuPLCFBDPDFSourceV25={capture:fbdCaptureForComposerV25}; function pdf(){if(mode()==='ladder'){let fr=document.getElementById('ladderFrame');if(fr&&fr.contentWindow){fr.contentWindow.postMessage({__simuplcPdf:true,cmd:'exportPdf'},'*');return}toast('Abre LADDER una vez y vuelve a intentar')}else if(mode()==='fbd')fbdPdf();else toast('PDF de este editor se exporta desde su propia barra')} let pdfBtn=document.getElementById('btnPdfActive');if(pdfBtn)pdfBtn.addEventListener('click',e=>{e.preventDefault();pdf()});window.SimuPLCSaveChoice={open:open,close:close,saveSingle:saveSingle,saveGlobal:saveGlobal}; })(); \n