123456 |
- import{z as He,d as E,l as le,a1 as ke,O as Xe,bZ as Ne,af as Fe,ag as j,a$ as $e,Y as T,J as q,k as xe,n as A,v as Ce,G as Re,b as N,F as Je,W as Ge,H as Ke,b_ as Ze,c as qe,S as Qe,a as _e,ae as et,aW as Ve,an as p,ai as m,aj as f,ak as W,aX as Ue,al as be,bB as tt,am as S,ap as D,aY as at,aA as lt,bz as nt,b6 as De,at as I,as as st,ao as Te,aC as Me,ax as ot,ay as Ee,az as Be,aP as ue,au as ae,aF as Oe}from"./index-D68iA7pN.js";import{M as ze}from"./index-AOcxwHT9.js";import{p as rt}from"./print-BUiXb7dt.js";function it(x){x.sort((y,C)=>y.minPt.y===C.minPt.y?y.minPt.x-C.minPt.x:y.minPt.y-C.minPt.y);let v=[];for(const y of x){let C=!0;for(const V of v)if(y.minPt.x>=V.minPt.x&&y.minPt.y>=V.minPt.y&&y.maxPt.x<=V.maxPt.x&&y.maxPt.y<=V.maxPt.y){C=!1;break}C&&v.push(y)}return v}const ut=async()=>{const x=await He.userSelect(E("528")),v=[],y=(u,r,M)=>(r.x-u.x)*(r.x-M.x)+(r.y-u.y)*(r.y-M.y)==0,C=(u,r,M,w)=>y(u,r,M),V=u=>{if(u instanceof le){const r=u.numVerts();if(r===0||(u.isClosed?r>4:r>5))return;for(let w=0;w<r;w++)if(u.getBulgeAt(w)>.001)return;const M=u.getPointAt(0).val;if(C(M,u.getPointAt(1).val,u.getPointAt(2).val,u.isClosed?M:u.getPointAt(3).val)){const{minPt:w,maxPt:k}=u.getBoundingBox();v.push({minPt:w,maxPt:k})}}},P=u=>{const r=u.blockTableRecordId.getMcDbBlockTableRecord();r&&r.getAllEntityId().forEach(M=>{const w=M.getMcDbEntity();w&&(w instanceof le&&V(w),w instanceof ke&&P(w))})};return x.forEach(u=>{const r=u.getMcDbEntity();r instanceof le?V(r):r instanceof ke&&P(r)}),it(v).filter(({minPt:u,maxPt:r})=>{const M=new Xe;return M.imp.userSelect(u.x,u.y,r.x,r.y,Ne(),!1),M.count()!==0})};function Le(x,v,y,C){const V=Math.abs(C.x-y.x),P=Math.abs(C.y-y.y);let B;return x/V<v/P?B=V/x:B=P/v,B}function dt(x,v,y,C,V){const P=x*V,B=v*V,u=(y.x+C.x)/2,r=(y.y+C.y)/2,M=new A(u-P/2,r+B/2),w=new A(u+P/2,r-B/2);return[M,w]}const ct=()=>{const x=Fe(!1,"Mx_PrintDialog"),v=j(!0),y=j(0),C=j(0),V=j(0),P=j(0),B=["A1","A2","A3","A4","自定义16.55x23.90"],u=j("A4"),r=()=>{switch(u.value){case"A1":return{w:594,h:841};case"A2":return{w:420,h:594};case"A3":return{w:297,h:420};case"A4":return{w:210,h:297};case"自定义16.55x23.90":return{w:165.5,h:239,nw:130,nh:190}}},M=["横向","纵向"],w=j("横向"),k=j(1),O=j(1);let ne,se,Q=O.value/k.value;const de=()=>{let{w:a,h:t}=r();const e=O.value/k.value;if(Math.abs(e-Q)<1e-6)return;Q=e;const[l,s]=dt(a,t,ne,se,e);y.value=T(l?.x||0,4),C.value=T(l?.y||0,4),V.value=T(s?.x||0,4),P.value=T(s?.y||0,4),z.pt1=l,z.pt2=s,z.w=a,z.h=t},pe=()=>{let{w:a,h:t}=r();const e=Le(a,t,ne,se);Q=e,O.value=T(k.value*e,4),de()},H=[];let z;const $=(a,t)=>{ne=a,se=t;let{w:e,h:l,nw:s,nh:g}=r();if(w.value==="横向"){let L=e;e=l,l=L,L=s,s=g,g=L}z&&H.push(z);const b=Le(e,l,a,t);return Q=b,O.value=T(k.value*b,4),z={pt1:a,pt2:t,w:e,h:l,size:u.value,paperOrientation:w.value,printParameterMillimeter:k.value,printParametersCADDrawingUnits:O.value,isDrawingBoundary:v.value},y.value=T(a?.x||0,4),C.value=T(a?.y||0,4),V.value=T(t?.x||0,4),P.value=T(t?.y||0,4),z},oe=()=>{const{minPt:a,maxPt:t}=N.getCurrentDatabase().currentSpace.getBoundingBox();return $(a,t)};Qe(()=>{v.value&&oe()});const me=()=>{const{pt1:a,pt3:t}=N.getCurrentMxCAD().getViewCADCoord();return $(a,t)},fe=()=>{typeof v.value=="boolean"&&(v.value?oe():me())},ye=()=>{const a=H.pop();if(!a)return q().error(E("529"));const{pt1:t,pt2:e,size:l}=a;return z=a,y.value=T(t?.x||0,4),C.value=T(t?.y||0,4),V.value=T(e?.x||0,4),P.value=T(e?.y||0,4),u.value=l,w.value=a.paperOrientation,k.value=a.printParameterMillimeter,O.value=a.printParametersCADDrawingUnits,v.value=a.isDrawingBoundary,v.value=null,q().success(E("530"))},re=async()=>{x.isShow.value=!1;const a=()=>{x.isShow.value=!0},t=new xe;t.clearLastInputPoint(),t.setMessage(`
- `+E("377")+":"),t.disableAllTrace();let e=await t.go();if(!e)return a();t.setMessage(`
- `+E("386")+":"),t.setUserDraw((s,g)=>{if(!e)return;g.setColor(16711680);let h=new le;h.addVertexAt(e),h.addVertexAt(new A(e.x,s.y)),h.addVertexAt(s),h.addVertexAt(new A(s.x,e.y)),h.constantWidth=Ce.screenCoordLong2Doc(2),h.isClosed=!0,g.drawMcDbEntity(h);let b=[];b.push(e.toVector3()),b.push(new THREE.Vector3(e.x,s.y)),b.push(s.toVector3()),b.push(new THREE.Vector3(s.x,e.y)),g.setColor(12868),g.drawSolid(b,.5)}),t.setDisableOsnap(!0),t.setDisableOrthoTrace(!0),t.setDynamicInputType(Re.kXYCoordInput);let l=await t.go();if(!l)return a();$(e,l),v.value=null,x.isShow.value=!0,q().success(E("531"))},we=async()=>{function a(o,F,d,U){const Y=Math.abs(U.x-d.x),ie=Math.abs(U.y-d.y);let K;Y>ie?K=Y/o:K=ie/F;const Z=o*K,ce=F*K;return new A(d.x+Z,d.y-ce)}x.isShow.value=!1;const t=()=>{x.isShow.value=!0},e=new xe;e.clearLastInputPoint(),e.setMessage(`
- `+E("532")+":"),e.disableAllTrace();let{w:l,h:s,nw:g,nh:h}=r();const b=O.value/k.value;(o=>{if(l=l*o,s=s*o,g&&(g=g*o),h&&(h=h*o),w.value==="横向"){let d=l;l=s,s=d,d=g,g=h,h=d}})(b);let R=await e.go();if(!R)return t();e.setMessage(`
- `+E("533")+":"),e.setUserDraw((o,F)=>{if(!R)return;F.setColor(16711680),o=a(l,s,R,o);let d=new le;d.addVertexAt(R),d.addVertexAt(new A(R.x,o.y)),d.addVertexAt(o),d.addVertexAt(new A(o.x,R.y)),d.constantWidth=Ce.screenCoordLong2Doc(2),d.isClosed=!0,F.drawMcDbEntity(d);let U=[];U.push(R.toVector3()),U.push(new THREE.Vector3(R.x,o.y)),U.push(o.toVector3()),U.push(new THREE.Vector3(o.x,R.y)),F.setColor(12868),F.drawSolid(U,.5)}),e.setDisableOsnap(!0),e.setDisableOrthoTrace(!0),e.setDynamicInputType(Re.kXYCoordInput);let X=await e.go();if(!X)return t();X=a(l,s,R,X),$(R,X),v.value=null,x.isShow.value=!0,q().success(E("531"))},ge=async()=>{x.isShow.value=!1;const a=O.value/k.value;let{w:t,h:e,nw:l,nh:s}=r();(o=>{if(t=t*o,e=e*o,l&&(l=l*o),s&&(s=s*o),w.value==="横向"){let d=t;t=e,e=d,d=l,l=s,s=d}})(a);const h=new xe;h.clearLastInputPoint(),h.disableAllTrace(),h.setMessage(`
- `+E("385")),h.setKeyWords("");const b=N.getCurrentMxCAD();h.setUserDraw((o,F)=>{F.setColor(16711680);let d=new le,U=new A(o.x-t*.5,o.y-e*.5),Y=new A(o.x-t*.5,o.y+e*.5),ie=new A(o.x+t*.5,o.y+e*.5),K=new A(o.x+t*.5,o.y-e*.5);d.addVertexAt(U),d.addVertexAt(Y),d.addVertexAt(ie),d.addVertexAt(K),d.constantWidth=Ce.screenCoordLong2Doc(2),d.isClosed=!0,F.drawMcDbEntity(d);let Z=[];if(Z.push(U.toVector3()),Z.push(Y.toVector3()),Z.push(ie.toVector3()),Z.push(K.toVector3()),F.setColor(12868),F.drawSolid(Z,.5),l&&s&&l>0&&s>0){let ce=new A(o.x-l*.5,o.y-s*.5),Ae=new A(o.x-l*.5,o.y+s*.5),je=new A(o.x+l*.5,o.y+s*.5),We=new A(o.x+l*.5,o.y-s*.5),te=[];te.push(ce.toVector3()),te.push(Ae.toVector3()),te.push(je.toVector3()),te.push(We.toVector3()),te.push(ce.toVector3());let Pe=b.mxdraw.viewCoordLong2Cad(3),Ye=Je.createDashedLines(te,16777215,Pe*2,Pe);F.drawEntity(Ye)}});let L=await h.go();if(!L)return x.isShow.value=!0;let R=new A(L.x-t*.5,L.y-e*.5),X=new A(L.x+t*.5,L.y+e*.5);$(R,X),x.isShow.value=!0,v.value=null,q().success(E("531"))},J=(a,t,e,l,s=!1)=>new Promise(g=>{let h={width:""+e,height:""+l,roate_angle:0,bd_pt1_x:""+a.x,bd_pt1_y:""+a.y,bd_pt2_x:""+t.x,bd_pt2_y:""+t.y};const b=_e(),L=()=>{b&&qe("MxFullScreen")};{let{baseUrl:R="",mxfilepath:X="",printPdfUrl:o=""}=Ke()||{};N.getCurrentMxCAD().saveFileToUrl(o,(F,d)=>{try{let U=JSON.parse(d);if(U.ret=="ok"){let Y=R+X+U.file;if(s)return g(Y);rt(Y),L(),q().success(E("534")),g(Y)}else console.log(d),q().error(E("535")),g(!1)}catch{console.log("Mx: sserverResult error"),g(!1)}},void 0,JSON.stringify(h))}}),he=()=>{const{pt1:a,pt2:t,w:e,h:l}=z||oe();J(a,t,e,l),x.isShow.value=!1},ve=(a,t,e=16711680)=>{const l=new Ze;return l.pt1=a.toVector3(),l.pt2=t.toVector3(),l.setLineWidth(10),l.color=e,l.top(),l},G=Fe(!1,"Mx_batch_PrintDialog");let n=[];const c=j([]);let i=[];const _=async()=>{x.isShow.value=!1,G.isShow.value=!1,i=await ut(),c.value=i.map((a,t)=>({name:E("536")+t,index:t})),n=i.filter(a=>!!a).map((a,t)=>{const{minPt:e,maxPt:l}=a,s=ve(e,l),g=N.getCurrentMxCAD();g.getMxDrawObject().addMxEntity(s);const h=new A((e.x+l.x)/2,(e.y+l.y)/2),b=new Ge;return b.text=t.toString(),b.position=h.toVector3(),b.color=16711680,b.height=e.distanceTo(l)*.5,g.getMxDrawObject().addMxEntity(b),[b,s]}),G.isShow.value=!0};function ee(a,t){var e=document.createElement("a");e.setAttribute("href",a),e.setAttribute("download",t),document.body.appendChild(e),e.click(),document.body.removeChild(e)}const Ie=async()=>{let{w:a,h:t}=r();for(let e=0;e<i.length;e++){const{minPt:l,maxPt:s}=i[e]||{};if(!l||!s)continue;const g=await J(l,s,a,t,!0);g&&ee(g,c.value[e].name)}G.isShow.value=!1},Se=()=>{const a=N.getCurrentMxCAD();n.forEach(([t,e])=>{a.mxdraw.eraseMxEntity(t.objectId()),a.mxdraw.eraseMxEntity(e.objectId())}),n=[],i=[],c.value=[],a.updateDisplay()};return $e(G.isShow,a=>{a||Se()}),{dialog:x,isDrawingBoundary:v,lowerLeftCornerCoordinateX:y,lowerLeftCornerCoordinateY:C,upperRightCornerCoordinateX:V,upperRightCornerCoordinateY:P,sheetSizes:B,sheetSize:u,paperOrientations:M,paperOrientation:w,printParameterMillimeter:k,printParametersCADDrawingUnits:O,scopeHistory:H,callLastTimeScopeHistory:ye,callFreeChoiceOfRange:re,callFixedProportionalSelection:we,callFixedDrawingSizeSelection:ge,callPrint:he,updateDrawingBoundary:fe,updatePrintParameters:de,updateSize:pe,universalBatchPrinting:Ie,frameIndexArr:c,removeFrame:a=>{const[t,e]=n[a],l=N.getCurrentMxCAD();l.mxdraw.eraseMxEntity(t.objectId()),l.mxdraw.eraseMxEntity(e.objectId()),l.updateDisplay(),i.splice(a,1),n.splice(a,1),c.value.splice(a,1)},removeFramesRectBoxArr:Se,frameRecognition:_,batchPrintingDialog:G,framePrint:a=>{if(!i[a])return;const{maxPt:t,minPt:e}=i[a];let{w:l,h:s}=r();J(e,t,l,s,!0)},positioningFrame:a=>{if(!i[a])return;let{maxPt:t,minPt:e}=i[a];const l=N.getCurrentMxCAD(),s=e.distanceTo(t)*.1;t=t.clone(),e=e.clone(),e.x-=s,e.y-=s,t.x+=s,t.y+=s,l.zoomW(e,t)}}},pt=["onUpdate:modelValue"],mt={class:"d-flex flex-column"},ft={class:"h-100 mt-2"},yt={class:"d-flex align-center flex-column"},Vt=et({__name:"index",setup(x){const{dialog:v,isDrawingBoundary:y,lowerLeftCornerCoordinateX:C,lowerLeftCornerCoordinateY:V,upperRightCornerCoordinateX:P,upperRightCornerCoordinateY:B,sheetSizes:u,sheetSize:r,paperOrientations:M,paperOrientation:w,printParameterMillimeter:k,printParametersCADDrawingUnits:O,callLastTimeScopeHistory:ne,callFreeChoiceOfRange:se,callFixedProportionalSelection:Q,callFixedDrawingSizeSelection:de,callPrint:pe,updateDrawingBoundary:H,updatePrintParameters:z,updateSize:$,universalBatchPrinting:oe,frameIndexArr:me,removeFrame:fe,frameRecognition:ye,batchPrintingDialog:re,framePrint:we,positioningFrame:ge}=ct(),{isShow:J,showDialog:he}=v,ve=[{name:"生成打印PDF",fun:pe,primary:!0},{name:"取消",fun:()=>he(!1)}],G=[{name:"批量下载",fun:oe,primary:!0},{name:"取消",fun:()=>re.showDialog(!1)}];return(n,c)=>(be(),Ve(Ue,null,[p(ze,{title:n.t("675"),modelValue:f(re).isShow.value,"onUpdate:modelValue":c[0]||(c[0]=i=>f(re).isShow.value=i),"max-width":"600",footerBtnList:G},{default:m(()=>[p(tt,{density:"compact","fixed-header":"",height:300,class:"attribute_table",style:{"table-layout":"fixed"}},{default:m(()=>[S("thead",null,[S("tr",null,[S("th",null,"pdf"+D(n.t("138")),1),S("th",null,D(n.t("676")),1)])]),S("tbody",null,[(be(!0),Ve(Ue,null,at(f(me),(i,_)=>(be(),Ve("tr",{key:_},[S("td",null,[lt(S("input",{class:"w-100 h-100","onUpdate:modelValue":ee=>i.name=ee},null,8,pt),[[nt,i.name]])]),S("td",null,[p(De,{onClick:ee=>f(fe)(_)},{default:m(()=>[I(D(n.t("148")),1)]),_:2},1032,["onClick"]),p(De,{onClick:ee=>f(we)(_),class:"ml-1"},{default:m(()=>[I(D(n.t("154")),1)]),_:2},1032,["onClick"]),p(De,{onClick:ee=>f(ge)(_),class:"ml-1"},{default:m(()=>[I(D(n.t("677")),1)]),_:2},1032,["onClick"])])]))),128))])]),_:1})]),_:1},8,["title","modelValue"]),p(ze,{title:n.t("154"),modelValue:f(J),"onUpdate:modelValue":c[10]||(c[10]=i=>W(J)?J.value=i:null),"max-width":"600",footerBtnList:ve},{default:m(()=>[p(st,{align:"stretch"},{default:m(()=>[p(Te,{cols:"6","align-self":"start"},{default:m(()=>[p(Me,{title:n.t("678"),class:"mt-2"},{default:m(()=>[p(ot,{modelValue:f(y),"onUpdate:modelValue":[c[1]||(c[1]=i=>W(y)?y.value=i:null),f(H)],inline:!1},{default:m(()=>[p(Ee,{value:!0,onClick:f(H)},{label:m(()=>[p(Be,{class:"","key-name":"W"},{default:m(()=>[I(D(n.t("160")+n.t("161")),1)]),_:1})]),_:1},8,["onClick"]),p(Ee,{class:"mt-1",value:!1,onClick:f(H)},{label:m(()=>[p(Be,{class:"","key-name":"R"},{default:m(()=>[I(D(n.t("162")+n.t("163")),1)]),_:1})]),_:1},8,["onClick"])]),_:1},8,["modelValue","onUpdate:modelValue"]),S("div",mt,[p(ue,{class:"mt-2",onClick:f(ne)},{default:m(()=>[I(D(n.t("164")+n.t("165")),1)]),_:1},8,["onClick"]),p(ue,{class:"mt-1",onClick:f(se)},{default:m(()=>[I(D(n.t("166")+n.t("167")),1)]),_:1},8,["onClick"]),p(ue,{class:"mt-1",onClick:f(Q)},{default:m(()=>[I(D(n.t("168")+n.t("169")+n.t("167")),1)]),_:1},8,["onClick"]),p(ue,{class:"mt-1",onClick:f(de)},{default:m(()=>[I(D(n.t("168")+n.t("160")+n.t("170")+n.t("167")),1)]),_:1},8,["onClick"]),p(ue,{class:"mt-1",onClick:f(ye)},{default:m(()=>[I(D(n.t("679")+" "+n.t("680")),1)]),_:1},8,["onClick"])]),p(ae,{modelValue:f(C),"onUpdate:modelValue":c[2]||(c[2]=i=>W(C)?C.value=i:null),class:"mt-2",type:"number"},{prepend:m(()=>[S("span",null,D(n.t("171")+n.t("172")+n.t("173"))+"X:",1)]),_:1},8,["modelValue"]),p(ae,{modelValue:f(V),"onUpdate:modelValue":c[3]||(c[3]=i=>W(V)?V.value=i:null),class:"mt-1",type:"number"},{prepend:m(()=>[S("span",null,D(n.t("171")+n.t("172")+n.t("173"))+"Y:",1)]),_:1},8,["modelValue"]),p(ae,{modelValue:f(P),"onUpdate:modelValue":c[4]||(c[4]=i=>W(P)?P.value=i:null),class:"mt-1",type:"number"},{prepend:m(()=>[S("span",null,D(n.t("174")+n.t("172")+n.t("173"))+"X:",1)]),_:1},8,["modelValue"]),p(ae,{modelValue:f(B),"onUpdate:modelValue":c[5]||(c[5]=i=>W(B)?B.value=i:null),class:"mt-1",type:"number"},{prepend:m(()=>[S("span",null,D(n.t("174")+n.t("172")+n.t("173"))+"Y:",1)]),_:1},8,["modelValue"])]),_:1},8,["title"])]),_:1}),p(Te,{cols:"6","align-self":"start"},{default:m(()=>[S("div",ft,[p(Me,{title:n.t("160")+n.t("175")},{default:m(()=>[p(Oe,{modelValue:f(r),"onUpdate:modelValue":[c[6]||(c[6]=i=>W(r)?r.value=i:null),f($)],items:f(u),class:"mr-1 my-2"},{prepend:m(()=>[S("span",null,D(n.t("160")+n.t("170"))+":",1)]),_:1},8,["modelValue","items","onUpdate:modelValue"]),p(Oe,{modelValue:f(w),"onUpdate:modelValue":[c[7]||(c[7]=i=>W(w)?w.value=i:null),f(H)],items:f(M),class:"mr-1 my-2"},{prepend:m(()=>[S("span",null,D(n.t("160")+n.t("176"))+":",1)]),_:1},8,["modelValue","items","onUpdate:modelValue"])]),_:1},8,["title"]),p(Me,{class:"my-4 py-4",title:n.t("154")+n.t("177")},{default:m(()=>[S("div",yt,[p(ae,{modelValue:f(k),"onUpdate:modelValue":c[8]||(c[8]=i=>W(k)?k.value=i:null),modelModifiers:{lazy:!0},min:"0","onUpdate:focused":f(z),class:"w-75 mr-1",type:"number"},{append:m(()=>[I(D(n.t("178")),1)]),_:1},8,["modelValue","onUpdate:focused"]),c[11]||(c[11]=S("span",null,"=",-1)),p(ae,{modelValue:f(O),"onUpdate:modelValue":c[9]||(c[9]=i=>W(O)?O.value=i:null),modelModifiers:{lazy:!0},min:"0","onUpdate:focused":f(z),class:"w-75 ml-1 mr-1",type:"number"},{append:m(()=>[I(D("CAD"+n.t("179")+n.t("180")),1)]),_:1},8,["modelValue","onUpdate:focused"])])]),_:1},8,["title"])])]),_:1})]),_:1})]),_:1},8,["title","modelValue"])],64))}});export{Vt as default};
|