index-Cz6Ec37f.js 6.3 KB

1
  1. import{ag as w,N as G,aL as ee,b2 as h,k as ae,d as u,Y as A,O as te,b as Y,b3 as le,a1 as se,S as ne,ae as oe,af as ie,ah as ce,ai as t,aj as l,ak as N,b4 as ue,J as I,n as re,aK as de,al as K,am as C,an as e,az as _,at as v,ap as k,aN as fe,ao as $,aC as J,aG as W,aD as X,aZ as q,au as H,ax as me,ay as F,aW as Q,aO as be,as as pe,aw as ke}from"./index-D68iA7pN.js";import{M as ye}from"./index-AOcxwHT9.js";var M=(d=>(d[d.HOLD=0]="HOLD",d[d.CONVERT_TO_BLOCK=1]="CONVERT_TO_BLOCK",d[d.DELETE=2]="DELETE",d))(M||{});const _e=()=>{const d=w(""),D=w([]);ne(()=>{D.value=h()});const f=G(!1,"Mx_CreateBlocksDialog_is_specify_on_screen_get_base_point"),o=ee({x:0,y:0,z:0}),T=async()=>{const b=new ae;b.clearLastInputPoint(),b.setMessage(u("527"));const p=await b.go();if(!p)return;const{x:y,y:g,z:r}=p;return o.x=A(y,3),o.y=A(g,3),o.z=A(r,3),p},i=G(!1,"Mx_CreateBlocksDialog_is_specify_on_screen_select_object"),R=G(2,"Mx_CreateBlocksDialog_select_Object_operation_type"),c=w(!0),V=w(0);let m;const x=async()=>{if(m=new te,V.value=0,!await m.userSelect(u("436")))return;const b=m.count();if(V.value=b,b===0){c.value=!0;return}return c.value=!1,m},S=()=>{const p=Y.getCurrentMxCAD().getDatabase().getBlockTable(),y=new le;return y.name=d.value,p.add(y)},L=(b,p,y)=>{p.getMcDbBlockTableRecord()?.getAllEntityId().forEach(E=>{E.getMcDbEntity()?.erase()});let g=p.getMcDbBlockTableRecord();if(!g)return;b.forEach(E=>{const j=E.getMcDbEntity();if(!j)return;const z=j.clone();g&&g.appendAcDbEntity(z)}),g.origin=y;let r=new se;return r.blockTableRecordId=p,r.position=y,r},P=w("");return{blockName:d,blockNames:D,getBlockNames:h,basePoint:o,getMouseClickGetBasePoint:T,isSpecifyOnScreenGetBasePoint:f,isNoSelectObject:c,isSpecifyOnScreenSelectObject:i,selectObjectOperationType:R,selectObject:x,createBlock:S,loadBlock:L,explainText:P,selectCount:V}},ve={class:"px-3"},ge={class:"f-flex justify-center align-center mt-2"},Ve={class:"f-flex justify-center align-center mt-2"},xe={class:"d-flex flex-column"},Ce={key:0,class:"f-flex justify-center align-center mt-2"},De={key:1},Be=oe({__name:"index",setup(d){const{isShow:D,showDialog:f}=ie(!1,"Mx_Block",()=>{f(!0),y()}),{blockName:o,blockNames:T,basePoint:i,getMouseClickGetBasePoint:R,isSpecifyOnScreenGetBasePoint:c,isNoSelectObject:V,isSpecifyOnScreenSelectObject:m,selectObjectOperationType:x,selectObject:S,selectCount:L,createBlock:P,loadBlock:b,explainText:p}=_e(),y=()=>{i.x=0,i.y=0,i.z=0,o.value="",r=void 0,V.value=!0,T.value=h()},g=async()=>{f(!1),await R(),f(!0)};let r;const E=async()=>{f(!1),r=await S(),f(!0)},z=[{name:"确定",fun:async()=>{const{open:n}=ue();let a=!1;const s=T.value.includes(o.value);if(o.value==="")return I().error(u("图块名不能为空")+"!");if(s)try{await new Promise((B,O)=>{n({title:u("是否替换该图块"),text:u("已定义")+o.value+u("的")+u("图块")+","+u("是否替换")+"?",define:()=>{a=!0,B()},cancel:()=>{a=!1,O()},defineTitle:u("是"),cancelTitle:u("否")})})}catch{return}let U;if(a?U=Y.getCurrentMxCAD().getDatabase().getBlockTable().get(o.value):U=P(),c.value&&(f(!1),await R()),m.value&&(f(!1),r=await S()),!r||V.value)return I().error(u("没有为块")+o.value+u("选择对象")+"!");const Z=b(r,U,new re(i.x,i.y,i.z));if(!Z)return I().error(u("创建块失败")+"!");x.value!==M.HOLD&&(r.forEach(B=>{const O=B.getMcDbEntity();O&&O.erase()}),de()),x.value===M.CONVERT_TO_BLOCK&&Y.getCurrentMxCAD().drawEntity(Z),f(!1)},primary:!0},{name:"关闭",fun:()=>{f(!1)}}];return(n,a)=>(K(),ce(ye,{title:n.t("142"),modelValue:l(D),"onUpdate:modelValue":a[7]||(a[7]=s=>N(D)?D.value=s:null),"max-width":"400",footerBtnList:z},{default:t(()=>[C("div",ve,[e(fe,{class:"mt-2",modelValue:l(o),"onUpdate:modelValue":a[0]||(a[0]=s=>N(o)?o.value=s:null),items:l(T)},{prepend:t(()=>[e(_,{"key-name":"N"},{default:t(()=>[v(k(n.t("138")),1)]),_:1})]),_:1},8,["modelValue","items"]),e(pe,{"align-stretch":""},{default:t(()=>[e($,{cols:6,"align-self":"stretch"},{default:t(()=>[e(J,{title:n.t("143"),class:"h-100"},{default:t(()=>[e(W,{modelValue:l(c),"onUpdate:modelValue":a[1]||(a[1]=s=>N(c)?c.value=s:null)},{label:t(()=>[e(_,{"key-name":"S"},{default:t(()=>[v(k(n.t("144")),1)]),_:1})]),_:1},8,["modelValue"]),C("div",ge,[e(X,{disabled:l(c),onClick:g},null,8,["disabled"]),e(_,{class:q(l(c)?"text-disabled":""),"key-name":"S"},{default:t(()=>[v(k(n.t("145")),1)]),_:1},8,["class"])]),e(H,{class:"mt-3",modelValue:l(i).x,"onUpdate:modelValue":a[2]||(a[2]=s=>l(i).x=s),type:"number",disabled:l(c)},{prepend:t(()=>a[8]||(a[8]=[C("span",{class:""}," X:",-1)])),_:1},8,["modelValue","disabled"]),e(H,{class:"mt-1",modelValue:l(i).y,"onUpdate:modelValue":a[3]||(a[3]=s=>l(i).y=s),type:"number",disabled:l(c)},{prepend:t(()=>a[9]||(a[9]=[C("span",{class:""}," Y: ",-1)])),_:1},8,["modelValue","disabled"]),e(H,{class:"mt-1",modelValue:l(i).z,"onUpdate:modelValue":a[4]||(a[4]=s=>l(i).z=s),type:"number",disabled:l(c)},{prepend:t(()=>a[10]||(a[10]=[C("span",{class:""}," Z:",-1)])),_:1},8,["modelValue","disabled"])]),_:1},8,["title"])]),_:1}),e($,{cols:6,"align-self":"stretch"},{default:t(()=>[e(J,{title:n.t("137"),class:"h-100"},{default:t(()=>[e(W,{modelValue:l(m),"onUpdate:modelValue":a[5]||(a[5]=s=>N(m)?m.value=s:null)},{label:t(()=>[e(_,{class:"","key-name":"S"},{default:t(()=>[v(k(n.t("144")),1)]),_:1})]),_:1},8,["modelValue"]),C("div",Ve,[e(X,{disabled:l(m),onClick:E},null,8,["disabled"]),e(_,{class:q(l(m)?"text-disabled":""),"key-name":"I"},{default:t(()=>[v(k(n.t("134")),1)]),_:1},8,["class"])]),e(me,{column:"",class:"mt-2",modelValue:l(x),"onUpdate:modelValue":a[6]||(a[6]=s=>N(x)?x.value=s:null)},{default:t(()=>[C("div",xe,[e(F,{value:l(M).HOLD,class:"mt-1"},{label:t(()=>[e(_,{class:"","key-name":"R"},{default:t(()=>[v(k(n.t("146")),1)]),_:1})]),_:1},8,["value"]),e(F,{value:l(M).CONVERT_TO_BLOCK,class:"mt-1"},{label:t(()=>[e(_,{class:"","key-name":"C"},{default:t(()=>[v(k(n.t("147")),1)]),_:1})]),_:1},8,["value"]),e(F,{value:l(M).DELETE,class:"mt-1"},{label:t(()=>[e(_,{class:"","key-name":"D"},{default:t(()=>[v(k(n.t("148")),1)]),_:1})]),_:1},8,["value"])])]),_:1},8,["modelValue"]),l(V)?(K(),Q("div",Ce,[e(be,{icon:"jinggao"}),e(_,{class:"","key-name":"I"},{default:t(()=>[v(k(n.t("149")),1)]),_:1})])):(K(),Q("div",De,k(n.t("150")+":"+l(L)+n.t("136")),1))]),_:1},8,["title"])]),_:1})]),_:1})])]),_:1},8,["title","modelValue"]))}}),Ee=ke(Be,[["__scopeId","data-v-3cb7b403"]]);export{Ee as default};