index.60c62931.js 7.5 KB

123
  1. var j=(Y,c,x)=>new Promise((k,B)=>{var U=n=>{try{r(x.next(n))}catch(f){B(f)}},p=n=>{try{r(x.throw(n))}catch(f){B(f)}},r=n=>n.done?k(n.value):Promise.resolve(n.value).then(U,p);r((x=x.apply(Y,c)).next())});import{d as ne,r as I,u as ie,A as de,cj as re,ck as me,a2 as h,aj as ce,cl as pe,o as q,c as H,w as l,a as g,b as s,V as A,e as u,$ as v,n as M,Z as fe,S as _e,cm as xe,D as Ve,t as be,k as ge,h as J,ad as G,ah as C,l as E,j as w,cn as ye,co as De,bI as ve,am as Me,al as X,a8 as L,cp as K,bL as we,a4 as Be,an as Q,cq as Fe,bP as W}from"./index.6c36cb53.js";import{M as Pe}from"./index.a696a3d7.js";import{V as Ee}from"./VAutocomplete.71c702e7.js";const ke={class:"px-3"},he=g("span",{class:""}," X:",-1),Ae=g("span",{class:""}," Y:",-1),Ce=g("span",{class:""}," Z:",-1),Ue=g("span",{class:""}," X:",-1),Ie=g("span",{class:""}," Y:",-1),Le=g("span",{class:""}," Z:",-1),Se=g("span",{class:""}," \u89D2\u5EA6:",-1),je=ne({__name:"index",setup(Y){const c=I(),{isShow:x,showDialog:k}=ie(!1,"Mx_Insert",o=>{var e;k(),o&&(c.value={name:o.name,filePath:o.filePath,id:(e=o.id)!=null?e:o.filePath})}),B=I([]);de(x,o=>{o&&(B.value=ve().map(e=>({name:e,id:e})))}),re("Mx_add_insert_blocks_list",o=>{const e=o.type,t=o.hash,y=o.file;let m="";if(t){let{baseUrl:a="",mxfilepath:D=""}=me()||{};m=a+D+t+"."+e+".mxweb"}else e==="mxweb"&&(m=URL.createObjectURL(y.source.source));const d={name:y.name,filePath:m,id:t||m};B.value.unshift(d),c.value=d});const U=()=>j(this,null,function*(){{const o=Me();yield ye(!1,"Mx_add_insert_blocks_list"),o&&De("MxFullscreen")}}),p=h(!0,"Mx_InsertDialog_is_get_insertion_point"),r=h(!0,"Mx_InsertDialog_is_get_proportion"),n=h(!0,"Mx_InsertDialog_is_uniform_proportion"),f=h(!0,"Mx_InsertDialog_is_get_rotation"),F=h(!0,"Mx_InsertDialog_is_decomposition"),V=ce({x:0,y:0,z:0}),_=pe({x:1,y:1,z:1},"Mx_InsertDialog_proportion"),S=I(0);function ee(o,e,t,y){const m=o-t,d=e-y;let a=0;return m==0?a=Math.PI/2:a=Math.atan(Math.abs(d/m)),m<0&&d>=0?a=Math.PI-a:m<0&&d<0?a=Math.PI+a:m>=0&&d<0&&(a=Math.PI*2-a),a+Math.PI}const Z=()=>j(this,null,function*(){let o=X.App.getCurrentMxCAD();const{filePath:e,hash:t,name:y}=c.value||{},m=o.getDatabase().getBlockTable();let d;if(y)d=m.get(y);else if(!e)return L().warning("\u8BF7\u9009\u62E9\u6B63\u786E\u7684\u56FE\u5757");if((!d||!d.isValid())&&e&&(K().showLoading(),L().info("\u56FE\u5757\u52A0\u8F7D\u4E2D..."),d=yield o.insertBlock(e,t||e),K().hideLoading(),!d.isValid())){L().error("\u56FE\u5757\u52A0\u8F7D\u5931\u8D25");return}let a=new we;a.blockTableRecordId=d;let D=a.getBoundingBox(),R=0;if(D.ret){let i=D.maxPt.distanceTo(D.minPt);i>1e-5&&(R=o.getMxDrawObject().screenCoordLong2Doc(100)/i,a.setScale(R))}let b=new Be;if(k(!1),p.value){b.setMessage(`
  2. \u6307\u5B9A\u63D2\u5165\u57FA\u70B9`),b.setUserDraw((P,T)=>{a.position=P,T.drawMcDbEntity(a)});let i=yield b.go();if(!i)return;a.position=i}else a.position=new Q(V.x,V.y,V.z);if(r.value){const i=D.minPt,P=D.maxPt;let T=P.x-i.x,se=P.y-i.y,z=(T+se)/3;z<1e-5&&(z=1),b.setMessage(`
  3. \u8F93\u5165\u6BD4\u4F8B\u56E0\u5B50<1.00>`),a.setScale(-R),b.setUserDraw((oe,ue)=>{const O=oe.distanceTo(a.position);if(O<1e-5)return;let N=O/z;N>1e5&&(N=1e5),a.setScale(N/2),ue.drawMcDbEntity(a)}),yield b.go()}else n.value?a.setScale(_.x):a.scaleFactors=new Q(_.x,_.y,_.z);f.value?(b.setBasePt(a.position),b.setUserDraw((i,P)=>{a.rotation=ee(a.position.x,a.position.y,i.x,i.y),P.drawMcDbEntity(a)}),yield b.go()):a.rotation=S.value;const ae=o.drawEntity(a);F.value&&setTimeout(()=>{let i=new Fe;X.App.MxCADAssist.MxExplode(i.imp),i.copyFormAryId([ae]),X.App.MxCADAssist.MxExplode(i.imp),W()}),W(),L().success("\u63D2\u5165\u56FE\u5757\u6210\u529F!")}),te=[{name:"\u786E\u5B9A",fun:Z,primary:!0},{name:"\u5173\u95ED",fun:()=>k(!1)}],$=I(),le={n:()=>{var t;const e=((t=$.value)==null?void 0:t.$el).getElementsByTagName("input")[0];e==null||e.focus()},b:U,s:()=>{p.value=!p.value},e:()=>{r.value=!r.value},c:()=>{f.value=!f.value},u:()=>{n.value=!n.value},d:()=>{F.value=!F.value},enter:()=>{Z()}};return(o,e)=>(q(),H(Pe,{title:"\u63D2\u5165\u5757",modelValue:u(x),"onUpdate:modelValue":e[13]||(e[13]=t=>E(x)?x.value=t:null),"max-width":"470",footerBtnList:te,keys:le},{default:l(()=>[g("div",ke,[s(J,null,{default:l(()=>[s(A,{cols:9},{default:l(()=>[s(u(Ee),{class:"mt-1",ref_key:"autocomplete",ref:$,items:B.value,"item-title":"name","return-object":"",modelValue:c.value,"onUpdate:modelValue":e[0]||(e[0]=t=>c.value=t)},{prepend:l(()=>[s(v,{class:"","key-name":"N"},{default:l(()=>[M("\u540D\u79F0")]),_:1})]),append:l(()=>[s(fe,{onClick:U},{default:l(()=>[s(v,{"key-name":"B"},{default:l(()=>[M("\u6D4F\u89C8")]),_:1}),s(_e,{icon:"class:iconfont more"})]),_:1})]),_:1},8,["items","modelValue"]),c.value&&c.value.filePath?(q(),H(xe,{key:0,text:c.value.filePath},{activator:l(({props:t})=>[g("p",Ve({class:"mt-1 text-truncate"},t),"\u8DEF\u5F84: "+be(c.value.filePath),17)]),_:1},8,["text"])):ge("",!0)]),_:1}),s(A,{cols:3,class:"h-100"})]),_:1}),s(J,{"align-stretch":""},{default:l(()=>[s(A,{cols:"4","align-self":"stretch"},{default:l(()=>[s(G,{title:"\u63D2\u5165\u70B9",class:"h-100"},{default:l(()=>[s(C,{class:"",modelValue:u(p),"onUpdate:modelValue":e[1]||(e[1]=t=>E(p)?p.value=t:null)},{label:l(()=>[s(v,{"key-name":"S"},{default:l(()=>[M("\u5728\u5C4F\u5E55\u4E0A\u6307\u5B9A")]),_:1})]),_:1},8,["modelValue"]),s(w,{class:"mt-1",type:"number",modelValue:V.x,"onUpdate:modelValue":e[2]||(e[2]=t=>V.x=t),disabled:u(p)},{prepend:l(()=>[he]),_:1},8,["modelValue","disabled"]),s(w,{class:"mt-1",type:"number",modelValue:V.y,"onUpdate:modelValue":e[3]||(e[3]=t=>V.y=t),disabled:u(p)},{prepend:l(()=>[Ae]),_:1},8,["modelValue","disabled"]),s(w,{class:"mt-1",type:"number",modelValue:V.z,"onUpdate:modelValue":e[4]||(e[4]=t=>V.z=t),disabled:u(p)},{prepend:l(()=>[Ce]),_:1},8,["modelValue","disabled"])]),_:1})]),_:1}),s(A,{cols:"4","align-self":"stretch"},{default:l(()=>[s(G,{title:"\u6BD4\u4F8B",class:"h-100"},{default:l(()=>[s(C,{class:"",modelValue:u(r),"onUpdate:modelValue":e[5]||(e[5]=t=>E(r)?r.value=t:null)},{label:l(()=>[s(v,{"key-name":"E"},{default:l(()=>[M("\u5728\u5C4F\u5E55\u4E0A\u6307\u5B9A")]),_:1})]),_:1},8,["modelValue"]),s(w,{class:"mt-1",type:"number",step:"0.001",modelValue:u(_).x,"onUpdate:modelValue":e[6]||(e[6]=t=>u(_).x=t),disabled:u(r)},{prepend:l(()=>[Ue]),_:1},8,["modelValue","disabled"]),s(w,{class:"mt-1",type:"number",modelValue:u(_).y,"onUpdate:modelValue":e[7]||(e[7]=t=>u(_).y=t),step:"0.001",disabled:u(r)||u(n)},{prepend:l(()=>[Ie]),_:1},8,["modelValue","disabled"]),s(w,{class:"mt-1",type:"number",modelValue:u(_).z,"onUpdate:modelValue":e[8]||(e[8]=t=>u(_).z=t),step:"0.001",disabled:u(r)||u(n)},{prepend:l(()=>[Le]),_:1},8,["modelValue","disabled"]),s(C,{class:"ml-4 mt-1",modelValue:u(n),"onUpdate:modelValue":e[9]||(e[9]=t=>E(n)?n.value=t:null)},{label:l(()=>[s(v,{"key-name":"U"},{default:l(()=>[M("\u7EDF\u4E00\u6BD4\u4F8B")]),_:1})]),_:1},8,["modelValue"])]),_:1})]),_:1}),s(A,{cols:"4","align-self":"stretch"},{default:l(()=>[s(G,{title:"\u65CB\u8F6C",class:"h-100"},{default:l(()=>[s(C,{class:"",modelValue:u(f),"onUpdate:modelValue":e[10]||(e[10]=t=>E(f)?f.value=t:null)},{label:l(()=>[s(v,{"key-name":"C"},{default:l(()=>[M("\u5728\u5C4F\u5E55\u4E0A\u6307\u5B9A")]),_:1})]),_:1},8,["modelValue"]),s(w,{class:"mt-1",type:"number",modelValue:S.value,"onUpdate:modelValue":e[11]||(e[11]=t=>S.value=t),disabled:u(f)},{prepend:l(()=>[Se]),_:1},8,["modelValue","disabled"])]),_:1})]),_:1})]),_:1}),s(C,{class:"mt-2",modelValue:u(F),"onUpdate:modelValue":e[12]||(e[12]=t=>E(F)?F.value=t:null)},{label:l(()=>[s(v,{"key-name":"D"},{default:l(()=>[M("\u5206\u89E3")]),_:1})]),_:1},8,["modelValue"])])]),_:1},8,["modelValue"]))}});export{je as default};