dxf-kit 1.0.2 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +3 -3
- package/dist/index.mjs +2117 -3
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,2121 @@
|
|
|
1
|
-
(function(_0x2a8ff4,_0x2febaf){const _0x430f7c=_0xcf9d,_0x16dbb5=_0x2a8ff4();while(!![]){try{const _0x25b3e5=parseInt(_0x430f7c(0x12a))/0x1+-parseInt(_0x430f7c(0x11f))/0x2*(parseInt(_0x430f7c(0x12d))/0x3)+-parseInt(_0x430f7c(0xbe))/0x4*(-parseInt(_0x430f7c(0x104))/0x5)+parseInt(_0x430f7c(0x131))/0x6*(parseInt(_0x430f7c(0x125))/0x7)+parseInt(_0x430f7c(0x147))/0x8*(parseInt(_0x430f7c(0xfa))/0x9)+parseInt(_0x430f7c(0x103))/0xa+-parseInt(_0x430f7c(0x140))/0xb*(parseInt(_0x430f7c(0xcc))/0xc);if(_0x25b3e5===_0x2febaf)break;else _0x16dbb5['push'](_0x16dbb5['shift']());}catch(_0x3b69b2){_0x16dbb5['push'](_0x16dbb5['shift']());}}}(_0x39c5,0xd2738));function tokenize(_0x5ada44){const _0x23bd34=_0xcf9d,_0x2bee6d=_0x5ada44[_0x23bd34(0xf7)](/\r?\n/),_0x8c5da=[];for(let _0xb9c9f9=0x0;_0xb9c9f9+0x1<_0x2bee6d[_0x23bd34(0x197)];_0xb9c9f9+=0x2){const _0x641f49=parseInt(_0x2bee6d[_0xb9c9f9][_0x23bd34(0xae)](),0xa),_0x3600a9=_0x2bee6d[_0xb9c9f9+0x1][_0x23bd34(0xae)]();_0x8c5da[_0x23bd34(0x174)]({'code':_0x641f49,'value':_0x3600a9});}return _0x8c5da;}function autoConvert(_0x2ca6b4,_0x4d20e1){if(_0x2ca6b4>=0xa&&_0x2ca6b4<=0x3b||_0x2ca6b4>=0x6e&&_0x2ca6b4<=0x95||_0x2ca6b4>=0xd2&&_0x2ca6b4<=0xef||_0x2ca6b4>=0x1cc&&_0x2ca6b4<=0x1d5||_0x2ca6b4>=0x3f2&&_0x2ca6b4<=0x423)return parseFloat(_0x4d20e1);if(_0x2ca6b4>=0x3c&&_0x2ca6b4<=0x4f||_0x2ca6b4>=0x5a&&_0x2ca6b4<=0x63||_0x2ca6b4>=0xaa&&_0x2ca6b4<=0xb3||_0x2ca6b4>=0x10e&&_0x2ca6b4<=0x121||_0x2ca6b4>=0x172&&_0x2ca6b4<=0x185||_0x2ca6b4>=0x190&&_0x2ca6b4<=0x199||_0x2ca6b4>=0x424&&_0x2ca6b4<=0x437)return parseInt(_0x4d20e1,0xa);return _0x4d20e1;}function splitSections(_0x472ba9){const _0x8fa8f0=_0xcf9d,_0x1e4d72={};let _0x568bd1=0x0;while(_0x568bd1<_0x472ba9[_0x8fa8f0(0x197)]){if(_0x472ba9[_0x568bd1]['code']===0x0&&_0x472ba9[_0x568bd1]['value']==='SECTION'){_0x568bd1++;const _0xc50767=_0x472ba9[_0x568bd1]['value'];_0x568bd1++;const _0x455f7c=_0x568bd1;while(_0x568bd1<_0x472ba9[_0x8fa8f0(0x197)]&&!(_0x472ba9[_0x568bd1][_0x8fa8f0(0x155)]===0x0&&_0x472ba9[_0x568bd1][_0x8fa8f0(0xf8)]===_0x8fa8f0(0x152))){_0x568bd1++;}_0x1e4d72[_0xc50767]=_0x472ba9['slice'](_0x455f7c,_0x568bd1),_0x568bd1++;}else _0x568bd1++;}return _0x1e4d72;}function parseHeader(_0x1e76cd){const _0x37de1b=_0xcf9d;if(!_0x1e76cd||_0x1e76cd[_0x37de1b(0x197)]===0x0)return {};const _0x3c59e8={};let _0x1d3d1f=0x0;while(_0x1d3d1f<_0x1e76cd['length']){if(_0x1e76cd[_0x1d3d1f][_0x37de1b(0x155)]===0x9){const _0x404258=_0x1e76cd[_0x1d3d1f]['value'];_0x1d3d1f++;const _0x35995e={};while(_0x1d3d1f<_0x1e76cd[_0x37de1b(0x197)]&&_0x1e76cd[_0x1d3d1f][_0x37de1b(0x155)]!==0x9&&_0x1e76cd[_0x1d3d1f][_0x37de1b(0x155)]!==0x0){_0x35995e[_0x1e76cd[_0x1d3d1f][_0x37de1b(0x155)]]=autoConvert(_0x1e76cd[_0x1d3d1f]['code'],_0x1e76cd[_0x1d3d1f][_0x37de1b(0xf8)]),_0x1d3d1f++;}const _0x358002=Object[_0x37de1b(0x180)](_0x35995e);_0x3c59e8[_0x404258]=_0x358002[_0x37de1b(0x197)]===0x1?_0x35995e[_0x358002[0x0]]:_0x35995e;}else _0x1d3d1f++;}return _0x3c59e8;}function parseClasses(_0x23103c){const _0x5cacd2=_0xcf9d;if(!_0x23103c||_0x23103c[_0x5cacd2(0x197)]===0x0)return [];const _0x2a1bd8=[];let _0x44b57b=0x0;while(_0x44b57b<_0x23103c[_0x5cacd2(0x197)]){if(_0x23103c[_0x44b57b]['code']===0x0&&_0x23103c[_0x44b57b][_0x5cacd2(0xf8)]===_0x5cacd2(0x168)){_0x44b57b++;const _0x3bff98={};while(_0x44b57b<_0x23103c[_0x5cacd2(0x197)]&&_0x23103c[_0x44b57b][_0x5cacd2(0x155)]!==0x0){switch(_0x23103c[_0x44b57b]['code']){case 0x1:_0x3bff98['dxfRecord']=_0x23103c[_0x44b57b]['value'];break;case 0x2:_0x3bff98[_0x5cacd2(0xbc)]=_0x23103c[_0x44b57b][_0x5cacd2(0xf8)];break;case 0x3:_0x3bff98[_0x5cacd2(0xc8)]=_0x23103c[_0x44b57b][_0x5cacd2(0xf8)];break;case 0x5a:_0x3bff98[_0x5cacd2(0x13d)]=parseInt(_0x23103c[_0x44b57b][_0x5cacd2(0xf8)],0xa);break;case 0x5b:_0x3bff98[_0x5cacd2(0x12b)]=parseInt(_0x23103c[_0x44b57b][_0x5cacd2(0xf8)],0xa);break;case 0x118:_0x3bff98['wasProxy']=parseInt(_0x23103c[_0x44b57b]['value'],0xa);break;case 0x119:_0x3bff98[_0x5cacd2(0x1a5)]=parseInt(_0x23103c[_0x44b57b]['value'],0xa);break;default:_0x3bff98[_0x5cacd2(0x134)+_0x23103c[_0x44b57b][_0x5cacd2(0x155)]]=_0x23103c[_0x44b57b][_0x5cacd2(0xf8)];}_0x44b57b++;}_0x2a1bd8['push'](_0x3bff98);}else _0x44b57b++;}return _0x2a1bd8;}function parseTables(_0xa6bf16){const _0x5976e0=_0xcf9d;if(!_0xa6bf16||_0xa6bf16['length']===0x0)return {};const _0x41c994={};let _0x6f8cdd=0x0;while(_0x6f8cdd<_0xa6bf16['length']){if(_0xa6bf16[_0x6f8cdd][_0x5976e0(0x155)]===0x0&&_0xa6bf16[_0x6f8cdd][_0x5976e0(0xf8)]===_0x5976e0(0xea)){_0x6f8cdd++;const _0x4c72d1=_0xa6bf16[_0x6f8cdd][_0x5976e0(0xf8)];_0x6f8cdd++;const _0x12483b=_0x6f8cdd;while(_0x6f8cdd<_0xa6bf16[_0x5976e0(0x197)]&&!(_0xa6bf16[_0x6f8cdd][_0x5976e0(0x155)]===0x0&&_0xa6bf16[_0x6f8cdd][_0x5976e0(0xf8)]===_0x5976e0(0xa5))){_0x6f8cdd++;}_0x41c994[_0x4c72d1]=parseTableEntries(_0x4c72d1,_0xa6bf16[_0x5976e0(0x12f)](_0x12483b,_0x6f8cdd)),_0x6f8cdd++;}else _0x6f8cdd++;}return _0x41c994;}function parseTableEntries(_0x208b89,_0x9c585c){const _0x3047c2=_0xcf9d,_0x4b5117=[];let _0x3798a5=0x0;while(_0x3798a5<_0x9c585c['length']){if(_0x9c585c[_0x3798a5][_0x3047c2(0x155)]===0x0){const _0x347349=_0x9c585c[_0x3798a5][_0x3047c2(0xf8)];_0x3798a5++;const _0x82366c={'_type':_0x347349};while(_0x3798a5<_0x9c585c['length']&&_0x9c585c[_0x3798a5][_0x3047c2(0x155)]!==0x0){const _0x39eb01=_0x9c585c[_0x3798a5]['code'],_0x3f7c3b=autoConvert(_0x39eb01,_0x9c585c[_0x3798a5][_0x3047c2(0xf8)]);switch(_0x39eb01){case 0x2:_0x82366c[_0x3047c2(0x176)]=_0x3f7c3b;break;case 0x5:_0x82366c[_0x3047c2(0xc5)]=_0x3f7c3b;break;case 0x6:_0x82366c[_0x3047c2(0x1b8)]=_0x3f7c3b;break;case 0x7:_0x82366c['styleName']=_0x3f7c3b;break;case 0x3e:_0x82366c[_0x3047c2(0x139)]=_0x3f7c3b;break;case 0x46:_0x82366c[_0x3047c2(0x15e)]=_0x3f7c3b;break;case 0x28:_0x82366c['height']=_0x3f7c3b;break;case 0x29:_0x82366c[_0x3047c2(0x10d)]=_0x3f7c3b;break;case 0x32:_0x82366c[_0x3047c2(0x190)]=_0x3f7c3b;break;case 0x64:_0x82366c[_0x3047c2(0x164)]=_0x82366c[_0x3047c2(0x164)]?[][_0x3047c2(0x19e)](_0x82366c[_0x3047c2(0x164)],_0x3f7c3b):_0x3f7c3b;break;case 0x14a:_0x82366c[_0x3047c2(0x11c)]=_0x3f7c3b;break;case 0x172:_0x82366c['lineweight']=_0x3f7c3b;break;case 0x186:_0x82366c['plotStyleHandle']=_0x3f7c3b;break;default:_0x82366c[_0x3047c2(0x134)+_0x39eb01]!==undefined?_0x82366c['code_'+_0x39eb01]=[][_0x3047c2(0x19e)](_0x82366c['code_'+_0x39eb01],_0x3f7c3b):_0x82366c['code_'+_0x39eb01]=_0x3f7c3b;}_0x3798a5++;}_0x4b5117[_0x3047c2(0x174)](_0x82366c);}else _0x3798a5++;}return _0x4b5117;}function parseBlocks(_0xeb628b){const _0x4e80a4=_0xcf9d;if(!_0xeb628b||_0xeb628b[_0x4e80a4(0x197)]===0x0)return [];const _0x2adc2e=[];let _0x222b34=0x0;while(_0x222b34<_0xeb628b[_0x4e80a4(0x197)]){if(_0xeb628b[_0x222b34][_0x4e80a4(0x155)]===0x0&&_0xeb628b[_0x222b34][_0x4e80a4(0xf8)]===_0x4e80a4(0x181)){_0x222b34++;const _0x27be92={'entities':[]};while(_0x222b34<_0xeb628b[_0x4e80a4(0x197)]&&_0xeb628b[_0x222b34][_0x4e80a4(0x155)]!==0x0){switch(_0xeb628b[_0x222b34][_0x4e80a4(0x155)]){case 0x2:_0x27be92['name']=_0xeb628b[_0x222b34]['value'];break;case 0x3:_0x27be92[_0x4e80a4(0xa8)]=_0xeb628b[_0x222b34]['value'];break;case 0x5:_0x27be92['handle']=_0xeb628b[_0x222b34][_0x4e80a4(0xf8)];break;case 0x8:_0x27be92['layer']=_0xeb628b[_0x222b34]['value'];break;case 0xa:_0x27be92[_0x4e80a4(0x17e)]=parseFloat(_0xeb628b[_0x222b34][_0x4e80a4(0xf8)]);break;case 0x14:_0x27be92[_0x4e80a4(0xbf)]=parseFloat(_0xeb628b[_0x222b34][_0x4e80a4(0xf8)]);break;case 0x1e:_0x27be92[_0x4e80a4(0xd9)]=parseFloat(_0xeb628b[_0x222b34]['value']);break;case 0x46:_0x27be92['flags']=parseInt(_0xeb628b[_0x222b34]['value'],0xa);break;case 0x64:break;case 0x14a:_0x27be92[_0x4e80a4(0x11c)]=_0xeb628b[_0x222b34]['value'];break;default:_0x27be92[_0x4e80a4(0x134)+_0xeb628b[_0x222b34][_0x4e80a4(0x155)]]=_0xeb628b[_0x222b34][_0x4e80a4(0xf8)];}_0x222b34++;}const _0x3291ad=[];while(_0x222b34<_0xeb628b['length']&&!(_0xeb628b[_0x222b34][_0x4e80a4(0x155)]===0x0&&_0xeb628b[_0x222b34][_0x4e80a4(0xf8)]==='ENDBLK')){_0x3291ad[_0x4e80a4(0x174)](_0xeb628b[_0x222b34]),_0x222b34++;}if(_0x3291ad['length']>0x0)_0x27be92[_0x4e80a4(0x1a8)]=parseEntityList(_0x3291ad);if(_0x222b34<_0xeb628b[_0x4e80a4(0x197)]){_0x222b34++;while(_0x222b34<_0xeb628b[_0x4e80a4(0x197)]&&_0xeb628b[_0x222b34][_0x4e80a4(0x155)]!==0x0)_0x222b34++;}_0x2adc2e[_0x4e80a4(0x174)](_0x27be92);}else _0x222b34++;}return _0x2adc2e;}function parseEntityList(_0x476a75){const _0x129f95=_0xcf9d,_0x44da76=[];let _0x50315f=0x0;while(_0x50315f<_0x476a75[_0x129f95(0x197)]){if(_0x476a75[_0x50315f][_0x129f95(0x155)]===0x0){const _0x200558=_0x476a75[_0x50315f]['value'];_0x50315f++;const _0x3e11e7=[];while(_0x50315f<_0x476a75[_0x129f95(0x197)]&&_0x476a75[_0x50315f]['code']!==0x0){_0x3e11e7[_0x129f95(0x174)](_0x476a75[_0x50315f]),_0x50315f++;}const _0x3250d9=parseOneEntity(_0x200558,_0x3e11e7);if(_0x3250d9)_0x44da76['push'](_0x3250d9);}else _0x50315f++;}return _0x44da76;}function parseOneEntity(_0x45188a,_0x2ace8f){const _0x34abf5=_0xcf9d,_0x181464={'type':_0x45188a};for(const _0x1dd780 of _0x2ace8f){switch(_0x1dd780[_0x34abf5(0x155)]){case 0x5:_0x181464['handle']=_0x1dd780['value'];break;case 0x8:_0x181464['layer']=_0x1dd780[_0x34abf5(0xf8)];break;case 0x6:_0x181464[_0x34abf5(0x1b8)]=_0x1dd780[_0x34abf5(0xf8)];break;case 0x30:_0x181464[_0x34abf5(0x18a)]=parseFloat(_0x1dd780[_0x34abf5(0xf8)]);break;case 0x3c:_0x181464[_0x34abf5(0x13e)]=parseInt(_0x1dd780[_0x34abf5(0xf8)],0xa)===0x0;break;case 0x3e:_0x181464[_0x34abf5(0x139)]=parseInt(_0x1dd780[_0x34abf5(0xf8)],0xa);break;case 0x43:_0x181464['inPaperSpace']=parseInt(_0x1dd780[_0x34abf5(0xf8)],0xa)===0x1;break;case 0x14a:_0x181464['ownerHandle']=_0x1dd780[_0x34abf5(0xf8)];break;case 0x172:_0x181464[_0x34abf5(0xe3)]=parseInt(_0x1dd780[_0x34abf5(0xf8)],0xa);break;case 0x1a4:_0x181464[_0x34abf5(0x16b)]=parseInt(_0x1dd780[_0x34abf5(0xf8)],0xa);break;}}switch(_0x45188a){case 'LINE':return parseLineEntity(_0x181464,_0x2ace8f);case 'LWPOLYLINE':return parseLWPolylineEntity(_0x181464,_0x2ace8f);case _0x34abf5(0x138):return parsePolylineEntity(_0x181464,_0x2ace8f);case _0x34abf5(0xf4):return parseVertexEntity(_0x181464,_0x2ace8f);case _0x34abf5(0xc7):return parseArcEntity(_0x181464,_0x2ace8f);case _0x34abf5(0xcd):return parseCircleEntity(_0x181464,_0x2ace8f);case _0x34abf5(0x1a9):return parseEllipseEntity(_0x181464,_0x2ace8f);case _0x34abf5(0x14f):return parsePointEntity(_0x181464,_0x2ace8f);case _0x34abf5(0xd2):return parseTextEntity(_0x181464,_0x2ace8f);case 'MTEXT':return parseMTextEntity(_0x181464,_0x2ace8f);case _0x34abf5(0x163):return parseAttribEntity(_0x181464,_0x2ace8f);case _0x34abf5(0x148):return parseAttribEntity(_0x181464,_0x2ace8f);case _0x34abf5(0x121):return parseInsertEntity(_0x181464,_0x2ace8f);case _0x34abf5(0x187):return parseDimensionEntity(_0x181464,_0x2ace8f);case _0x34abf5(0x183):return parseLeaderEntity(_0x181464,_0x2ace8f);case _0x34abf5(0x102):return parseMLeaderEntity(_0x181464,_0x2ace8f);case _0x34abf5(0xca):return parseHatchEntity(_0x181464,_0x2ace8f);case 'SPLINE':return parseSplineEntity(_0x181464,_0x2ace8f);case _0x34abf5(0x1ab):case '3DSOLID':case _0x34abf5(0x117):return parseSolidEntity(_0x181464,_0x2ace8f);case '3DFACE':return parse3DFaceEntity(_0x181464,_0x2ace8f);case 'RAY':case _0x34abf5(0x1a3):return parseRayEntity(_0x181464,_0x2ace8f);case _0x34abf5(0x130):return parseViewportEntity(_0x181464,_0x2ace8f);case _0x34abf5(0x182):case _0x34abf5(0xe8):return parseImageEntity(_0x181464,_0x2ace8f);case _0x34abf5(0x11e):return parseToleranceEntity(_0x181464,_0x2ace8f);case _0x34abf5(0xb4):return parseHelixEntity(_0x181464,_0x2ace8f);case _0x34abf5(0xa6):return parseMeshEntity(_0x181464,_0x2ace8f);case 'REGION':case _0x34abf5(0x1af):case _0x34abf5(0x14b):return parseRegionEntity(_0x181464,_0x2ace8f);case _0x34abf5(0x106):return parseOle2Entity(_0x181464,_0x2ace8f);case _0x34abf5(0xea):return parseTableEntity(_0x181464,_0x2ace8f);case _0x34abf5(0xd4):return parseMLineEntity(_0x181464,_0x2ace8f);case _0x34abf5(0x13c):return _0x181464;default:return parseGenericEntity(_0x181464,_0x2ace8f);}}function parseLineEntity(_0x5f3a2b,_0x5d203a){const _0x4a2922=_0xcf9d;_0x5f3a2b[_0x4a2922(0xab)]={'x':0x0,'y':0x0,'z':0x0},_0x5f3a2b[_0x4a2922(0x11d)]={'x':0x0,'y':0x0,'z':0x0},_0x5f3a2b[_0x4a2922(0x169)]=0x0,_0x5f3a2b['extrusionDirection']={'x':0x0,'y':0x0,'z':0x1};for(const _0x485770 of _0x5d203a){switch(_0x485770[_0x4a2922(0x155)]){case 0xa:_0x5f3a2b['startPoint']['x']=parseFloat(_0x485770['value']);break;case 0x14:_0x5f3a2b[_0x4a2922(0xab)]['y']=parseFloat(_0x485770[_0x4a2922(0xf8)]);break;case 0x1e:_0x5f3a2b[_0x4a2922(0xab)]['z']=parseFloat(_0x485770[_0x4a2922(0xf8)]);break;case 0xb:_0x5f3a2b[_0x4a2922(0x11d)]['x']=parseFloat(_0x485770['value']);break;case 0x15:_0x5f3a2b['endPoint']['y']=parseFloat(_0x485770[_0x4a2922(0xf8)]);break;case 0x1f:_0x5f3a2b[_0x4a2922(0x11d)]['z']=parseFloat(_0x485770[_0x4a2922(0xf8)]);break;case 0x27:_0x5f3a2b['thickness']=parseFloat(_0x485770[_0x4a2922(0xf8)]);break;case 0xd2:_0x5f3a2b[_0x4a2922(0x175)]['x']=parseFloat(_0x485770['value']);break;case 0xdc:_0x5f3a2b['extrusionDirection']['y']=parseFloat(_0x485770[_0x4a2922(0xf8)]);break;case 0xe6:_0x5f3a2b[_0x4a2922(0x175)]['z']=parseFloat(_0x485770[_0x4a2922(0xf8)]);break;}}return _0x5f3a2b;}function parseLWPolylineEntity(_0x586971,_0x18f499){const _0x116e7c=_0xcf9d;_0x586971['closed']=![],_0x586971[_0x116e7c(0x136)]=0x0,_0x586971[_0x116e7c(0xf1)]=0x0,_0x586971[_0x116e7c(0x169)]=0x0,_0x586971['vertices']=[],_0x586971[_0x116e7c(0x175)]={'x':0x0,'y':0x0,'z':0x1};let _0x133d0d=null;for(const _0x2c10e9 of _0x18f499){switch(_0x2c10e9['code']){case 0x46:_0x586971[_0x116e7c(0xe9)]=(parseInt(_0x2c10e9[_0x116e7c(0xf8)],0xa)&0x1)===0x1;break;case 0x26:_0x586971[_0x116e7c(0xf1)]=parseFloat(_0x2c10e9[_0x116e7c(0xf8)]);break;case 0x27:_0x586971[_0x116e7c(0x169)]=parseFloat(_0x2c10e9[_0x116e7c(0xf8)]);break;case 0x2b:_0x586971[_0x116e7c(0x136)]=parseFloat(_0x2c10e9['value']);break;case 0x5a:_0x586971[_0x116e7c(0xf5)]=parseInt(_0x2c10e9[_0x116e7c(0xf8)],0xa);break;case 0xa:if(_0x133d0d)_0x586971['vertices'][_0x116e7c(0x174)](_0x133d0d);_0x133d0d={'x':parseFloat(_0x2c10e9[_0x116e7c(0xf8)]),'y':0x0,'bulge':0x0,'startWidth':0x0,'endWidth':0x0};break;case 0x14:if(_0x133d0d)_0x133d0d['y']=parseFloat(_0x2c10e9[_0x116e7c(0xf8)]);break;case 0x28:if(_0x133d0d)_0x133d0d['startWidth']=parseFloat(_0x2c10e9['value']);break;case 0x29:if(_0x133d0d)_0x133d0d[_0x116e7c(0x135)]=parseFloat(_0x2c10e9['value']);break;case 0x2a:if(_0x133d0d)_0x133d0d['bulge']=parseFloat(_0x2c10e9[_0x116e7c(0xf8)]);break;case 0xd2:_0x586971[_0x116e7c(0x175)]['x']=parseFloat(_0x2c10e9['value']);break;case 0xdc:_0x586971['extrusionDirection']['y']=parseFloat(_0x2c10e9[_0x116e7c(0xf8)]);break;case 0xe6:_0x586971['extrusionDirection']['z']=parseFloat(_0x2c10e9[_0x116e7c(0xf8)]);break;}}if(_0x133d0d)_0x586971[_0x116e7c(0x12c)][_0x116e7c(0x174)](_0x133d0d);return _0x586971;}function parsePolylineEntity(_0x566312,_0x5da295){const _0xbccba9=_0xcf9d;_0x566312[_0xbccba9(0xe9)]=![],_0x566312[_0xbccba9(0x122)]=![],_0x566312['is3DMesh']=![],_0x566312[_0xbccba9(0x118)]=![],_0x566312['meshMVertexCount']=0x0,_0x566312[_0xbccba9(0xc3)]=0x0,_0x566312[_0xbccba9(0xd0)]=0x0,_0x566312[_0xbccba9(0x100)]=0x0,_0x566312[_0xbccba9(0xf1)]=0x0,_0x566312[_0xbccba9(0x12c)]=[];for(const _0x1e2fc5 of _0x5da295){switch(_0x1e2fc5[_0xbccba9(0x155)]){case 0xa:_0x566312['dummyX']=parseFloat(_0x1e2fc5['value']);break;case 0x14:_0x566312[_0xbccba9(0x1a2)]=parseFloat(_0x1e2fc5['value']);break;case 0x1e:_0x566312['elevation']=parseFloat(_0x1e2fc5['value']);break;case 0x27:_0x566312['thickness']=parseFloat(_0x1e2fc5['value']);break;case 0x28:_0x566312[_0xbccba9(0xd0)]=parseFloat(_0x1e2fc5['value']);break;case 0x29:_0x566312[_0xbccba9(0x100)]=parseFloat(_0x1e2fc5[_0xbccba9(0xf8)]);break;case 0x46:{const _0x49fcb6=parseInt(_0x1e2fc5[_0xbccba9(0xf8)],0xa);_0x566312[_0xbccba9(0xe9)]=(_0x49fcb6&0x1)===0x1,_0x566312[_0xbccba9(0x122)]=(_0x49fcb6&0x8)===0x8,_0x566312[_0xbccba9(0xbd)]=(_0x49fcb6&0x10)===0x10,_0x566312[_0xbccba9(0x118)]=(_0x49fcb6&0x40)===0x40,_0x566312[_0xbccba9(0x15e)]=_0x49fcb6;break;}case 0x47:_0x566312[_0xbccba9(0xb3)]=parseInt(_0x1e2fc5[_0xbccba9(0xf8)],0xa);break;case 0x48:_0x566312['meshNVertexCount']=parseInt(_0x1e2fc5[_0xbccba9(0xf8)],0xa);break;case 0xd2:(_0x566312['extrusionDirection']=_0x566312['extrusionDirection']||{})['x']=parseFloat(_0x1e2fc5[_0xbccba9(0xf8)]);break;case 0xdc:(_0x566312[_0xbccba9(0x175)]=_0x566312[_0xbccba9(0x175)]||{})['y']=parseFloat(_0x1e2fc5[_0xbccba9(0xf8)]);break;case 0xe6:(_0x566312[_0xbccba9(0x175)]=_0x566312[_0xbccba9(0x175)]||{})['z']=parseFloat(_0x1e2fc5[_0xbccba9(0xf8)]);break;}}return _0x566312;}function parseVertexEntity(_0x3b5b3f,_0x19a204){const _0x2131bd=_0xcf9d;_0x3b5b3f['position']={'x':0x0,'y':0x0,'z':0x0},_0x3b5b3f[_0x2131bd(0x167)]=0x0,_0x3b5b3f['startWidth']=0x0,_0x3b5b3f[_0x2131bd(0x135)]=0x0,_0x3b5b3f[_0x2131bd(0x15e)]=0x0;for(const _0x3866a0 of _0x19a204){switch(_0x3866a0[_0x2131bd(0x155)]){case 0xa:_0x3b5b3f[_0x2131bd(0x128)]['x']=parseFloat(_0x3866a0['value']);break;case 0x14:_0x3b5b3f[_0x2131bd(0x128)]['y']=parseFloat(_0x3866a0[_0x2131bd(0xf8)]);break;case 0x1e:_0x3b5b3f[_0x2131bd(0x128)]['z']=parseFloat(_0x3866a0[_0x2131bd(0xf8)]);break;case 0x28:_0x3b5b3f[_0x2131bd(0x177)]=parseFloat(_0x3866a0['value']);break;case 0x29:_0x3b5b3f['endWidth']=parseFloat(_0x3866a0[_0x2131bd(0xf8)]);break;case 0x2a:_0x3b5b3f[_0x2131bd(0x167)]=parseFloat(_0x3866a0[_0x2131bd(0xf8)]);break;case 0x46:_0x3b5b3f[_0x2131bd(0x15e)]=parseInt(_0x3866a0['value'],0xa);break;case 0x47:_0x3b5b3f[_0x2131bd(0xaf)]=parseInt(_0x3866a0[_0x2131bd(0xf8)],0xa);break;case 0x48:_0x3b5b3f[_0x2131bd(0x115)]=parseInt(_0x3866a0[_0x2131bd(0xf8)],0xa);break;case 0x49:_0x3b5b3f[_0x2131bd(0xb5)]=parseInt(_0x3866a0[_0x2131bd(0xf8)],0xa);break;case 0x4a:_0x3b5b3f[_0x2131bd(0x1b1)]=parseInt(_0x3866a0[_0x2131bd(0xf8)],0xa);break;}}return _0x3b5b3f;}function parseArcEntity(_0x4d8b82,_0x51b070){const _0x495aed=_0xcf9d;_0x4d8b82[_0x495aed(0xba)]={'x':0x0,'y':0x0,'z':0x0},_0x4d8b82[_0x495aed(0x120)]=0x0,_0x4d8b82[_0x495aed(0xb8)]=0x0,_0x4d8b82[_0x495aed(0x156)]=0x168,_0x4d8b82['thickness']=0x0,_0x4d8b82[_0x495aed(0x175)]={'x':0x0,'y':0x0,'z':0x1};for(const _0x388ba7 of _0x51b070){switch(_0x388ba7[_0x495aed(0x155)]){case 0xa:_0x4d8b82[_0x495aed(0xba)]['x']=parseFloat(_0x388ba7['value']);break;case 0x14:_0x4d8b82[_0x495aed(0xba)]['y']=parseFloat(_0x388ba7[_0x495aed(0xf8)]);break;case 0x1e:_0x4d8b82[_0x495aed(0xba)]['z']=parseFloat(_0x388ba7['value']);break;case 0x27:_0x4d8b82[_0x495aed(0x169)]=parseFloat(_0x388ba7[_0x495aed(0xf8)]);break;case 0x28:_0x4d8b82[_0x495aed(0x120)]=parseFloat(_0x388ba7[_0x495aed(0xf8)]);break;case 0x32:_0x4d8b82[_0x495aed(0xb8)]=parseFloat(_0x388ba7[_0x495aed(0xf8)]);break;case 0x33:_0x4d8b82[_0x495aed(0x156)]=parseFloat(_0x388ba7[_0x495aed(0xf8)]);break;case 0xd2:_0x4d8b82[_0x495aed(0x175)]['x']=parseFloat(_0x388ba7[_0x495aed(0xf8)]);break;case 0xdc:_0x4d8b82['extrusionDirection']['y']=parseFloat(_0x388ba7[_0x495aed(0xf8)]);break;case 0xe6:_0x4d8b82[_0x495aed(0x175)]['z']=parseFloat(_0x388ba7[_0x495aed(0xf8)]);break;}}return _0x4d8b82;}function parseCircleEntity(_0x277b8f,_0x4c59d8){const _0xaf4f66=_0xcf9d;_0x277b8f['center']={'x':0x0,'y':0x0,'z':0x0},_0x277b8f['radius']=0x0,_0x277b8f['thickness']=0x0,_0x277b8f[_0xaf4f66(0x175)]={'x':0x0,'y':0x0,'z':0x1};for(const _0x5e6aff of _0x4c59d8){switch(_0x5e6aff[_0xaf4f66(0x155)]){case 0xa:_0x277b8f[_0xaf4f66(0xba)]['x']=parseFloat(_0x5e6aff[_0xaf4f66(0xf8)]);break;case 0x14:_0x277b8f['center']['y']=parseFloat(_0x5e6aff[_0xaf4f66(0xf8)]);break;case 0x1e:_0x277b8f[_0xaf4f66(0xba)]['z']=parseFloat(_0x5e6aff[_0xaf4f66(0xf8)]);break;case 0x27:_0x277b8f[_0xaf4f66(0x169)]=parseFloat(_0x5e6aff[_0xaf4f66(0xf8)]);break;case 0x28:_0x277b8f[_0xaf4f66(0x120)]=parseFloat(_0x5e6aff[_0xaf4f66(0xf8)]);break;case 0xd2:_0x277b8f[_0xaf4f66(0x175)]['x']=parseFloat(_0x5e6aff[_0xaf4f66(0xf8)]);break;case 0xdc:_0x277b8f[_0xaf4f66(0x175)]['y']=parseFloat(_0x5e6aff[_0xaf4f66(0xf8)]);break;case 0xe6:_0x277b8f['extrusionDirection']['z']=parseFloat(_0x5e6aff['value']);break;}}return _0x277b8f;}function parseEllipseEntity(_0x95f4af,_0x18ee24){const _0x243f41=_0xcf9d;_0x95f4af[_0x243f41(0xba)]={'x':0x0,'y':0x0,'z':0x0},_0x95f4af[_0x243f41(0x11a)]={'x':0x0,'y':0x0,'z':0x0},_0x95f4af[_0x243f41(0x10c)]=0x1,_0x95f4af[_0x243f41(0xb8)]=0x0,_0x95f4af[_0x243f41(0x156)]=Math['PI']*0x2,_0x95f4af['extrusionDirection']={'x':0x0,'y':0x0,'z':0x1};for(const _0x2a8983 of _0x18ee24){switch(_0x2a8983[_0x243f41(0x155)]){case 0xa:_0x95f4af['center']['x']=parseFloat(_0x2a8983['value']);break;case 0x14:_0x95f4af[_0x243f41(0xba)]['y']=parseFloat(_0x2a8983[_0x243f41(0xf8)]);break;case 0x1e:_0x95f4af[_0x243f41(0xba)]['z']=parseFloat(_0x2a8983[_0x243f41(0xf8)]);break;case 0xb:_0x95f4af[_0x243f41(0x11a)]['x']=parseFloat(_0x2a8983[_0x243f41(0xf8)]);break;case 0x15:_0x95f4af[_0x243f41(0x11a)]['y']=parseFloat(_0x2a8983['value']);break;case 0x1f:_0x95f4af['majorAxisEndPoint']['z']=parseFloat(_0x2a8983[_0x243f41(0xf8)]);break;case 0x28:_0x95f4af[_0x243f41(0x10c)]=parseFloat(_0x2a8983[_0x243f41(0xf8)]);break;case 0x29:_0x95f4af['startAngle']=parseFloat(_0x2a8983[_0x243f41(0xf8)]);break;case 0x2a:_0x95f4af['endAngle']=parseFloat(_0x2a8983[_0x243f41(0xf8)]);break;case 0xd2:_0x95f4af[_0x243f41(0x175)]['x']=parseFloat(_0x2a8983['value']);break;case 0xdc:_0x95f4af['extrusionDirection']['y']=parseFloat(_0x2a8983['value']);break;case 0xe6:_0x95f4af[_0x243f41(0x175)]['z']=parseFloat(_0x2a8983[_0x243f41(0xf8)]);break;}}return _0x95f4af;}function parsePointEntity(_0x2457a0,_0x22cc7c){const _0x4caa62=_0xcf9d;_0x2457a0[_0x4caa62(0x128)]={'x':0x0,'y':0x0,'z':0x0},_0x2457a0[_0x4caa62(0x169)]=0x0,_0x2457a0['extrusionDirection']={'x':0x0,'y':0x0,'z':0x1};for(const _0x39690a of _0x22cc7c){switch(_0x39690a[_0x4caa62(0x155)]){case 0xa:_0x2457a0[_0x4caa62(0x128)]['x']=parseFloat(_0x39690a[_0x4caa62(0xf8)]);break;case 0x14:_0x2457a0[_0x4caa62(0x128)]['y']=parseFloat(_0x39690a[_0x4caa62(0xf8)]);break;case 0x1e:_0x2457a0[_0x4caa62(0x128)]['z']=parseFloat(_0x39690a[_0x4caa62(0xf8)]);break;case 0x27:_0x2457a0[_0x4caa62(0x169)]=parseFloat(_0x39690a[_0x4caa62(0xf8)]);break;case 0x32:_0x2457a0[_0x4caa62(0x190)]=parseFloat(_0x39690a[_0x4caa62(0xf8)]);break;case 0xd2:_0x2457a0['extrusionDirection']['x']=parseFloat(_0x39690a[_0x4caa62(0xf8)]);break;case 0xdc:_0x2457a0[_0x4caa62(0x175)]['y']=parseFloat(_0x39690a[_0x4caa62(0xf8)]);break;case 0xe6:_0x2457a0[_0x4caa62(0x175)]['z']=parseFloat(_0x39690a[_0x4caa62(0xf8)]);break;}}return _0x2457a0;}function parseTextEntity(_0x2c9e99,_0x30fba4){const _0x1a473f=_0xcf9d;_0x2c9e99[_0x1a473f(0x193)]={'x':0x0,'y':0x0,'z':0x0},_0x2c9e99[_0x1a473f(0x108)]={'x':0x0,'y':0x0,'z':0x0},_0x2c9e99[_0x1a473f(0x132)]=0x0,_0x2c9e99[_0x1a473f(0xdb)]='',_0x2c9e99[_0x1a473f(0xe4)]=0x0,_0x2c9e99[_0x1a473f(0x1a6)]=0x1,_0x2c9e99[_0x1a473f(0x142)]=0x0,_0x2c9e99[_0x1a473f(0x1aa)]=_0x1a473f(0x17d),_0x2c9e99['generationFlags']=0x0,_0x2c9e99['hAlign']=0x0,_0x2c9e99['vAlign']=0x0,_0x2c9e99[_0x1a473f(0x169)]=0x0,_0x2c9e99[_0x1a473f(0x175)]={'x':0x0,'y':0x0,'z':0x1};for(const _0xab774c of _0x30fba4){switch(_0xab774c[_0x1a473f(0x155)]){case 0x1:_0x2c9e99['text']=_0xab774c[_0x1a473f(0xf8)];break;case 0x7:_0x2c9e99[_0x1a473f(0x1aa)]=_0xab774c[_0x1a473f(0xf8)];break;case 0xa:_0x2c9e99[_0x1a473f(0x193)]['x']=parseFloat(_0xab774c[_0x1a473f(0xf8)]);break;case 0x14:_0x2c9e99[_0x1a473f(0x193)]['y']=parseFloat(_0xab774c[_0x1a473f(0xf8)]);break;case 0x1e:_0x2c9e99[_0x1a473f(0x193)]['z']=parseFloat(_0xab774c[_0x1a473f(0xf8)]);break;case 0xb:_0x2c9e99[_0x1a473f(0x108)]['x']=parseFloat(_0xab774c[_0x1a473f(0xf8)]);break;case 0x15:_0x2c9e99[_0x1a473f(0x108)]['y']=parseFloat(_0xab774c['value']);break;case 0x1f:_0x2c9e99['alignmentPoint']['z']=parseFloat(_0xab774c[_0x1a473f(0xf8)]);break;case 0x27:_0x2c9e99[_0x1a473f(0x169)]=parseFloat(_0xab774c['value']);break;case 0x28:_0x2c9e99['height']=parseFloat(_0xab774c[_0x1a473f(0xf8)]);break;case 0x29:_0x2c9e99[_0x1a473f(0x1a6)]=parseFloat(_0xab774c[_0x1a473f(0xf8)]);break;case 0x32:_0x2c9e99[_0x1a473f(0xe4)]=parseFloat(_0xab774c['value']);break;case 0x33:_0x2c9e99[_0x1a473f(0x142)]=parseFloat(_0xab774c[_0x1a473f(0xf8)]);break;case 0x47:_0x2c9e99[_0x1a473f(0x1a0)]=parseInt(_0xab774c['value'],0xa);break;case 0x48:_0x2c9e99[_0x1a473f(0x15a)]=parseInt(_0xab774c[_0x1a473f(0xf8)],0xa);break;case 0x49:_0x2c9e99[_0x1a473f(0x1ad)]=parseInt(_0xab774c[_0x1a473f(0xf8)],0xa);break;case 0xd2:_0x2c9e99['extrusionDirection']['x']=parseFloat(_0xab774c['value']);break;case 0xdc:_0x2c9e99[_0x1a473f(0x175)]['y']=parseFloat(_0xab774c[_0x1a473f(0xf8)]);break;case 0xe6:_0x2c9e99['extrusionDirection']['z']=parseFloat(_0xab774c[_0x1a473f(0xf8)]);break;}}return _0x2c9e99;}function parseMTextEntity(_0x15ae0a,_0x5b114b){const _0x1f23ba=_0xcf9d;_0x15ae0a['insertionPoint']={'x':0x0,'y':0x0,'z':0x0},_0x15ae0a[_0x1f23ba(0x1a1)]={'x':0x1,'y':0x0,'z':0x0},_0x15ae0a[_0x1f23ba(0x132)]=0x0,_0x15ae0a['width']=0x0,_0x15ae0a[_0x1f23ba(0xdb)]='',_0x15ae0a[_0x1f23ba(0xe4)]=0x0,_0x15ae0a[_0x1f23ba(0x1aa)]=_0x1f23ba(0x17d),_0x15ae0a[_0x1f23ba(0x113)]=0x1,_0x15ae0a[_0x1f23ba(0xad)]=0x1,_0x15ae0a['lineSpacing']=0x1,_0x15ae0a[_0x1f23ba(0x1b4)]=0x1,_0x15ae0a['extrusionDirection']={'x':0x0,'y':0x0,'z':0x1};let _0x53b20d=[];for(const _0x19f07d of _0x5b114b){switch(_0x19f07d[_0x1f23ba(0x155)]){case 0x1:_0x53b20d[_0x1f23ba(0x174)](_0x19f07d['value']);break;case 0x3:_0x53b20d[_0x1f23ba(0x174)](_0x19f07d['value']);break;case 0x7:_0x15ae0a['styleName']=_0x19f07d[_0x1f23ba(0xf8)];break;case 0xa:_0x15ae0a[_0x1f23ba(0x193)]['x']=parseFloat(_0x19f07d['value']);break;case 0x14:_0x15ae0a[_0x1f23ba(0x193)]['y']=parseFloat(_0x19f07d[_0x1f23ba(0xf8)]);break;case 0x1e:_0x15ae0a[_0x1f23ba(0x193)]['z']=parseFloat(_0x19f07d[_0x1f23ba(0xf8)]);break;case 0xb:_0x15ae0a[_0x1f23ba(0x1a1)]['x']=parseFloat(_0x19f07d[_0x1f23ba(0xf8)]);break;case 0x15:_0x15ae0a[_0x1f23ba(0x1a1)]['y']=parseFloat(_0x19f07d['value']);break;case 0x1f:_0x15ae0a[_0x1f23ba(0x1a1)]['z']=parseFloat(_0x19f07d[_0x1f23ba(0xf8)]);break;case 0x28:_0x15ae0a['height']=parseFloat(_0x19f07d[_0x1f23ba(0xf8)]);break;case 0x29:_0x15ae0a[_0x1f23ba(0xf0)]=parseFloat(_0x19f07d[_0x1f23ba(0xf8)]);break;case 0x2c:_0x15ae0a[_0x1f23ba(0x16c)]=parseFloat(_0x19f07d[_0x1f23ba(0xf8)]);break;case 0x32:_0x15ae0a[_0x1f23ba(0xe4)]=parseFloat(_0x19f07d['value']);break;case 0x47:_0x15ae0a[_0x1f23ba(0x113)]=parseInt(_0x19f07d['value'],0xa);break;case 0x48:_0x15ae0a[_0x1f23ba(0xad)]=parseInt(_0x19f07d['value'],0xa);break;case 0x49:_0x15ae0a[_0x1f23ba(0x1b4)]=parseInt(_0x19f07d[_0x1f23ba(0xf8)],0xa);break;case 0xd2:_0x15ae0a[_0x1f23ba(0x175)]['x']=parseFloat(_0x19f07d[_0x1f23ba(0xf8)]);break;case 0xdc:_0x15ae0a[_0x1f23ba(0x175)]['y']=parseFloat(_0x19f07d[_0x1f23ba(0xf8)]);break;case 0xe6:_0x15ae0a[_0x1f23ba(0x175)]['z']=parseFloat(_0x19f07d[_0x1f23ba(0xf8)]);break;}}return _0x15ae0a[_0x1f23ba(0xdb)]=_0x53b20d[_0x1f23ba(0xe5)](''),_0x15ae0a;}function parseAttribEntity(_0x49d25d,_0xd015fe){const _0x56449c=_0xcf9d;_0x49d25d[_0x56449c(0x193)]={'x':0x0,'y':0x0,'z':0x0},_0x49d25d['alignmentPoint']={'x':0x0,'y':0x0,'z':0x0},_0x49d25d['height']=0x0,_0x49d25d[_0x56449c(0xdb)]='',_0x49d25d[_0x56449c(0xaa)]='',_0x49d25d[_0x56449c(0x14c)]='',_0x49d25d[_0x56449c(0xe4)]=0x0,_0x49d25d['flags']=0x0,_0x49d25d[_0x56449c(0x1aa)]=_0x56449c(0x17d);for(const _0x47d405 of _0xd015fe){switch(_0x47d405[_0x56449c(0x155)]){case 0x1:_0x49d25d[_0x56449c(0xdb)]=_0x47d405[_0x56449c(0xf8)];break;case 0x2:_0x49d25d[_0x56449c(0xaa)]=_0x47d405[_0x56449c(0xf8)];break;case 0x3:_0x49d25d[_0x56449c(0x14c)]=_0x47d405['value'];break;case 0x7:_0x49d25d['styleName']=_0x47d405[_0x56449c(0xf8)];break;case 0xa:_0x49d25d[_0x56449c(0x193)]['x']=parseFloat(_0x47d405['value']);break;case 0x14:_0x49d25d[_0x56449c(0x193)]['y']=parseFloat(_0x47d405[_0x56449c(0xf8)]);break;case 0x1e:_0x49d25d['insertionPoint']['z']=parseFloat(_0x47d405[_0x56449c(0xf8)]);break;case 0xb:_0x49d25d[_0x56449c(0x108)]['x']=parseFloat(_0x47d405[_0x56449c(0xf8)]);break;case 0x15:_0x49d25d[_0x56449c(0x108)]['y']=parseFloat(_0x47d405[_0x56449c(0xf8)]);break;case 0x1f:_0x49d25d['alignmentPoint']['z']=parseFloat(_0x47d405[_0x56449c(0xf8)]);break;case 0x28:_0x49d25d['height']=parseFloat(_0x47d405[_0x56449c(0xf8)]);break;case 0x29:_0x49d25d[_0x56449c(0x1a6)]=parseFloat(_0x47d405['value']);break;case 0x32:_0x49d25d[_0x56449c(0xe4)]=parseFloat(_0x47d405[_0x56449c(0xf8)]);break;case 0x46:_0x49d25d[_0x56449c(0x15e)]=parseInt(_0x47d405[_0x56449c(0xf8)],0xa);break;case 0x47:_0x49d25d[_0x56449c(0x1a0)]=parseInt(_0x47d405['value'],0xa);break;case 0x48:_0x49d25d['hAlign']=parseInt(_0x47d405[_0x56449c(0xf8)],0xa);break;case 0x49:_0x49d25d['vAlign']=parseInt(_0x47d405['value'],0xa);break;}}return _0x49d25d;}function parseInsertEntity(_0x4e91c8,_0x5ea6f1){const _0xd07b06=_0xcf9d;_0x4e91c8[_0xd07b06(0x1b7)]='',_0x4e91c8[_0xd07b06(0x193)]={'x':0x0,'y':0x0,'z':0x0},_0x4e91c8[_0xd07b06(0x1b9)]={'x':0x1,'y':0x1,'z':0x1},_0x4e91c8[_0xd07b06(0xe4)]=0x0,_0x4e91c8[_0xd07b06(0x19f)]=0x1,_0x4e91c8[_0xd07b06(0xb9)]=0x1,_0x4e91c8['columnSpacing']=0x0,_0x4e91c8['rowSpacing']=0x0,_0x4e91c8['extrusionDirection']={'x':0x0,'y':0x0,'z':0x1},_0x4e91c8[_0xd07b06(0xbb)]=[];for(const _0x6cd790 of _0x5ea6f1){switch(_0x6cd790[_0xd07b06(0x155)]){case 0x2:_0x4e91c8[_0xd07b06(0x1b7)]=_0x6cd790[_0xd07b06(0xf8)];break;case 0xa:_0x4e91c8['insertionPoint']['x']=parseFloat(_0x6cd790[_0xd07b06(0xf8)]);break;case 0x14:_0x4e91c8[_0xd07b06(0x193)]['y']=parseFloat(_0x6cd790[_0xd07b06(0xf8)]);break;case 0x1e:_0x4e91c8['insertionPoint']['z']=parseFloat(_0x6cd790['value']);break;case 0x29:_0x4e91c8['scale']['x']=parseFloat(_0x6cd790['value']);break;case 0x2a:_0x4e91c8[_0xd07b06(0x1b9)]['y']=parseFloat(_0x6cd790[_0xd07b06(0xf8)]);break;case 0x2b:_0x4e91c8['scale']['z']=parseFloat(_0x6cd790[_0xd07b06(0xf8)]);break;case 0x2c:_0x4e91c8[_0xd07b06(0xcb)]=parseFloat(_0x6cd790['value']);break;case 0x2d:_0x4e91c8[_0xd07b06(0x11b)]=parseFloat(_0x6cd790[_0xd07b06(0xf8)]);break;case 0x32:_0x4e91c8[_0xd07b06(0xe4)]=parseFloat(_0x6cd790[_0xd07b06(0xf8)]);break;case 0x42:_0x4e91c8[_0xd07b06(0x15b)]=parseInt(_0x6cd790[_0xd07b06(0xf8)],0xa)===0x1;break;case 0x46:_0x4e91c8[_0xd07b06(0x19f)]=parseInt(_0x6cd790[_0xd07b06(0xf8)],0xa);break;case 0x47:_0x4e91c8[_0xd07b06(0xb9)]=parseInt(_0x6cd790[_0xd07b06(0xf8)],0xa);break;case 0xd2:_0x4e91c8[_0xd07b06(0x175)]['x']=parseFloat(_0x6cd790[_0xd07b06(0xf8)]);break;case 0xdc:_0x4e91c8['extrusionDirection']['y']=parseFloat(_0x6cd790[_0xd07b06(0xf8)]);break;case 0xe6:_0x4e91c8['extrusionDirection']['z']=parseFloat(_0x6cd790[_0xd07b06(0xf8)]);break;}}return _0x4e91c8;}function parseDimensionEntity(_0x330890,_0x2671f4){const _0x2573a1=_0xcf9d;_0x330890[_0x2573a1(0x1b7)]='',_0x330890[_0x2573a1(0xe2)]={'x':0x0,'y':0x0,'z':0x0},_0x330890[_0x2573a1(0x150)]={'x':0x0,'y':0x0,'z':0x0},_0x330890[_0x2573a1(0x193)]={'x':0x0,'y':0x0,'z':0x0},_0x330890[_0x2573a1(0x1a7)]=0x0,_0x330890[_0x2573a1(0xdb)]='',_0x330890['styleName']=_0x2573a1(0x17d),_0x330890[_0x2573a1(0xe4)]=0x0,_0x330890[_0x2573a1(0xc1)]={'x':0x0,'y':0x0,'z':0x0},_0x330890[_0x2573a1(0x178)]={'x':0x0,'y':0x0,'z':0x0};for(const _0x4074e3 of _0x2671f4){switch(_0x4074e3[_0x2573a1(0x155)]){case 0x1:_0x330890[_0x2573a1(0xdb)]=_0x4074e3[_0x2573a1(0xf8)];break;case 0x2:_0x330890[_0x2573a1(0x1b7)]=_0x4074e3[_0x2573a1(0xf8)];break;case 0x3:_0x330890['styleName']=_0x4074e3[_0x2573a1(0xf8)];break;case 0xa:_0x330890[_0x2573a1(0xe2)]['x']=parseFloat(_0x4074e3[_0x2573a1(0xf8)]);break;case 0x14:_0x330890[_0x2573a1(0xe2)]['y']=parseFloat(_0x4074e3['value']);break;case 0x1e:_0x330890[_0x2573a1(0xe2)]['z']=parseFloat(_0x4074e3[_0x2573a1(0xf8)]);break;case 0xb:_0x330890[_0x2573a1(0x150)]['x']=parseFloat(_0x4074e3[_0x2573a1(0xf8)]);break;case 0x15:_0x330890[_0x2573a1(0x150)]['y']=parseFloat(_0x4074e3[_0x2573a1(0xf8)]);break;case 0x1f:_0x330890[_0x2573a1(0x150)]['z']=parseFloat(_0x4074e3[_0x2573a1(0xf8)]);break;case 0xd:_0x330890['point1']['x']=parseFloat(_0x4074e3['value']);break;case 0x17:_0x330890['point1']['y']=parseFloat(_0x4074e3['value']);break;case 0x21:_0x330890[_0x2573a1(0xc1)]['z']=parseFloat(_0x4074e3[_0x2573a1(0xf8)]);break;case 0xe:_0x330890[_0x2573a1(0x178)]['x']=parseFloat(_0x4074e3[_0x2573a1(0xf8)]);break;case 0x18:_0x330890['point2']['y']=parseFloat(_0x4074e3[_0x2573a1(0xf8)]);break;case 0x22:_0x330890[_0x2573a1(0x178)]['z']=parseFloat(_0x4074e3['value']);break;case 0x28:_0x330890[_0x2573a1(0x14e)]=parseFloat(_0x4074e3[_0x2573a1(0xf8)]);break;case 0x32:_0x330890[_0x2573a1(0xe4)]=parseFloat(_0x4074e3['value']);break;case 0x46:_0x330890[_0x2573a1(0x1a7)]=parseInt(_0x4074e3['value'],0xa);break;case 0x47:_0x330890['attachmentPoint']=parseInt(_0x4074e3['value'],0xa);break;}}return _0x330890;}function parseLeaderEntity(_0x11e262,_0x5a3440){const _0x13820f=_0xcf9d;_0x11e262[_0x13820f(0x1aa)]=_0x13820f(0x17d),_0x11e262[_0x13820f(0x1ac)]=0x1,_0x11e262[_0x13820f(0x159)]=0x0,_0x11e262[_0x13820f(0xd8)]=0x0,_0x11e262[_0x13820f(0xfd)]=0x0,_0x11e262[_0x13820f(0x12c)]=[],_0x11e262['annotationReference']=null,_0x11e262[_0x13820f(0xe0)]={'x':0x0,'y':0x0,'z':0x1},_0x11e262[_0x13820f(0x17a)]={'x':0x1,'y':0x0,'z':0x0};let _0x5f034a=null;for(const _0x5bb113 of _0x5a3440){switch(_0x5bb113[_0x13820f(0x155)]){case 0x3:_0x11e262[_0x13820f(0x1aa)]=_0x5bb113[_0x13820f(0xf8)];break;case 0xa:_0x5f034a=parseFloat(_0x5bb113[_0x13820f(0xf8)]);break;case 0x14:_0x5f034a!==null&&(_0x11e262[_0x13820f(0x12c)][_0x13820f(0x174)]({'x':_0x5f034a,'y':parseFloat(_0x5bb113[_0x13820f(0xf8)]),'z':0x0}),_0x5f034a=null);break;case 0x1e:if(_0x11e262['vertices']['length']>0x0)_0x11e262['vertices'][_0x11e262[_0x13820f(0x12c)][_0x13820f(0x197)]-0x1]['z']=parseFloat(_0x5bb113[_0x13820f(0xf8)]);break;case 0x28:_0x11e262['textHeight']=parseFloat(_0x5bb113[_0x13820f(0xf8)]);break;case 0x29:_0x11e262[_0x13820f(0x129)]=parseFloat(_0x5bb113['value']);break;case 0x47:_0x11e262[_0x13820f(0x1ac)]=parseInt(_0x5bb113[_0x13820f(0xf8)],0xa);break;case 0x48:_0x11e262[_0x13820f(0x159)]=parseInt(_0x5bb113[_0x13820f(0xf8)],0xa);break;case 0x49:_0x11e262[_0x13820f(0xd8)]=parseInt(_0x5bb113[_0x13820f(0xf8)],0xa);break;case 0x4c:_0x11e262['vertexCount']=parseInt(_0x5bb113[_0x13820f(0xf8)],0xa);break;case 0x154:_0x11e262[_0x13820f(0xef)]=_0x5bb113[_0x13820f(0xf8)];break;}}return _0x11e262;}function parseMLeaderEntity(_0x2dc964,_0x1b9325){const _0x3fca73=_0xcf9d;_0x2dc964[_0x3fca73(0x1aa)]='',_0x2dc964[_0x3fca73(0xdb)]='',_0x2dc964[_0x3fca73(0xda)]=[],_0x2dc964[_0x3fca73(0x170)]=0x0,_0x2dc964[_0x3fca73(0x185)]='';let _0x425c5c=null;for(const _0x4f2d21 of _0x1b9325){switch(_0x4f2d21[_0x3fca73(0x155)]){case 0x3:_0x2dc964[_0x3fca73(0x1aa)]=_0x4f2d21[_0x3fca73(0xf8)];break;case 0x130:_0x2dc964[_0x3fca73(0xdb)]=_0x4f2d21[_0x3fca73(0xf8)];break;case 0xaa:_0x2dc964[_0x3fca73(0x170)]=parseInt(_0x4f2d21['value'],0xa);break;case 0x154:_0x2dc964[_0x3fca73(0x185)]=_0x4f2d21[_0x3fca73(0xf8)];break;case 0xa:_0x425c5c=parseFloat(_0x4f2d21[_0x3fca73(0xf8)]);break;case 0x14:_0x425c5c!==null&&(_0x2dc964[_0x3fca73(0xda)]['push']({'x':_0x425c5c,'y':parseFloat(_0x4f2d21[_0x3fca73(0xf8)]),'z':0x0}),_0x425c5c=null);break;case 0x1e:if(_0x2dc964[_0x3fca73(0xda)]['length']>0x0)_0x2dc964['leaderPoints'][_0x2dc964[_0x3fca73(0xda)][_0x3fca73(0x197)]-0x1]['z']=parseFloat(_0x4f2d21[_0x3fca73(0xf8)]);break;case 0x28:_0x2dc964[_0x3fca73(0x1ba)]=parseFloat(_0x4f2d21['value']);break;case 0x29:_0x2dc964[_0x3fca73(0x165)]=parseFloat(_0x4f2d21[_0x3fca73(0xf8)]);break;case 0x2a:_0x2dc964[_0x3fca73(0xf6)]=parseFloat(_0x4f2d21[_0x3fca73(0xf8)]);break;}}return _0x2dc964;}function parseHatchEntity(_0x4dbc68,_0x4c0921){const _0x4e3179=_0xcf9d;_0x4dbc68['patternName']='',_0x4dbc68['solid']=![],_0x4dbc68[_0x4e3179(0x19a)]=![],_0x4dbc68[_0x4e3179(0x195)]=0x0,_0x4dbc68[_0x4e3179(0x17f)]=0x0,_0x4dbc68[_0x4e3179(0x186)]=0x0,_0x4dbc68[_0x4e3179(0xd1)]=0x1,_0x4dbc68[_0x4e3179(0xf1)]=0x0,_0x4dbc68[_0x4e3179(0x175)]={'x':0x0,'y':0x0,'z':0x1},_0x4dbc68[_0x4e3179(0xff)]=[],_0x4dbc68[_0x4e3179(0x17c)]=[];let _0x408cf2=![],_0x5a86ff=null;for(const _0x3ef8d9 of _0x4c0921){switch(_0x3ef8d9['code']){case 0x2:_0x4dbc68[_0x4e3179(0xd6)]=_0x3ef8d9[_0x4e3179(0xf8)];break;case 0xa:_0x408cf2&&_0x5a86ff&&(_0x5a86ff[_0x4e3179(0x1b2)]=_0x5a86ff[_0x4e3179(0x1b2)]||[],_0x5a86ff[_0x4e3179(0x1b2)][_0x4e3179(0x174)]({'x':parseFloat(_0x3ef8d9[_0x4e3179(0xf8)])}));break;case 0x14:if(_0x408cf2&&_0x5a86ff&&_0x5a86ff[_0x4e3179(0x1b2)]&&_0x5a86ff[_0x4e3179(0x1b2)]['length']>0x0)_0x5a86ff['points'][_0x5a86ff[_0x4e3179(0x1b2)][_0x4e3179(0x197)]-0x1]['y']=parseFloat(_0x3ef8d9['value']);break;case 0x1e:_0x4dbc68[_0x4e3179(0xf1)]=parseFloat(_0x3ef8d9[_0x4e3179(0xf8)]);break;case 0x29:_0x4dbc68[_0x4e3179(0xd1)]=parseFloat(_0x3ef8d9[_0x4e3179(0xf8)]);break;case 0x34:_0x4dbc68[_0x4e3179(0x186)]=parseFloat(_0x3ef8d9[_0x4e3179(0xf8)]);break;case 0x46:_0x4dbc68[_0x4e3179(0xb2)]=parseInt(_0x3ef8d9[_0x4e3179(0xf8)],0xa)===0x1;break;case 0x47:_0x4dbc68['associative']=parseInt(_0x3ef8d9[_0x4e3179(0xf8)],0xa)===0x1;break;case 0x4b:_0x4dbc68[_0x4e3179(0x195)]=parseInt(_0x3ef8d9[_0x4e3179(0xf8)],0xa);break;case 0x4c:_0x4dbc68['patternType']=parseInt(_0x3ef8d9[_0x4e3179(0xf8)],0xa);break;case 0x5b:_0x408cf2=!![];break;case 0x5c:if(_0x5a86ff)_0x4dbc68[_0x4e3179(0xff)][_0x4e3179(0x174)](_0x5a86ff);_0x5a86ff={'type':parseInt(_0x3ef8d9[_0x4e3179(0xf8)],0xa),'edges':[],'points':[]};break;case 0x5d:if(_0x5a86ff)_0x5a86ff[_0x4e3179(0x192)]=parseInt(_0x3ef8d9['value'],0xa);break;case 0x61:if(_0x5a86ff)_0x4dbc68[_0x4e3179(0xff)][_0x4e3179(0x174)](_0x5a86ff);_0x5a86ff=null,_0x408cf2=![];break;case 0xd2:_0x4dbc68[_0x4e3179(0x175)]['x']=parseFloat(_0x3ef8d9['value']);break;case 0xdc:_0x4dbc68['extrusionDirection']['y']=parseFloat(_0x3ef8d9[_0x4e3179(0xf8)]);break;case 0xe6:_0x4dbc68['extrusionDirection']['z']=parseFloat(_0x3ef8d9[_0x4e3179(0xf8)]);break;}}if(_0x5a86ff)_0x4dbc68['boundaryPaths'][_0x4e3179(0x174)](_0x5a86ff);return _0x4dbc68;}function parseSplineEntity(_0x8d5426,_0x5c699e){const _0x8512d9=_0xcf9d;_0x8d5426['normal']={'x':0x0,'y':0x0,'z':0x1},_0x8d5426[_0x8512d9(0x14d)]=0x3,_0x8d5426[_0x8512d9(0xe9)]=![],_0x8d5426[_0x8512d9(0xb1)]=![],_0x8d5426[_0x8512d9(0x173)]=![],_0x8d5426['planar']=![],_0x8d5426[_0x8512d9(0xdd)]=1e-7,_0x8d5426[_0x8512d9(0x141)]=1e-7,_0x8d5426[_0x8512d9(0x198)]=1e-10,_0x8d5426['startTangent']={'x':0x0,'y':0x0,'z':0x0},_0x8d5426['endTangent']={'x':0x0,'y':0x0,'z':0x0},_0x8d5426[_0x8512d9(0x189)]=[],_0x8d5426[_0x8512d9(0x137)]=[],_0x8d5426[_0x8512d9(0xc6)]=[],_0x8d5426['fitPoints']=[];let _0x4c424d=null,_0x3fdea7=null;for(const _0x2df430 of _0x5c699e){switch(_0x2df430[_0x8512d9(0x155)]){case 0xa:_0x4c424d=parseFloat(_0x2df430[_0x8512d9(0xf8)]);break;case 0x14:_0x4c424d!==null&&(_0x8d5426['controlPoints'][_0x8512d9(0x174)]({'x':_0x4c424d,'y':parseFloat(_0x2df430[_0x8512d9(0xf8)]),'z':0x0}),_0x4c424d=null);break;case 0x1e:if(_0x8d5426[_0x8512d9(0xc6)][_0x8512d9(0x197)]>0x0)_0x8d5426['controlPoints'][_0x8d5426['controlPoints'][_0x8512d9(0x197)]-0x1]['z']=parseFloat(_0x2df430[_0x8512d9(0xf8)]);break;case 0xb:_0x3fdea7=parseFloat(_0x2df430[_0x8512d9(0xf8)]);break;case 0x15:_0x3fdea7!==null&&(_0x8d5426[_0x8512d9(0x112)][_0x8512d9(0x174)]({'x':_0x3fdea7,'y':parseFloat(_0x2df430[_0x8512d9(0xf8)]),'z':0x0}),_0x3fdea7=null);break;case 0x1f:if(_0x8d5426[_0x8512d9(0x112)]['length']>0x0)_0x8d5426[_0x8512d9(0x112)][_0x8d5426['fitPoints'][_0x8512d9(0x197)]-0x1]['z']=parseFloat(_0x2df430[_0x8512d9(0xf8)]);break;case 0xc:_0x8d5426[_0x8512d9(0x1bb)]['x']=parseFloat(_0x2df430[_0x8512d9(0xf8)]);break;case 0x16:_0x8d5426['startTangent']['y']=parseFloat(_0x2df430['value']);break;case 0x20:_0x8d5426[_0x8512d9(0x1bb)]['z']=parseFloat(_0x2df430['value']);break;case 0xd:_0x8d5426[_0x8512d9(0x114)]['x']=parseFloat(_0x2df430[_0x8512d9(0xf8)]);break;case 0x17:_0x8d5426[_0x8512d9(0x114)]['y']=parseFloat(_0x2df430[_0x8512d9(0xf8)]);break;case 0x21:_0x8d5426[_0x8512d9(0x114)]['z']=parseFloat(_0x2df430[_0x8512d9(0xf8)]);break;case 0x28:_0x8d5426[_0x8512d9(0x189)][_0x8512d9(0x174)](parseFloat(_0x2df430[_0x8512d9(0xf8)]));break;case 0x29:_0x8d5426['weights'][_0x8512d9(0x174)](parseFloat(_0x2df430[_0x8512d9(0xf8)]));break;case 0x2a:_0x8d5426[_0x8512d9(0xdd)]=parseFloat(_0x2df430[_0x8512d9(0xf8)]);break;case 0x2b:_0x8d5426[_0x8512d9(0x141)]=parseFloat(_0x2df430['value']);break;case 0x2c:_0x8d5426[_0x8512d9(0x198)]=parseFloat(_0x2df430[_0x8512d9(0xf8)]);break;case 0x46:{const _0xb5d906=parseInt(_0x2df430[_0x8512d9(0xf8)],0xa);_0x8d5426[_0x8512d9(0xe9)]=(_0xb5d906&0x1)===0x1,_0x8d5426[_0x8512d9(0xb1)]=(_0xb5d906&0x2)===0x2,_0x8d5426[_0x8512d9(0x173)]=(_0xb5d906&0x4)===0x4,_0x8d5426['planar']=(_0xb5d906&0x8)===0x8,_0x8d5426[_0x8512d9(0x15e)]=_0xb5d906;break;}case 0x47:_0x8d5426[_0x8512d9(0x14d)]=parseInt(_0x2df430[_0x8512d9(0xf8)],0xa);break;case 0x48:_0x8d5426[_0x8512d9(0xfc)]=parseInt(_0x2df430[_0x8512d9(0xf8)],0xa);break;case 0x49:_0x8d5426['controlPointCount']=parseInt(_0x2df430[_0x8512d9(0xf8)],0xa);break;case 0x4a:_0x8d5426[_0x8512d9(0x17b)]=parseInt(_0x2df430[_0x8512d9(0xf8)],0xa);break;case 0xd2:_0x8d5426[_0x8512d9(0xe0)]['x']=parseFloat(_0x2df430[_0x8512d9(0xf8)]);break;case 0xdc:_0x8d5426[_0x8512d9(0xe0)]['y']=parseFloat(_0x2df430['value']);break;case 0xe6:_0x8d5426[_0x8512d9(0xe0)]['z']=parseFloat(_0x2df430[_0x8512d9(0xf8)]);break;}}return _0x8d5426;}function parseSolidEntity(_0x20fec0,_0x304011){const _0x1d1ea6=_0xcf9d;_0x20fec0['points']=[{'x':0x0,'y':0x0,'z':0x0},{'x':0x0,'y':0x0,'z':0x0},{'x':0x0,'y':0x0,'z':0x0},{'x':0x0,'y':0x0,'z':0x0}],_0x20fec0[_0x1d1ea6(0x169)]=0x0,_0x20fec0[_0x1d1ea6(0x175)]={'x':0x0,'y':0x0,'z':0x1};for(const _0x2f084a of _0x304011){switch(_0x2f084a[_0x1d1ea6(0x155)]){case 0xa:_0x20fec0['points'][0x0]['x']=parseFloat(_0x2f084a[_0x1d1ea6(0xf8)]);break;case 0x14:_0x20fec0[_0x1d1ea6(0x1b2)][0x0]['y']=parseFloat(_0x2f084a[_0x1d1ea6(0xf8)]);break;case 0x1e:_0x20fec0[_0x1d1ea6(0x1b2)][0x0]['z']=parseFloat(_0x2f084a['value']);break;case 0xb:_0x20fec0[_0x1d1ea6(0x1b2)][0x1]['x']=parseFloat(_0x2f084a[_0x1d1ea6(0xf8)]);break;case 0x15:_0x20fec0[_0x1d1ea6(0x1b2)][0x1]['y']=parseFloat(_0x2f084a[_0x1d1ea6(0xf8)]);break;case 0x1f:_0x20fec0[_0x1d1ea6(0x1b2)][0x1]['z']=parseFloat(_0x2f084a[_0x1d1ea6(0xf8)]);break;case 0xc:_0x20fec0[_0x1d1ea6(0x1b2)][0x2]['x']=parseFloat(_0x2f084a[_0x1d1ea6(0xf8)]);break;case 0x16:_0x20fec0[_0x1d1ea6(0x1b2)][0x2]['y']=parseFloat(_0x2f084a[_0x1d1ea6(0xf8)]);break;case 0x20:_0x20fec0[_0x1d1ea6(0x1b2)][0x2]['z']=parseFloat(_0x2f084a[_0x1d1ea6(0xf8)]);break;case 0xd:_0x20fec0[_0x1d1ea6(0x1b2)][0x3]['x']=parseFloat(_0x2f084a[_0x1d1ea6(0xf8)]);break;case 0x17:_0x20fec0[_0x1d1ea6(0x1b2)][0x3]['y']=parseFloat(_0x2f084a[_0x1d1ea6(0xf8)]);break;case 0x21:_0x20fec0['points'][0x3]['z']=parseFloat(_0x2f084a['value']);break;case 0x27:_0x20fec0[_0x1d1ea6(0x169)]=parseFloat(_0x2f084a['value']);break;case 0xd2:_0x20fec0[_0x1d1ea6(0x175)]['x']=parseFloat(_0x2f084a['value']);break;case 0xdc:_0x20fec0[_0x1d1ea6(0x175)]['y']=parseFloat(_0x2f084a[_0x1d1ea6(0xf8)]);break;case 0xe6:_0x20fec0['extrusionDirection']['z']=parseFloat(_0x2f084a['value']);break;}}return _0x20fec0;}function _0xcf9d(_0x38e7e1,_0x383932){_0x38e7e1=_0x38e7e1-0xa5;const _0x39c5b3=_0x39c5();let _0xcf9dc9=_0x39c5b3[_0x38e7e1];return _0xcf9dc9;}function parse3DFaceEntity(_0x264a3e,_0x1de57a){const _0x164f2f=_0xcf9d;_0x264a3e[_0x164f2f(0x12c)]=[{'x':0x0,'y':0x0,'z':0x0},{'x':0x0,'y':0x0,'z':0x0},{'x':0x0,'y':0x0,'z':0x0},{'x':0x0,'y':0x0,'z':0x0}],_0x264a3e[_0x164f2f(0x1b0)]=0x0;for(const _0x551fda of _0x1de57a){switch(_0x551fda[_0x164f2f(0x155)]){case 0xa:_0x264a3e[_0x164f2f(0x12c)][0x0]['x']=parseFloat(_0x551fda[_0x164f2f(0xf8)]);break;case 0x14:_0x264a3e[_0x164f2f(0x12c)][0x0]['y']=parseFloat(_0x551fda[_0x164f2f(0xf8)]);break;case 0x1e:_0x264a3e[_0x164f2f(0x12c)][0x0]['z']=parseFloat(_0x551fda['value']);break;case 0xb:_0x264a3e['vertices'][0x1]['x']=parseFloat(_0x551fda[_0x164f2f(0xf8)]);break;case 0x15:_0x264a3e[_0x164f2f(0x12c)][0x1]['y']=parseFloat(_0x551fda[_0x164f2f(0xf8)]);break;case 0x1f:_0x264a3e['vertices'][0x1]['z']=parseFloat(_0x551fda['value']);break;case 0xc:_0x264a3e['vertices'][0x2]['x']=parseFloat(_0x551fda[_0x164f2f(0xf8)]);break;case 0x16:_0x264a3e['vertices'][0x2]['y']=parseFloat(_0x551fda[_0x164f2f(0xf8)]);break;case 0x20:_0x264a3e['vertices'][0x2]['z']=parseFloat(_0x551fda[_0x164f2f(0xf8)]);break;case 0xd:_0x264a3e[_0x164f2f(0x12c)][0x3]['x']=parseFloat(_0x551fda[_0x164f2f(0xf8)]);break;case 0x17:_0x264a3e[_0x164f2f(0x12c)][0x3]['y']=parseFloat(_0x551fda[_0x164f2f(0xf8)]);break;case 0x21:_0x264a3e[_0x164f2f(0x12c)][0x3]['z']=parseFloat(_0x551fda['value']);break;case 0x46:_0x264a3e[_0x164f2f(0x1b0)]=parseInt(_0x551fda['value'],0xa);break;}}return _0x264a3e;}function parseRayEntity(_0x46f4ae,_0xdf12f8){const _0x1834c9=_0xcf9d;_0x46f4ae[_0x1834c9(0x1b5)]={'x':0x0,'y':0x0,'z':0x0},_0x46f4ae[_0x1834c9(0x1a1)]={'x':0x1,'y':0x0,'z':0x0};for(const _0x141432 of _0xdf12f8){switch(_0x141432[_0x1834c9(0x155)]){case 0xa:_0x46f4ae[_0x1834c9(0x1b5)]['x']=parseFloat(_0x141432[_0x1834c9(0xf8)]);break;case 0x14:_0x46f4ae['basePoint']['y']=parseFloat(_0x141432[_0x1834c9(0xf8)]);break;case 0x1e:_0x46f4ae['basePoint']['z']=parseFloat(_0x141432[_0x1834c9(0xf8)]);break;case 0xb:_0x46f4ae['direction']['x']=parseFloat(_0x141432[_0x1834c9(0xf8)]);break;case 0x15:_0x46f4ae[_0x1834c9(0x1a1)]['y']=parseFloat(_0x141432[_0x1834c9(0xf8)]);break;case 0x1f:_0x46f4ae['direction']['z']=parseFloat(_0x141432['value']);break;}}return _0x46f4ae;}function parseViewportEntity(_0x43c2ef,_0x251245){const _0x777a80=_0xcf9d;_0x43c2ef['center']={'x':0x0,'y':0x0,'z':0x0},_0x43c2ef[_0x777a80(0xf0)]=0x0,_0x43c2ef[_0x777a80(0x132)]=0x0,_0x43c2ef[_0x777a80(0x151)]={'x':0x0,'y':0x0,'z':0x0},_0x43c2ef[_0x777a80(0x15c)]={'x':0x0,'y':0x0,'z':0x1},_0x43c2ef[_0x777a80(0x153)]=0x0,_0x43c2ef['viewHeight']=0x0,_0x43c2ef[_0x777a80(0x191)]={'x':0x0,'y':0x0},_0x43c2ef[_0x777a80(0x161)]=0x32,_0x43c2ef[_0x777a80(0xb7)]=0x0,_0x43c2ef[_0x777a80(0x158)]=null,_0x43c2ef['frozenLayers']=[];for(const _0x3b2317 of _0x251245){switch(_0x3b2317[_0x777a80(0x155)]){case 0xa:_0x43c2ef[_0x777a80(0xba)]['x']=parseFloat(_0x3b2317[_0x777a80(0xf8)]);break;case 0x14:_0x43c2ef[_0x777a80(0xba)]['y']=parseFloat(_0x3b2317[_0x777a80(0xf8)]);break;case 0x1e:_0x43c2ef[_0x777a80(0xba)]['z']=parseFloat(_0x3b2317['value']);break;case 0xc:_0x43c2ef['viewCenter']['x']=parseFloat(_0x3b2317['value']);break;case 0x16:_0x43c2ef[_0x777a80(0x191)]['y']=parseFloat(_0x3b2317[_0x777a80(0xf8)]);break;case 0x28:_0x43c2ef['width']=parseFloat(_0x3b2317[_0x777a80(0xf8)]);break;case 0x29:_0x43c2ef[_0x777a80(0x132)]=parseFloat(_0x3b2317[_0x777a80(0xf8)]);break;case 0x2d:_0x43c2ef[_0x777a80(0xc4)]=parseFloat(_0x3b2317[_0x777a80(0xf8)]);break;case 0x33:_0x43c2ef[_0x777a80(0x153)]=parseFloat(_0x3b2317['value']);break;case 0x44:_0x43c2ef[_0x777a80(0xb7)]=parseInt(_0x3b2317[_0x777a80(0xf8)],0xa);break;case 0x45:_0x43c2ef['id']=parseInt(_0x3b2317[_0x777a80(0xf8)],0xa);break;case 0x14b:_0x43c2ef[_0x777a80(0x10f)][_0x777a80(0x174)](_0x3b2317['value']);break;case 0x154:_0x43c2ef[_0x777a80(0x158)]=_0x3b2317['value'];break;}}return _0x43c2ef;}function parseImageEntity(_0x19347f,_0x524170){const _0x55fe66=_0xcf9d;_0x19347f[_0x55fe66(0x193)]={'x':0x0,'y':0x0,'z':0x0},_0x19347f[_0x55fe66(0x13a)]={'x':0x1,'y':0x0,'z':0x0},_0x19347f['vVector']={'x':0x0,'y':0x1,'z':0x0},_0x19347f[_0x55fe66(0x12e)]={'u':0x0,'v':0x0},_0x19347f[_0x55fe66(0xdc)]='',_0x19347f[_0x55fe66(0xf2)]=0x0,_0x19347f[_0x55fe66(0x179)]=0x0,_0x19347f['brightness']=0x32,_0x19347f[_0x55fe66(0x157)]=0x32,_0x19347f[_0x55fe66(0x144)]=0x0,_0x19347f[_0x55fe66(0xdf)]=[];for(const _0x149ed3 of _0x524170){switch(_0x149ed3[_0x55fe66(0x155)]){case 0xa:_0x19347f[_0x55fe66(0x193)]['x']=parseFloat(_0x149ed3['value']);break;case 0x14:_0x19347f[_0x55fe66(0x193)]['y']=parseFloat(_0x149ed3['value']);break;case 0x1e:_0x19347f[_0x55fe66(0x193)]['z']=parseFloat(_0x149ed3[_0x55fe66(0xf8)]);break;case 0xd:_0x19347f[_0x55fe66(0x12e)]['u']=parseFloat(_0x149ed3['value']);break;case 0x17:_0x19347f[_0x55fe66(0x12e)]['v']=parseFloat(_0x149ed3[_0x55fe66(0xf8)]);break;case 0xe:_0x19347f[_0x55fe66(0xdf)]['push']({'x':parseFloat(_0x149ed3['value'])});break;case 0x18:if(_0x19347f[_0x55fe66(0xdf)][_0x55fe66(0x197)]>0x0)_0x19347f[_0x55fe66(0xdf)][_0x19347f[_0x55fe66(0xdf)][_0x55fe66(0x197)]-0x1]['y']=parseFloat(_0x149ed3[_0x55fe66(0xf8)]);break;case 0x46:_0x19347f[_0x55fe66(0xf2)]=parseInt(_0x149ed3[_0x55fe66(0xf8)],0xa);break;case 0x154:_0x19347f[_0x55fe66(0xdc)]=_0x149ed3[_0x55fe66(0xf8)];break;}}return _0x19347f;}function parseToleranceEntity(_0x345944,_0x494ca6){const _0xf9a912=_0xcf9d;_0x345944[_0xf9a912(0x193)]={'x':0x0,'y':0x0,'z':0x0},_0x345944[_0xf9a912(0x1a1)]={'x':0x1,'y':0x0,'z':0x0},_0x345944[_0xf9a912(0x1aa)]=_0xf9a912(0x17d),_0x345944[_0xf9a912(0xdb)]='';for(const _0xb0db09 of _0x494ca6){switch(_0xb0db09[_0xf9a912(0x155)]){case 0x1:_0x345944[_0xf9a912(0xdb)]=_0xb0db09[_0xf9a912(0xf8)];break;case 0x3:_0x345944[_0xf9a912(0x1aa)]=_0xb0db09[_0xf9a912(0xf8)];break;case 0xa:_0x345944[_0xf9a912(0x193)]['x']=parseFloat(_0xb0db09['value']);break;case 0x14:_0x345944[_0xf9a912(0x193)]['y']=parseFloat(_0xb0db09[_0xf9a912(0xf8)]);break;case 0x1e:_0x345944[_0xf9a912(0x193)]['z']=parseFloat(_0xb0db09[_0xf9a912(0xf8)]);break;case 0xb:_0x345944[_0xf9a912(0x1a1)]['x']=parseFloat(_0xb0db09[_0xf9a912(0xf8)]);break;case 0x15:_0x345944[_0xf9a912(0x1a1)]['y']=parseFloat(_0xb0db09['value']);break;case 0x1f:_0x345944['direction']['z']=parseFloat(_0xb0db09[_0xf9a912(0xf8)]);break;}}return _0x345944;}function parseHelixEntity(_0x30b03d,_0x439ba7){const _0x44bb37=_0xcf9d;_0x30b03d[_0x44bb37(0xe7)]={'x':0x0,'y':0x0,'z':0x0},_0x30b03d[_0x44bb37(0xab)]={'x':0x0,'y':0x0,'z':0x0},_0x30b03d[_0x44bb37(0x123)]={'x':0x0,'y':0x0,'z':0x1},_0x30b03d[_0x44bb37(0x120)]=0x0,_0x30b03d['turns']=0x1,_0x30b03d[_0x44bb37(0x18c)]=0x0,_0x30b03d['handedness']=0x0,_0x30b03d[_0x44bb37(0x145)]=0x0;for(const _0x4931ee of _0x439ba7){switch(_0x4931ee[_0x44bb37(0x155)]){case 0xa:_0x30b03d['axisBasePoint']['x']=parseFloat(_0x4931ee['value']);break;case 0x14:_0x30b03d['axisBasePoint']['y']=parseFloat(_0x4931ee[_0x44bb37(0xf8)]);break;case 0x1e:_0x30b03d['axisBasePoint']['z']=parseFloat(_0x4931ee[_0x44bb37(0xf8)]);break;case 0xb:_0x30b03d[_0x44bb37(0xab)]['x']=parseFloat(_0x4931ee[_0x44bb37(0xf8)]);break;case 0x15:_0x30b03d['startPoint']['y']=parseFloat(_0x4931ee[_0x44bb37(0xf8)]);break;case 0x1f:_0x30b03d[_0x44bb37(0xab)]['z']=parseFloat(_0x4931ee[_0x44bb37(0xf8)]);break;case 0x28:_0x30b03d[_0x44bb37(0x120)]=parseFloat(_0x4931ee[_0x44bb37(0xf8)]);break;case 0x29:_0x30b03d[_0x44bb37(0x15f)]=parseFloat(_0x4931ee['value']);break;case 0x2a:_0x30b03d['turnHeight']=parseFloat(_0x4931ee[_0x44bb37(0xf8)]);break;case 0x122:_0x30b03d[_0x44bb37(0x154)]=parseInt(_0x4931ee[_0x44bb37(0xf8)],0xa);break;case 0x118:_0x30b03d[_0x44bb37(0x145)]=parseInt(_0x4931ee[_0x44bb37(0xf8)],0xa);break;}}return _0x30b03d;}function parseMeshEntity(_0x5119da,_0x12c4a4){const _0xcff820=_0xcf9d;_0x5119da[_0xcff820(0xe1)]=0x2,_0x5119da[_0xcff820(0xce)]=0x0,_0x5119da['vertices']=[],_0x5119da['faces']=[],_0x5119da['edges']=[],_0x5119da[_0xcff820(0x16a)]=[];let _0x11e98c=null,_0x2c215d=![],_0x33370a=![],_0x367508=![];for(const _0x2d252a of _0x12c4a4){switch(_0x2d252a[_0xcff820(0x155)]){case 0x47:_0x5119da[_0xcff820(0xe1)]=parseInt(_0x2d252a[_0xcff820(0xf8)],0xa);break;case 0x48:_0x5119da['subdivisionLevel']=parseInt(_0x2d252a['value'],0xa);break;case 0x5b:_0x2c215d=![];break;case 0x5c:_0x2c215d=!![];break;case 0x5d:_0x33370a=!![],_0x2c215d=![];break;case 0x5e:_0x367508=!![],_0x33370a=![];break;case 0x5f:_0x367508=![];break;case 0xa:_0x11e98c=parseFloat(_0x2d252a[_0xcff820(0xf8)]);break;case 0x14:_0x11e98c!==null&&(_0x5119da[_0xcff820(0x12c)][_0xcff820(0x174)]({'x':_0x11e98c,'y':parseFloat(_0x2d252a[_0xcff820(0xf8)]),'z':0x0}),_0x11e98c=null);break;case 0x1e:if(_0x5119da[_0xcff820(0x12c)][_0xcff820(0x197)]>0x0)_0x5119da[_0xcff820(0x12c)][_0x5119da[_0xcff820(0x12c)][_0xcff820(0x197)]-0x1]['z']=parseFloat(_0x2d252a['value']);break;case 0x5a:if(_0x2c215d)_0x5119da[_0xcff820(0xa7)][_0xcff820(0x174)](parseInt(_0x2d252a[_0xcff820(0xf8)],0xa));else {if(_0x33370a)_0x5119da[_0xcff820(0x1b6)][_0xcff820(0x174)](parseInt(_0x2d252a[_0xcff820(0xf8)],0xa));}break;case 0x8c:if(_0x367508)_0x5119da[_0xcff820(0x16a)][_0xcff820(0x174)](parseFloat(_0x2d252a['value']));break;}}return _0x5119da;}function parseRegionEntity(_0x2eeff5,_0x3d01cd){const _0x1fe24e=_0xcf9d;_0x2eeff5[_0x1fe24e(0x18e)]=[];for(const _0x54a9dd of _0x3d01cd){if(_0x54a9dd[_0x1fe24e(0x155)]===0x1||_0x54a9dd['code']===0x3)_0x2eeff5['acisData'][_0x1fe24e(0x174)](_0x54a9dd['value']);if(_0x54a9dd[_0x1fe24e(0x155)]===0x46)_0x2eeff5[_0x1fe24e(0x10b)]=parseInt(_0x54a9dd[_0x1fe24e(0xf8)],0xa);}return _0x2eeff5[_0x1fe24e(0xac)]=_0x2eeff5['acisData'][_0x1fe24e(0xe5)](''),_0x2eeff5;}function parseOle2Entity(_0x505246,_0x4c9ea2){const _0x122116=_0xcf9d;_0x505246[_0x122116(0xb0)]={'x':0x0,'y':0x0,'z':0x0},_0x505246[_0x122116(0xa9)]={'x':0x0,'y':0x0,'z':0x0},_0x505246[_0x122116(0x133)]=0x0,_0x505246['tileMode']=0x0;for(const _0x596cd7 of _0x4c9ea2){switch(_0x596cd7[_0x122116(0x155)]){case 0xa:_0x505246[_0x122116(0xb0)]['x']=parseFloat(_0x596cd7[_0x122116(0xf8)]);break;case 0x14:_0x505246[_0x122116(0xb0)]['y']=parseFloat(_0x596cd7[_0x122116(0xf8)]);break;case 0xb:_0x505246[_0x122116(0xa9)]['x']=parseFloat(_0x596cd7['value']);break;case 0x15:_0x505246['lowerRightCorner']['y']=parseFloat(_0x596cd7[_0x122116(0xf8)]);break;case 0x46:_0x505246[_0x122116(0x133)]=parseInt(_0x596cd7[_0x122116(0xf8)],0xa);break;case 0x47:_0x505246[_0x122116(0xd3)]=parseInt(_0x596cd7[_0x122116(0xf8)],0xa);break;case 0x1:case 0x3:_0x505246['binaryData']=_0x505246['binaryData']||[],_0x505246['binaryData'][_0x122116(0x174)](_0x596cd7['value']);break;}}return _0x505246;}function parseTableEntity(_0x4606f8,_0x2e1ee4){const _0x526276=_0xcf9d;_0x4606f8[_0x526276(0x193)]={'x':0x0,'y':0x0,'z':0x0},_0x4606f8['blockName']='',_0x4606f8[_0x526276(0x1a1)]={'x':0x1,'y':0x0,'z':0x0},_0x4606f8[_0x526276(0x110)]=0x0,_0x4606f8[_0x526276(0x10e)]=0x0;for(const _0xea9875 of _0x2e1ee4){switch(_0xea9875[_0x526276(0x155)]){case 0x2:_0x4606f8[_0x526276(0x1b7)]=_0xea9875[_0x526276(0xf8)];break;case 0xa:_0x4606f8[_0x526276(0x193)]['x']=parseFloat(_0xea9875[_0x526276(0xf8)]);break;case 0x14:_0x4606f8[_0x526276(0x193)]['y']=parseFloat(_0xea9875[_0x526276(0xf8)]);break;case 0xb:_0x4606f8[_0x526276(0x1a1)]['x']=parseFloat(_0xea9875[_0x526276(0xf8)]);break;case 0x15:_0x4606f8[_0x526276(0x1a1)]['y']=parseFloat(_0xea9875[_0x526276(0xf8)]);break;case 0x5b:_0x4606f8[_0x526276(0x110)]=parseInt(_0xea9875['value'],0xa);break;case 0x5c:_0x4606f8[_0x526276(0x10e)]=parseInt(_0xea9875[_0x526276(0xf8)],0xa);break;case 0x8e:_0x4606f8[_0x526276(0x149)]=_0x4606f8['rowHeights']||[],_0x4606f8[_0x526276(0x149)]['push'](parseFloat(_0xea9875['value']));break;case 0x8d:_0x4606f8[_0x526276(0x127)]=_0x4606f8[_0x526276(0x127)]||[],_0x4606f8['columnWidths']['push'](parseFloat(_0xea9875[_0x526276(0xf8)]));break;}}return _0x4606f8;}function _0x39c5(){const _0x7f3c84=['attachmentPoint','endTangent','faceVertex2','other_list','TRACE','isPolyfaceMesh','get','majorAxisEndPoint','rowSpacing','ownerHandle','endPoint','TOLERANCE','5118KqsbZp','radius','INSERT','is3DPolyline','axisVector','entryName','175IkxgKB','type','columnWidths','position','textWidth','689025fdffDL','instanceCount','vertices','1866fMKbDP','imageSize','slice','VIEWPORT','50910cOWNDF','height','oleType','code_','endWidth','constantWidth','weights','POLYLINE','colorNumber','uVector','arc_list','SEQEND','proxyCapabilities','visible','3DSOLID','11aWaWHn','controlPointTolerance','oblique','data','fade','constraint','styleHandle','8cNKauX','ATTDEF','rowHeights','status','SURFACE','prompt','degree','leaderLength','POINT','middleOfText','viewTarget','ENDSEC','viewTwistAngle','handedness','code','endAngle','contrast','clippingBoundary','pathType','hAlign','hasAttributes','viewDirection','hardPointer','flags','turns','spline_list','perspectiveLensLength','startsWith','ATTRIB','subclassMarker','arrowheadSize','insert_list','bulge','CLASS','thickness','edgeCreases','trueColor','lineSpacing','error','dimension_list','versions','contentType','ellipse_list','face3d_list','rational','push','extrusionDirection','name','startWidth','point2','clippingType','horizontalDirection','fitPointCount','seedPoints','STANDARD','basePointX','patternType','keys','BLOCK','IMAGE','LEADER','includes','textStyleId','patternAngle','DIMENSION','HEADER','knots','linetypeScale','polyline_list','turnHeight','TABLES','acisData','3DFACE','angle','viewCenter','edgeCount','insertionPoint','SECTION','style','获取\x20DXF\x20失败:\x20HTTP\x20','length','fitTolerance','justification','associative','circle_list','OBJECTS','Defpoints','concat','columnCount','generationFlags','direction','dummyY','XLINE','test','isEntity','xScale','dimensionType','entities','ELLIPSE','styleName','SOLID','arrowheadFlag','vAlign','leader_list','BODY','invisibleEdgeFlags','faceVertex4','points','node','lineSpacingStyle','basePoint','edges','blockName','linetypeName','scale','doglegLength','startTangent','ENDTAB','MESH','faces','name2','lowerRightCorner','tag','startPoint','acisDataString','drawingDirection','trim','faceVertex1','upperLeftCorner','periodic','solid','meshMVertexCount','HELIX','faceVertex3','point_list','statusField','startAngle','rowCount','center','attributes','cppClassName','is3DMesh','200YfTeXd','basePointY','LAYER','point1','layers','meshNVertexCount','viewHeight','handle','controlPoints','ARC','appName','mtext_list','HATCH','columnSpacing','12845016dohFbt','CIRCLE','subdivisionLevel','undefined','defaultStartWidth','patternScale','TEXT','tileMode','MLINE','fs/promises','patternName','BLOCKS','creationType','basePointZ','leaderPoints','text','imageDefHandle','knotTolerance','HTTP\x20','clippingVertices','normal','version','definitionPoint','lineweight','rotation','join','softPointer','axisBasePoint','WIPEOUT','closed','TABLE','layer','https','blocks','find','annotationReference','width','elevation','displayFlags','parseDxf:\x20请传入\x20DXF\x20字符串、文件路径、URL\x20或\x20File\x20对象','VERTEX','vertexCount','textHeight','split','value','浏览器不支持读取本地路径,请用\x20URL\x20或\x20File\x20对象','12735783DBaspg','LWPOLYLINE','knotCount','hooklineFlag','setEncoding','boundaryPaths','defaultEndWidth','ENTITIES','MLEADER','8860870GUCcPQ','32180WzxPUD','image_list','OLE2FRAME','statusCode','alignmentPoint','string','LINE','modelerFormat','axisRatio','widthFactor','columns','frozenLayers','rows','MTEXT','fitPoints'];_0x39c5=function(){return _0x7f3c84;};return _0x39c5();}function parseMLineEntity(_0x2ce0fb,_0x1a78e7){const _0x1f2060=_0xcf9d;_0x2ce0fb[_0x1f2060(0x1aa)]=_0x1f2060(0x17d),_0x2ce0fb[_0x1f2060(0x1b9)]=0x1,_0x2ce0fb[_0x1f2060(0x199)]=0x0,_0x2ce0fb[_0x1f2060(0x15e)]=0x0,_0x2ce0fb['startPoint']={'x':0x0,'y':0x0,'z':0x0},_0x2ce0fb[_0x1f2060(0xe0)]={'x':0x0,'y':0x0,'z':0x1},_0x2ce0fb[_0x1f2060(0x12c)]=[];let _0x160ec6=null;for(const _0x494763 of _0x1a78e7){switch(_0x494763[_0x1f2060(0x155)]){case 0x2:_0x2ce0fb[_0x1f2060(0x1aa)]=_0x494763[_0x1f2060(0xf8)];break;case 0xa:_0x2ce0fb['startPoint']['x']=parseFloat(_0x494763['value']);break;case 0x14:_0x2ce0fb[_0x1f2060(0xab)]['y']=parseFloat(_0x494763[_0x1f2060(0xf8)]);break;case 0x1e:_0x2ce0fb[_0x1f2060(0xab)]['z']=parseFloat(_0x494763['value']);break;case 0xb:_0x160ec6=parseFloat(_0x494763[_0x1f2060(0xf8)]);break;case 0x15:_0x160ec6!==null&&(_0x2ce0fb['vertices'][_0x1f2060(0x174)]({'x':_0x160ec6,'y':parseFloat(_0x494763[_0x1f2060(0xf8)]),'z':0x0}),_0x160ec6=null);break;case 0x1f:if(_0x2ce0fb[_0x1f2060(0x12c)]['length']>0x0)_0x2ce0fb[_0x1f2060(0x12c)][_0x2ce0fb[_0x1f2060(0x12c)][_0x1f2060(0x197)]-0x1]['z']=parseFloat(_0x494763[_0x1f2060(0xf8)]);break;case 0x28:_0x2ce0fb[_0x1f2060(0x1b9)]=parseFloat(_0x494763[_0x1f2060(0xf8)]);break;case 0x46:_0x2ce0fb['justification']=parseInt(_0x494763[_0x1f2060(0xf8)],0xa);break;case 0x47:_0x2ce0fb['flags']=parseInt(_0x494763[_0x1f2060(0xf8)],0xa);break;case 0x48:_0x2ce0fb[_0x1f2060(0xf5)]=parseInt(_0x494763['value'],0xa);break;case 0x154:_0x2ce0fb[_0x1f2060(0x146)]=_0x494763[_0x1f2060(0xf8)];break;case 0xd2:_0x2ce0fb[_0x1f2060(0xe0)]['x']=parseFloat(_0x494763[_0x1f2060(0xf8)]);break;case 0xdc:_0x2ce0fb[_0x1f2060(0xe0)]['y']=parseFloat(_0x494763['value']);break;case 0xe6:_0x2ce0fb[_0x1f2060(0xe0)]['z']=parseFloat(_0x494763[_0x1f2060(0xf8)]);break;}}return _0x2ce0fb;}function parseGenericEntity(_0x2c669f,_0x1e6ff5){const _0x363980=_0xcf9d;_0x2c669f[_0x363980(0x143)]={};for(const _0x45e624 of _0x1e6ff5){const _0x23335d=_0x363980(0x134)+_0x45e624[_0x363980(0x155)],_0x444b81=autoConvert(_0x45e624[_0x363980(0x155)],_0x45e624[_0x363980(0xf8)]);if(_0x2c669f[_0x363980(0x143)][_0x23335d]!==undefined)_0x2c669f[_0x363980(0x143)][_0x23335d]=[][_0x363980(0x19e)](_0x2c669f['data'][_0x23335d],_0x444b81);else _0x2c669f[_0x363980(0x143)][_0x23335d]=_0x444b81;}return _0x2c669f;}function parseObjects(_0x38ffd5){const _0x5f5060=_0xcf9d;if(!_0x38ffd5||_0x38ffd5[_0x5f5060(0x197)]===0x0)return [];const _0x21f6aa=[];let _0x7863be=0x0;while(_0x7863be<_0x38ffd5[_0x5f5060(0x197)]){if(_0x38ffd5[_0x7863be][_0x5f5060(0x155)]===0x0){const _0x21dc74=_0x38ffd5[_0x7863be][_0x5f5060(0xf8)];_0x7863be++;const _0x22e856={'type':_0x21dc74};while(_0x7863be<_0x38ffd5['length']&&_0x38ffd5[_0x7863be][_0x5f5060(0x155)]!==0x0){const _0x3e48ba=_0x38ffd5[_0x7863be][_0x5f5060(0x155)],_0xca5cd3=autoConvert(_0x3e48ba,_0x38ffd5[_0x7863be]['value']);switch(_0x3e48ba){case 0x5:_0x22e856[_0x5f5060(0xc5)]=_0xca5cd3;break;case 0x2:_0x22e856[_0x5f5060(0x176)]=_0xca5cd3;break;case 0x3:_0x22e856[_0x5f5060(0x124)]=_0x22e856[_0x5f5060(0x124)]?[][_0x5f5060(0x19e)](_0x22e856['entryName'],_0xca5cd3):_0xca5cd3;break;case 0x14a:_0x22e856['ownerHandle']=_0xca5cd3;break;case 0x15e:_0x22e856[_0x5f5060(0xe6)]=_0x22e856[_0x5f5060(0xe6)]?[][_0x5f5060(0x19e)](_0x22e856[_0x5f5060(0xe6)],_0xca5cd3):_0xca5cd3;break;case 0x168:_0x22e856[_0x5f5060(0x15d)]=_0x22e856['hardPointer']?[][_0x5f5060(0x19e)](_0x22e856[_0x5f5060(0x15d)],_0xca5cd3):_0xca5cd3;break;default:const _0x1cdf4a=_0x5f5060(0x134)+_0x3e48ba;if(_0x22e856[_0x1cdf4a]!==undefined)_0x22e856[_0x1cdf4a]=[][_0x5f5060(0x19e)](_0x22e856[_0x1cdf4a],_0xca5cd3);else _0x22e856[_0x1cdf4a]=_0xca5cd3;}_0x7863be++;}_0x21f6aa[_0x5f5060(0x174)](_0x22e856);}else _0x7863be++;}return _0x21f6aa;}function assemblePolylineVertices(_0x338cad){const _0x5b29ab=_0xcf9d,_0x425f61=[];let _0x75658d=null;for(const _0x21f4f6 of _0x338cad){if(_0x21f4f6[_0x5b29ab(0x126)]===_0x5b29ab(0x138))_0x75658d=_0x21f4f6,_0x425f61[_0x5b29ab(0x174)](_0x21f4f6);else {if(_0x21f4f6[_0x5b29ab(0x126)]==='VERTEX'&&_0x75658d)_0x75658d[_0x5b29ab(0x12c)][_0x5b29ab(0x174)]({'x':_0x21f4f6[_0x5b29ab(0x128)]['x'],'y':_0x21f4f6[_0x5b29ab(0x128)]['y'],'z':_0x21f4f6[_0x5b29ab(0x128)]['z'],'bulge':_0x21f4f6[_0x5b29ab(0x167)],'startWidth':_0x21f4f6[_0x5b29ab(0x177)],'endWidth':_0x21f4f6[_0x5b29ab(0x135)],'flags':_0x21f4f6['flags'],'faceVertex1':_0x21f4f6[_0x5b29ab(0xaf)],'faceVertex2':_0x21f4f6[_0x5b29ab(0x115)],'faceVertex3':_0x21f4f6['faceVertex3'],'faceVertex4':_0x21f4f6[_0x5b29ab(0x1b1)]});else _0x21f4f6[_0x5b29ab(0x126)]===_0x5b29ab(0x13c)?_0x75658d=null:(_0x75658d=null,_0x425f61['push'](_0x21f4f6));}}return _0x425f61;}function assembleInsertAttributes(_0x54761d){const _0x38e7e6=_0xcf9d,_0x4b0a2d=[];let _0xa12f66=null;for(const _0x308cdc of _0x54761d){if(_0x308cdc[_0x38e7e6(0x126)]===_0x38e7e6(0x121)&&_0x308cdc[_0x38e7e6(0x15b)])_0xa12f66=_0x308cdc,_0x4b0a2d['push'](_0x308cdc);else {if(_0x308cdc[_0x38e7e6(0x126)]===_0x38e7e6(0x163)&&_0xa12f66)_0xa12f66['attributes'][_0x38e7e6(0x174)](_0x308cdc);else _0x308cdc[_0x38e7e6(0x126)]==='SEQEND'?_0xa12f66=null:(_0xa12f66=null,_0x4b0a2d[_0x38e7e6(0x174)](_0x308cdc));}}return _0x4b0a2d;}async function fetchDxfFromUrl(_0xbcdd70){const _0xe0c579=_0xcf9d;if(typeof fetch==='function'){const _0x3a02cd=await fetch(_0xbcdd70);if(!_0x3a02cd['ok'])throw new Error(_0xe0c579(0x196)+_0x3a02cd[_0xe0c579(0x14a)]+'\x20—\x20'+_0xbcdd70);return await _0x3a02cd[_0xe0c579(0xdb)]();}if(typeof process!==_0xe0c579(0xcf)&&process['versions']?.['node']){const {default:_0x12a4f}=_0xbcdd70[_0xe0c579(0x162)](_0xe0c579(0xec))?await import(_0xe0c579(0xec)):await import('http');return new Promise((_0x296954,_0x1e3531)=>{const _0x3b9c82=_0xe0c579;_0x12a4f[_0x3b9c82(0x119)](_0xbcdd70,_0x5ae639=>{const _0x1cf06c=_0x3b9c82;if(_0x5ae639[_0x1cf06c(0x107)]!==0xc8){_0x1e3531(new Error(_0x1cf06c(0xde)+_0x5ae639['statusCode']));return;}let _0xb44daf='';_0x5ae639[_0x1cf06c(0xfe)]('utf-8'),_0x5ae639['on'](_0x1cf06c(0x143),_0x5d7af1=>_0xb44daf+=_0x5d7af1),_0x5ae639['on']('end',()=>_0x296954(_0xb44daf)),_0x5ae639['on'](_0x1cf06c(0x16d),_0x1e3531);})['on'](_0x3b9c82(0x16d),_0x1e3531);});}throw new Error('当前环境不支持\x20HTTP\x20请求');}async function readLocalFile(_0x3284b1){const _0x2d4591=_0xcf9d;if(typeof process!==_0x2d4591(0xcf)&&process[_0x2d4591(0x16f)]?.[_0x2d4591(0x1b3)]){const {readFile:_0x2d2781}=await import(_0x2d4591(0xd5));return await _0x2d2781(_0x3284b1,'utf-8');}throw new Error(_0x2d4591(0xf9));}async function parseDxf(_0x586cce){const _0x38d162=_0xcf9d;let _0x4bdc7e;if(typeof Blob!==_0x38d162(0xcf)&&_0x586cce instanceof Blob)_0x4bdc7e=await _0x586cce[_0x38d162(0xdb)]();else {if(typeof _0x586cce===_0x38d162(0x109)){if(_0x586cce['includes']('\x0a')||_0x586cce[_0x38d162(0x184)](_0x38d162(0x194)))_0x4bdc7e=_0x586cce;else /^https?:\/\//i[_0x38d162(0x1a4)](_0x586cce)?_0x4bdc7e=await fetchDxfFromUrl(_0x586cce):_0x4bdc7e=await readLocalFile(_0x586cce);}else throw new Error(_0x38d162(0xf3));}const _0x2c80b9=tokenize(_0x4bdc7e),_0x13cda5=splitSections(_0x2c80b9),_0x3c1df1={'header':parseHeader(_0x13cda5[_0x38d162(0x188)]),'classes':parseClasses(_0x13cda5['CLASSES']),'tables':parseTables(_0x13cda5[_0x38d162(0x18d)]),'blocks':parseBlocks(_0x13cda5[_0x38d162(0xd7)]),'entities':parseEntityList(_0x13cda5[_0x38d162(0x101)]||[]),'objects':parseObjects(_0x13cda5[_0x38d162(0x19c)])};_0x3c1df1[_0x38d162(0x1a8)]=assemblePolylineVertices(_0x3c1df1[_0x38d162(0x1a8)]),_0x3c1df1[_0x38d162(0x1a8)]=assembleInsertAttributes(_0x3c1df1[_0x38d162(0x1a8)]);for(const _0x225045 of _0x3c1df1[_0x38d162(0xed)]){_0x225045[_0x38d162(0x1a8)]&&_0x225045[_0x38d162(0x1a8)]['length']>0x0&&(_0x225045[_0x38d162(0x1a8)]=assemblePolylineVertices(_0x225045[_0x38d162(0x1a8)]),_0x225045['entities']=assembleInsertAttributes(_0x225045['entities']));}return _0x3c1df1;}
|
|
1
|
+
/**
|
|
2
|
+
* ============================================================
|
|
3
|
+
* dxf-kit/src/dxfParser.js — ESM 版
|
|
4
|
+
*
|
|
5
|
+
* 与你原来的 CJS 版相比,改动只有 3 处:
|
|
6
|
+
* 1. 删掉顶部 const fs = require("fs").promises
|
|
7
|
+
* 2. parseDxf 内部按需 import("fs")
|
|
8
|
+
* 3. 底部 module.exports → export
|
|
9
|
+
* ============================================================
|
|
10
|
+
*/
|
|
2
11
|
|
|
3
|
-
function _0x5629(){const _0x30ef16=['extrusionDirection','EOF','AcDb2dVertex','arrowheadSize','SPLINE','instanceCount','SECTION','TABLE','columnSpacing','IMAGE','alignmentPoint','ENDBLK','data','acisDataString','style','26014OxtpYM','AcDbMline','textStyleId','elevation','closed','fade','associative','href','defaultStartWidth','axisVector','binaryData','rowSpacing','ELLIPSE','length','type','AcDbBlockBegin','meshMVertexCount','invisibleEdgeFlags','point3','LWPOLYLINE','drawingDirection','generationFlags','version','middleOfText','inPaperSpace','VERTEX','elementCount','scale','startPoint','direction','point2','8aypvAp','BODY','endsWith','endAngle','blockName','linetypeScale','OBJECTS','versions','frontClipPlane','upperLeftCorner','majorAxisEndPoint','widthFactor','pathType','fitTolerance','AcDb3dSolid','AcDb3PointAngularDimension','angle','cppClassName','imageDefHandle','AcDbAlignedDimension','AcDbTrace','snapAngle','AcDbTable','defaultEndWidth','TABLES','AcDbHatch','plotStyleHandle','DIMENSION','clippingVertices','AcDbMText','constantWidth','weights','extra','hAlign','0.0','HEADER','MTEXT','object','AcDbWipeout','hasAttributes','7YZTGJu','radius','lineSpacing','annotationReference','concat','keys','height','point1','AcDbFcf','128EvUfhU','extensionLineAngle','AcDbVertex','SURFACE','rotation','POLYLINE','ENDSEC','tables','faces','AcDbBlockReference','AcDbSurface','download','insertionPoint','40cehsgX','vVector','BLOCK','AcDbEntity','columnCount','creationType','createObjectURL','endTangent','AcDbPoint','oleType','xScale','startAngle','patternName','substring','controlPointTolerance','AcDbDimension','layer','snapSpacing','width','18PxkDXj','3757070MAGseh','AcDbEllipse','LINE','vertices','meshNVertexCount','round','solid','appName','visible','basePointY','hooklineFlag','AcDbArc','fitPoints','uVector','application/dxf','11MEgPGU','periodic','oblique','AcDbRay','planar','imageSize','contentType','CLASSES','styleHandle','AcDbXline','VIEWPORT','replace','TRACE','vAlign','28rqPnSZ','edgeCreases','horizontalDirection','AcDbMLeader','attachmentPoint','OLE2FRAME','rowCount','trueColor','hooklineDirectionFlag','arrowheadFlag','points','viewDirection','4366921laFQTE','backClipPlane','utf-8','viewCenter','WIPEOUT','viewTwistAngle','7690596JIJlJw','definitionPoint','doglegLength','rowHeights','turns','acisData','columnWidths','modelerFormat','88752vlycCl','AcDbLeader','endWidth','textWidth','endPoint','fs/promises','createElement','STANDARD','AcDbSpline','AcDbCircle','handle','controlPoints','frozenLayers','toFixed','lineSpacingStyle','AcDbDiametricDimension','AcDbAttribute','isArray','AcDbRotatedDimension','brightness','viewTarget','wasProxy','colorNumber','rational','subclassMarker','softPointer','statusField','patternAngle','TOLERANCE','basePointZ','name2','dimensionType','bulge','name','clippingBoundary','header','2284456EYKGIG','basePointX','ARC','entities','rows','dxfRecord','isEntity','leaderPoints','clippingType','seedPoints','SOLID','lineweight','styleName','linetypeName','attributes','prompt','flags','AcDbFace','AcDbOrdinateDimension','MLINE','entryName','ATTDEF','basePoint','SEQEND','textHeight','degree','startWidth','columns','TEXT','AcDbHelix','contrast','displayFlags','number','AcDbRasterImage','subdivisionLevel','startsWith','AcDbPolyline','HELIX','knotTolerance','110301ZaDCbP','normal','leaderLength','patternType','ENDTAB','knots','axisRatio','POINT','AcDbOle2Frame','code_','CLASS','AcDbSubDMesh','thickness','snapBase','perspectiveLensLength','AcDbText','gridSpacing','XLINE','viewHeight','proxyCapabilities','position','entries','center','ownerHandle','writeDxfFile\x20仅支持\x20Node.js\x20环境,浏览器请用\x20downloadDxfFile()','INSERT','text'];_0x5629=function(){return _0x30ef16;};return _0x5629();}(function(_0x383dbc,_0x5e43ea){const _0x454aa4=_0x4940,_0x556b29=_0x383dbc();while(!![]){try{const _0x7ba6cf=parseInt(_0x454aa4(0x1df))/0x1*(parseInt(_0x454aa4(0x1fe))/0x2)+-parseInt(_0x454aa4(0x1b5))/0x3*(-parseInt(_0x454aa4(0x22f))/0x4)+parseInt(_0x454aa4(0x23c))/0x5*(-parseInt(_0x454aa4(0x287))/0x6)+parseInt(_0x454aa4(0x226))/0x7*(parseInt(_0x454aa4(0x18e))/0x8)+parseInt(_0x454aa4(0x24f))/0x9*(-parseInt(_0x454aa4(0x250))/0xa)+parseInt(_0x454aa4(0x25f))/0xb*(-parseInt(_0x454aa4(0x27f))/0xc)+parseInt(_0x454aa4(0x279))/0xd*(parseInt(_0x454aa4(0x26d))/0xe);if(_0x7ba6cf===_0x5e43ea)break;else _0x556b29['push'](_0x556b29['shift']());}catch(_0x4d0f1c){_0x556b29['push'](_0x556b29['shift']());}}}(_0x5629,0xb193e));function pair(_0x3e2592,_0x431c42){if(_0x431c42===undefined||_0x431c42===null)return '';return '\x20\x20'+_0x3e2592+'\x0a'+_0x431c42+'\x0a';}function pairF(_0x2cd20f,_0x2db0be){if(_0x2db0be===undefined||_0x2db0be===null)return '';return pair(_0x2cd20f,formatFloat(_0x2db0be));}function formatFloat(_0x41a35c){const _0x394418=_0x4940;if(typeof _0x41a35c!==_0x394418(0x1ae)||isNaN(_0x41a35c))return _0x394418(0x220);let _0x4ad026=_0x41a35c[_0x394418(0x177)](0x6);_0x4ad026=_0x4ad026[_0x394418(0x26a)](/(\.\d*?)0+$/,'$1');if(_0x4ad026[_0x394418(0x200)]('.'))_0x4ad026+='0';return _0x4ad026;}function pairI(_0x5150eb,_0x2f9ac0){const _0x9204ed=_0x4940;if(_0x2f9ac0===undefined||_0x2f9ac0===null)return '';return pair(_0x5150eb,Math[_0x9204ed(0x255)](_0x2f9ac0));}function writePoint3D(_0xd496c6,_0x2eef6c){if(!_0x2eef6c)return '';return pairF(_0xd496c6,_0x2eef6c['x'])+pairF(_0xd496c6+0xa,_0x2eef6c['y'])+pairF(_0xd496c6+0x14,_0x2eef6c['z']);}function writePoint2D(_0x4c2af3,_0x5ad68d){if(!_0x5ad68d)return '';return pairF(_0x4c2af3,_0x5ad68d['x'])+pairF(_0x4c2af3+0xa,_0x5ad68d['y']);}function writeExtrusion(_0x2a567b){if(!_0x2a567b)return '';if(_0x2a567b['x']===0x0&&_0x2a567b['y']===0x0&&_0x2a567b['z']===0x1)return '';return pairF(0xd2,_0x2a567b['x'])+pairF(0xdc,_0x2a567b['y'])+pairF(0xe6,_0x2a567b['z']);}function writeHeader(_0x3291c8){const _0x19b5fc=_0x4940;if(!_0x3291c8||Object[_0x19b5fc(0x22b)](_0x3291c8)[_0x19b5fc(0x1ec)]===0x0)return '';let _0xdbbb91=pair(0x0,_0x19b5fc(0x1d6))+pair(0x2,_0x19b5fc(0x221));for(const [_0x5eefc6,_0x487511]of Object[_0x19b5fc(0x1ca)](_0x3291c8)){_0xdbbb91+=pair(0x9,_0x5eefc6);if(typeof _0x487511===_0x19b5fc(0x223)&&_0x487511!==null&&!Array[_0x19b5fc(0x17b)](_0x487511))for(const [_0x186381,_0x17377f]of Object[_0x19b5fc(0x1ca)](_0x487511)){_0xdbbb91+=pair(parseInt(_0x186381),_0x17377f);}else _0xdbbb91+=pair(0x1,_0x487511);}return _0xdbbb91+=pair(0x0,_0x19b5fc(0x235)),_0xdbbb91;}function writeClasses(_0x1403d1){const _0xf38a50=_0x4940;if(!_0x1403d1||_0x1403d1['length']===0x0)return '';let _0x406962=pair(0x0,'SECTION')+pair(0x2,_0xf38a50(0x266));for(const _0x2ff060 of _0x1403d1){_0x406962+=pair(0x0,_0xf38a50(0x1bf));if(_0x2ff060[_0xf38a50(0x193)])_0x406962+=pair(0x1,_0x2ff060[_0xf38a50(0x193)]);if(_0x2ff060[_0xf38a50(0x20f)])_0x406962+=pair(0x2,_0x2ff060['cppClassName']);if(_0x2ff060[_0xf38a50(0x257)])_0x406962+=pair(0x3,_0x2ff060[_0xf38a50(0x257)]);if(_0x2ff060[_0xf38a50(0x1c8)]!==undefined)_0x406962+=pairI(0x5a,_0x2ff060['proxyCapabilities']);if(_0x2ff060[_0xf38a50(0x1d5)]!==undefined)_0x406962+=pairI(0x5b,_0x2ff060['instanceCount']);if(_0x2ff060[_0xf38a50(0x17f)]!==undefined)_0x406962+=pairI(0x118,_0x2ff060[_0xf38a50(0x17f)]);if(_0x2ff060[_0xf38a50(0x194)]!==undefined)_0x406962+=pairI(0x119,_0x2ff060['isEntity']);}return _0x406962+=pair(0x0,_0xf38a50(0x235)),_0x406962;}function writeTables(_0x468e0b){const _0x21df97=_0x4940;if(!_0x468e0b||Object[_0x21df97(0x22b)](_0x468e0b)[_0x21df97(0x1ec)]===0x0)return '';let _0x1a1457=pair(0x0,'SECTION')+pair(0x2,_0x21df97(0x216));for(const [_0x472ba9,_0x117e44]of Object[_0x21df97(0x1ca)](_0x468e0b)){_0x1a1457+=pair(0x0,_0x21df97(0x1d7)),_0x1a1457+=pair(0x2,_0x472ba9);if(_0x117e44[_0x21df97(0x1ec)]>0x0){const _0x12f752=_0x117e44[0x0];if(_0x12f752['handle'])_0x1a1457+=pair(0x5,_0x12f752[_0x21df97(0x174)]);if(_0x12f752['ownerHandle'])_0x1a1457+=pair(0x14a,_0x12f752[_0x21df97(0x1cc)]);_0x1a1457+=pair(0x64,'AcDbSymbolTable'),_0x1a1457+=pairI(0x46,_0x117e44['length']);}for(const _0xc4f91e of _0x117e44){_0x1a1457+=pair(0x0,_0xc4f91e['_type']||_0x472ba9);if(_0xc4f91e[_0x21df97(0x174)])_0x1a1457+=pair(0x5,_0xc4f91e['handle']);if(_0xc4f91e['ownerHandle'])_0x1a1457+=pair(0x14a,_0xc4f91e[_0x21df97(0x1cc)]);if(_0xc4f91e[_0x21df97(0x182)]){const _0x39d551=[]['concat'](_0xc4f91e[_0x21df97(0x182)]);for(const _0x50ac94 of _0x39d551){_0x1a1457+=pair(0x64,_0x50ac94);}}if(_0xc4f91e['name'])_0x1a1457+=pair(0x2,_0xc4f91e[_0x21df97(0x18b)]);if(_0xc4f91e[_0x21df97(0x19e)]!==undefined)_0x1a1457+=pairI(0x46,_0xc4f91e[_0x21df97(0x19e)]);if(_0xc4f91e[_0x21df97(0x180)]!==undefined)_0x1a1457+=pairI(0x3e,_0xc4f91e['colorNumber']);if(_0xc4f91e[_0x21df97(0x19b)])_0x1a1457+=pair(0x6,_0xc4f91e[_0x21df97(0x19b)]);if(_0xc4f91e[_0x21df97(0x19a)])_0x1a1457+=pair(0x7,_0xc4f91e[_0x21df97(0x19a)]);if(_0xc4f91e['height'])_0x1a1457+=pairF(0x28,_0xc4f91e[_0x21df97(0x22c)]);if(_0xc4f91e[_0x21df97(0x209)])_0x1a1457+=pairF(0x29,_0xc4f91e['widthFactor']);if(_0xc4f91e['angle'])_0x1a1457+=pairF(0x32,_0xc4f91e[_0x21df97(0x20e)]);if(_0xc4f91e['lineweight']!==undefined)_0x1a1457+=pairI(0x172,_0xc4f91e['lineweight']);if(_0xc4f91e[_0x21df97(0x218)])_0x1a1457+=pair(0x186,_0xc4f91e[_0x21df97(0x218)]);if(_0xc4f91e[_0x21df97(0x21e)])for(const [_0x5a317c,_0x15aa34]of Object[_0x21df97(0x1ca)](_0xc4f91e)){if(_0x5a317c[_0x21df97(0x1b1)](_0x21df97(0x1be))){const _0x313273=parseInt(_0x5a317c['replace'](_0x21df97(0x1be),'')),_0x40dab3=[][_0x21df97(0x22a)](_0x15aa34);for(const _0x43d33f of _0x40dab3){_0x1a1457+=pair(_0x313273,_0x43d33f);}}}}_0x1a1457+=pair(0x0,_0x21df97(0x1b9));}return _0x1a1457+=pair(0x0,_0x21df97(0x235)),_0x1a1457;}function writeBlocks(_0x5cee94){const _0x551077=_0x4940;if(!_0x5cee94||_0x5cee94[_0x551077(0x1ec)]===0x0)return '';let _0x158c68=pair(0x0,_0x551077(0x1d6))+pair(0x2,'BLOCKS');for(const _0x1b58b9 of _0x5cee94){_0x158c68+=pair(0x0,_0x551077(0x23e));if(_0x1b58b9[_0x551077(0x174)])_0x158c68+=pair(0x5,_0x1b58b9[_0x551077(0x174)]);if(_0x1b58b9[_0x551077(0x1cc)])_0x158c68+=pair(0x14a,_0x1b58b9['ownerHandle']);_0x158c68+=pair(0x64,_0x551077(0x23f));if(_0x1b58b9[_0x551077(0x24c)])_0x158c68+=pair(0x8,_0x1b58b9['layer']);_0x158c68+=pair(0x64,_0x551077(0x1ee));if(_0x1b58b9[_0x551077(0x18b)])_0x158c68+=pair(0x2,_0x1b58b9[_0x551077(0x18b)]);if(_0x1b58b9['flags']!==undefined)_0x158c68+=pairI(0x46,_0x1b58b9[_0x551077(0x19e)]);_0x158c68+=pairF(0xa,_0x1b58b9[_0x551077(0x18f)]||_0x1b58b9[_0x551077(0x1a4)]&&_0x1b58b9['basePoint']['x']||0x0),_0x158c68+=pairF(0x14,_0x1b58b9[_0x551077(0x259)]||_0x1b58b9[_0x551077(0x1a4)]&&_0x1b58b9['basePoint']['y']||0x0),_0x158c68+=pairF(0x1e,_0x1b58b9[_0x551077(0x187)]||_0x1b58b9[_0x551077(0x1a4)]&&_0x1b58b9[_0x551077(0x1a4)]['z']||0x0);if(_0x1b58b9[_0x551077(0x188)]||_0x1b58b9['name'])_0x158c68+=pair(0x3,_0x1b58b9[_0x551077(0x188)]||_0x1b58b9[_0x551077(0x18b)]);_0x1b58b9['entities']&&_0x1b58b9[_0x551077(0x191)][_0x551077(0x1ec)]>0x0&&(_0x158c68+=writeEntityList(_0x1b58b9[_0x551077(0x191)]));_0x158c68+=pair(0x0,_0x551077(0x1db));if(_0x1b58b9[_0x551077(0x174)])_0x158c68+=pair(0x5,_0x1b58b9[_0x551077(0x174)]);if(_0x1b58b9['ownerHandle'])_0x158c68+=pair(0x14a,_0x1b58b9[_0x551077(0x1cc)]);_0x158c68+=pair(0x64,_0x551077(0x23f));if(_0x1b58b9['layer'])_0x158c68+=pair(0x8,_0x1b58b9[_0x551077(0x24c)]);_0x158c68+=pair(0x64,'AcDbBlockEnd');}return _0x158c68+=pair(0x0,'ENDSEC'),_0x158c68;}function writeEntityList(_0x46a69e){let _0x40cf27='';for(const _0x2ab39c of _0x46a69e){_0x40cf27+=writeOneEntity(_0x2ab39c);}return _0x40cf27;}function writeEntitiesSection(_0x58a467){const _0x4c4b51=_0x4940;if(!_0x58a467||_0x58a467[_0x4c4b51(0x1ec)]===0x0)return '';let _0x340651=pair(0x0,_0x4c4b51(0x1d6))+pair(0x2,'ENTITIES');return _0x340651+=writeEntityList(_0x58a467),_0x340651+=pair(0x0,_0x4c4b51(0x235)),_0x340651;}function writeCommonFields(_0x2fb9df){const _0x42a2e0=_0x4940;let _0x509f59='';if(_0x2fb9df[_0x42a2e0(0x174)])_0x509f59+=pair(0x5,_0x2fb9df[_0x42a2e0(0x174)]);if(_0x2fb9df[_0x42a2e0(0x1cc)])_0x509f59+=pair(0x14a,_0x2fb9df[_0x42a2e0(0x1cc)]);_0x509f59+=pair(0x64,_0x42a2e0(0x23f));if(_0x2fb9df[_0x42a2e0(0x1f7)])_0x509f59+=pairI(0x43,0x1);if(_0x2fb9df[_0x42a2e0(0x24c)])_0x509f59+=pair(0x8,_0x2fb9df[_0x42a2e0(0x24c)]);if(_0x2fb9df['linetypeName'])_0x509f59+=pair(0x6,_0x2fb9df[_0x42a2e0(0x19b)]);if(_0x2fb9df['colorNumber']!==undefined&&_0x2fb9df['colorNumber']!==0x0)_0x509f59+=pairI(0x3e,_0x2fb9df[_0x42a2e0(0x180)]);if(_0x2fb9df[_0x42a2e0(0x199)]!==undefined)_0x509f59+=pairI(0x172,_0x2fb9df['lineweight']);if(_0x2fb9df[_0x42a2e0(0x203)]!==undefined&&_0x2fb9df[_0x42a2e0(0x203)]!==0x1)_0x509f59+=pairF(0x30,_0x2fb9df[_0x42a2e0(0x203)]);if(_0x2fb9df[_0x42a2e0(0x258)]===![])_0x509f59+=pairI(0x3c,0x1);if(_0x2fb9df['trueColor'])_0x509f59+=pairI(0x1a4,_0x2fb9df[_0x42a2e0(0x274)]);return _0x509f59;}function writeOneEntity(_0x3fe80d){const _0x218b33=_0x4940;if(!_0x3fe80d||!_0x3fe80d['type'])return '';let _0x253638=pair(0x0,_0x3fe80d['type']);_0x253638+=writeCommonFields(_0x3fe80d);switch(_0x3fe80d[_0x218b33(0x1ed)]){case _0x218b33(0x252):_0x253638+=writeLineEntity(_0x3fe80d);break;case _0x218b33(0x1f2):_0x253638+=writeLWPolylineEntity(_0x3fe80d);break;case _0x218b33(0x234):_0x253638+=writePolylineEntity(_0x3fe80d);break;case _0x218b33(0x190):_0x253638+=writeArcEntity(_0x3fe80d);break;case 'CIRCLE':_0x253638+=writeCircleEntity(_0x3fe80d);break;case _0x218b33(0x1eb):_0x253638+=writeEllipseEntity(_0x3fe80d);break;case _0x218b33(0x1bc):_0x253638+=writePointEntity(_0x3fe80d);break;case _0x218b33(0x1aa):_0x253638+=writeTextEntity(_0x3fe80d);break;case _0x218b33(0x222):_0x253638+=writeMTextEntity(_0x3fe80d);break;case 'ATTRIB':case _0x218b33(0x1a3):_0x253638+=writeAttribEntity(_0x3fe80d);break;case _0x218b33(0x1ce):_0x253638+=writeInsertEntity(_0x3fe80d);break;case _0x218b33(0x219):_0x253638+=writeDimensionEntity(_0x3fe80d);break;case 'LEADER':_0x253638+=writeLeaderEntity(_0x3fe80d);break;case 'MLEADER':_0x253638+=writeMLeaderEntity(_0x3fe80d);break;case 'HATCH':_0x253638+=writeHatchEntity(_0x3fe80d);break;case _0x218b33(0x1d4):_0x253638+=writeSplineEntity(_0x3fe80d);break;case _0x218b33(0x198):case '3DSOLID':case _0x218b33(0x26b):_0x253638+=writeSolidEntity(_0x3fe80d);break;case '3DFACE':_0x253638+=write3DFaceEntity(_0x3fe80d);break;case 'RAY':case _0x218b33(0x1c6):_0x253638+=writeRayEntity(_0x3fe80d);break;case _0x218b33(0x269):_0x253638+=writeViewportEntity(_0x3fe80d);break;case _0x218b33(0x1d9):case _0x218b33(0x27d):_0x253638+=writeImageEntity(_0x3fe80d);break;case _0x218b33(0x186):_0x253638+=writeToleranceEntity(_0x3fe80d);break;case _0x218b33(0x1b3):_0x253638+=writeHelixEntity(_0x3fe80d);break;case 'MESH':_0x253638+=writeMeshEntity(_0x3fe80d);break;case 'REGION':case 'BODY':case 'SURFACE':_0x253638+=writeRegionEntity(_0x3fe80d);break;case _0x218b33(0x272):_0x253638+=writeOle2Entity(_0x3fe80d);break;case _0x218b33(0x1d7):_0x253638+=writeTableEntity(_0x3fe80d);break;case _0x218b33(0x1a1):_0x253638+=writeMLineEntity(_0x3fe80d);break;case _0x218b33(0x1a5):break;default:_0x253638+=writeGenericEntity(_0x3fe80d);break;}return _0x253638;}function writeLineEntity(_0x302b9c){const _0xd495ab=_0x4940;let _0x27c0ac=pair(0x64,'AcDbLine');if(_0x302b9c[_0xd495ab(0x1c1)])_0x27c0ac+=pairF(0x27,_0x302b9c[_0xd495ab(0x1c1)]);return _0x27c0ac+=writePoint3D(0xa,_0x302b9c[_0xd495ab(0x1fb)]),_0x27c0ac+=writePoint3D(0xb,_0x302b9c[_0xd495ab(0x28b)]),_0x27c0ac+=writeExtrusion(_0x302b9c[_0xd495ab(0x1d0)]),_0x27c0ac;}function writeLWPolylineEntity(_0x3b49ea){const _0x1ab313=_0x4940;let _0x312695=pair(0x64,_0x1ab313(0x1b2));const _0x560a99=_0x3b49ea['vertices']||[];_0x312695+=pairI(0x5a,_0x560a99[_0x1ab313(0x1ec)]);let _0x5b9df4=0x0;if(_0x3b49ea[_0x1ab313(0x1e3)])_0x5b9df4|=0x1;_0x312695+=pairI(0x46,_0x5b9df4);if(_0x3b49ea[_0x1ab313(0x21c)])_0x312695+=pairF(0x2b,_0x3b49ea['constantWidth']);if(_0x3b49ea['elevation'])_0x312695+=pairF(0x26,_0x3b49ea[_0x1ab313(0x1e2)]);if(_0x3b49ea['thickness'])_0x312695+=pairF(0x27,_0x3b49ea['thickness']);for(const _0x1dff97 of _0x560a99){_0x312695+=pairF(0xa,_0x1dff97['x']),_0x312695+=pairF(0x14,_0x1dff97['y']);if(_0x1dff97[_0x1ab313(0x1a8)])_0x312695+=pairF(0x28,_0x1dff97['startWidth']);if(_0x1dff97[_0x1ab313(0x289)])_0x312695+=pairF(0x29,_0x1dff97['endWidth']);if(_0x1dff97[_0x1ab313(0x18a)])_0x312695+=pairF(0x2a,_0x1dff97[_0x1ab313(0x18a)]);}return _0x312695+=writeExtrusion(_0x3b49ea[_0x1ab313(0x1d0)]),_0x312695;}function writePolylineEntity(_0xd30fd0){const _0x44c5d9=_0x4940;let _0x52a2c2=pair(0x64,'AcDb2dPolyline'),_0x22b8cf=_0xd30fd0['flags']||0x0;if(_0xd30fd0['closed'])_0x22b8cf|=0x1;_0x52a2c2+=pairI(0x46,_0x22b8cf),_0x52a2c2+=pairF(0xa,0x0),_0x52a2c2+=pairF(0x14,0x0);if(_0xd30fd0[_0x44c5d9(0x1e2)])_0x52a2c2+=pairF(0x1e,_0xd30fd0['elevation']);if(_0xd30fd0[_0x44c5d9(0x1c1)])_0x52a2c2+=pairF(0x27,_0xd30fd0[_0x44c5d9(0x1c1)]);if(_0xd30fd0['defaultStartWidth'])_0x52a2c2+=pairF(0x28,_0xd30fd0[_0x44c5d9(0x1e7)]);if(_0xd30fd0[_0x44c5d9(0x215)])_0x52a2c2+=pairF(0x29,_0xd30fd0[_0x44c5d9(0x215)]);if(_0xd30fd0[_0x44c5d9(0x1ef)])_0x52a2c2+=pairI(0x47,_0xd30fd0[_0x44c5d9(0x1ef)]);if(_0xd30fd0[_0x44c5d9(0x254)])_0x52a2c2+=pairI(0x48,_0xd30fd0[_0x44c5d9(0x254)]);_0x52a2c2+=writeExtrusion(_0xd30fd0[_0x44c5d9(0x1d0)]);if(_0xd30fd0['vertices']&&_0xd30fd0[_0x44c5d9(0x253)]['length']>0x0){for(const _0x1bcdda of _0xd30fd0[_0x44c5d9(0x253)]){_0x52a2c2+=pair(0x0,_0x44c5d9(0x1f8));if(_0xd30fd0[_0x44c5d9(0x174)])_0x52a2c2+=pair(0x5,'');_0x52a2c2+=pair(0x64,_0x44c5d9(0x23f));if(_0xd30fd0[_0x44c5d9(0x24c)])_0x52a2c2+=pair(0x8,_0xd30fd0[_0x44c5d9(0x24c)]);_0x52a2c2+=pair(0x64,_0x44c5d9(0x231)),_0x52a2c2+=pair(0x64,_0x44c5d9(0x1d2)),_0x52a2c2+=pairF(0xa,_0x1bcdda['x']),_0x52a2c2+=pairF(0x14,_0x1bcdda['y']),_0x52a2c2+=pairF(0x1e,_0x1bcdda['z']||0x0);if(_0x1bcdda[_0x44c5d9(0x1a8)])_0x52a2c2+=pairF(0x28,_0x1bcdda['startWidth']);if(_0x1bcdda[_0x44c5d9(0x289)])_0x52a2c2+=pairF(0x29,_0x1bcdda[_0x44c5d9(0x289)]);if(_0x1bcdda[_0x44c5d9(0x18a)])_0x52a2c2+=pairF(0x2a,_0x1bcdda['bulge']);if(_0x1bcdda[_0x44c5d9(0x19e)])_0x52a2c2+=pairI(0x46,_0x1bcdda[_0x44c5d9(0x19e)]);}_0x52a2c2+=pair(0x0,_0x44c5d9(0x1a5)),_0x52a2c2+=pair(0x64,_0x44c5d9(0x23f));if(_0xd30fd0[_0x44c5d9(0x24c)])_0x52a2c2+=pair(0x8,_0xd30fd0['layer']);}return _0x52a2c2;}function writeArcEntity(_0x2a17f1){const _0x4903f3=_0x4940;let _0x234ead=pair(0x64,'AcDbCircle');if(_0x2a17f1[_0x4903f3(0x1c1)])_0x234ead+=pairF(0x27,_0x2a17f1[_0x4903f3(0x1c1)]);return _0x234ead+=writePoint3D(0xa,_0x2a17f1['center']),_0x234ead+=pairF(0x28,_0x2a17f1[_0x4903f3(0x227)]),_0x234ead+=writeExtrusion(_0x2a17f1[_0x4903f3(0x1d0)]),_0x234ead+=pair(0x64,_0x4903f3(0x25b)),_0x234ead+=pairF(0x32,_0x2a17f1[_0x4903f3(0x247)]),_0x234ead+=pairF(0x33,_0x2a17f1[_0x4903f3(0x201)]),_0x234ead;}function writeCircleEntity(_0x182320){const _0x89a92=_0x4940;let _0x3e1d4a=pair(0x64,_0x89a92(0x173));if(_0x182320[_0x89a92(0x1c1)])_0x3e1d4a+=pairF(0x27,_0x182320[_0x89a92(0x1c1)]);return _0x3e1d4a+=writePoint3D(0xa,_0x182320[_0x89a92(0x1cb)]),_0x3e1d4a+=pairF(0x28,_0x182320[_0x89a92(0x227)]),_0x3e1d4a+=writeExtrusion(_0x182320[_0x89a92(0x1d0)]),_0x3e1d4a;}function writeEllipseEntity(_0x12dd81){const _0x507d84=_0x4940;let _0x2e12cd=pair(0x64,_0x507d84(0x251));return _0x2e12cd+=writePoint3D(0xa,_0x12dd81[_0x507d84(0x1cb)]),_0x2e12cd+=writePoint3D(0xb,_0x12dd81[_0x507d84(0x208)]),_0x2e12cd+=writeExtrusion(_0x12dd81['extrusionDirection']),_0x2e12cd+=pairF(0x28,_0x12dd81[_0x507d84(0x1bb)]),_0x2e12cd+=pairF(0x29,_0x12dd81[_0x507d84(0x247)]),_0x2e12cd+=pairF(0x2a,_0x12dd81['endAngle']),_0x2e12cd;}function writePointEntity(_0x628bbc){const _0x361158=_0x4940;let _0x50e2ed=pair(0x64,_0x361158(0x244));_0x50e2ed+=writePoint3D(0xa,_0x628bbc[_0x361158(0x1c9)]);if(_0x628bbc['thickness'])_0x50e2ed+=pairF(0x27,_0x628bbc[_0x361158(0x1c1)]);if(_0x628bbc[_0x361158(0x20e)])_0x50e2ed+=pairF(0x32,_0x628bbc[_0x361158(0x20e)]);return _0x50e2ed+=writeExtrusion(_0x628bbc[_0x361158(0x1d0)]),_0x50e2ed;}function writeTextEntity(_0x2a8c3e){const _0x4bdd31=_0x4940;let _0x24ee08=pair(0x64,'AcDbText');if(_0x2a8c3e[_0x4bdd31(0x1c1)])_0x24ee08+=pairF(0x27,_0x2a8c3e[_0x4bdd31(0x1c1)]);_0x24ee08+=writePoint3D(0xa,_0x2a8c3e['insertionPoint']),_0x24ee08+=pairF(0x28,_0x2a8c3e['height']),_0x24ee08+=pair(0x1,_0x2a8c3e[_0x4bdd31(0x1cf)]);if(_0x2a8c3e[_0x4bdd31(0x233)])_0x24ee08+=pairF(0x32,_0x2a8c3e[_0x4bdd31(0x233)]);if(_0x2a8c3e[_0x4bdd31(0x246)]&&_0x2a8c3e[_0x4bdd31(0x246)]!==0x1)_0x24ee08+=pairF(0x29,_0x2a8c3e[_0x4bdd31(0x246)]);if(_0x2a8c3e[_0x4bdd31(0x261)])_0x24ee08+=pairF(0x33,_0x2a8c3e[_0x4bdd31(0x261)]);if(_0x2a8c3e[_0x4bdd31(0x19a)]&&_0x2a8c3e[_0x4bdd31(0x19a)]!=='STANDARD')_0x24ee08+=pair(0x7,_0x2a8c3e[_0x4bdd31(0x19a)]);if(_0x2a8c3e[_0x4bdd31(0x1f4)])_0x24ee08+=pairI(0x47,_0x2a8c3e[_0x4bdd31(0x1f4)]);if(_0x2a8c3e[_0x4bdd31(0x21f)])_0x24ee08+=pairI(0x48,_0x2a8c3e['hAlign']);_0x24ee08+=writePoint3D(0xb,_0x2a8c3e[_0x4bdd31(0x1da)]),_0x24ee08+=writeExtrusion(_0x2a8c3e[_0x4bdd31(0x1d0)]),_0x24ee08+=pair(0x64,_0x4bdd31(0x1c4));if(_0x2a8c3e['vAlign'])_0x24ee08+=pairI(0x49,_0x2a8c3e['vAlign']);return _0x24ee08;}function writeMTextEntity(_0x1274a8){const _0x5036d2=_0x4940;let _0x4dde49=pair(0x64,_0x5036d2(0x21b));_0x4dde49+=writePoint3D(0xa,_0x1274a8['insertionPoint']),_0x4dde49+=pairF(0x28,_0x1274a8[_0x5036d2(0x22c)]);if(_0x1274a8[_0x5036d2(0x24e)])_0x4dde49+=pairF(0x29,_0x1274a8['width']);if(_0x1274a8[_0x5036d2(0x271)])_0x4dde49+=pairI(0x47,_0x1274a8[_0x5036d2(0x271)]);if(_0x1274a8['drawingDirection'])_0x4dde49+=pairI(0x48,_0x1274a8[_0x5036d2(0x1f3)]);const _0x4407d6=_0x1274a8[_0x5036d2(0x1cf)]||'';if(_0x4407d6[_0x5036d2(0x1ec)]>0xfa){let _0x1fddab=_0x4407d6;while(_0x1fddab['length']>0xfa){_0x4dde49+=pair(0x3,_0x1fddab[_0x5036d2(0x249)](0x0,0xfa)),_0x1fddab=_0x1fddab[_0x5036d2(0x249)](0xfa);}_0x4dde49+=pair(0x1,_0x1fddab);}else _0x4dde49+=pair(0x1,_0x4407d6);if(_0x1274a8['styleName']&&_0x1274a8[_0x5036d2(0x19a)]!==_0x5036d2(0x28e))_0x4dde49+=pair(0x7,_0x1274a8[_0x5036d2(0x19a)]);if(_0x1274a8[_0x5036d2(0x233)])_0x4dde49+=pairF(0x32,_0x1274a8[_0x5036d2(0x233)]);if(_0x1274a8[_0x5036d2(0x178)])_0x4dde49+=pairI(0x49,_0x1274a8['lineSpacingStyle']);if(_0x1274a8[_0x5036d2(0x228)]&&_0x1274a8['lineSpacing']!==0x1)_0x4dde49+=pairF(0x2c,_0x1274a8[_0x5036d2(0x228)]);return _0x4dde49+=writePoint3D(0xb,_0x1274a8[_0x5036d2(0x1fc)]),_0x4dde49+=writeExtrusion(_0x1274a8[_0x5036d2(0x1d0)]),_0x4dde49;}function writeAttribEntity(_0x194072){const _0x6ca16d=_0x4940,_0x30cf71=_0x194072['type']==='ATTDEF';let _0x28f3e4=pair(0x64,_0x30cf71?'AcDbAttributeDefinition':_0x6ca16d(0x17a));_0x28f3e4+=writePoint3D(0xa,_0x194072['insertionPoint']),_0x28f3e4+=pairF(0x28,_0x194072[_0x6ca16d(0x22c)]),_0x28f3e4+=pair(0x1,_0x194072[_0x6ca16d(0x1cf)]);if(_0x194072['tag'])_0x28f3e4+=pair(0x2,_0x194072['tag']);if(_0x194072['prompt'])_0x28f3e4+=pair(0x3,_0x194072[_0x6ca16d(0x19d)]);if(_0x194072['flags'])_0x28f3e4+=pairI(0x46,_0x194072[_0x6ca16d(0x19e)]);if(_0x194072['rotation'])_0x28f3e4+=pairF(0x32,_0x194072[_0x6ca16d(0x233)]);if(_0x194072[_0x6ca16d(0x246)]&&_0x194072['xScale']!==0x1)_0x28f3e4+=pairF(0x29,_0x194072[_0x6ca16d(0x246)]);if(_0x194072[_0x6ca16d(0x19a)]&&_0x194072[_0x6ca16d(0x19a)]!==_0x6ca16d(0x28e))_0x28f3e4+=pair(0x7,_0x194072['styleName']);if(_0x194072[_0x6ca16d(0x1f4)])_0x28f3e4+=pairI(0x47,_0x194072[_0x6ca16d(0x1f4)]);if(_0x194072[_0x6ca16d(0x21f)])_0x28f3e4+=pairI(0x48,_0x194072[_0x6ca16d(0x21f)]);if(_0x194072[_0x6ca16d(0x26c)])_0x28f3e4+=pairI(0x49,_0x194072[_0x6ca16d(0x26c)]);return _0x28f3e4+=writePoint3D(0xb,_0x194072[_0x6ca16d(0x1da)]),_0x28f3e4;}function writeInsertEntity(_0x355ce7){const _0x5c27aa=_0x4940;let _0x1c852f=pair(0x64,'AcDbBlockReference');if(_0x355ce7[_0x5c27aa(0x225)])_0x1c852f+=pairI(0x42,0x1);_0x1c852f+=pair(0x2,_0x355ce7[_0x5c27aa(0x202)]),_0x1c852f+=writePoint3D(0xa,_0x355ce7[_0x5c27aa(0x23b)]);if(_0x355ce7[_0x5c27aa(0x1fa)]){if(_0x355ce7[_0x5c27aa(0x1fa)]['x']!==0x1)_0x1c852f+=pairF(0x29,_0x355ce7[_0x5c27aa(0x1fa)]['x']);if(_0x355ce7[_0x5c27aa(0x1fa)]['y']!==0x1)_0x1c852f+=pairF(0x2a,_0x355ce7[_0x5c27aa(0x1fa)]['y']);if(_0x355ce7[_0x5c27aa(0x1fa)]['z']!==0x1)_0x1c852f+=pairF(0x2b,_0x355ce7['scale']['z']);}if(_0x355ce7[_0x5c27aa(0x233)])_0x1c852f+=pairF(0x32,_0x355ce7[_0x5c27aa(0x233)]);if(_0x355ce7['columnCount']&&_0x355ce7[_0x5c27aa(0x240)]!==0x1)_0x1c852f+=pairI(0x46,_0x355ce7[_0x5c27aa(0x240)]);if(_0x355ce7[_0x5c27aa(0x273)]&&_0x355ce7[_0x5c27aa(0x273)]!==0x1)_0x1c852f+=pairI(0x47,_0x355ce7['rowCount']);if(_0x355ce7[_0x5c27aa(0x1d8)])_0x1c852f+=pairF(0x2c,_0x355ce7[_0x5c27aa(0x1d8)]);if(_0x355ce7[_0x5c27aa(0x1ea)])_0x1c852f+=pairF(0x2d,_0x355ce7[_0x5c27aa(0x1ea)]);_0x1c852f+=writeExtrusion(_0x355ce7['extrusionDirection']);if(_0x355ce7[_0x5c27aa(0x19c)]&&_0x355ce7[_0x5c27aa(0x19c)][_0x5c27aa(0x1ec)]>0x0){for(const _0x116568 of _0x355ce7[_0x5c27aa(0x19c)]){_0x1c852f+=writeOneEntity(_0x116568);}_0x1c852f+=pair(0x0,_0x5c27aa(0x1a5)),_0x1c852f+=pair(0x64,_0x5c27aa(0x23f));if(_0x355ce7['layer'])_0x1c852f+=pair(0x8,_0x355ce7[_0x5c27aa(0x24c)]);}return _0x1c852f;}function writeDimensionEntity(_0x32fdcf){const _0x475e25=_0x4940;let _0x5b0d6f=pair(0x64,_0x475e25(0x24b));if(_0x32fdcf['blockName'])_0x5b0d6f+=pair(0x2,_0x32fdcf[_0x475e25(0x202)]);_0x5b0d6f+=writePoint3D(0xa,_0x32fdcf[_0x475e25(0x280)]),_0x5b0d6f+=writePoint3D(0xb,_0x32fdcf[_0x475e25(0x1f6)]);if(_0x32fdcf[_0x475e25(0x189)]!==undefined)_0x5b0d6f+=pairI(0x46,_0x32fdcf[_0x475e25(0x189)]);if(_0x32fdcf[_0x475e25(0x271)])_0x5b0d6f+=pairI(0x47,_0x32fdcf[_0x475e25(0x271)]);if(_0x32fdcf[_0x475e25(0x1cf)])_0x5b0d6f+=pair(0x1,_0x32fdcf[_0x475e25(0x1cf)]);if(_0x32fdcf[_0x475e25(0x19a)]&&_0x32fdcf[_0x475e25(0x19a)]!=='STANDARD')_0x5b0d6f+=pair(0x3,_0x32fdcf['styleName']);if(_0x32fdcf[_0x475e25(0x233)])_0x5b0d6f+=pairF(0x32,_0x32fdcf[_0x475e25(0x233)]);const _0x2bedf5=(_0x32fdcf[_0x475e25(0x189)]||0x0)&0xf;switch(_0x2bedf5){case 0x0:case 0x1:_0x5b0d6f+=pair(0x64,_0x475e25(0x211)),_0x5b0d6f+=writePoint3D(0xd,_0x32fdcf['point1']),_0x5b0d6f+=writePoint3D(0xe,_0x32fdcf[_0x475e25(0x1fd)]);if(_0x32fdcf[_0x475e25(0x230)])_0x5b0d6f+=pairF(0x34,_0x32fdcf['extensionLineAngle']);_0x2bedf5===0x0&&(_0x5b0d6f+=pair(0x64,_0x475e25(0x17c)));break;case 0x2:_0x5b0d6f+=pair(0x64,_0x475e25(0x20d)),_0x5b0d6f+=writePoint3D(0xd,_0x32fdcf['point1']),_0x5b0d6f+=writePoint3D(0xe,_0x32fdcf[_0x475e25(0x1fd)]);if(_0x32fdcf[_0x475e25(0x1f1)])_0x5b0d6f+=writePoint3D(0xf,_0x32fdcf['point3']);break;case 0x3:case 0x4:_0x5b0d6f+=pair(0x64,_0x2bedf5===0x3?_0x475e25(0x179):'AcDbRadialDimension'),_0x5b0d6f+=writePoint3D(0xf,_0x32fdcf[_0x475e25(0x1f1)]||_0x32fdcf['point1']);if(_0x32fdcf[_0x475e25(0x1b7)])_0x5b0d6f+=pairF(0x28,_0x32fdcf['leaderLength']);break;case 0x5:_0x5b0d6f+=pair(0x64,_0x475e25(0x20d)),_0x5b0d6f+=writePoint3D(0xd,_0x32fdcf[_0x475e25(0x22d)]),_0x5b0d6f+=writePoint3D(0xe,_0x32fdcf[_0x475e25(0x1fd)]);if(_0x32fdcf[_0x475e25(0x1f1)])_0x5b0d6f+=writePoint3D(0xf,_0x32fdcf[_0x475e25(0x1f1)]);break;case 0x6:_0x5b0d6f+=pair(0x64,_0x475e25(0x1a0)),_0x5b0d6f+=writePoint3D(0xd,_0x32fdcf[_0x475e25(0x22d)]),_0x5b0d6f+=writePoint3D(0xe,_0x32fdcf[_0x475e25(0x1fd)]);break;default:_0x5b0d6f+=writePoint3D(0xd,_0x32fdcf[_0x475e25(0x22d)]),_0x5b0d6f+=writePoint3D(0xe,_0x32fdcf[_0x475e25(0x1fd)]);break;}return _0x5b0d6f;}function writeLeaderEntity(_0x49cce5){const _0x2016f8=_0x4940;let _0x4a1ae9=pair(0x64,_0x2016f8(0x288));if(_0x49cce5[_0x2016f8(0x19a)])_0x4a1ae9+=pair(0x3,_0x49cce5[_0x2016f8(0x19a)]);if(_0x49cce5[_0x2016f8(0x276)]!==undefined)_0x4a1ae9+=pairI(0x47,_0x49cce5['arrowheadFlag']);if(_0x49cce5[_0x2016f8(0x20a)]!==undefined)_0x4a1ae9+=pairI(0x48,_0x49cce5[_0x2016f8(0x20a)]);if(_0x49cce5[_0x2016f8(0x241)]!==undefined)_0x4a1ae9+=pairI(0x49,_0x49cce5[_0x2016f8(0x241)]);if(_0x49cce5[_0x2016f8(0x275)]!==undefined)_0x4a1ae9+=pairI(0x4a,_0x49cce5[_0x2016f8(0x275)]);if(_0x49cce5[_0x2016f8(0x25a)]!==undefined)_0x4a1ae9+=pairI(0x4b,_0x49cce5[_0x2016f8(0x25a)]);if(_0x49cce5[_0x2016f8(0x1a6)])_0x4a1ae9+=pairF(0x28,_0x49cce5['textHeight']);if(_0x49cce5[_0x2016f8(0x28a)])_0x4a1ae9+=pairF(0x29,_0x49cce5[_0x2016f8(0x28a)]);const _0x2c0d30=_0x49cce5[_0x2016f8(0x253)]||[];_0x4a1ae9+=pairI(0x4c,_0x2c0d30['length']);for(const _0x8b0392 of _0x2c0d30){_0x4a1ae9+=writePoint3D(0xa,_0x8b0392);}if(_0x49cce5[_0x2016f8(0x229)])_0x4a1ae9+=pair(0x154,_0x49cce5[_0x2016f8(0x229)]);return _0x49cce5[_0x2016f8(0x1b6)]&&(_0x4a1ae9+=pairF(0xd2,_0x49cce5[_0x2016f8(0x1b6)]['x']),_0x4a1ae9+=pairF(0xdc,_0x49cce5[_0x2016f8(0x1b6)]['y']),_0x4a1ae9+=pairF(0xe6,_0x49cce5[_0x2016f8(0x1b6)]['z'])),_0x49cce5[_0x2016f8(0x26f)]&&(_0x4a1ae9+=pairF(0xd3,_0x49cce5[_0x2016f8(0x26f)]['x']),_0x4a1ae9+=pairF(0xdd,_0x49cce5['horizontalDirection']['y']),_0x4a1ae9+=pairF(0xe7,_0x49cce5[_0x2016f8(0x26f)]['z'])),_0x4a1ae9;}function writeMLeaderEntity(_0x2a007a){const _0x57953b=_0x4940;let _0x56b72e=pair(0x64,_0x57953b(0x270));if(_0x2a007a[_0x57953b(0x19a)])_0x56b72e+=pair(0x3,_0x2a007a[_0x57953b(0x19a)]);if(_0x2a007a[_0x57953b(0x265)]!==undefined)_0x56b72e+=pairI(0xaa,_0x2a007a[_0x57953b(0x265)]);if(_0x2a007a['text'])_0x56b72e+=pair(0x130,_0x2a007a['text']);if(_0x2a007a[_0x57953b(0x1e1)])_0x56b72e+=pair(0x154,_0x2a007a[_0x57953b(0x1e1)]);if(_0x2a007a['doglegLength'])_0x56b72e+=pairF(0x28,_0x2a007a[_0x57953b(0x281)]);if(_0x2a007a[_0x57953b(0x1d3)])_0x56b72e+=pairF(0x29,_0x2a007a['arrowheadSize']);if(_0x2a007a[_0x57953b(0x1a6)])_0x56b72e+=pairF(0x2a,_0x2a007a[_0x57953b(0x1a6)]);if(_0x2a007a[_0x57953b(0x195)])for(const _0x3b4ba0 of _0x2a007a[_0x57953b(0x195)]){_0x56b72e+=writePoint3D(0xa,_0x3b4ba0);}return _0x56b72e;}function writeHatchEntity(_0x5b6421){const _0x3b818f=_0x4940;let _0x308ea9=pair(0x64,_0x3b818f(0x217));_0x308ea9+=pairF(0xa,0x0),_0x308ea9+=pairF(0x14,0x0),_0x308ea9+=pairF(0x1e,_0x5b6421[_0x3b818f(0x1e2)]||0x0),_0x308ea9+=writeExtrusion(_0x5b6421[_0x3b818f(0x1d0)]),_0x308ea9+=pair(0x2,_0x5b6421[_0x3b818f(0x248)]||''),_0x308ea9+=pairI(0x46,_0x5b6421[_0x3b818f(0x256)]?0x1:0x0),_0x308ea9+=pairI(0x47,_0x5b6421[_0x3b818f(0x1e5)]?0x1:0x0);const _0x5703d8=_0x5b6421['boundaryPaths']||[];_0x308ea9+=pairI(0x5b,_0x5703d8[_0x3b818f(0x1ec)]);for(const _0x7b356a of _0x5703d8){_0x308ea9+=pairI(0x5c,_0x7b356a[_0x3b818f(0x1ed)]||0x0);if(_0x7b356a[_0x3b818f(0x277)]&&_0x7b356a[_0x3b818f(0x277)]['length']>0x0){_0x308ea9+=pairI(0x5d,_0x7b356a['points'][_0x3b818f(0x1ec)]);for(const _0xb29cab of _0x7b356a[_0x3b818f(0x277)]){_0x308ea9+=pairF(0xa,_0xb29cab['x']),_0x308ea9+=pairF(0x14,_0xb29cab['y']||0x0);}}}_0x308ea9+=pairI(0x4b,_0x5b6421[_0x3b818f(0x1de)]||0x0),_0x308ea9+=pairI(0x4c,_0x5b6421[_0x3b818f(0x1b8)]||0x0);if(!_0x5b6421[_0x3b818f(0x256)]){if(_0x5b6421['patternAngle'])_0x308ea9+=pairF(0x34,_0x5b6421[_0x3b818f(0x185)]);if(_0x5b6421['patternScale'])_0x308ea9+=pairF(0x29,_0x5b6421['patternScale']);}const _0x4ceba8=_0x5b6421[_0x3b818f(0x197)]||[];_0x308ea9+=pairI(0x62,_0x4ceba8[_0x3b818f(0x1ec)]);for(const _0x8f2f34 of _0x4ceba8){_0x308ea9+=pairF(0xa,_0x8f2f34['x']),_0x308ea9+=pairF(0x14,_0x8f2f34['y']||0x0);}return _0x308ea9;}function writeSplineEntity(_0x38d1b4){const _0x238a11=_0x4940;let _0x545f44=pair(0x64,_0x238a11(0x172));_0x38d1b4[_0x238a11(0x1b6)]&&(_0x545f44+=pairF(0xd2,_0x38d1b4[_0x238a11(0x1b6)]['x']),_0x545f44+=pairF(0xdc,_0x38d1b4['normal']['y']),_0x545f44+=pairF(0xe6,_0x38d1b4['normal']['z']));let _0x46344f=_0x38d1b4['flags']||0x0;if(_0x38d1b4[_0x238a11(0x1e3)])_0x46344f|=0x1;if(_0x38d1b4[_0x238a11(0x260)])_0x46344f|=0x2;if(_0x38d1b4[_0x238a11(0x181)])_0x46344f|=0x4;if(_0x38d1b4[_0x238a11(0x263)])_0x46344f|=0x8;_0x545f44+=pairI(0x46,_0x46344f),_0x545f44+=pairI(0x47,_0x38d1b4[_0x238a11(0x1a7)]||0x3);const _0xbba1ac=_0x38d1b4[_0x238a11(0x1ba)]||[],_0x16cb99=_0x38d1b4[_0x238a11(0x175)]||[],_0x571f67=_0x38d1b4[_0x238a11(0x25c)]||[];_0x545f44+=pairI(0x48,_0xbba1ac[_0x238a11(0x1ec)]),_0x545f44+=pairI(0x49,_0x16cb99[_0x238a11(0x1ec)]),_0x545f44+=pairI(0x4a,_0x571f67[_0x238a11(0x1ec)]);if(_0x38d1b4[_0x238a11(0x1b4)])_0x545f44+=pairF(0x2a,_0x38d1b4[_0x238a11(0x1b4)]);if(_0x38d1b4[_0x238a11(0x24a)])_0x545f44+=pairF(0x2b,_0x38d1b4[_0x238a11(0x24a)]);if(_0x38d1b4[_0x238a11(0x20b)])_0x545f44+=pairF(0x2c,_0x38d1b4[_0x238a11(0x20b)]);if(_0x38d1b4['startTangent'])_0x545f44+=writePoint3D(0xc,_0x38d1b4['startTangent']);if(_0x38d1b4['endTangent'])_0x545f44+=writePoint3D(0xd,_0x38d1b4[_0x238a11(0x243)]);for(const _0x447cb1 of _0xbba1ac){_0x545f44+=pairF(0x28,_0x447cb1);}if(_0x38d1b4[_0x238a11(0x21d)])for(const _0x2f510e of _0x38d1b4[_0x238a11(0x21d)]){_0x545f44+=pairF(0x29,_0x2f510e);}for(const _0x2a8ddf of _0x16cb99){_0x545f44+=writePoint3D(0xa,_0x2a8ddf);}for(const _0x341054 of _0x571f67){_0x545f44+=writePoint3D(0xb,_0x341054);}return _0x545f44;}function writeSolidEntity(_0x2d72ea){const _0x34d5e0=_0x4940;let _0x297743=_0x34d5e0(0x212);if(_0x2d72ea[_0x34d5e0(0x1ed)]===_0x34d5e0(0x198))_0x297743='AcDbTrace';else {if(_0x2d72ea[_0x34d5e0(0x1ed)]==='3DSOLID')_0x297743=_0x34d5e0(0x20c);}let _0x5a07c9=pair(0x64,_0x297743);const _0x31fee1=_0x2d72ea[_0x34d5e0(0x277)]||[];if(_0x31fee1[0x0])_0x5a07c9+=writePoint3D(0xa,_0x31fee1[0x0]);if(_0x31fee1[0x1])_0x5a07c9+=writePoint3D(0xb,_0x31fee1[0x1]);if(_0x31fee1[0x2])_0x5a07c9+=writePoint3D(0xc,_0x31fee1[0x2]);if(_0x31fee1[0x3])_0x5a07c9+=writePoint3D(0xd,_0x31fee1[0x3]);if(_0x2d72ea['thickness'])_0x5a07c9+=pairF(0x27,_0x2d72ea[_0x34d5e0(0x1c1)]);return _0x5a07c9+=writeExtrusion(_0x2d72ea[_0x34d5e0(0x1d0)]),_0x5a07c9;}function write3DFaceEntity(_0x140a83){const _0x12a322=_0x4940;let _0x34167e=pair(0x64,_0x12a322(0x19f));const _0x11ab3f=_0x140a83[_0x12a322(0x253)]||[];if(_0x11ab3f[0x0])_0x34167e+=writePoint3D(0xa,_0x11ab3f[0x0]);if(_0x11ab3f[0x1])_0x34167e+=writePoint3D(0xb,_0x11ab3f[0x1]);if(_0x11ab3f[0x2])_0x34167e+=writePoint3D(0xc,_0x11ab3f[0x2]);if(_0x11ab3f[0x3])_0x34167e+=writePoint3D(0xd,_0x11ab3f[0x3]);if(_0x140a83[_0x12a322(0x1f0)])_0x34167e+=pairI(0x46,_0x140a83[_0x12a322(0x1f0)]);return _0x34167e;}function writeRayEntity(_0x158959){const _0x341608=_0x4940,_0xb042ec=_0x158959[_0x341608(0x1ed)]==='RAY'?_0x341608(0x262):_0x341608(0x268);let _0x196c55=pair(0x64,_0xb042ec);return _0x196c55+=writePoint3D(0xa,_0x158959[_0x341608(0x1a4)]),_0x196c55+=writePoint3D(0xb,_0x158959[_0x341608(0x1fc)]),_0x196c55;}function writeViewportEntity(_0x580223){const _0x23238c=_0x4940;let _0x4d1e6a=pair(0x64,'AcDbViewport');_0x4d1e6a+=writePoint3D(0xa,_0x580223['center']),_0x4d1e6a+=pairF(0x28,_0x580223[_0x23238c(0x24e)]),_0x4d1e6a+=pairF(0x29,_0x580223[_0x23238c(0x22c)]);if(_0x580223['id'])_0x4d1e6a+=pairI(0x45,_0x580223['id']);if(_0x580223[_0x23238c(0x27c)])_0x4d1e6a+=writePoint2D(0xc,_0x580223[_0x23238c(0x27c)]);if(_0x580223[_0x23238c(0x1c2)])_0x4d1e6a+=writePoint2D(0xd,_0x580223[_0x23238c(0x1c2)]);if(_0x580223['snapSpacing'])_0x4d1e6a+=writePoint2D(0xe,_0x580223[_0x23238c(0x24d)]);if(_0x580223[_0x23238c(0x1c5)])_0x4d1e6a+=writePoint2D(0xf,_0x580223[_0x23238c(0x1c5)]);_0x4d1e6a+=writePoint3D(0x10,_0x580223[_0x23238c(0x278)]),_0x4d1e6a+=writePoint3D(0x11,_0x580223[_0x23238c(0x17e)]);if(_0x580223[_0x23238c(0x1c3)])_0x4d1e6a+=pairF(0x2a,_0x580223[_0x23238c(0x1c3)]);if(_0x580223[_0x23238c(0x206)])_0x4d1e6a+=pairF(0x2b,_0x580223[_0x23238c(0x206)]);if(_0x580223[_0x23238c(0x27a)])_0x4d1e6a+=pairF(0x2c,_0x580223[_0x23238c(0x27a)]);if(_0x580223[_0x23238c(0x1c7)])_0x4d1e6a+=pairF(0x2d,_0x580223[_0x23238c(0x1c7)]);if(_0x580223[_0x23238c(0x213)])_0x4d1e6a+=pairF(0x32,_0x580223[_0x23238c(0x213)]);if(_0x580223[_0x23238c(0x27e)])_0x4d1e6a+=pairF(0x33,_0x580223[_0x23238c(0x27e)]);if(_0x580223[_0x23238c(0x184)])_0x4d1e6a+=pairI(0x44,_0x580223[_0x23238c(0x184)]);if(_0x580223['frozenLayers'])for(const _0x23aa72 of _0x580223[_0x23238c(0x176)]){_0x4d1e6a+=pair(0x14b,_0x23aa72);}if(_0x580223[_0x23238c(0x18c)])_0x4d1e6a+=pair(0x154,_0x580223[_0x23238c(0x18c)]);return _0x4d1e6a;}function writeImageEntity(_0x4f217e){const _0x33453c=_0x4940;let _0x157dc6=pair(0x64,_0x4f217e[_0x33453c(0x1ed)]===_0x33453c(0x27d)?_0x33453c(0x224):_0x33453c(0x1af));_0x157dc6+=writePoint3D(0xa,_0x4f217e[_0x33453c(0x23b)]),_0x157dc6+=writePoint3D(0xb,_0x4f217e[_0x33453c(0x25d)]),_0x157dc6+=writePoint3D(0xc,_0x4f217e[_0x33453c(0x23d)]),_0x157dc6+=pairF(0xd,_0x4f217e[_0x33453c(0x264)]?_0x4f217e['imageSize']['u']:0x0),_0x157dc6+=pairF(0x17,_0x4f217e[_0x33453c(0x264)]?_0x4f217e[_0x33453c(0x264)]['v']:0x0);if(_0x4f217e[_0x33453c(0x210)])_0x157dc6+=pair(0x154,_0x4f217e[_0x33453c(0x210)]);if(_0x4f217e[_0x33453c(0x1ad)])_0x157dc6+=pairI(0x46,_0x4f217e[_0x33453c(0x1ad)]);if(_0x4f217e['clippingType'])_0x157dc6+=pairI(0x47,_0x4f217e[_0x33453c(0x196)]);if(_0x4f217e[_0x33453c(0x17d)]!==undefined)_0x157dc6+=pairI(0x118,_0x4f217e[_0x33453c(0x17d)]);if(_0x4f217e[_0x33453c(0x1ac)]!==undefined)_0x157dc6+=pairI(0x119,_0x4f217e[_0x33453c(0x1ac)]);if(_0x4f217e[_0x33453c(0x1e4)]!==undefined)_0x157dc6+=pairI(0x11a,_0x4f217e[_0x33453c(0x1e4)]);if(_0x4f217e['clippingVertices'])for(const _0x2f83c6 of _0x4f217e[_0x33453c(0x21a)]){_0x157dc6+=pairF(0xe,_0x2f83c6['x']),_0x157dc6+=pairF(0x18,_0x2f83c6['y']||0x0);}return _0x157dc6;}function writeToleranceEntity(_0x3d9ebc){const _0x377483=_0x4940;let _0x726901=pair(0x64,_0x377483(0x22e));if(_0x3d9ebc[_0x377483(0x19a)])_0x726901+=pair(0x3,_0x3d9ebc['styleName']);_0x726901+=writePoint3D(0xa,_0x3d9ebc[_0x377483(0x23b)]);if(_0x3d9ebc['text'])_0x726901+=pair(0x1,_0x3d9ebc['text']);return _0x726901+=writePoint3D(0xb,_0x3d9ebc['direction']),_0x726901;}function writeHelixEntity(_0x5ce0cd){const _0x88acfb=_0x4940;let _0x3974f8=pair(0x64,_0x88acfb(0x1ab));_0x3974f8+=writePoint3D(0xa,_0x5ce0cd['axisBasePoint']),_0x3974f8+=writePoint3D(0xb,_0x5ce0cd[_0x88acfb(0x1fb)]),_0x3974f8+=writePoint3D(0xc,_0x5ce0cd[_0x88acfb(0x1e8)]),_0x3974f8+=pairF(0x28,_0x5ce0cd[_0x88acfb(0x227)]),_0x3974f8+=pairF(0x29,_0x5ce0cd[_0x88acfb(0x283)]),_0x3974f8+=pairF(0x2a,_0x5ce0cd['turnHeight']);if(_0x5ce0cd['handedness']!==undefined)_0x3974f8+=pairI(0x122,_0x5ce0cd['handedness']);if(_0x5ce0cd['constraint']!==undefined)_0x3974f8+=pairI(0x118,_0x5ce0cd['constraint']);return _0x3974f8;}function writeMeshEntity(_0x5d691c){const _0x343375=_0x4940;let _0x205017=pair(0x64,_0x343375(0x1c0));_0x205017+=pairI(0x47,_0x5d691c[_0x343375(0x1f5)]||0x2),_0x205017+=pairI(0x48,_0x5d691c[_0x343375(0x1b0)]||0x0);const _0x38799c=_0x5d691c[_0x343375(0x253)]||[];_0x205017+=pairI(0x5b,_0x38799c['length']);for(const _0x190571 of _0x38799c){_0x205017+=writePoint3D(0xa,_0x190571);}const _0x309f60=_0x5d691c[_0x343375(0x237)]||[];_0x205017+=pairI(0x5c,_0x309f60[_0x343375(0x1ec)]);for(const _0x30955e of _0x309f60){_0x205017+=pairI(0x5a,_0x30955e);}const _0x59bffe=_0x5d691c['edges']||[];_0x205017+=pairI(0x5d,_0x59bffe[_0x343375(0x1ec)]);for(const _0x315e3e of _0x59bffe){_0x205017+=pairI(0x5a,_0x315e3e);}const _0xc471a4=_0x5d691c[_0x343375(0x26e)]||[];_0x205017+=pairI(0x5e,_0xc471a4[_0x343375(0x1ec)]);for(const _0x3f96b2 of _0xc471a4){_0x205017+=pairF(0x8c,_0x3f96b2);}return _0x205017;}function _0x4940(_0x1126aa,_0x14e928){_0x1126aa=_0x1126aa-0x172;const _0x562943=_0x5629();let _0x49405f=_0x562943[_0x1126aa];return _0x49405f;}function writeRegionEntity(_0x2f33a9){const _0x1dd3b2=_0x4940;let _0x5cf458='AcDbRegion';if(_0x2f33a9[_0x1dd3b2(0x1ed)]===_0x1dd3b2(0x1ff))_0x5cf458='AcDbBody';else {if(_0x2f33a9[_0x1dd3b2(0x1ed)]===_0x1dd3b2(0x232))_0x5cf458=_0x1dd3b2(0x239);}let _0xf904e9=pair(0x64,_0x5cf458);if(_0x2f33a9[_0x1dd3b2(0x286)]!==undefined)_0xf904e9+=pairI(0x46,_0x2f33a9['modelerFormat']);const _0x47a82b=_0x2f33a9[_0x1dd3b2(0x1dd)]||(_0x2f33a9[_0x1dd3b2(0x284)]||[])['join']('');if(_0x47a82b){let _0x377a1d=_0x47a82b;while(_0x377a1d[_0x1dd3b2(0x1ec)]>0xff){_0xf904e9+=pair(0x3,_0x377a1d[_0x1dd3b2(0x249)](0x0,0xff)),_0x377a1d=_0x377a1d['substring'](0xff);}_0xf904e9+=pair(0x1,_0x377a1d);}return _0xf904e9;}function writeOle2Entity(_0x177fab){const _0x48d303=_0x4940;let _0x590847=pair(0x64,_0x48d303(0x1bd));_0x590847+=pairI(0x46,_0x177fab[_0x48d303(0x245)]||0x0),_0x590847+=pairI(0x47,_0x177fab['tileMode']||0x0),_0x590847+=writePoint3D(0xa,_0x177fab[_0x48d303(0x207)]),_0x590847+=writePoint3D(0xb,_0x177fab['lowerRightCorner']);if(_0x177fab[_0x48d303(0x1e9)])for(const _0x377f2b of _0x177fab[_0x48d303(0x1e9)]){_0x590847+=pair(0x1,_0x377f2b);}return _0x590847;}function writeTableEntity(_0x5ef9cc){const _0x4be94e=_0x4940;let _0x1af602=pair(0x64,_0x4be94e(0x238));if(_0x5ef9cc[_0x4be94e(0x202)])_0x1af602+=pair(0x2,_0x5ef9cc[_0x4be94e(0x202)]);_0x1af602+=writePoint3D(0xa,_0x5ef9cc[_0x4be94e(0x23b)]),_0x1af602+=pair(0x64,_0x4be94e(0x214)),_0x1af602+=writePoint3D(0xb,_0x5ef9cc['direction']);if(_0x5ef9cc[_0x4be94e(0x192)])_0x1af602+=pairI(0x5b,_0x5ef9cc[_0x4be94e(0x192)]);if(_0x5ef9cc[_0x4be94e(0x1a9)])_0x1af602+=pairI(0x5c,_0x5ef9cc[_0x4be94e(0x1a9)]);if(_0x5ef9cc[_0x4be94e(0x282)])for(const _0x3f1f01 of _0x5ef9cc[_0x4be94e(0x282)]){_0x1af602+=pairF(0x8e,_0x3f1f01);}if(_0x5ef9cc['columnWidths'])for(const _0x443af4 of _0x5ef9cc[_0x4be94e(0x285)]){_0x1af602+=pairF(0x8d,_0x443af4);}return _0x1af602;}function writeMLineEntity(_0x2ba83c){const _0x39a542=_0x4940;let _0x47446a=pair(0x64,_0x39a542(0x1e0));if(_0x2ba83c[_0x39a542(0x19a)])_0x47446a+=pair(0x2,_0x2ba83c[_0x39a542(0x19a)]);if(_0x2ba83c[_0x39a542(0x267)])_0x47446a+=pair(0x154,_0x2ba83c[_0x39a542(0x267)]);_0x47446a+=pairF(0x28,_0x2ba83c[_0x39a542(0x1fa)]||0x1),_0x47446a+=pairI(0x46,_0x2ba83c['justification']||0x0),_0x47446a+=pairI(0x47,_0x2ba83c['flags']||0x0);const _0x212cfd=_0x2ba83c[_0x39a542(0x253)]||[];_0x47446a+=pairI(0x48,_0x212cfd['length']);if(_0x2ba83c[_0x39a542(0x1f9)])_0x47446a+=pairI(0x49,_0x2ba83c['elementCount']);_0x47446a+=writePoint3D(0xa,_0x2ba83c[_0x39a542(0x1fb)]);_0x2ba83c[_0x39a542(0x1b6)]&&(_0x47446a+=pairF(0xd2,_0x2ba83c[_0x39a542(0x1b6)]['x']),_0x47446a+=pairF(0xdc,_0x2ba83c[_0x39a542(0x1b6)]['y']),_0x47446a+=pairF(0xe6,_0x2ba83c[_0x39a542(0x1b6)]['z']));for(const _0x1140fb of _0x212cfd){_0x47446a+=pairF(0xb,_0x1140fb['x']),_0x47446a+=pairF(0x15,_0x1140fb['y']),_0x47446a+=pairF(0x1f,_0x1140fb['z']||0x0);}return _0x47446a;}function writeGenericEntity(_0x3c4580){const _0x1ace87=_0x4940;let _0xef5118='';if(_0x3c4580['data'])for(const [_0x3185fd,_0x362ef9]of Object[_0x1ace87(0x1ca)](_0x3c4580[_0x1ace87(0x1dc)])){if(_0x3185fd['startsWith'](_0x1ace87(0x1be))){const _0x2f39fe=parseInt(_0x3185fd['replace'](_0x1ace87(0x1be),'')),_0x334cd9=[][_0x1ace87(0x22a)](_0x362ef9);for(const _0x5cd7f8 of _0x334cd9){_0xef5118+=pair(_0x2f39fe,_0x5cd7f8);}}}return _0xef5118;}function writeObjects(_0x59b3d5){const _0x5299ef=_0x4940;if(!_0x59b3d5||_0x59b3d5['length']===0x0)return '';let _0x36e84d=pair(0x0,_0x5299ef(0x1d6))+pair(0x2,_0x5299ef(0x204));for(const _0x4fcd8f of _0x59b3d5){_0x36e84d+=pair(0x0,_0x4fcd8f[_0x5299ef(0x1ed)]);if(_0x4fcd8f[_0x5299ef(0x174)])_0x36e84d+=pair(0x5,_0x4fcd8f[_0x5299ef(0x174)]);if(_0x4fcd8f['ownerHandle'])_0x36e84d+=pair(0x14a,_0x4fcd8f[_0x5299ef(0x1cc)]);if(_0x4fcd8f['name'])_0x36e84d+=pair(0x2,_0x4fcd8f['name']);if(_0x4fcd8f[_0x5299ef(0x1a2)]){const _0x5a5387=[]['concat'](_0x4fcd8f[_0x5299ef(0x1a2)]);for(const _0x2cab58 of _0x5a5387){_0x36e84d+=pair(0x3,_0x2cab58);}}if(_0x4fcd8f[_0x5299ef(0x183)]){const _0x22e806=[][_0x5299ef(0x22a)](_0x4fcd8f[_0x5299ef(0x183)]);for(const _0x3e9f00 of _0x22e806){_0x36e84d+=pair(0x15e,_0x3e9f00);}}if(_0x4fcd8f['hardPointer']){const _0x80f8f7=[][_0x5299ef(0x22a)](_0x4fcd8f['hardPointer']);for(const _0x1b1407 of _0x80f8f7){_0x36e84d+=pair(0x168,_0x1b1407);}}for(const [_0x5685fc,_0xe166ce]of Object['entries'](_0x4fcd8f)){if(_0x5685fc[_0x5299ef(0x1b1)](_0x5299ef(0x1be))){const _0x496feb=parseInt(_0x5685fc[_0x5299ef(0x26a)](_0x5299ef(0x1be),'')),_0x330da6=[][_0x5299ef(0x22a)](_0xe166ce);for(const _0x564fc8 of _0x330da6){_0x36e84d+=pair(_0x496feb,_0x564fc8);}}}}return _0x36e84d+=pair(0x0,_0x5299ef(0x235)),_0x36e84d;}function writeDxf(_0x4db2ea){const _0x33d007=_0x4940;let _0x25b4f5='';return _0x25b4f5+=writeHeader(_0x4db2ea[_0x33d007(0x18d)]),_0x25b4f5+=writeClasses(_0x4db2ea['classes']),_0x25b4f5+=writeTables(_0x4db2ea[_0x33d007(0x236)]),_0x25b4f5+=writeBlocks(_0x4db2ea['blocks']),_0x25b4f5+=writeEntitiesSection(_0x4db2ea[_0x33d007(0x191)]),_0x25b4f5+=writeObjects(_0x4db2ea['objects']),_0x25b4f5+=pair(0x0,_0x33d007(0x1d1)),_0x25b4f5;}async function writeDxfFile(_0x437220,_0x5874bf){const _0x24ec84=_0x4940,_0x314045=writeDxf(_0x437220);if(typeof process!=='undefined'&&process[_0x24ec84(0x205)]?.['node']){const {writeFile:_0x8475b1}=await import(_0x24ec84(0x28c));await _0x8475b1(_0x5874bf,_0x314045,_0x24ec84(0x27b));}else throw new Error(_0x24ec84(0x1cd));}function downloadDxfFile(_0x54b8ec,_0x33289a='output.dxf'){const _0x3d7291=_0x4940,_0x4b3498=writeDxf(_0x54b8ec),_0x4e1f6d=new Blob([_0x4b3498],{'type':_0x3d7291(0x25e)}),_0x3087bd=URL[_0x3d7291(0x242)](_0x4e1f6d),_0x5745f1=document[_0x3d7291(0x28d)]('a');_0x5745f1[_0x3d7291(0x1e6)]=_0x3087bd,_0x5745f1[_0x3d7291(0x23a)]=_0x33289a,_0x5745f1['click'](),URL['revokeObjectURL'](_0x3087bd);}
|
|
12
|
+
// ─────────────────── 工具函数 ───────────────────
|
|
13
|
+
// (这部分和你原来的完全一样,一行不改)
|
|
4
14
|
|
|
5
|
-
function
|
|
15
|
+
function tokenize(dxfString) {
|
|
16
|
+
const lines = dxfString.split(/\r?\n/);
|
|
17
|
+
const pairs = [];
|
|
18
|
+
for (let i = 0; i + 1 < lines.length; i += 2) {
|
|
19
|
+
const code = parseInt(lines[i].trim(), 10);
|
|
20
|
+
const value = lines[i + 1].trim();
|
|
21
|
+
pairs.push({ code, value });
|
|
22
|
+
}
|
|
23
|
+
return pairs;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function autoConvert(code, value) {
|
|
27
|
+
if (
|
|
28
|
+
(code >= 10 && code <= 59) ||
|
|
29
|
+
(code >= 110 && code <= 149) ||
|
|
30
|
+
(code >= 210 && code <= 239) ||
|
|
31
|
+
(code >= 460 && code <= 469) ||
|
|
32
|
+
(code >= 1010 && code <= 1059)
|
|
33
|
+
) {
|
|
34
|
+
return parseFloat(value);
|
|
35
|
+
}
|
|
36
|
+
if (
|
|
37
|
+
(code >= 60 && code <= 79) ||
|
|
38
|
+
(code >= 90 && code <= 99) ||
|
|
39
|
+
(code >= 170 && code <= 179) ||
|
|
40
|
+
(code >= 270 && code <= 289) ||
|
|
41
|
+
(code >= 370 && code <= 389) ||
|
|
42
|
+
(code >= 400 && code <= 409) ||
|
|
43
|
+
(code >= 1060 && code <= 1079)
|
|
44
|
+
) {
|
|
45
|
+
return parseInt(value, 10);
|
|
46
|
+
}
|
|
47
|
+
return value;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function splitSections(pairs) {
|
|
51
|
+
const sections = {};
|
|
52
|
+
let i = 0;
|
|
53
|
+
while (i < pairs.length) {
|
|
54
|
+
if (pairs[i].code === 0 && pairs[i].value === "SECTION") {
|
|
55
|
+
i++;
|
|
56
|
+
const sectionName = pairs[i].value;
|
|
57
|
+
i++;
|
|
58
|
+
const start = i;
|
|
59
|
+
while (i < pairs.length && !(pairs[i].code === 0 && pairs[i].value === "ENDSEC")) {
|
|
60
|
+
i++;
|
|
61
|
+
}
|
|
62
|
+
sections[sectionName] = pairs.slice(start, i);
|
|
63
|
+
i++;
|
|
64
|
+
} else {
|
|
65
|
+
i++;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return sections;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function parseHeader(pairs) {
|
|
72
|
+
if (!pairs || pairs.length === 0) return {};
|
|
73
|
+
const header = {};
|
|
74
|
+
let i = 0;
|
|
75
|
+
while (i < pairs.length) {
|
|
76
|
+
if (pairs[i].code === 9) {
|
|
77
|
+
const varName = pairs[i].value;
|
|
78
|
+
i++;
|
|
79
|
+
const values = {};
|
|
80
|
+
while (i < pairs.length && pairs[i].code !== 9 && pairs[i].code !== 0) {
|
|
81
|
+
values[pairs[i].code] = autoConvert(pairs[i].code, pairs[i].value);
|
|
82
|
+
i++;
|
|
83
|
+
}
|
|
84
|
+
const keys = Object.keys(values);
|
|
85
|
+
header[varName] = keys.length === 1 ? values[keys[0]] : values;
|
|
86
|
+
} else {
|
|
87
|
+
i++;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
return header;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
function parseClasses(pairs) {
|
|
94
|
+
if (!pairs || pairs.length === 0) return [];
|
|
95
|
+
const classes = [];
|
|
96
|
+
let i = 0;
|
|
97
|
+
while (i < pairs.length) {
|
|
98
|
+
if (pairs[i].code === 0 && pairs[i].value === "CLASS") {
|
|
99
|
+
i++;
|
|
100
|
+
const cls = {};
|
|
101
|
+
while (i < pairs.length && pairs[i].code !== 0) {
|
|
102
|
+
switch (pairs[i].code) {
|
|
103
|
+
case 1: cls.dxfRecord = pairs[i].value; break;
|
|
104
|
+
case 2: cls.cppClassName = pairs[i].value; break;
|
|
105
|
+
case 3: cls.appName = pairs[i].value; break;
|
|
106
|
+
case 90: cls.proxyCapabilities = parseInt(pairs[i].value, 10); break;
|
|
107
|
+
case 91: cls.instanceCount = parseInt(pairs[i].value, 10); break;
|
|
108
|
+
case 280: cls.wasProxy = parseInt(pairs[i].value, 10); break;
|
|
109
|
+
case 281: cls.isEntity = parseInt(pairs[i].value, 10); break;
|
|
110
|
+
default: cls[`code_${pairs[i].code}`] = pairs[i].value;
|
|
111
|
+
}
|
|
112
|
+
i++;
|
|
113
|
+
}
|
|
114
|
+
classes.push(cls);
|
|
115
|
+
} else {
|
|
116
|
+
i++;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
return classes;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
function parseTables(pairs) {
|
|
123
|
+
if (!pairs || pairs.length === 0) return {};
|
|
124
|
+
const tables = {};
|
|
125
|
+
let i = 0;
|
|
126
|
+
while (i < pairs.length) {
|
|
127
|
+
if (pairs[i].code === 0 && pairs[i].value === "TABLE") {
|
|
128
|
+
i++;
|
|
129
|
+
const tableName = pairs[i].value;
|
|
130
|
+
i++;
|
|
131
|
+
const start = i;
|
|
132
|
+
while (i < pairs.length && !(pairs[i].code === 0 && pairs[i].value === "ENDTAB")) {
|
|
133
|
+
i++;
|
|
134
|
+
}
|
|
135
|
+
tables[tableName] = parseTableEntries(tableName, pairs.slice(start, i));
|
|
136
|
+
i++;
|
|
137
|
+
} else {
|
|
138
|
+
i++;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
return tables;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
function parseTableEntries(tableName, pairs) {
|
|
145
|
+
const entries = [];
|
|
146
|
+
let i = 0;
|
|
147
|
+
while (i < pairs.length) {
|
|
148
|
+
if (pairs[i].code === 0) {
|
|
149
|
+
const entryType = pairs[i].value;
|
|
150
|
+
i++;
|
|
151
|
+
const entry = { _type: entryType };
|
|
152
|
+
while (i < pairs.length && pairs[i].code !== 0) {
|
|
153
|
+
const code = pairs[i].code;
|
|
154
|
+
const val = autoConvert(code, pairs[i].value);
|
|
155
|
+
switch (code) {
|
|
156
|
+
case 2: entry.name = val; break;
|
|
157
|
+
case 5: entry.handle = val; break;
|
|
158
|
+
case 6: entry.linetypeName = val; break;
|
|
159
|
+
case 7: entry.styleName = val; break;
|
|
160
|
+
case 62: entry.colorNumber = val; break;
|
|
161
|
+
case 70: entry.flags = val; break;
|
|
162
|
+
case 40: entry.height = val; break;
|
|
163
|
+
case 41: entry.widthFactor = val; break;
|
|
164
|
+
case 50: entry.angle = val; break;
|
|
165
|
+
case 100: entry.subclassMarker = entry.subclassMarker ? [].concat(entry.subclassMarker, val) : val; break;
|
|
166
|
+
case 330: entry.ownerHandle = val; break;
|
|
167
|
+
case 370: entry.lineweight = val; break;
|
|
168
|
+
case 390: entry.plotStyleHandle = val; break;
|
|
169
|
+
default:
|
|
170
|
+
if (entry[`code_${code}`] !== undefined) {
|
|
171
|
+
entry[`code_${code}`] = [].concat(entry[`code_${code}`], val);
|
|
172
|
+
} else {
|
|
173
|
+
entry[`code_${code}`] = val;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
i++;
|
|
177
|
+
}
|
|
178
|
+
entries.push(entry);
|
|
179
|
+
} else {
|
|
180
|
+
i++;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
return entries;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
function parseBlocks(pairs) {
|
|
187
|
+
if (!pairs || pairs.length === 0) return [];
|
|
188
|
+
const blocks = [];
|
|
189
|
+
let i = 0;
|
|
190
|
+
while (i < pairs.length) {
|
|
191
|
+
if (pairs[i].code === 0 && pairs[i].value === "BLOCK") {
|
|
192
|
+
i++;
|
|
193
|
+
const block = { entities: [] };
|
|
194
|
+
while (i < pairs.length && pairs[i].code !== 0) {
|
|
195
|
+
switch (pairs[i].code) {
|
|
196
|
+
case 2: block.name = pairs[i].value; break;
|
|
197
|
+
case 3: block.name2 = pairs[i].value; break;
|
|
198
|
+
case 5: block.handle = pairs[i].value; break;
|
|
199
|
+
case 8: block.layer = pairs[i].value; break;
|
|
200
|
+
case 10: block.basePointX = parseFloat(pairs[i].value); break;
|
|
201
|
+
case 20: block.basePointY = parseFloat(pairs[i].value); break;
|
|
202
|
+
case 30: block.basePointZ = parseFloat(pairs[i].value); break;
|
|
203
|
+
case 70: block.flags = parseInt(pairs[i].value, 10); break;
|
|
204
|
+
case 100: break;
|
|
205
|
+
case 330: block.ownerHandle = pairs[i].value; break;
|
|
206
|
+
default: block[`code_${pairs[i].code}`] = pairs[i].value;
|
|
207
|
+
}
|
|
208
|
+
i++;
|
|
209
|
+
}
|
|
210
|
+
const entityPairs = [];
|
|
211
|
+
while (i < pairs.length && !(pairs[i].code === 0 && pairs[i].value === "ENDBLK")) {
|
|
212
|
+
entityPairs.push(pairs[i]);
|
|
213
|
+
i++;
|
|
214
|
+
}
|
|
215
|
+
if (entityPairs.length > 0) block.entities = parseEntityList(entityPairs);
|
|
216
|
+
if (i < pairs.length) {
|
|
217
|
+
i++;
|
|
218
|
+
while (i < pairs.length && pairs[i].code !== 0) i++;
|
|
219
|
+
}
|
|
220
|
+
blocks.push(block);
|
|
221
|
+
} else {
|
|
222
|
+
i++;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
return blocks;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
// ─────────────────── ENTITIES 解析 ───────────────────
|
|
229
|
+
|
|
230
|
+
function parseEntityList(pairs) {
|
|
231
|
+
const entities = [];
|
|
232
|
+
let i = 0;
|
|
233
|
+
while (i < pairs.length) {
|
|
234
|
+
if (pairs[i].code === 0) {
|
|
235
|
+
const entityType = pairs[i].value;
|
|
236
|
+
i++;
|
|
237
|
+
const entityPairs = [];
|
|
238
|
+
while (i < pairs.length && pairs[i].code !== 0) {
|
|
239
|
+
entityPairs.push(pairs[i]);
|
|
240
|
+
i++;
|
|
241
|
+
}
|
|
242
|
+
const entity = parseOneEntity(entityType, entityPairs);
|
|
243
|
+
if (entity) entities.push(entity);
|
|
244
|
+
} else {
|
|
245
|
+
i++;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
return entities;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
function parseOneEntity(type, pairs) {
|
|
252
|
+
const base = { type };
|
|
253
|
+
for (const p of pairs) {
|
|
254
|
+
switch (p.code) {
|
|
255
|
+
case 5: base.handle = p.value; break;
|
|
256
|
+
case 8: base.layer = p.value; break;
|
|
257
|
+
case 6: base.linetypeName = p.value; break;
|
|
258
|
+
case 48: base.linetypeScale = parseFloat(p.value); break;
|
|
259
|
+
case 60: base.visible = parseInt(p.value, 10) === 0; break;
|
|
260
|
+
case 62: base.colorNumber = parseInt(p.value, 10); break;
|
|
261
|
+
case 67: base.inPaperSpace = parseInt(p.value, 10) === 1; break;
|
|
262
|
+
case 330: base.ownerHandle = p.value; break;
|
|
263
|
+
case 370: base.lineweight = parseInt(p.value, 10); break;
|
|
264
|
+
case 420: base.trueColor = parseInt(p.value, 10); break;
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
switch (type) {
|
|
268
|
+
case "LINE": return parseLineEntity(base, pairs);
|
|
269
|
+
case "LWPOLYLINE": return parseLWPolylineEntity(base, pairs);
|
|
270
|
+
case "POLYLINE": return parsePolylineEntity(base, pairs);
|
|
271
|
+
case "VERTEX": return parseVertexEntity(base, pairs);
|
|
272
|
+
case "ARC": return parseArcEntity(base, pairs);
|
|
273
|
+
case "CIRCLE": return parseCircleEntity(base, pairs);
|
|
274
|
+
case "ELLIPSE": return parseEllipseEntity(base, pairs);
|
|
275
|
+
case "POINT": return parsePointEntity(base, pairs);
|
|
276
|
+
case "TEXT": return parseTextEntity(base, pairs);
|
|
277
|
+
case "MTEXT": return parseMTextEntity(base, pairs);
|
|
278
|
+
case "ATTRIB": return parseAttribEntity(base, pairs);
|
|
279
|
+
case "ATTDEF": return parseAttribEntity(base, pairs);
|
|
280
|
+
case "INSERT": return parseInsertEntity(base, pairs);
|
|
281
|
+
case "DIMENSION": return parseDimensionEntity(base, pairs);
|
|
282
|
+
case "LEADER": return parseLeaderEntity(base, pairs);
|
|
283
|
+
case "MLEADER": return parseMLeaderEntity(base, pairs);
|
|
284
|
+
case "HATCH": return parseHatchEntity(base, pairs);
|
|
285
|
+
case "SPLINE": return parseSplineEntity(base, pairs);
|
|
286
|
+
case "SOLID": case "3DSOLID": case "TRACE": return parseSolidEntity(base, pairs);
|
|
287
|
+
case "3DFACE": return parse3DFaceEntity(base, pairs);
|
|
288
|
+
case "RAY": case "XLINE": return parseRayEntity(base, pairs);
|
|
289
|
+
case "VIEWPORT": return parseViewportEntity(base, pairs);
|
|
290
|
+
case "IMAGE": case "WIPEOUT": return parseImageEntity(base, pairs);
|
|
291
|
+
case "TOLERANCE": return parseToleranceEntity(base, pairs);
|
|
292
|
+
case "HELIX": return parseHelixEntity(base, pairs);
|
|
293
|
+
case "MESH": return parseMeshEntity(base, pairs);
|
|
294
|
+
case "REGION": case "BODY": case "SURFACE": return parseRegionEntity(base, pairs);
|
|
295
|
+
case "OLE2FRAME": return parseOle2Entity(base, pairs);
|
|
296
|
+
case "TABLE": return parseTableEntity(base, pairs);
|
|
297
|
+
case "MLINE": return parseMLineEntity(base, pairs);
|
|
298
|
+
case "SEQEND": return base;
|
|
299
|
+
default: return parseGenericEntity(base, pairs);
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
// ── 以下所有实体解析器与你原来的完全一样,不需要任何改动 ──
|
|
304
|
+
// (这里为了完整性全部保留)
|
|
305
|
+
|
|
306
|
+
function parseLineEntity(base, pairs) {
|
|
307
|
+
base.startPoint = { x: 0, y: 0, z: 0 };
|
|
308
|
+
base.endPoint = { x: 0, y: 0, z: 0 };
|
|
309
|
+
base.thickness = 0;
|
|
310
|
+
base.extrusionDirection = { x: 0, y: 0, z: 1 };
|
|
311
|
+
for (const p of pairs) {
|
|
312
|
+
switch (p.code) {
|
|
313
|
+
case 10: base.startPoint.x = parseFloat(p.value); break;
|
|
314
|
+
case 20: base.startPoint.y = parseFloat(p.value); break;
|
|
315
|
+
case 30: base.startPoint.z = parseFloat(p.value); break;
|
|
316
|
+
case 11: base.endPoint.x = parseFloat(p.value); break;
|
|
317
|
+
case 21: base.endPoint.y = parseFloat(p.value); break;
|
|
318
|
+
case 31: base.endPoint.z = parseFloat(p.value); break;
|
|
319
|
+
case 39: base.thickness = parseFloat(p.value); break;
|
|
320
|
+
case 210: base.extrusionDirection.x = parseFloat(p.value); break;
|
|
321
|
+
case 220: base.extrusionDirection.y = parseFloat(p.value); break;
|
|
322
|
+
case 230: base.extrusionDirection.z = parseFloat(p.value); break;
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
return base;
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
function parseLWPolylineEntity(base, pairs) {
|
|
329
|
+
base.closed = false; base.constantWidth = 0; base.elevation = 0;
|
|
330
|
+
base.thickness = 0; base.vertices = [];
|
|
331
|
+
base.extrusionDirection = { x: 0, y: 0, z: 1 };
|
|
332
|
+
let currentVertex = null;
|
|
333
|
+
for (const p of pairs) {
|
|
334
|
+
switch (p.code) {
|
|
335
|
+
case 70: base.closed = (parseInt(p.value, 10) & 1) === 1; break;
|
|
336
|
+
case 38: base.elevation = parseFloat(p.value); break;
|
|
337
|
+
case 39: base.thickness = parseFloat(p.value); break;
|
|
338
|
+
case 43: base.constantWidth = parseFloat(p.value); break;
|
|
339
|
+
case 90: base.vertexCount = parseInt(p.value, 10); break;
|
|
340
|
+
case 10:
|
|
341
|
+
if (currentVertex) base.vertices.push(currentVertex);
|
|
342
|
+
currentVertex = { x: parseFloat(p.value), y: 0, bulge: 0, startWidth: 0, endWidth: 0 };
|
|
343
|
+
break;
|
|
344
|
+
case 20: if (currentVertex) currentVertex.y = parseFloat(p.value); break;
|
|
345
|
+
case 40: if (currentVertex) currentVertex.startWidth = parseFloat(p.value); break;
|
|
346
|
+
case 41: if (currentVertex) currentVertex.endWidth = parseFloat(p.value); break;
|
|
347
|
+
case 42: if (currentVertex) currentVertex.bulge = parseFloat(p.value); break;
|
|
348
|
+
case 210: base.extrusionDirection.x = parseFloat(p.value); break;
|
|
349
|
+
case 220: base.extrusionDirection.y = parseFloat(p.value); break;
|
|
350
|
+
case 230: base.extrusionDirection.z = parseFloat(p.value); break;
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
if (currentVertex) base.vertices.push(currentVertex);
|
|
354
|
+
return base;
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
function parsePolylineEntity(base, pairs) {
|
|
358
|
+
base.closed = false; base.is3DPolyline = false; base.is3DMesh = false;
|
|
359
|
+
base.isPolyfaceMesh = false; base.meshMVertexCount = 0; base.meshNVertexCount = 0;
|
|
360
|
+
base.defaultStartWidth = 0; base.defaultEndWidth = 0; base.elevation = 0;
|
|
361
|
+
base.vertices = [];
|
|
362
|
+
for (const p of pairs) {
|
|
363
|
+
switch (p.code) {
|
|
364
|
+
case 10: base.dummyX = parseFloat(p.value); break;
|
|
365
|
+
case 20: base.dummyY = parseFloat(p.value); break;
|
|
366
|
+
case 30: base.elevation = parseFloat(p.value); break;
|
|
367
|
+
case 39: base.thickness = parseFloat(p.value); break;
|
|
368
|
+
case 40: base.defaultStartWidth = parseFloat(p.value); break;
|
|
369
|
+
case 41: base.defaultEndWidth = parseFloat(p.value); break;
|
|
370
|
+
case 70: {
|
|
371
|
+
const flags = parseInt(p.value, 10);
|
|
372
|
+
base.closed = (flags & 1) === 1; base.is3DPolyline = (flags & 8) === 8;
|
|
373
|
+
base.is3DMesh = (flags & 16) === 16; base.isPolyfaceMesh = (flags & 64) === 64;
|
|
374
|
+
base.flags = flags; break;
|
|
375
|
+
}
|
|
376
|
+
case 71: base.meshMVertexCount = parseInt(p.value, 10); break;
|
|
377
|
+
case 72: base.meshNVertexCount = parseInt(p.value, 10); break;
|
|
378
|
+
case 210: (base.extrusionDirection = base.extrusionDirection || {}).x = parseFloat(p.value); break;
|
|
379
|
+
case 220: (base.extrusionDirection = base.extrusionDirection || {}).y = parseFloat(p.value); break;
|
|
380
|
+
case 230: (base.extrusionDirection = base.extrusionDirection || {}).z = parseFloat(p.value); break;
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
return base;
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
function parseVertexEntity(base, pairs) {
|
|
387
|
+
base.position = { x: 0, y: 0, z: 0 }; base.bulge = 0;
|
|
388
|
+
base.startWidth = 0; base.endWidth = 0; base.flags = 0;
|
|
389
|
+
for (const p of pairs) {
|
|
390
|
+
switch (p.code) {
|
|
391
|
+
case 10: base.position.x = parseFloat(p.value); break;
|
|
392
|
+
case 20: base.position.y = parseFloat(p.value); break;
|
|
393
|
+
case 30: base.position.z = parseFloat(p.value); break;
|
|
394
|
+
case 40: base.startWidth = parseFloat(p.value); break;
|
|
395
|
+
case 41: base.endWidth = parseFloat(p.value); break;
|
|
396
|
+
case 42: base.bulge = parseFloat(p.value); break;
|
|
397
|
+
case 70: base.flags = parseInt(p.value, 10); break;
|
|
398
|
+
case 71: base.faceVertex1 = parseInt(p.value, 10); break;
|
|
399
|
+
case 72: base.faceVertex2 = parseInt(p.value, 10); break;
|
|
400
|
+
case 73: base.faceVertex3 = parseInt(p.value, 10); break;
|
|
401
|
+
case 74: base.faceVertex4 = parseInt(p.value, 10); break;
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
return base;
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
function parseArcEntity(base, pairs) {
|
|
408
|
+
base.center = { x: 0, y: 0, z: 0 }; base.radius = 0;
|
|
409
|
+
base.startAngle = 0; base.endAngle = 360; base.thickness = 0;
|
|
410
|
+
base.extrusionDirection = { x: 0, y: 0, z: 1 };
|
|
411
|
+
for (const p of pairs) {
|
|
412
|
+
switch (p.code) {
|
|
413
|
+
case 10: base.center.x = parseFloat(p.value); break;
|
|
414
|
+
case 20: base.center.y = parseFloat(p.value); break;
|
|
415
|
+
case 30: base.center.z = parseFloat(p.value); break;
|
|
416
|
+
case 39: base.thickness = parseFloat(p.value); break;
|
|
417
|
+
case 40: base.radius = parseFloat(p.value); break;
|
|
418
|
+
case 50: base.startAngle = parseFloat(p.value); break;
|
|
419
|
+
case 51: base.endAngle = parseFloat(p.value); break;
|
|
420
|
+
case 210: base.extrusionDirection.x = parseFloat(p.value); break;
|
|
421
|
+
case 220: base.extrusionDirection.y = parseFloat(p.value); break;
|
|
422
|
+
case 230: base.extrusionDirection.z = parseFloat(p.value); break;
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
return base;
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
function parseCircleEntity(base, pairs) {
|
|
429
|
+
base.center = { x: 0, y: 0, z: 0 }; base.radius = 0; base.thickness = 0;
|
|
430
|
+
base.extrusionDirection = { x: 0, y: 0, z: 1 };
|
|
431
|
+
for (const p of pairs) {
|
|
432
|
+
switch (p.code) {
|
|
433
|
+
case 10: base.center.x = parseFloat(p.value); break;
|
|
434
|
+
case 20: base.center.y = parseFloat(p.value); break;
|
|
435
|
+
case 30: base.center.z = parseFloat(p.value); break;
|
|
436
|
+
case 39: base.thickness = parseFloat(p.value); break;
|
|
437
|
+
case 40: base.radius = parseFloat(p.value); break;
|
|
438
|
+
case 210: base.extrusionDirection.x = parseFloat(p.value); break;
|
|
439
|
+
case 220: base.extrusionDirection.y = parseFloat(p.value); break;
|
|
440
|
+
case 230: base.extrusionDirection.z = parseFloat(p.value); break;
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
return base;
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
function parseEllipseEntity(base, pairs) {
|
|
447
|
+
base.center = { x: 0, y: 0, z: 0 };
|
|
448
|
+
base.majorAxisEndPoint = { x: 0, y: 0, z: 0 };
|
|
449
|
+
base.axisRatio = 1; base.startAngle = 0; base.endAngle = Math.PI * 2;
|
|
450
|
+
base.extrusionDirection = { x: 0, y: 0, z: 1 };
|
|
451
|
+
for (const p of pairs) {
|
|
452
|
+
switch (p.code) {
|
|
453
|
+
case 10: base.center.x = parseFloat(p.value); break;
|
|
454
|
+
case 20: base.center.y = parseFloat(p.value); break;
|
|
455
|
+
case 30: base.center.z = parseFloat(p.value); break;
|
|
456
|
+
case 11: base.majorAxisEndPoint.x = parseFloat(p.value); break;
|
|
457
|
+
case 21: base.majorAxisEndPoint.y = parseFloat(p.value); break;
|
|
458
|
+
case 31: base.majorAxisEndPoint.z = parseFloat(p.value); break;
|
|
459
|
+
case 40: base.axisRatio = parseFloat(p.value); break;
|
|
460
|
+
case 41: base.startAngle = parseFloat(p.value); break;
|
|
461
|
+
case 42: base.endAngle = parseFloat(p.value); break;
|
|
462
|
+
case 210: base.extrusionDirection.x = parseFloat(p.value); break;
|
|
463
|
+
case 220: base.extrusionDirection.y = parseFloat(p.value); break;
|
|
464
|
+
case 230: base.extrusionDirection.z = parseFloat(p.value); break;
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
return base;
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
function parsePointEntity(base, pairs) {
|
|
471
|
+
base.position = { x: 0, y: 0, z: 0 }; base.thickness = 0;
|
|
472
|
+
base.extrusionDirection = { x: 0, y: 0, z: 1 };
|
|
473
|
+
for (const p of pairs) {
|
|
474
|
+
switch (p.code) {
|
|
475
|
+
case 10: base.position.x = parseFloat(p.value); break;
|
|
476
|
+
case 20: base.position.y = parseFloat(p.value); break;
|
|
477
|
+
case 30: base.position.z = parseFloat(p.value); break;
|
|
478
|
+
case 39: base.thickness = parseFloat(p.value); break;
|
|
479
|
+
case 50: base.angle = parseFloat(p.value); break;
|
|
480
|
+
case 210: base.extrusionDirection.x = parseFloat(p.value); break;
|
|
481
|
+
case 220: base.extrusionDirection.y = parseFloat(p.value); break;
|
|
482
|
+
case 230: base.extrusionDirection.z = parseFloat(p.value); break;
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
return base;
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
function parseTextEntity(base, pairs) {
|
|
489
|
+
base.insertionPoint = { x: 0, y: 0, z: 0 }; base.alignmentPoint = { x: 0, y: 0, z: 0 };
|
|
490
|
+
base.height = 0; base.text = ""; base.rotation = 0; base.xScale = 1;
|
|
491
|
+
base.oblique = 0; base.styleName = "STANDARD"; base.generationFlags = 0;
|
|
492
|
+
base.hAlign = 0; base.vAlign = 0; base.thickness = 0;
|
|
493
|
+
base.extrusionDirection = { x: 0, y: 0, z: 1 };
|
|
494
|
+
for (const p of pairs) {
|
|
495
|
+
switch (p.code) {
|
|
496
|
+
case 1: base.text = p.value; break; case 7: base.styleName = p.value; break;
|
|
497
|
+
case 10: base.insertionPoint.x = parseFloat(p.value); break;
|
|
498
|
+
case 20: base.insertionPoint.y = parseFloat(p.value); break;
|
|
499
|
+
case 30: base.insertionPoint.z = parseFloat(p.value); break;
|
|
500
|
+
case 11: base.alignmentPoint.x = parseFloat(p.value); break;
|
|
501
|
+
case 21: base.alignmentPoint.y = parseFloat(p.value); break;
|
|
502
|
+
case 31: base.alignmentPoint.z = parseFloat(p.value); break;
|
|
503
|
+
case 39: base.thickness = parseFloat(p.value); break;
|
|
504
|
+
case 40: base.height = parseFloat(p.value); break;
|
|
505
|
+
case 41: base.xScale = parseFloat(p.value); break;
|
|
506
|
+
case 50: base.rotation = parseFloat(p.value); break;
|
|
507
|
+
case 51: base.oblique = parseFloat(p.value); break;
|
|
508
|
+
case 71: base.generationFlags = parseInt(p.value, 10); break;
|
|
509
|
+
case 72: base.hAlign = parseInt(p.value, 10); break;
|
|
510
|
+
case 73: base.vAlign = parseInt(p.value, 10); break;
|
|
511
|
+
case 210: base.extrusionDirection.x = parseFloat(p.value); break;
|
|
512
|
+
case 220: base.extrusionDirection.y = parseFloat(p.value); break;
|
|
513
|
+
case 230: base.extrusionDirection.z = parseFloat(p.value); break;
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
return base;
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
function parseMTextEntity(base, pairs) {
|
|
520
|
+
base.insertionPoint = { x: 0, y: 0, z: 0 }; base.direction = { x: 1, y: 0, z: 0 };
|
|
521
|
+
base.height = 0; base.width = 0; base.text = ""; base.rotation = 0;
|
|
522
|
+
base.styleName = "STANDARD"; base.attachmentPoint = 1; base.drawingDirection = 1;
|
|
523
|
+
base.lineSpacing = 1; base.lineSpacingStyle = 1;
|
|
524
|
+
base.extrusionDirection = { x: 0, y: 0, z: 1 };
|
|
525
|
+
let textParts = [];
|
|
526
|
+
for (const p of pairs) {
|
|
527
|
+
switch (p.code) {
|
|
528
|
+
case 1: textParts.push(p.value); break; case 3: textParts.push(p.value); break;
|
|
529
|
+
case 7: base.styleName = p.value; break;
|
|
530
|
+
case 10: base.insertionPoint.x = parseFloat(p.value); break;
|
|
531
|
+
case 20: base.insertionPoint.y = parseFloat(p.value); break;
|
|
532
|
+
case 30: base.insertionPoint.z = parseFloat(p.value); break;
|
|
533
|
+
case 11: base.direction.x = parseFloat(p.value); break;
|
|
534
|
+
case 21: base.direction.y = parseFloat(p.value); break;
|
|
535
|
+
case 31: base.direction.z = parseFloat(p.value); break;
|
|
536
|
+
case 40: base.height = parseFloat(p.value); break;
|
|
537
|
+
case 41: base.width = parseFloat(p.value); break;
|
|
538
|
+
case 44: base.lineSpacing = parseFloat(p.value); break;
|
|
539
|
+
case 50: base.rotation = parseFloat(p.value); break;
|
|
540
|
+
case 71: base.attachmentPoint = parseInt(p.value, 10); break;
|
|
541
|
+
case 72: base.drawingDirection = parseInt(p.value, 10); break;
|
|
542
|
+
case 73: base.lineSpacingStyle = parseInt(p.value, 10); break;
|
|
543
|
+
case 210: base.extrusionDirection.x = parseFloat(p.value); break;
|
|
544
|
+
case 220: base.extrusionDirection.y = parseFloat(p.value); break;
|
|
545
|
+
case 230: base.extrusionDirection.z = parseFloat(p.value); break;
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
base.text = textParts.join("");
|
|
549
|
+
return base;
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
function parseAttribEntity(base, pairs) {
|
|
553
|
+
base.insertionPoint = { x: 0, y: 0, z: 0 }; base.alignmentPoint = { x: 0, y: 0, z: 0 };
|
|
554
|
+
base.height = 0; base.text = ""; base.tag = ""; base.prompt = "";
|
|
555
|
+
base.rotation = 0; base.flags = 0; base.styleName = "STANDARD";
|
|
556
|
+
for (const p of pairs) {
|
|
557
|
+
switch (p.code) {
|
|
558
|
+
case 1: base.text = p.value; break; case 2: base.tag = p.value; break;
|
|
559
|
+
case 3: base.prompt = p.value; break; case 7: base.styleName = p.value; break;
|
|
560
|
+
case 10: base.insertionPoint.x = parseFloat(p.value); break;
|
|
561
|
+
case 20: base.insertionPoint.y = parseFloat(p.value); break;
|
|
562
|
+
case 30: base.insertionPoint.z = parseFloat(p.value); break;
|
|
563
|
+
case 11: base.alignmentPoint.x = parseFloat(p.value); break;
|
|
564
|
+
case 21: base.alignmentPoint.y = parseFloat(p.value); break;
|
|
565
|
+
case 31: base.alignmentPoint.z = parseFloat(p.value); break;
|
|
566
|
+
case 40: base.height = parseFloat(p.value); break;
|
|
567
|
+
case 41: base.xScale = parseFloat(p.value); break;
|
|
568
|
+
case 50: base.rotation = parseFloat(p.value); break;
|
|
569
|
+
case 70: base.flags = parseInt(p.value, 10); break;
|
|
570
|
+
case 71: base.generationFlags = parseInt(p.value, 10); break;
|
|
571
|
+
case 72: base.hAlign = parseInt(p.value, 10); break;
|
|
572
|
+
case 73: base.vAlign = parseInt(p.value, 10); break;
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
return base;
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
function parseInsertEntity(base, pairs) {
|
|
579
|
+
base.blockName = ""; base.insertionPoint = { x: 0, y: 0, z: 0 };
|
|
580
|
+
base.scale = { x: 1, y: 1, z: 1 }; base.rotation = 0;
|
|
581
|
+
base.columnCount = 1; base.rowCount = 1; base.columnSpacing = 0; base.rowSpacing = 0;
|
|
582
|
+
base.extrusionDirection = { x: 0, y: 0, z: 1 }; base.attributes = [];
|
|
583
|
+
for (const p of pairs) {
|
|
584
|
+
switch (p.code) {
|
|
585
|
+
case 2: base.blockName = p.value; break;
|
|
586
|
+
case 10: base.insertionPoint.x = parseFloat(p.value); break;
|
|
587
|
+
case 20: base.insertionPoint.y = parseFloat(p.value); break;
|
|
588
|
+
case 30: base.insertionPoint.z = parseFloat(p.value); break;
|
|
589
|
+
case 41: base.scale.x = parseFloat(p.value); break;
|
|
590
|
+
case 42: base.scale.y = parseFloat(p.value); break;
|
|
591
|
+
case 43: base.scale.z = parseFloat(p.value); break;
|
|
592
|
+
case 44: base.columnSpacing = parseFloat(p.value); break;
|
|
593
|
+
case 45: base.rowSpacing = parseFloat(p.value); break;
|
|
594
|
+
case 50: base.rotation = parseFloat(p.value); break;
|
|
595
|
+
case 66: base.hasAttributes = parseInt(p.value, 10) === 1; break;
|
|
596
|
+
case 70: base.columnCount = parseInt(p.value, 10); break;
|
|
597
|
+
case 71: base.rowCount = parseInt(p.value, 10); break;
|
|
598
|
+
case 210: base.extrusionDirection.x = parseFloat(p.value); break;
|
|
599
|
+
case 220: base.extrusionDirection.y = parseFloat(p.value); break;
|
|
600
|
+
case 230: base.extrusionDirection.z = parseFloat(p.value); break;
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
return base;
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
function parseDimensionEntity(base, pairs) {
|
|
607
|
+
base.blockName = ""; base.definitionPoint = { x: 0, y: 0, z: 0 };
|
|
608
|
+
base.middleOfText = { x: 0, y: 0, z: 0 }; base.insertionPoint = { x: 0, y: 0, z: 0 };
|
|
609
|
+
base.dimensionType = 0; base.text = ""; base.styleName = "STANDARD"; base.rotation = 0;
|
|
610
|
+
base.point1 = { x: 0, y: 0, z: 0 }; base.point2 = { x: 0, y: 0, z: 0 };
|
|
611
|
+
for (const p of pairs) {
|
|
612
|
+
switch (p.code) {
|
|
613
|
+
case 1: base.text = p.value; break; case 2: base.blockName = p.value; break;
|
|
614
|
+
case 3: base.styleName = p.value; break;
|
|
615
|
+
case 10: base.definitionPoint.x = parseFloat(p.value); break;
|
|
616
|
+
case 20: base.definitionPoint.y = parseFloat(p.value); break;
|
|
617
|
+
case 30: base.definitionPoint.z = parseFloat(p.value); break;
|
|
618
|
+
case 11: base.middleOfText.x = parseFloat(p.value); break;
|
|
619
|
+
case 21: base.middleOfText.y = parseFloat(p.value); break;
|
|
620
|
+
case 31: base.middleOfText.z = parseFloat(p.value); break;
|
|
621
|
+
case 13: base.point1.x = parseFloat(p.value); break;
|
|
622
|
+
case 23: base.point1.y = parseFloat(p.value); break;
|
|
623
|
+
case 33: base.point1.z = parseFloat(p.value); break;
|
|
624
|
+
case 14: base.point2.x = parseFloat(p.value); break;
|
|
625
|
+
case 24: base.point2.y = parseFloat(p.value); break;
|
|
626
|
+
case 34: base.point2.z = parseFloat(p.value); break;
|
|
627
|
+
case 40: base.leaderLength = parseFloat(p.value); break;
|
|
628
|
+
case 50: base.rotation = parseFloat(p.value); break;
|
|
629
|
+
case 70: base.dimensionType = parseInt(p.value, 10); break;
|
|
630
|
+
case 71: base.attachmentPoint = parseInt(p.value, 10); break;
|
|
631
|
+
}
|
|
632
|
+
}
|
|
633
|
+
return base;
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
function parseLeaderEntity(base, pairs) {
|
|
637
|
+
base.styleName = "STANDARD"; base.arrowheadFlag = 1; base.pathType = 0;
|
|
638
|
+
base.creationType = 0; base.hooklineFlag = 0; base.vertices = [];
|
|
639
|
+
base.annotationReference = null;
|
|
640
|
+
base.normal = { x: 0, y: 0, z: 1 }; base.horizontalDirection = { x: 1, y: 0, z: 0 };
|
|
641
|
+
let currentX = null;
|
|
642
|
+
for (const p of pairs) {
|
|
643
|
+
switch (p.code) {
|
|
644
|
+
case 3: base.styleName = p.value; break;
|
|
645
|
+
case 10: currentX = parseFloat(p.value); break;
|
|
646
|
+
case 20:
|
|
647
|
+
if (currentX !== null) { base.vertices.push({ x: currentX, y: parseFloat(p.value), z: 0 }); currentX = null; } break;
|
|
648
|
+
case 30: if (base.vertices.length > 0) base.vertices[base.vertices.length - 1].z = parseFloat(p.value); break;
|
|
649
|
+
case 40: base.textHeight = parseFloat(p.value); break;
|
|
650
|
+
case 41: base.textWidth = parseFloat(p.value); break;
|
|
651
|
+
case 71: base.arrowheadFlag = parseInt(p.value, 10); break;
|
|
652
|
+
case 72: base.pathType = parseInt(p.value, 10); break;
|
|
653
|
+
case 73: base.creationType = parseInt(p.value, 10); break;
|
|
654
|
+
case 76: base.vertexCount = parseInt(p.value, 10); break;
|
|
655
|
+
case 340: base.annotationReference = p.value; break;
|
|
656
|
+
}
|
|
657
|
+
}
|
|
658
|
+
return base;
|
|
659
|
+
}
|
|
660
|
+
|
|
661
|
+
function parseMLeaderEntity(base, pairs) {
|
|
662
|
+
base.styleName = ""; base.text = ""; base.leaderPoints = [];
|
|
663
|
+
base.contentType = 0; base.textStyleId = "";
|
|
664
|
+
let currentX = null;
|
|
665
|
+
for (const p of pairs) {
|
|
666
|
+
switch (p.code) {
|
|
667
|
+
case 3: base.styleName = p.value; break;
|
|
668
|
+
case 304: base.text = p.value; break;
|
|
669
|
+
case 170: base.contentType = parseInt(p.value, 10); break;
|
|
670
|
+
case 340: base.textStyleId = p.value; break;
|
|
671
|
+
case 10: currentX = parseFloat(p.value); break;
|
|
672
|
+
case 20:
|
|
673
|
+
if (currentX !== null) { base.leaderPoints.push({ x: currentX, y: parseFloat(p.value), z: 0 }); currentX = null; } break;
|
|
674
|
+
case 30: if (base.leaderPoints.length > 0) base.leaderPoints[base.leaderPoints.length - 1].z = parseFloat(p.value); break;
|
|
675
|
+
case 40: base.doglegLength = parseFloat(p.value); break;
|
|
676
|
+
case 41: base.arrowheadSize = parseFloat(p.value); break;
|
|
677
|
+
case 42: base.textHeight = parseFloat(p.value); break;
|
|
678
|
+
}
|
|
679
|
+
}
|
|
680
|
+
return base;
|
|
681
|
+
}
|
|
682
|
+
|
|
683
|
+
function parseHatchEntity(base, pairs) {
|
|
684
|
+
base.patternName = ""; base.solid = false; base.associative = false;
|
|
685
|
+
base.style = 0; base.patternType = 0; base.patternAngle = 0; base.patternScale = 1;
|
|
686
|
+
base.elevation = 0; base.extrusionDirection = { x: 0, y: 0, z: 1 };
|
|
687
|
+
base.boundaryPaths = []; base.seedPoints = [];
|
|
688
|
+
let readingBoundary = false; let currentPath = null;
|
|
689
|
+
for (const p of pairs) {
|
|
690
|
+
switch (p.code) {
|
|
691
|
+
case 2: base.patternName = p.value; break;
|
|
692
|
+
case 10: if (readingBoundary && currentPath) { currentPath.points = currentPath.points || []; currentPath.points.push({ x: parseFloat(p.value) }); } break;
|
|
693
|
+
case 20: if (readingBoundary && currentPath && currentPath.points && currentPath.points.length > 0) currentPath.points[currentPath.points.length - 1].y = parseFloat(p.value); break;
|
|
694
|
+
case 30: base.elevation = parseFloat(p.value); break;
|
|
695
|
+
case 41: base.patternScale = parseFloat(p.value); break;
|
|
696
|
+
case 52: base.patternAngle = parseFloat(p.value); break;
|
|
697
|
+
case 70: base.solid = parseInt(p.value, 10) === 1; break;
|
|
698
|
+
case 71: base.associative = parseInt(p.value, 10) === 1; break;
|
|
699
|
+
case 75: base.style = parseInt(p.value, 10); break;
|
|
700
|
+
case 76: base.patternType = parseInt(p.value, 10); break;
|
|
701
|
+
case 91: readingBoundary = true; break;
|
|
702
|
+
case 92: if (currentPath) base.boundaryPaths.push(currentPath); currentPath = { type: parseInt(p.value, 10), edges: [], points: [] }; break;
|
|
703
|
+
case 93: if (currentPath) currentPath.edgeCount = parseInt(p.value, 10); break;
|
|
704
|
+
case 97: if (currentPath) base.boundaryPaths.push(currentPath); currentPath = null; readingBoundary = false; break;
|
|
705
|
+
case 210: base.extrusionDirection.x = parseFloat(p.value); break;
|
|
706
|
+
case 220: base.extrusionDirection.y = parseFloat(p.value); break;
|
|
707
|
+
case 230: base.extrusionDirection.z = parseFloat(p.value); break;
|
|
708
|
+
}
|
|
709
|
+
}
|
|
710
|
+
if (currentPath) base.boundaryPaths.push(currentPath);
|
|
711
|
+
return base;
|
|
712
|
+
}
|
|
713
|
+
|
|
714
|
+
function parseSplineEntity(base, pairs) {
|
|
715
|
+
base.normal = { x: 0, y: 0, z: 1 }; base.degree = 3;
|
|
716
|
+
base.closed = false; base.periodic = false; base.rational = false; base.planar = false;
|
|
717
|
+
base.knotTolerance = 0.0000001; base.controlPointTolerance = 0.0000001;
|
|
718
|
+
base.fitTolerance = 0.0000000001;
|
|
719
|
+
base.startTangent = { x: 0, y: 0, z: 0 }; base.endTangent = { x: 0, y: 0, z: 0 };
|
|
720
|
+
base.knots = []; base.weights = []; base.controlPoints = []; base.fitPoints = [];
|
|
721
|
+
let cpX = null, fpX = null;
|
|
722
|
+
for (const p of pairs) {
|
|
723
|
+
switch (p.code) {
|
|
724
|
+
case 10: cpX = parseFloat(p.value); break;
|
|
725
|
+
case 20: if (cpX !== null) { base.controlPoints.push({ x: cpX, y: parseFloat(p.value), z: 0 }); cpX = null; } break;
|
|
726
|
+
case 30: if (base.controlPoints.length > 0) base.controlPoints[base.controlPoints.length - 1].z = parseFloat(p.value); break;
|
|
727
|
+
case 11: fpX = parseFloat(p.value); break;
|
|
728
|
+
case 21: if (fpX !== null) { base.fitPoints.push({ x: fpX, y: parseFloat(p.value), z: 0 }); fpX = null; } break;
|
|
729
|
+
case 31: if (base.fitPoints.length > 0) base.fitPoints[base.fitPoints.length - 1].z = parseFloat(p.value); break;
|
|
730
|
+
case 12: base.startTangent.x = parseFloat(p.value); break;
|
|
731
|
+
case 22: base.startTangent.y = parseFloat(p.value); break;
|
|
732
|
+
case 32: base.startTangent.z = parseFloat(p.value); break;
|
|
733
|
+
case 13: base.endTangent.x = parseFloat(p.value); break;
|
|
734
|
+
case 23: base.endTangent.y = parseFloat(p.value); break;
|
|
735
|
+
case 33: base.endTangent.z = parseFloat(p.value); break;
|
|
736
|
+
case 40: base.knots.push(parseFloat(p.value)); break;
|
|
737
|
+
case 41: base.weights.push(parseFloat(p.value)); break;
|
|
738
|
+
case 42: base.knotTolerance = parseFloat(p.value); break;
|
|
739
|
+
case 43: base.controlPointTolerance = parseFloat(p.value); break;
|
|
740
|
+
case 44: base.fitTolerance = parseFloat(p.value); break;
|
|
741
|
+
case 70: { const f = parseInt(p.value, 10); base.closed = (f & 1) === 1; base.periodic = (f & 2) === 2; base.rational = (f & 4) === 4; base.planar = (f & 8) === 8; base.flags = f; break; }
|
|
742
|
+
case 71: base.degree = parseInt(p.value, 10); break;
|
|
743
|
+
case 72: base.knotCount = parseInt(p.value, 10); break;
|
|
744
|
+
case 73: base.controlPointCount = parseInt(p.value, 10); break;
|
|
745
|
+
case 74: base.fitPointCount = parseInt(p.value, 10); break;
|
|
746
|
+
case 210: base.normal.x = parseFloat(p.value); break;
|
|
747
|
+
case 220: base.normal.y = parseFloat(p.value); break;
|
|
748
|
+
case 230: base.normal.z = parseFloat(p.value); break;
|
|
749
|
+
}
|
|
750
|
+
}
|
|
751
|
+
return base;
|
|
752
|
+
}
|
|
753
|
+
|
|
754
|
+
function parseSolidEntity(base, pairs) {
|
|
755
|
+
base.points = [{ x: 0, y: 0, z: 0 }, { x: 0, y: 0, z: 0 }, { x: 0, y: 0, z: 0 }, { x: 0, y: 0, z: 0 }];
|
|
756
|
+
base.thickness = 0; base.extrusionDirection = { x: 0, y: 0, z: 1 };
|
|
757
|
+
for (const p of pairs) {
|
|
758
|
+
switch (p.code) {
|
|
759
|
+
case 10: base.points[0].x = parseFloat(p.value); break; case 20: base.points[0].y = parseFloat(p.value); break; case 30: base.points[0].z = parseFloat(p.value); break;
|
|
760
|
+
case 11: base.points[1].x = parseFloat(p.value); break; case 21: base.points[1].y = parseFloat(p.value); break; case 31: base.points[1].z = parseFloat(p.value); break;
|
|
761
|
+
case 12: base.points[2].x = parseFloat(p.value); break; case 22: base.points[2].y = parseFloat(p.value); break; case 32: base.points[2].z = parseFloat(p.value); break;
|
|
762
|
+
case 13: base.points[3].x = parseFloat(p.value); break; case 23: base.points[3].y = parseFloat(p.value); break; case 33: base.points[3].z = parseFloat(p.value); break;
|
|
763
|
+
case 39: base.thickness = parseFloat(p.value); break;
|
|
764
|
+
case 210: base.extrusionDirection.x = parseFloat(p.value); break;
|
|
765
|
+
case 220: base.extrusionDirection.y = parseFloat(p.value); break;
|
|
766
|
+
case 230: base.extrusionDirection.z = parseFloat(p.value); break;
|
|
767
|
+
}
|
|
768
|
+
}
|
|
769
|
+
return base;
|
|
770
|
+
}
|
|
771
|
+
|
|
772
|
+
function parse3DFaceEntity(base, pairs) {
|
|
773
|
+
base.vertices = [{ x: 0, y: 0, z: 0 }, { x: 0, y: 0, z: 0 }, { x: 0, y: 0, z: 0 }, { x: 0, y: 0, z: 0 }];
|
|
774
|
+
base.invisibleEdgeFlags = 0;
|
|
775
|
+
for (const p of pairs) {
|
|
776
|
+
switch (p.code) {
|
|
777
|
+
case 10: base.vertices[0].x = parseFloat(p.value); break; case 20: base.vertices[0].y = parseFloat(p.value); break; case 30: base.vertices[0].z = parseFloat(p.value); break;
|
|
778
|
+
case 11: base.vertices[1].x = parseFloat(p.value); break; case 21: base.vertices[1].y = parseFloat(p.value); break; case 31: base.vertices[1].z = parseFloat(p.value); break;
|
|
779
|
+
case 12: base.vertices[2].x = parseFloat(p.value); break; case 22: base.vertices[2].y = parseFloat(p.value); break; case 32: base.vertices[2].z = parseFloat(p.value); break;
|
|
780
|
+
case 13: base.vertices[3].x = parseFloat(p.value); break; case 23: base.vertices[3].y = parseFloat(p.value); break; case 33: base.vertices[3].z = parseFloat(p.value); break;
|
|
781
|
+
case 70: base.invisibleEdgeFlags = parseInt(p.value, 10); break;
|
|
782
|
+
}
|
|
783
|
+
}
|
|
784
|
+
return base;
|
|
785
|
+
}
|
|
786
|
+
|
|
787
|
+
function parseRayEntity(base, pairs) {
|
|
788
|
+
base.basePoint = { x: 0, y: 0, z: 0 }; base.direction = { x: 1, y: 0, z: 0 };
|
|
789
|
+
for (const p of pairs) {
|
|
790
|
+
switch (p.code) {
|
|
791
|
+
case 10: base.basePoint.x = parseFloat(p.value); break; case 20: base.basePoint.y = parseFloat(p.value); break; case 30: base.basePoint.z = parseFloat(p.value); break;
|
|
792
|
+
case 11: base.direction.x = parseFloat(p.value); break; case 21: base.direction.y = parseFloat(p.value); break; case 31: base.direction.z = parseFloat(p.value); break;
|
|
793
|
+
}
|
|
794
|
+
}
|
|
795
|
+
return base;
|
|
796
|
+
}
|
|
797
|
+
|
|
798
|
+
function parseViewportEntity(base, pairs) {
|
|
799
|
+
base.center = { x: 0, y: 0, z: 0 }; base.width = 0; base.height = 0;
|
|
800
|
+
base.viewTarget = { x: 0, y: 0, z: 0 }; base.viewDirection = { x: 0, y: 0, z: 1 };
|
|
801
|
+
base.viewTwistAngle = 0; base.viewHeight = 0; base.viewCenter = { x: 0, y: 0 };
|
|
802
|
+
base.perspectiveLensLength = 50; base.statusField = 0;
|
|
803
|
+
base.clippingBoundary = null; base.frozenLayers = [];
|
|
804
|
+
for (const p of pairs) {
|
|
805
|
+
switch (p.code) {
|
|
806
|
+
case 10: base.center.x = parseFloat(p.value); break; case 20: base.center.y = parseFloat(p.value); break; case 30: base.center.z = parseFloat(p.value); break;
|
|
807
|
+
case 12: base.viewCenter.x = parseFloat(p.value); break; case 22: base.viewCenter.y = parseFloat(p.value); break;
|
|
808
|
+
case 40: base.width = parseFloat(p.value); break; case 41: base.height = parseFloat(p.value); break;
|
|
809
|
+
case 45: base.viewHeight = parseFloat(p.value); break;
|
|
810
|
+
case 51: base.viewTwistAngle = parseFloat(p.value); break;
|
|
811
|
+
case 68: base.statusField = parseInt(p.value, 10); break;
|
|
812
|
+
case 69: base.id = parseInt(p.value, 10); break;
|
|
813
|
+
case 331: base.frozenLayers.push(p.value); break;
|
|
814
|
+
case 340: base.clippingBoundary = p.value; break;
|
|
815
|
+
}
|
|
816
|
+
}
|
|
817
|
+
return base;
|
|
818
|
+
}
|
|
819
|
+
|
|
820
|
+
function parseImageEntity(base, pairs) {
|
|
821
|
+
base.insertionPoint = { x: 0, y: 0, z: 0 }; base.uVector = { x: 1, y: 0, z: 0 };
|
|
822
|
+
base.vVector = { x: 0, y: 1, z: 0 }; base.imageSize = { u: 0, v: 0 };
|
|
823
|
+
base.imageDefHandle = ""; base.displayFlags = 0; base.clippingType = 0;
|
|
824
|
+
base.brightness = 50; base.contrast = 50; base.fade = 0; base.clippingVertices = [];
|
|
825
|
+
for (const p of pairs) {
|
|
826
|
+
switch (p.code) {
|
|
827
|
+
case 10: base.insertionPoint.x = parseFloat(p.value); break; case 20: base.insertionPoint.y = parseFloat(p.value); break; case 30: base.insertionPoint.z = parseFloat(p.value); break;
|
|
828
|
+
case 13: base.imageSize.u = parseFloat(p.value); break; case 23: base.imageSize.v = parseFloat(p.value); break;
|
|
829
|
+
case 14: base.clippingVertices.push({ x: parseFloat(p.value) }); break;
|
|
830
|
+
case 24: if (base.clippingVertices.length > 0) base.clippingVertices[base.clippingVertices.length - 1].y = parseFloat(p.value); break;
|
|
831
|
+
case 70: base.displayFlags = parseInt(p.value, 10); break;
|
|
832
|
+
case 340: base.imageDefHandle = p.value; break;
|
|
833
|
+
}
|
|
834
|
+
}
|
|
835
|
+
return base;
|
|
836
|
+
}
|
|
837
|
+
|
|
838
|
+
function parseToleranceEntity(base, pairs) {
|
|
839
|
+
base.insertionPoint = { x: 0, y: 0, z: 0 }; base.direction = { x: 1, y: 0, z: 0 };
|
|
840
|
+
base.styleName = "STANDARD"; base.text = "";
|
|
841
|
+
for (const p of pairs) {
|
|
842
|
+
switch (p.code) {
|
|
843
|
+
case 1: base.text = p.value; break; case 3: base.styleName = p.value; break;
|
|
844
|
+
case 10: base.insertionPoint.x = parseFloat(p.value); break; case 20: base.insertionPoint.y = parseFloat(p.value); break; case 30: base.insertionPoint.z = parseFloat(p.value); break;
|
|
845
|
+
case 11: base.direction.x = parseFloat(p.value); break; case 21: base.direction.y = parseFloat(p.value); break; case 31: base.direction.z = parseFloat(p.value); break;
|
|
846
|
+
}
|
|
847
|
+
}
|
|
848
|
+
return base;
|
|
849
|
+
}
|
|
850
|
+
|
|
851
|
+
function parseHelixEntity(base, pairs) {
|
|
852
|
+
base.axisBasePoint = { x: 0, y: 0, z: 0 }; base.startPoint = { x: 0, y: 0, z: 0 };
|
|
853
|
+
base.axisVector = { x: 0, y: 0, z: 1 }; base.radius = 0; base.turns = 1;
|
|
854
|
+
base.turnHeight = 0; base.handedness = 0; base.constraint = 0;
|
|
855
|
+
for (const p of pairs) {
|
|
856
|
+
switch (p.code) {
|
|
857
|
+
case 10: base.axisBasePoint.x = parseFloat(p.value); break; case 20: base.axisBasePoint.y = parseFloat(p.value); break; case 30: base.axisBasePoint.z = parseFloat(p.value); break;
|
|
858
|
+
case 11: base.startPoint.x = parseFloat(p.value); break; case 21: base.startPoint.y = parseFloat(p.value); break; case 31: base.startPoint.z = parseFloat(p.value); break;
|
|
859
|
+
case 40: base.radius = parseFloat(p.value); break; case 41: base.turns = parseFloat(p.value); break; case 42: base.turnHeight = parseFloat(p.value); break;
|
|
860
|
+
case 290: base.handedness = parseInt(p.value, 10); break; case 280: base.constraint = parseInt(p.value, 10); break;
|
|
861
|
+
}
|
|
862
|
+
}
|
|
863
|
+
return base;
|
|
864
|
+
}
|
|
865
|
+
|
|
866
|
+
function parseMeshEntity(base, pairs) {
|
|
867
|
+
base.version = 2; base.subdivisionLevel = 0; base.vertices = [];
|
|
868
|
+
base.faces = []; base.edges = []; base.edgeCreases = [];
|
|
869
|
+
let currentX = null; let readingFaces = false; let readingEdges = false; let readingCreases = false;
|
|
870
|
+
for (const p of pairs) {
|
|
871
|
+
switch (p.code) {
|
|
872
|
+
case 71: base.version = parseInt(p.value, 10); break;
|
|
873
|
+
case 72: base.subdivisionLevel = parseInt(p.value, 10); break;
|
|
874
|
+
case 91: readingFaces = false; break;
|
|
875
|
+
case 92: readingFaces = true; break;
|
|
876
|
+
case 93: readingEdges = true; readingFaces = false; break;
|
|
877
|
+
case 94: readingCreases = true; readingEdges = false; break;
|
|
878
|
+
case 95: readingCreases = false; break;
|
|
879
|
+
case 10: currentX = parseFloat(p.value); break;
|
|
880
|
+
case 20: if (currentX !== null) { base.vertices.push({ x: currentX, y: parseFloat(p.value), z: 0 }); currentX = null; } break;
|
|
881
|
+
case 30: if (base.vertices.length > 0) base.vertices[base.vertices.length - 1].z = parseFloat(p.value); break;
|
|
882
|
+
case 90: if (readingFaces) base.faces.push(parseInt(p.value, 10)); else if (readingEdges) base.edges.push(parseInt(p.value, 10)); break;
|
|
883
|
+
case 140: if (readingCreases) base.edgeCreases.push(parseFloat(p.value)); break;
|
|
884
|
+
}
|
|
885
|
+
}
|
|
886
|
+
return base;
|
|
887
|
+
}
|
|
888
|
+
|
|
889
|
+
function parseRegionEntity(base, pairs) {
|
|
890
|
+
base.acisData = [];
|
|
891
|
+
for (const p of pairs) { if (p.code === 1 || p.code === 3) base.acisData.push(p.value); if (p.code === 70) base.modelerFormat = parseInt(p.value, 10); }
|
|
892
|
+
base.acisDataString = base.acisData.join("");
|
|
893
|
+
return base;
|
|
894
|
+
}
|
|
895
|
+
|
|
896
|
+
function parseOle2Entity(base, pairs) {
|
|
897
|
+
base.upperLeftCorner = { x: 0, y: 0, z: 0 }; base.lowerRightCorner = { x: 0, y: 0, z: 0 };
|
|
898
|
+
base.oleType = 0; base.tileMode = 0;
|
|
899
|
+
for (const p of pairs) {
|
|
900
|
+
switch (p.code) {
|
|
901
|
+
case 10: base.upperLeftCorner.x = parseFloat(p.value); break; case 20: base.upperLeftCorner.y = parseFloat(p.value); break;
|
|
902
|
+
case 11: base.lowerRightCorner.x = parseFloat(p.value); break; case 21: base.lowerRightCorner.y = parseFloat(p.value); break;
|
|
903
|
+
case 70: base.oleType = parseInt(p.value, 10); break; case 71: base.tileMode = parseInt(p.value, 10); break;
|
|
904
|
+
case 1: case 3: base.binaryData = base.binaryData || []; base.binaryData.push(p.value); break;
|
|
905
|
+
}
|
|
906
|
+
}
|
|
907
|
+
return base;
|
|
908
|
+
}
|
|
909
|
+
|
|
910
|
+
function parseTableEntity(base, pairs) {
|
|
911
|
+
base.insertionPoint = { x: 0, y: 0, z: 0 }; base.blockName = "";
|
|
912
|
+
base.direction = { x: 1, y: 0, z: 0 }; base.rows = 0; base.columns = 0;
|
|
913
|
+
for (const p of pairs) {
|
|
914
|
+
switch (p.code) {
|
|
915
|
+
case 2: base.blockName = p.value; break;
|
|
916
|
+
case 10: base.insertionPoint.x = parseFloat(p.value); break; case 20: base.insertionPoint.y = parseFloat(p.value); break;
|
|
917
|
+
case 11: base.direction.x = parseFloat(p.value); break; case 21: base.direction.y = parseFloat(p.value); break;
|
|
918
|
+
case 91: base.rows = parseInt(p.value, 10); break; case 92: base.columns = parseInt(p.value, 10); break;
|
|
919
|
+
case 142: base.rowHeights = base.rowHeights || []; base.rowHeights.push(parseFloat(p.value)); break;
|
|
920
|
+
case 141: base.columnWidths = base.columnWidths || []; base.columnWidths.push(parseFloat(p.value)); break;
|
|
921
|
+
}
|
|
922
|
+
}
|
|
923
|
+
return base;
|
|
924
|
+
}
|
|
925
|
+
|
|
926
|
+
function parseMLineEntity(base, pairs) {
|
|
927
|
+
base.styleName = "STANDARD"; base.scale = 1; base.justification = 0; base.flags = 0;
|
|
928
|
+
base.startPoint = { x: 0, y: 0, z: 0 }; base.normal = { x: 0, y: 0, z: 1 }; base.vertices = [];
|
|
929
|
+
let currentX = null;
|
|
930
|
+
for (const p of pairs) {
|
|
931
|
+
switch (p.code) {
|
|
932
|
+
case 2: base.styleName = p.value; break;
|
|
933
|
+
case 10: base.startPoint.x = parseFloat(p.value); break; case 20: base.startPoint.y = parseFloat(p.value); break; case 30: base.startPoint.z = parseFloat(p.value); break;
|
|
934
|
+
case 11: currentX = parseFloat(p.value); break;
|
|
935
|
+
case 21: if (currentX !== null) { base.vertices.push({ x: currentX, y: parseFloat(p.value), z: 0 }); currentX = null; } break;
|
|
936
|
+
case 31: if (base.vertices.length > 0) base.vertices[base.vertices.length - 1].z = parseFloat(p.value); break;
|
|
937
|
+
case 40: base.scale = parseFloat(p.value); break;
|
|
938
|
+
case 70: base.justification = parseInt(p.value, 10); break;
|
|
939
|
+
case 71: base.flags = parseInt(p.value, 10); break;
|
|
940
|
+
case 72: base.vertexCount = parseInt(p.value, 10); break;
|
|
941
|
+
case 340: base.styleHandle = p.value; break;
|
|
942
|
+
case 210: base.normal.x = parseFloat(p.value); break; case 220: base.normal.y = parseFloat(p.value); break; case 230: base.normal.z = parseFloat(p.value); break;
|
|
943
|
+
}
|
|
944
|
+
}
|
|
945
|
+
return base;
|
|
946
|
+
}
|
|
947
|
+
|
|
948
|
+
function parseGenericEntity(base, pairs) {
|
|
949
|
+
base.data = {};
|
|
950
|
+
for (const p of pairs) {
|
|
951
|
+
const key = `code_${p.code}`;
|
|
952
|
+
const val = autoConvert(p.code, p.value);
|
|
953
|
+
if (base.data[key] !== undefined) base.data[key] = [].concat(base.data[key], val);
|
|
954
|
+
else base.data[key] = val;
|
|
955
|
+
}
|
|
956
|
+
return base;
|
|
957
|
+
}
|
|
958
|
+
|
|
959
|
+
function parseObjects(pairs) {
|
|
960
|
+
if (!pairs || pairs.length === 0) return [];
|
|
961
|
+
const objects = []; let i = 0;
|
|
962
|
+
while (i < pairs.length) {
|
|
963
|
+
if (pairs[i].code === 0) {
|
|
964
|
+
const objType = pairs[i].value; i++;
|
|
965
|
+
const obj = { type: objType };
|
|
966
|
+
while (i < pairs.length && pairs[i].code !== 0) {
|
|
967
|
+
const code = pairs[i].code; const val = autoConvert(code, pairs[i].value);
|
|
968
|
+
switch (code) {
|
|
969
|
+
case 5: obj.handle = val; break; case 2: obj.name = val; break;
|
|
970
|
+
case 3: obj.entryName = obj.entryName ? [].concat(obj.entryName, val) : val; break;
|
|
971
|
+
case 330: obj.ownerHandle = val; break;
|
|
972
|
+
case 350: obj.softPointer = obj.softPointer ? [].concat(obj.softPointer, val) : val; break;
|
|
973
|
+
case 360: obj.hardPointer = obj.hardPointer ? [].concat(obj.hardPointer, val) : val; break;
|
|
974
|
+
default: const key = `code_${code}`; if (obj[key] !== undefined) obj[key] = [].concat(obj[key], val); else obj[key] = val;
|
|
975
|
+
}
|
|
976
|
+
i++;
|
|
977
|
+
}
|
|
978
|
+
objects.push(obj);
|
|
979
|
+
} else { i++; }
|
|
980
|
+
}
|
|
981
|
+
return objects;
|
|
982
|
+
}
|
|
983
|
+
|
|
984
|
+
function assemblePolylineVertices(entities) {
|
|
985
|
+
const result = []; let currentPolyline = null;
|
|
986
|
+
for (const entity of entities) {
|
|
987
|
+
if (entity.type === "POLYLINE") { currentPolyline = entity; result.push(entity); }
|
|
988
|
+
else if (entity.type === "VERTEX" && currentPolyline) {
|
|
989
|
+
currentPolyline.vertices.push({ x: entity.position.x, y: entity.position.y, z: entity.position.z, bulge: entity.bulge, startWidth: entity.startWidth, endWidth: entity.endWidth, flags: entity.flags, faceVertex1: entity.faceVertex1, faceVertex2: entity.faceVertex2, faceVertex3: entity.faceVertex3, faceVertex4: entity.faceVertex4 });
|
|
990
|
+
} else if (entity.type === "SEQEND") { currentPolyline = null; }
|
|
991
|
+
else { currentPolyline = null; result.push(entity); }
|
|
992
|
+
}
|
|
993
|
+
return result;
|
|
994
|
+
}
|
|
995
|
+
|
|
996
|
+
function assembleInsertAttributes(entities) {
|
|
997
|
+
const result = []; let currentInsert = null;
|
|
998
|
+
for (const entity of entities) {
|
|
999
|
+
if (entity.type === "INSERT" && entity.hasAttributes) { currentInsert = entity; result.push(entity); }
|
|
1000
|
+
else if (entity.type === "ATTRIB" && currentInsert) { currentInsert.attributes.push(entity); }
|
|
1001
|
+
else if (entity.type === "SEQEND") { currentInsert = null; }
|
|
1002
|
+
else { currentInsert = null; result.push(entity); }
|
|
1003
|
+
}
|
|
1004
|
+
return result;
|
|
1005
|
+
}
|
|
1006
|
+
|
|
1007
|
+
// ─────────────────── 输入适配(关键改动部分) ───────────────────
|
|
1008
|
+
|
|
1009
|
+
/**
|
|
1010
|
+
* ★ 改动点: 从 URL 获取 DXF 文本
|
|
1011
|
+
*/
|
|
1012
|
+
async function fetchDxfFromUrl(url) {
|
|
1013
|
+
if (typeof fetch === "function") {
|
|
1014
|
+
const resp = await fetch(url);
|
|
1015
|
+
if (!resp.ok) throw new Error(`获取 DXF 失败: HTTP ${resp.status} — ${url}`);
|
|
1016
|
+
return await resp.text();
|
|
1017
|
+
}
|
|
1018
|
+
// Node < 18 降级
|
|
1019
|
+
if (typeof process !== "undefined" && process.versions?.node) {
|
|
1020
|
+
const { default: http } = url.startsWith("https") ? await import('https') : await import('http');
|
|
1021
|
+
return new Promise((resolve, reject) => {
|
|
1022
|
+
http.get(url, (res) => {
|
|
1023
|
+
if (res.statusCode !== 200) { reject(new Error(`HTTP ${res.statusCode}`)); return; }
|
|
1024
|
+
let data = ""; res.setEncoding("utf-8");
|
|
1025
|
+
res.on("data", (c) => (data += c)); res.on("end", () => resolve(data)); res.on("error", reject);
|
|
1026
|
+
}).on("error", reject);
|
|
1027
|
+
});
|
|
1028
|
+
}
|
|
1029
|
+
throw new Error("当前环境不支持 HTTP 请求");
|
|
1030
|
+
}
|
|
1031
|
+
|
|
1032
|
+
/**
|
|
1033
|
+
* ★ 改动点: 读取本地文件,动态 import("fs")
|
|
1034
|
+
*/
|
|
1035
|
+
async function readLocalFile(filePath) {
|
|
1036
|
+
if (typeof process !== "undefined" && process.versions?.node) {
|
|
1037
|
+
const { readFile } = await import('fs/promises');
|
|
1038
|
+
return await readFile(filePath, "utf-8");
|
|
1039
|
+
}
|
|
1040
|
+
throw new Error("浏览器不支持读取本地路径,请用 URL 或 File 对象");
|
|
1041
|
+
}
|
|
1042
|
+
|
|
1043
|
+
// ─────────────────── 主入口 ───────────────────
|
|
1044
|
+
|
|
1045
|
+
/**
|
|
1046
|
+
* ★ 改动点: 支持 字符串 / 文件路径 / URL / File 对象
|
|
1047
|
+
*/
|
|
1048
|
+
async function parseDxf(input) {
|
|
1049
|
+
let dxfString;
|
|
1050
|
+
|
|
1051
|
+
if (typeof Blob !== "undefined" && input instanceof Blob) {
|
|
1052
|
+
dxfString = await input.text();
|
|
1053
|
+
} else if (typeof input === "string") {
|
|
1054
|
+
if (input.includes("\n") || input.includes("SECTION")) {
|
|
1055
|
+
dxfString = input;
|
|
1056
|
+
} else if (/^https?:\/\//i.test(input)) {
|
|
1057
|
+
dxfString = await fetchDxfFromUrl(input);
|
|
1058
|
+
} else {
|
|
1059
|
+
dxfString = await readLocalFile(input);
|
|
1060
|
+
}
|
|
1061
|
+
} else {
|
|
1062
|
+
throw new Error("parseDxf: 请传入 DXF 字符串、文件路径、URL 或 File 对象");
|
|
1063
|
+
}
|
|
1064
|
+
|
|
1065
|
+
const pairs = tokenize(dxfString);
|
|
1066
|
+
const sections = splitSections(pairs);
|
|
1067
|
+
const result = {
|
|
1068
|
+
header: parseHeader(sections.HEADER),
|
|
1069
|
+
classes: parseClasses(sections.CLASSES),
|
|
1070
|
+
tables: parseTables(sections.TABLES),
|
|
1071
|
+
blocks: parseBlocks(sections.BLOCKS),
|
|
1072
|
+
entities: parseEntityList(sections.ENTITIES || []),
|
|
1073
|
+
objects: parseObjects(sections.OBJECTS),
|
|
1074
|
+
};
|
|
1075
|
+
result.entities = assemblePolylineVertices(result.entities);
|
|
1076
|
+
result.entities = assembleInsertAttributes(result.entities);
|
|
1077
|
+
for (const block of result.blocks) {
|
|
1078
|
+
if (block.entities && block.entities.length > 0) {
|
|
1079
|
+
block.entities = assemblePolylineVertices(block.entities);
|
|
1080
|
+
block.entities = assembleInsertAttributes(block.entities);
|
|
1081
|
+
}
|
|
1082
|
+
}
|
|
1083
|
+
return result;
|
|
1084
|
+
}
|
|
1085
|
+
|
|
1086
|
+
/**
|
|
1087
|
+
* ============================================================
|
|
1088
|
+
* DXF 文件写入器
|
|
1089
|
+
* 将 parseDxf() 输出的 JSON 数据结构写回 DXF 文本格式
|
|
1090
|
+
* 支持所有 parser 中解析的实体类型
|
|
1091
|
+
*
|
|
1092
|
+
* ★ CJS → ESM 改动:
|
|
1093
|
+
* ① writeDxfFile 内 require("fs") → await import("fs/promises")
|
|
1094
|
+
* ② 末尾 module.exports → export
|
|
1095
|
+
* ③ 新增 downloadDxfFile() 浏览器下载方法
|
|
1096
|
+
* ============================================================
|
|
1097
|
+
*/
|
|
1098
|
+
|
|
1099
|
+
// ─────────────────── 工具函数 ───────────────────
|
|
1100
|
+
|
|
1101
|
+
/**
|
|
1102
|
+
* 写入一对 group code + value
|
|
1103
|
+
*/
|
|
1104
|
+
function pair(code, value) {
|
|
1105
|
+
if (value === undefined || value === null) return "";
|
|
1106
|
+
return ` ${code}\n${value}\n`;
|
|
1107
|
+
}
|
|
1108
|
+
|
|
1109
|
+
/** 写入浮点数,保留合理精度 */
|
|
1110
|
+
function pairF(code, value) {
|
|
1111
|
+
if (value === undefined || value === null) return "";
|
|
1112
|
+
return pair(code, formatFloat(value));
|
|
1113
|
+
}
|
|
1114
|
+
|
|
1115
|
+
/** 格式化浮点数:去掉多余尾零,但至少保留一位小数 */
|
|
1116
|
+
function formatFloat(v) {
|
|
1117
|
+
if (typeof v !== "number" || isNaN(v)) return "0.0";
|
|
1118
|
+
let s = v.toFixed(6);
|
|
1119
|
+
s = s.replace(/(\.\d*?)0+$/, "$1");
|
|
1120
|
+
if (s.endsWith(".")) s += "0";
|
|
1121
|
+
return s;
|
|
1122
|
+
}
|
|
1123
|
+
|
|
1124
|
+
/** 写入整数 */
|
|
1125
|
+
function pairI(code, value) {
|
|
1126
|
+
if (value === undefined || value === null) return "";
|
|
1127
|
+
return pair(code, Math.round(value));
|
|
1128
|
+
}
|
|
1129
|
+
|
|
1130
|
+
/** 写入 3D 点 (codeX, codeX+10, codeX+20) */
|
|
1131
|
+
function writePoint3D(baseCode, point) {
|
|
1132
|
+
if (!point) return "";
|
|
1133
|
+
return (
|
|
1134
|
+
pairF(baseCode, point.x) +
|
|
1135
|
+
pairF(baseCode + 10, point.y) +
|
|
1136
|
+
pairF(baseCode + 20, point.z)
|
|
1137
|
+
);
|
|
1138
|
+
}
|
|
1139
|
+
|
|
1140
|
+
/** 写入 2D 点 */
|
|
1141
|
+
function writePoint2D(baseCode, point) {
|
|
1142
|
+
if (!point) return "";
|
|
1143
|
+
return pairF(baseCode, point.x) + pairF(baseCode + 10, point.y);
|
|
1144
|
+
}
|
|
1145
|
+
|
|
1146
|
+
/** 写入挤出方向 (210/220/230) */
|
|
1147
|
+
function writeExtrusion(ext) {
|
|
1148
|
+
if (!ext) return "";
|
|
1149
|
+
if (ext.x === 0 && ext.y === 0 && ext.z === 1) return "";
|
|
1150
|
+
return pairF(210, ext.x) + pairF(220, ext.y) + pairF(230, ext.z);
|
|
1151
|
+
}
|
|
1152
|
+
|
|
1153
|
+
// ─────────────────── HEADER 写入 ───────────────────
|
|
1154
|
+
|
|
1155
|
+
function writeHeader(header) {
|
|
1156
|
+
if (!header || Object.keys(header).length === 0) return "";
|
|
1157
|
+
let out = pair(0, "SECTION") + pair(2, "HEADER");
|
|
1158
|
+
|
|
1159
|
+
for (const [varName, values] of Object.entries(header)) {
|
|
1160
|
+
out += pair(9, varName);
|
|
1161
|
+
if (typeof values === "object" && values !== null && !Array.isArray(values)) {
|
|
1162
|
+
for (const [code, val] of Object.entries(values)) {
|
|
1163
|
+
out += pair(parseInt(code), val);
|
|
1164
|
+
}
|
|
1165
|
+
} else {
|
|
1166
|
+
out += pair(1, values);
|
|
1167
|
+
}
|
|
1168
|
+
}
|
|
1169
|
+
|
|
1170
|
+
out += pair(0, "ENDSEC");
|
|
1171
|
+
return out;
|
|
1172
|
+
}
|
|
1173
|
+
|
|
1174
|
+
// ─────────────────── CLASSES 写入 ───────────────────
|
|
1175
|
+
|
|
1176
|
+
function writeClasses(classes) {
|
|
1177
|
+
if (!classes || classes.length === 0) return "";
|
|
1178
|
+
let out = pair(0, "SECTION") + pair(2, "CLASSES");
|
|
1179
|
+
|
|
1180
|
+
for (const cls of classes) {
|
|
1181
|
+
out += pair(0, "CLASS");
|
|
1182
|
+
if (cls.dxfRecord) out += pair(1, cls.dxfRecord);
|
|
1183
|
+
if (cls.cppClassName) out += pair(2, cls.cppClassName);
|
|
1184
|
+
if (cls.appName) out += pair(3, cls.appName);
|
|
1185
|
+
if (cls.proxyCapabilities !== undefined) out += pairI(90, cls.proxyCapabilities);
|
|
1186
|
+
if (cls.instanceCount !== undefined) out += pairI(91, cls.instanceCount);
|
|
1187
|
+
if (cls.wasProxy !== undefined) out += pairI(280, cls.wasProxy);
|
|
1188
|
+
if (cls.isEntity !== undefined) out += pairI(281, cls.isEntity);
|
|
1189
|
+
}
|
|
1190
|
+
|
|
1191
|
+
out += pair(0, "ENDSEC");
|
|
1192
|
+
return out;
|
|
1193
|
+
}
|
|
1194
|
+
|
|
1195
|
+
// ─────────────────── TABLES 写入 ───────────────────
|
|
1196
|
+
|
|
1197
|
+
function writeTables(tables) {
|
|
1198
|
+
if (!tables || Object.keys(tables).length === 0) return "";
|
|
1199
|
+
let out = pair(0, "SECTION") + pair(2, "TABLES");
|
|
1200
|
+
|
|
1201
|
+
for (const [tableName, entries] of Object.entries(tables)) {
|
|
1202
|
+
out += pair(0, "TABLE");
|
|
1203
|
+
out += pair(2, tableName);
|
|
1204
|
+
if (entries.length > 0) {
|
|
1205
|
+
const first = entries[0];
|
|
1206
|
+
if (first.handle) out += pair(5, first.handle);
|
|
1207
|
+
if (first.ownerHandle) out += pair(330, first.ownerHandle);
|
|
1208
|
+
out += pair(100, "AcDbSymbolTable");
|
|
1209
|
+
out += pairI(70, entries.length);
|
|
1210
|
+
}
|
|
1211
|
+
|
|
1212
|
+
for (const entry of entries) {
|
|
1213
|
+
out += pair(0, entry._type || tableName);
|
|
1214
|
+
if (entry.handle) out += pair(5, entry.handle);
|
|
1215
|
+
if (entry.ownerHandle) out += pair(330, entry.ownerHandle);
|
|
1216
|
+
if (entry.subclassMarker) {
|
|
1217
|
+
const markers = [].concat(entry.subclassMarker);
|
|
1218
|
+
for (const m of markers) {
|
|
1219
|
+
out += pair(100, m);
|
|
1220
|
+
}
|
|
1221
|
+
}
|
|
1222
|
+
if (entry.name) out += pair(2, entry.name);
|
|
1223
|
+
if (entry.flags !== undefined) out += pairI(70, entry.flags);
|
|
1224
|
+
if (entry.colorNumber !== undefined) out += pairI(62, entry.colorNumber);
|
|
1225
|
+
if (entry.linetypeName) out += pair(6, entry.linetypeName);
|
|
1226
|
+
if (entry.styleName) out += pair(7, entry.styleName);
|
|
1227
|
+
if (entry.height) out += pairF(40, entry.height);
|
|
1228
|
+
if (entry.widthFactor) out += pairF(41, entry.widthFactor);
|
|
1229
|
+
if (entry.angle) out += pairF(50, entry.angle);
|
|
1230
|
+
if (entry.lineweight !== undefined) out += pairI(370, entry.lineweight);
|
|
1231
|
+
if (entry.plotStyleHandle) out += pair(390, entry.plotStyleHandle);
|
|
1232
|
+
|
|
1233
|
+
if (entry.extra) {
|
|
1234
|
+
for (const [key, val] of Object.entries(entry)) {
|
|
1235
|
+
if (key.startsWith("code_")) {
|
|
1236
|
+
const code = parseInt(key.replace("code_", ""));
|
|
1237
|
+
const vals = [].concat(val);
|
|
1238
|
+
for (const v of vals) {
|
|
1239
|
+
out += pair(code, v);
|
|
1240
|
+
}
|
|
1241
|
+
}
|
|
1242
|
+
}
|
|
1243
|
+
}
|
|
1244
|
+
}
|
|
1245
|
+
|
|
1246
|
+
out += pair(0, "ENDTAB");
|
|
1247
|
+
}
|
|
1248
|
+
|
|
1249
|
+
out += pair(0, "ENDSEC");
|
|
1250
|
+
return out;
|
|
1251
|
+
}
|
|
1252
|
+
|
|
1253
|
+
// ─────────────────── BLOCKS 写入 ───────────────────
|
|
1254
|
+
|
|
1255
|
+
function writeBlocks(blocks) {
|
|
1256
|
+
if (!blocks || blocks.length === 0) return "";
|
|
1257
|
+
let out = pair(0, "SECTION") + pair(2, "BLOCKS");
|
|
1258
|
+
|
|
1259
|
+
for (const block of blocks) {
|
|
1260
|
+
out += pair(0, "BLOCK");
|
|
1261
|
+
if (block.handle) out += pair(5, block.handle);
|
|
1262
|
+
if (block.ownerHandle) out += pair(330, block.ownerHandle);
|
|
1263
|
+
out += pair(100, "AcDbEntity");
|
|
1264
|
+
if (block.layer) out += pair(8, block.layer);
|
|
1265
|
+
out += pair(100, "AcDbBlockBegin");
|
|
1266
|
+
if (block.name) out += pair(2, block.name);
|
|
1267
|
+
if (block.flags !== undefined) out += pairI(70, block.flags);
|
|
1268
|
+
out += pairF(10, block.basePointX || (block.basePoint && block.basePoint.x) || 0);
|
|
1269
|
+
out += pairF(20, block.basePointY || (block.basePoint && block.basePoint.y) || 0);
|
|
1270
|
+
out += pairF(30, block.basePointZ || (block.basePoint && block.basePoint.z) || 0);
|
|
1271
|
+
if (block.name2 || block.name) out += pair(3, block.name2 || block.name);
|
|
1272
|
+
|
|
1273
|
+
if (block.entities && block.entities.length > 0) {
|
|
1274
|
+
out += writeEntityList(block.entities);
|
|
1275
|
+
}
|
|
1276
|
+
|
|
1277
|
+
out += pair(0, "ENDBLK");
|
|
1278
|
+
if (block.handle) out += pair(5, block.handle);
|
|
1279
|
+
if (block.ownerHandle) out += pair(330, block.ownerHandle);
|
|
1280
|
+
out += pair(100, "AcDbEntity");
|
|
1281
|
+
if (block.layer) out += pair(8, block.layer);
|
|
1282
|
+
out += pair(100, "AcDbBlockEnd");
|
|
1283
|
+
}
|
|
1284
|
+
|
|
1285
|
+
out += pair(0, "ENDSEC");
|
|
1286
|
+
return out;
|
|
1287
|
+
}
|
|
1288
|
+
|
|
1289
|
+
// ─────────────────── ENTITIES 写入 ───────────────────
|
|
1290
|
+
|
|
1291
|
+
function writeEntityList(entities) {
|
|
1292
|
+
let out = "";
|
|
1293
|
+
for (const entity of entities) {
|
|
1294
|
+
out += writeOneEntity(entity);
|
|
1295
|
+
}
|
|
1296
|
+
return out;
|
|
1297
|
+
}
|
|
1298
|
+
|
|
1299
|
+
function writeEntitiesSection(entities) {
|
|
1300
|
+
if (!entities || entities.length === 0) return "";
|
|
1301
|
+
let out = pair(0, "SECTION") + pair(2, "ENTITIES");
|
|
1302
|
+
out += writeEntityList(entities);
|
|
1303
|
+
out += pair(0, "ENDSEC");
|
|
1304
|
+
return out;
|
|
1305
|
+
}
|
|
1306
|
+
|
|
1307
|
+
/** 写入通用实体头部字段 */
|
|
1308
|
+
function writeCommonFields(entity) {
|
|
1309
|
+
let out = "";
|
|
1310
|
+
if (entity.handle) out += pair(5, entity.handle);
|
|
1311
|
+
if (entity.ownerHandle) out += pair(330, entity.ownerHandle);
|
|
1312
|
+
out += pair(100, "AcDbEntity");
|
|
1313
|
+
if (entity.inPaperSpace) out += pairI(67, 1);
|
|
1314
|
+
if (entity.layer) out += pair(8, entity.layer);
|
|
1315
|
+
if (entity.linetypeName) out += pair(6, entity.linetypeName);
|
|
1316
|
+
if (entity.colorNumber !== undefined && entity.colorNumber !== 0) out += pairI(62, entity.colorNumber);
|
|
1317
|
+
if (entity.lineweight !== undefined) out += pairI(370, entity.lineweight);
|
|
1318
|
+
if (entity.linetypeScale !== undefined && entity.linetypeScale !== 1) out += pairF(48, entity.linetypeScale);
|
|
1319
|
+
if (entity.visible === false) out += pairI(60, 1);
|
|
1320
|
+
if (entity.trueColor) out += pairI(420, entity.trueColor);
|
|
1321
|
+
return out;
|
|
1322
|
+
}
|
|
1323
|
+
|
|
1324
|
+
/** 写入单个实体 */
|
|
1325
|
+
function writeOneEntity(entity) {
|
|
1326
|
+
if (!entity || !entity.type) return "";
|
|
1327
|
+
|
|
1328
|
+
let out = pair(0, entity.type);
|
|
1329
|
+
out += writeCommonFields(entity);
|
|
1330
|
+
|
|
1331
|
+
switch (entity.type) {
|
|
1332
|
+
case "LINE": out += writeLineEntity(entity); break;
|
|
1333
|
+
case "LWPOLYLINE": out += writeLWPolylineEntity(entity); break;
|
|
1334
|
+
case "POLYLINE": out += writePolylineEntity(entity); break;
|
|
1335
|
+
case "ARC": out += writeArcEntity(entity); break;
|
|
1336
|
+
case "CIRCLE": out += writeCircleEntity(entity); break;
|
|
1337
|
+
case "ELLIPSE": out += writeEllipseEntity(entity); break;
|
|
1338
|
+
case "POINT": out += writePointEntity(entity); break;
|
|
1339
|
+
case "TEXT": out += writeTextEntity(entity); break;
|
|
1340
|
+
case "MTEXT": out += writeMTextEntity(entity); break;
|
|
1341
|
+
case "ATTRIB":
|
|
1342
|
+
case "ATTDEF": out += writeAttribEntity(entity); break;
|
|
1343
|
+
case "INSERT": out += writeInsertEntity(entity); break;
|
|
1344
|
+
case "DIMENSION": out += writeDimensionEntity(entity); break;
|
|
1345
|
+
case "LEADER": out += writeLeaderEntity(entity); break;
|
|
1346
|
+
case "MLEADER": out += writeMLeaderEntity(entity); break;
|
|
1347
|
+
case "HATCH": out += writeHatchEntity(entity); break;
|
|
1348
|
+
case "SPLINE": out += writeSplineEntity(entity); break;
|
|
1349
|
+
case "SOLID":
|
|
1350
|
+
case "3DSOLID":
|
|
1351
|
+
case "TRACE": out += writeSolidEntity(entity); break;
|
|
1352
|
+
case "3DFACE": out += write3DFaceEntity(entity); break;
|
|
1353
|
+
case "RAY":
|
|
1354
|
+
case "XLINE": out += writeRayEntity(entity); break;
|
|
1355
|
+
case "VIEWPORT": out += writeViewportEntity(entity); break;
|
|
1356
|
+
case "IMAGE":
|
|
1357
|
+
case "WIPEOUT": out += writeImageEntity(entity); break;
|
|
1358
|
+
case "TOLERANCE": out += writeToleranceEntity(entity); break;
|
|
1359
|
+
case "HELIX": out += writeHelixEntity(entity); break;
|
|
1360
|
+
case "MESH": out += writeMeshEntity(entity); break;
|
|
1361
|
+
case "REGION":
|
|
1362
|
+
case "BODY":
|
|
1363
|
+
case "SURFACE": out += writeRegionEntity(entity); break;
|
|
1364
|
+
case "OLE2FRAME": out += writeOle2Entity(entity); break;
|
|
1365
|
+
case "TABLE": out += writeTableEntity(entity); break;
|
|
1366
|
+
case "MLINE": out += writeMLineEntity(entity); break;
|
|
1367
|
+
case "SEQEND": break;
|
|
1368
|
+
default: out += writeGenericEntity(entity); break;
|
|
1369
|
+
}
|
|
1370
|
+
|
|
1371
|
+
return out;
|
|
1372
|
+
}
|
|
1373
|
+
|
|
1374
|
+
// ─────────────────── 各实体写入器 ───────────────────
|
|
1375
|
+
|
|
1376
|
+
function writeLineEntity(e) {
|
|
1377
|
+
let out = pair(100, "AcDbLine");
|
|
1378
|
+
if (e.thickness) out += pairF(39, e.thickness);
|
|
1379
|
+
out += writePoint3D(10, e.startPoint);
|
|
1380
|
+
out += writePoint3D(11, e.endPoint);
|
|
1381
|
+
out += writeExtrusion(e.extrusionDirection);
|
|
1382
|
+
return out;
|
|
1383
|
+
}
|
|
1384
|
+
|
|
1385
|
+
function writeLWPolylineEntity(e) {
|
|
1386
|
+
let out = pair(100, "AcDbPolyline");
|
|
1387
|
+
const verts = e.vertices || [];
|
|
1388
|
+
out += pairI(90, verts.length);
|
|
1389
|
+
|
|
1390
|
+
let flags = 0;
|
|
1391
|
+
if (e.closed) flags |= 1;
|
|
1392
|
+
out += pairI(70, flags);
|
|
1393
|
+
|
|
1394
|
+
if (e.constantWidth) out += pairF(43, e.constantWidth);
|
|
1395
|
+
if (e.elevation) out += pairF(38, e.elevation);
|
|
1396
|
+
if (e.thickness) out += pairF(39, e.thickness);
|
|
1397
|
+
|
|
1398
|
+
for (const v of verts) {
|
|
1399
|
+
out += pairF(10, v.x);
|
|
1400
|
+
out += pairF(20, v.y);
|
|
1401
|
+
if (v.startWidth) out += pairF(40, v.startWidth);
|
|
1402
|
+
if (v.endWidth) out += pairF(41, v.endWidth);
|
|
1403
|
+
if (v.bulge) out += pairF(42, v.bulge);
|
|
1404
|
+
}
|
|
1405
|
+
|
|
1406
|
+
out += writeExtrusion(e.extrusionDirection);
|
|
1407
|
+
return out;
|
|
1408
|
+
}
|
|
1409
|
+
|
|
1410
|
+
function writePolylineEntity(e) {
|
|
1411
|
+
let out = pair(100, "AcDb2dPolyline");
|
|
1412
|
+
|
|
1413
|
+
let flags = e.flags || 0;
|
|
1414
|
+
if (e.closed) flags |= 1;
|
|
1415
|
+
out += pairI(70, flags);
|
|
1416
|
+
|
|
1417
|
+
out += pairF(10, 0);
|
|
1418
|
+
out += pairF(20, 0);
|
|
1419
|
+
if (e.elevation) out += pairF(30, e.elevation);
|
|
1420
|
+
if (e.thickness) out += pairF(39, e.thickness);
|
|
1421
|
+
if (e.defaultStartWidth) out += pairF(40, e.defaultStartWidth);
|
|
1422
|
+
if (e.defaultEndWidth) out += pairF(41, e.defaultEndWidth);
|
|
1423
|
+
if (e.meshMVertexCount) out += pairI(71, e.meshMVertexCount);
|
|
1424
|
+
if (e.meshNVertexCount) out += pairI(72, e.meshNVertexCount);
|
|
1425
|
+
out += writeExtrusion(e.extrusionDirection);
|
|
1426
|
+
|
|
1427
|
+
if (e.vertices && e.vertices.length > 0) {
|
|
1428
|
+
for (const v of e.vertices) {
|
|
1429
|
+
out += pair(0, "VERTEX");
|
|
1430
|
+
if (e.handle) out += pair(5, "");
|
|
1431
|
+
out += pair(100, "AcDbEntity");
|
|
1432
|
+
if (e.layer) out += pair(8, e.layer);
|
|
1433
|
+
out += pair(100, "AcDbVertex");
|
|
1434
|
+
out += pair(100, "AcDb2dVertex");
|
|
1435
|
+
out += pairF(10, v.x);
|
|
1436
|
+
out += pairF(20, v.y);
|
|
1437
|
+
out += pairF(30, v.z || 0);
|
|
1438
|
+
if (v.startWidth) out += pairF(40, v.startWidth);
|
|
1439
|
+
if (v.endWidth) out += pairF(41, v.endWidth);
|
|
1440
|
+
if (v.bulge) out += pairF(42, v.bulge);
|
|
1441
|
+
if (v.flags) out += pairI(70, v.flags);
|
|
1442
|
+
}
|
|
1443
|
+
out += pair(0, "SEQEND");
|
|
1444
|
+
out += pair(100, "AcDbEntity");
|
|
1445
|
+
if (e.layer) out += pair(8, e.layer);
|
|
1446
|
+
}
|
|
1447
|
+
|
|
1448
|
+
return out;
|
|
1449
|
+
}
|
|
1450
|
+
|
|
1451
|
+
function writeArcEntity(e) {
|
|
1452
|
+
let out = pair(100, "AcDbCircle");
|
|
1453
|
+
if (e.thickness) out += pairF(39, e.thickness);
|
|
1454
|
+
out += writePoint3D(10, e.center);
|
|
1455
|
+
out += pairF(40, e.radius);
|
|
1456
|
+
out += writeExtrusion(e.extrusionDirection);
|
|
1457
|
+
out += pair(100, "AcDbArc");
|
|
1458
|
+
out += pairF(50, e.startAngle);
|
|
1459
|
+
out += pairF(51, e.endAngle);
|
|
1460
|
+
return out;
|
|
1461
|
+
}
|
|
1462
|
+
|
|
1463
|
+
function writeCircleEntity(e) {
|
|
1464
|
+
let out = pair(100, "AcDbCircle");
|
|
1465
|
+
if (e.thickness) out += pairF(39, e.thickness);
|
|
1466
|
+
out += writePoint3D(10, e.center);
|
|
1467
|
+
out += pairF(40, e.radius);
|
|
1468
|
+
out += writeExtrusion(e.extrusionDirection);
|
|
1469
|
+
return out;
|
|
1470
|
+
}
|
|
1471
|
+
|
|
1472
|
+
function writeEllipseEntity(e) {
|
|
1473
|
+
let out = pair(100, "AcDbEllipse");
|
|
1474
|
+
out += writePoint3D(10, e.center);
|
|
1475
|
+
out += writePoint3D(11, e.majorAxisEndPoint);
|
|
1476
|
+
out += writeExtrusion(e.extrusionDirection);
|
|
1477
|
+
out += pairF(40, e.axisRatio);
|
|
1478
|
+
out += pairF(41, e.startAngle);
|
|
1479
|
+
out += pairF(42, e.endAngle);
|
|
1480
|
+
return out;
|
|
1481
|
+
}
|
|
1482
|
+
|
|
1483
|
+
function writePointEntity(e) {
|
|
1484
|
+
let out = pair(100, "AcDbPoint");
|
|
1485
|
+
out += writePoint3D(10, e.position);
|
|
1486
|
+
if (e.thickness) out += pairF(39, e.thickness);
|
|
1487
|
+
if (e.angle) out += pairF(50, e.angle);
|
|
1488
|
+
out += writeExtrusion(e.extrusionDirection);
|
|
1489
|
+
return out;
|
|
1490
|
+
}
|
|
1491
|
+
|
|
1492
|
+
function writeTextEntity(e) {
|
|
1493
|
+
let out = pair(100, "AcDbText");
|
|
1494
|
+
if (e.thickness) out += pairF(39, e.thickness);
|
|
1495
|
+
out += writePoint3D(10, e.insertionPoint);
|
|
1496
|
+
out += pairF(40, e.height);
|
|
1497
|
+
out += pair(1, e.text);
|
|
1498
|
+
if (e.rotation) out += pairF(50, e.rotation);
|
|
1499
|
+
if (e.xScale && e.xScale !== 1) out += pairF(41, e.xScale);
|
|
1500
|
+
if (e.oblique) out += pairF(51, e.oblique);
|
|
1501
|
+
if (e.styleName && e.styleName !== "STANDARD") out += pair(7, e.styleName);
|
|
1502
|
+
if (e.generationFlags) out += pairI(71, e.generationFlags);
|
|
1503
|
+
if (e.hAlign) out += pairI(72, e.hAlign);
|
|
1504
|
+
out += writePoint3D(11, e.alignmentPoint);
|
|
1505
|
+
out += writeExtrusion(e.extrusionDirection);
|
|
1506
|
+
out += pair(100, "AcDbText");
|
|
1507
|
+
if (e.vAlign) out += pairI(73, e.vAlign);
|
|
1508
|
+
return out;
|
|
1509
|
+
}
|
|
1510
|
+
|
|
1511
|
+
function writeMTextEntity(e) {
|
|
1512
|
+
let out = pair(100, "AcDbMText");
|
|
1513
|
+
out += writePoint3D(10, e.insertionPoint);
|
|
1514
|
+
out += pairF(40, e.height);
|
|
1515
|
+
if (e.width) out += pairF(41, e.width);
|
|
1516
|
+
if (e.attachmentPoint) out += pairI(71, e.attachmentPoint);
|
|
1517
|
+
if (e.drawingDirection) out += pairI(72, e.drawingDirection);
|
|
1518
|
+
|
|
1519
|
+
const text = e.text || "";
|
|
1520
|
+
if (text.length > 250) {
|
|
1521
|
+
let remaining = text;
|
|
1522
|
+
while (remaining.length > 250) {
|
|
1523
|
+
out += pair(3, remaining.substring(0, 250));
|
|
1524
|
+
remaining = remaining.substring(250);
|
|
1525
|
+
}
|
|
1526
|
+
out += pair(1, remaining);
|
|
1527
|
+
} else {
|
|
1528
|
+
out += pair(1, text);
|
|
1529
|
+
}
|
|
1530
|
+
|
|
1531
|
+
if (e.styleName && e.styleName !== "STANDARD") out += pair(7, e.styleName);
|
|
1532
|
+
if (e.rotation) out += pairF(50, e.rotation);
|
|
1533
|
+
if (e.lineSpacingStyle) out += pairI(73, e.lineSpacingStyle);
|
|
1534
|
+
if (e.lineSpacing && e.lineSpacing !== 1) out += pairF(44, e.lineSpacing);
|
|
1535
|
+
out += writePoint3D(11, e.direction);
|
|
1536
|
+
out += writeExtrusion(e.extrusionDirection);
|
|
1537
|
+
return out;
|
|
1538
|
+
}
|
|
1539
|
+
|
|
1540
|
+
function writeAttribEntity(e) {
|
|
1541
|
+
const isAttdef = e.type === "ATTDEF";
|
|
1542
|
+
let out = pair(100, isAttdef ? "AcDbAttributeDefinition" : "AcDbAttribute");
|
|
1543
|
+
out += writePoint3D(10, e.insertionPoint);
|
|
1544
|
+
out += pairF(40, e.height);
|
|
1545
|
+
out += pair(1, e.text);
|
|
1546
|
+
if (e.tag) out += pair(2, e.tag);
|
|
1547
|
+
if (e.prompt) out += pair(3, e.prompt);
|
|
1548
|
+
if (e.flags) out += pairI(70, e.flags);
|
|
1549
|
+
if (e.rotation) out += pairF(50, e.rotation);
|
|
1550
|
+
if (e.xScale && e.xScale !== 1) out += pairF(41, e.xScale);
|
|
1551
|
+
if (e.styleName && e.styleName !== "STANDARD") out += pair(7, e.styleName);
|
|
1552
|
+
if (e.generationFlags) out += pairI(71, e.generationFlags);
|
|
1553
|
+
if (e.hAlign) out += pairI(72, e.hAlign);
|
|
1554
|
+
if (e.vAlign) out += pairI(73, e.vAlign);
|
|
1555
|
+
out += writePoint3D(11, e.alignmentPoint);
|
|
1556
|
+
return out;
|
|
1557
|
+
}
|
|
1558
|
+
|
|
1559
|
+
function writeInsertEntity(e) {
|
|
1560
|
+
let out = pair(100, "AcDbBlockReference");
|
|
1561
|
+
if (e.hasAttributes) out += pairI(66, 1);
|
|
1562
|
+
out += pair(2, e.blockName);
|
|
1563
|
+
out += writePoint3D(10, e.insertionPoint);
|
|
1564
|
+
if (e.scale) {
|
|
1565
|
+
if (e.scale.x !== 1) out += pairF(41, e.scale.x);
|
|
1566
|
+
if (e.scale.y !== 1) out += pairF(42, e.scale.y);
|
|
1567
|
+
if (e.scale.z !== 1) out += pairF(43, e.scale.z);
|
|
1568
|
+
}
|
|
1569
|
+
if (e.rotation) out += pairF(50, e.rotation);
|
|
1570
|
+
if (e.columnCount && e.columnCount !== 1) out += pairI(70, e.columnCount);
|
|
1571
|
+
if (e.rowCount && e.rowCount !== 1) out += pairI(71, e.rowCount);
|
|
1572
|
+
if (e.columnSpacing) out += pairF(44, e.columnSpacing);
|
|
1573
|
+
if (e.rowSpacing) out += pairF(45, e.rowSpacing);
|
|
1574
|
+
out += writeExtrusion(e.extrusionDirection);
|
|
1575
|
+
|
|
1576
|
+
if (e.attributes && e.attributes.length > 0) {
|
|
1577
|
+
for (const attr of e.attributes) {
|
|
1578
|
+
out += writeOneEntity(attr);
|
|
1579
|
+
}
|
|
1580
|
+
out += pair(0, "SEQEND");
|
|
1581
|
+
out += pair(100, "AcDbEntity");
|
|
1582
|
+
if (e.layer) out += pair(8, e.layer);
|
|
1583
|
+
}
|
|
1584
|
+
|
|
1585
|
+
return out;
|
|
1586
|
+
}
|
|
1587
|
+
|
|
1588
|
+
function writeDimensionEntity(e) {
|
|
1589
|
+
let out = pair(100, "AcDbDimension");
|
|
1590
|
+
if (e.blockName) out += pair(2, e.blockName);
|
|
1591
|
+
out += writePoint3D(10, e.definitionPoint);
|
|
1592
|
+
out += writePoint3D(11, e.middleOfText);
|
|
1593
|
+
if (e.dimensionType !== undefined) out += pairI(70, e.dimensionType);
|
|
1594
|
+
if (e.attachmentPoint) out += pairI(71, e.attachmentPoint);
|
|
1595
|
+
if (e.text) out += pair(1, e.text);
|
|
1596
|
+
if (e.styleName && e.styleName !== "STANDARD") out += pair(3, e.styleName);
|
|
1597
|
+
if (e.rotation) out += pairF(50, e.rotation);
|
|
1598
|
+
|
|
1599
|
+
const dimType = (e.dimensionType || 0) & 0x0f;
|
|
1600
|
+
switch (dimType) {
|
|
1601
|
+
case 0:
|
|
1602
|
+
case 1:
|
|
1603
|
+
out += pair(100, "AcDbAlignedDimension");
|
|
1604
|
+
out += writePoint3D(13, e.point1);
|
|
1605
|
+
out += writePoint3D(14, e.point2);
|
|
1606
|
+
if (e.extensionLineAngle) out += pairF(52, e.extensionLineAngle);
|
|
1607
|
+
if (dimType === 0) {
|
|
1608
|
+
out += pair(100, "AcDbRotatedDimension");
|
|
1609
|
+
}
|
|
1610
|
+
break;
|
|
1611
|
+
case 2:
|
|
1612
|
+
out += pair(100, "AcDb3PointAngularDimension");
|
|
1613
|
+
out += writePoint3D(13, e.point1);
|
|
1614
|
+
out += writePoint3D(14, e.point2);
|
|
1615
|
+
if (e.point3) out += writePoint3D(15, e.point3);
|
|
1616
|
+
break;
|
|
1617
|
+
case 3:
|
|
1618
|
+
case 4:
|
|
1619
|
+
out += pair(100, dimType === 3 ? "AcDbDiametricDimension" : "AcDbRadialDimension");
|
|
1620
|
+
out += writePoint3D(15, e.point3 || e.point1);
|
|
1621
|
+
if (e.leaderLength) out += pairF(40, e.leaderLength);
|
|
1622
|
+
break;
|
|
1623
|
+
case 5:
|
|
1624
|
+
out += pair(100, "AcDb3PointAngularDimension");
|
|
1625
|
+
out += writePoint3D(13, e.point1);
|
|
1626
|
+
out += writePoint3D(14, e.point2);
|
|
1627
|
+
if (e.point3) out += writePoint3D(15, e.point3);
|
|
1628
|
+
break;
|
|
1629
|
+
case 6:
|
|
1630
|
+
out += pair(100, "AcDbOrdinateDimension");
|
|
1631
|
+
out += writePoint3D(13, e.point1);
|
|
1632
|
+
out += writePoint3D(14, e.point2);
|
|
1633
|
+
break;
|
|
1634
|
+
default:
|
|
1635
|
+
out += writePoint3D(13, e.point1);
|
|
1636
|
+
out += writePoint3D(14, e.point2);
|
|
1637
|
+
break;
|
|
1638
|
+
}
|
|
1639
|
+
|
|
1640
|
+
return out;
|
|
1641
|
+
}
|
|
1642
|
+
|
|
1643
|
+
function writeLeaderEntity(e) {
|
|
1644
|
+
let out = pair(100, "AcDbLeader");
|
|
1645
|
+
if (e.styleName) out += pair(3, e.styleName);
|
|
1646
|
+
if (e.arrowheadFlag !== undefined) out += pairI(71, e.arrowheadFlag);
|
|
1647
|
+
if (e.pathType !== undefined) out += pairI(72, e.pathType);
|
|
1648
|
+
if (e.creationType !== undefined) out += pairI(73, e.creationType);
|
|
1649
|
+
if (e.hooklineDirectionFlag !== undefined) out += pairI(74, e.hooklineDirectionFlag);
|
|
1650
|
+
if (e.hooklineFlag !== undefined) out += pairI(75, e.hooklineFlag);
|
|
1651
|
+
if (e.textHeight) out += pairF(40, e.textHeight);
|
|
1652
|
+
if (e.textWidth) out += pairF(41, e.textWidth);
|
|
1653
|
+
|
|
1654
|
+
const verts = e.vertices || [];
|
|
1655
|
+
out += pairI(76, verts.length);
|
|
1656
|
+
for (const v of verts) {
|
|
1657
|
+
out += writePoint3D(10, v);
|
|
1658
|
+
}
|
|
1659
|
+
|
|
1660
|
+
if (e.annotationReference) out += pair(340, e.annotationReference);
|
|
1661
|
+
if (e.normal) {
|
|
1662
|
+
out += pairF(210, e.normal.x);
|
|
1663
|
+
out += pairF(220, e.normal.y);
|
|
1664
|
+
out += pairF(230, e.normal.z);
|
|
1665
|
+
}
|
|
1666
|
+
if (e.horizontalDirection) {
|
|
1667
|
+
out += pairF(211, e.horizontalDirection.x);
|
|
1668
|
+
out += pairF(221, e.horizontalDirection.y);
|
|
1669
|
+
out += pairF(231, e.horizontalDirection.z);
|
|
1670
|
+
}
|
|
1671
|
+
return out;
|
|
1672
|
+
}
|
|
1673
|
+
|
|
1674
|
+
function writeMLeaderEntity(e) {
|
|
1675
|
+
let out = pair(100, "AcDbMLeader");
|
|
1676
|
+
if (e.styleName) out += pair(3, e.styleName);
|
|
1677
|
+
if (e.contentType !== undefined) out += pairI(170, e.contentType);
|
|
1678
|
+
if (e.text) out += pair(304, e.text);
|
|
1679
|
+
if (e.textStyleId) out += pair(340, e.textStyleId);
|
|
1680
|
+
if (e.doglegLength) out += pairF(40, e.doglegLength);
|
|
1681
|
+
if (e.arrowheadSize) out += pairF(41, e.arrowheadSize);
|
|
1682
|
+
if (e.textHeight) out += pairF(42, e.textHeight);
|
|
1683
|
+
|
|
1684
|
+
if (e.leaderPoints) {
|
|
1685
|
+
for (const pt of e.leaderPoints) {
|
|
1686
|
+
out += writePoint3D(10, pt);
|
|
1687
|
+
}
|
|
1688
|
+
}
|
|
1689
|
+
return out;
|
|
1690
|
+
}
|
|
1691
|
+
|
|
1692
|
+
function writeHatchEntity(e) {
|
|
1693
|
+
let out = pair(100, "AcDbHatch");
|
|
1694
|
+
out += pairF(10, 0);
|
|
1695
|
+
out += pairF(20, 0);
|
|
1696
|
+
out += pairF(30, e.elevation || 0);
|
|
1697
|
+
out += writeExtrusion(e.extrusionDirection);
|
|
1698
|
+
out += pair(2, e.patternName || "");
|
|
1699
|
+
out += pairI(70, e.solid ? 1 : 0);
|
|
1700
|
+
out += pairI(71, e.associative ? 1 : 0);
|
|
1701
|
+
|
|
1702
|
+
const paths = e.boundaryPaths || [];
|
|
1703
|
+
out += pairI(91, paths.length);
|
|
1704
|
+
for (const path of paths) {
|
|
1705
|
+
out += pairI(92, path.type || 0);
|
|
1706
|
+
|
|
1707
|
+
if (path.points && path.points.length > 0) {
|
|
1708
|
+
out += pairI(93, path.points.length);
|
|
1709
|
+
for (const pt of path.points) {
|
|
1710
|
+
out += pairF(10, pt.x);
|
|
1711
|
+
out += pairF(20, pt.y || 0);
|
|
1712
|
+
}
|
|
1713
|
+
}
|
|
1714
|
+
}
|
|
1715
|
+
|
|
1716
|
+
out += pairI(75, e.style || 0);
|
|
1717
|
+
out += pairI(76, e.patternType || 0);
|
|
1718
|
+
if (!e.solid) {
|
|
1719
|
+
if (e.patternAngle) out += pairF(52, e.patternAngle);
|
|
1720
|
+
if (e.patternScale) out += pairF(41, e.patternScale);
|
|
1721
|
+
}
|
|
1722
|
+
|
|
1723
|
+
const seeds = e.seedPoints || [];
|
|
1724
|
+
out += pairI(98, seeds.length);
|
|
1725
|
+
for (const s of seeds) {
|
|
1726
|
+
out += pairF(10, s.x);
|
|
1727
|
+
out += pairF(20, s.y || 0);
|
|
1728
|
+
}
|
|
1729
|
+
|
|
1730
|
+
return out;
|
|
1731
|
+
}
|
|
1732
|
+
|
|
1733
|
+
function writeSplineEntity(e) {
|
|
1734
|
+
let out = pair(100, "AcDbSpline");
|
|
1735
|
+
|
|
1736
|
+
if (e.normal) {
|
|
1737
|
+
out += pairF(210, e.normal.x);
|
|
1738
|
+
out += pairF(220, e.normal.y);
|
|
1739
|
+
out += pairF(230, e.normal.z);
|
|
1740
|
+
}
|
|
1741
|
+
|
|
1742
|
+
let flags = e.flags || 0;
|
|
1743
|
+
if (e.closed) flags |= 1;
|
|
1744
|
+
if (e.periodic) flags |= 2;
|
|
1745
|
+
if (e.rational) flags |= 4;
|
|
1746
|
+
if (e.planar) flags |= 8;
|
|
1747
|
+
out += pairI(70, flags);
|
|
1748
|
+
|
|
1749
|
+
out += pairI(71, e.degree || 3);
|
|
1750
|
+
|
|
1751
|
+
const knots = e.knots || [];
|
|
1752
|
+
const cps = e.controlPoints || [];
|
|
1753
|
+
const fps = e.fitPoints || [];
|
|
1754
|
+
out += pairI(72, knots.length);
|
|
1755
|
+
out += pairI(73, cps.length);
|
|
1756
|
+
out += pairI(74, fps.length);
|
|
1757
|
+
|
|
1758
|
+
if (e.knotTolerance) out += pairF(42, e.knotTolerance);
|
|
1759
|
+
if (e.controlPointTolerance) out += pairF(43, e.controlPointTolerance);
|
|
1760
|
+
if (e.fitTolerance) out += pairF(44, e.fitTolerance);
|
|
1761
|
+
|
|
1762
|
+
if (e.startTangent) out += writePoint3D(12, e.startTangent);
|
|
1763
|
+
if (e.endTangent) out += writePoint3D(13, e.endTangent);
|
|
1764
|
+
|
|
1765
|
+
for (const k of knots) {
|
|
1766
|
+
out += pairF(40, k);
|
|
1767
|
+
}
|
|
1768
|
+
if (e.weights) {
|
|
1769
|
+
for (const w of e.weights) {
|
|
1770
|
+
out += pairF(41, w);
|
|
1771
|
+
}
|
|
1772
|
+
}
|
|
1773
|
+
for (const cp of cps) {
|
|
1774
|
+
out += writePoint3D(10, cp);
|
|
1775
|
+
}
|
|
1776
|
+
for (const fp of fps) {
|
|
1777
|
+
out += writePoint3D(11, fp);
|
|
1778
|
+
}
|
|
1779
|
+
|
|
1780
|
+
return out;
|
|
1781
|
+
}
|
|
1782
|
+
|
|
1783
|
+
function writeSolidEntity(e) {
|
|
1784
|
+
let subclass = "AcDbTrace";
|
|
1785
|
+
if (e.type === "SOLID") subclass = "AcDbTrace";
|
|
1786
|
+
else if (e.type === "3DSOLID") subclass = "AcDb3dSolid";
|
|
1787
|
+
|
|
1788
|
+
let out = pair(100, subclass);
|
|
1789
|
+
|
|
1790
|
+
const pts = e.points || [];
|
|
1791
|
+
if (pts[0]) out += writePoint3D(10, pts[0]);
|
|
1792
|
+
if (pts[1]) out += writePoint3D(11, pts[1]);
|
|
1793
|
+
if (pts[2]) out += writePoint3D(12, pts[2]);
|
|
1794
|
+
if (pts[3]) out += writePoint3D(13, pts[3]);
|
|
1795
|
+
if (e.thickness) out += pairF(39, e.thickness);
|
|
1796
|
+
out += writeExtrusion(e.extrusionDirection);
|
|
1797
|
+
return out;
|
|
1798
|
+
}
|
|
1799
|
+
|
|
1800
|
+
function write3DFaceEntity(e) {
|
|
1801
|
+
let out = pair(100, "AcDbFace");
|
|
1802
|
+
const verts = e.vertices || [];
|
|
1803
|
+
if (verts[0]) out += writePoint3D(10, verts[0]);
|
|
1804
|
+
if (verts[1]) out += writePoint3D(11, verts[1]);
|
|
1805
|
+
if (verts[2]) out += writePoint3D(12, verts[2]);
|
|
1806
|
+
if (verts[3]) out += writePoint3D(13, verts[3]);
|
|
1807
|
+
if (e.invisibleEdgeFlags) out += pairI(70, e.invisibleEdgeFlags);
|
|
1808
|
+
return out;
|
|
1809
|
+
}
|
|
1810
|
+
|
|
1811
|
+
function writeRayEntity(e) {
|
|
1812
|
+
const subclass = e.type === "RAY" ? "AcDbRay" : "AcDbXline";
|
|
1813
|
+
let out = pair(100, subclass);
|
|
1814
|
+
out += writePoint3D(10, e.basePoint);
|
|
1815
|
+
out += writePoint3D(11, e.direction);
|
|
1816
|
+
return out;
|
|
1817
|
+
}
|
|
1818
|
+
|
|
1819
|
+
function writeViewportEntity(e) {
|
|
1820
|
+
let out = pair(100, "AcDbViewport");
|
|
1821
|
+
out += writePoint3D(10, e.center);
|
|
1822
|
+
out += pairF(40, e.width);
|
|
1823
|
+
out += pairF(41, e.height);
|
|
1824
|
+
if (e.id) out += pairI(69, e.id);
|
|
1825
|
+
if (e.viewCenter) out += writePoint2D(12, e.viewCenter);
|
|
1826
|
+
if (e.snapBase) out += writePoint2D(13, e.snapBase);
|
|
1827
|
+
if (e.snapSpacing) out += writePoint2D(14, e.snapSpacing);
|
|
1828
|
+
if (e.gridSpacing) out += writePoint2D(15, e.gridSpacing);
|
|
1829
|
+
out += writePoint3D(16, e.viewDirection);
|
|
1830
|
+
out += writePoint3D(17, e.viewTarget);
|
|
1831
|
+
if (e.perspectiveLensLength) out += pairF(42, e.perspectiveLensLength);
|
|
1832
|
+
if (e.frontClipPlane) out += pairF(43, e.frontClipPlane);
|
|
1833
|
+
if (e.backClipPlane) out += pairF(44, e.backClipPlane);
|
|
1834
|
+
if (e.viewHeight) out += pairF(45, e.viewHeight);
|
|
1835
|
+
if (e.snapAngle) out += pairF(50, e.snapAngle);
|
|
1836
|
+
if (e.viewTwistAngle) out += pairF(51, e.viewTwistAngle);
|
|
1837
|
+
if (e.statusField) out += pairI(68, e.statusField);
|
|
1838
|
+
|
|
1839
|
+
if (e.frozenLayers) {
|
|
1840
|
+
for (const fl of e.frozenLayers) {
|
|
1841
|
+
out += pair(331, fl);
|
|
1842
|
+
}
|
|
1843
|
+
}
|
|
1844
|
+
if (e.clippingBoundary) out += pair(340, e.clippingBoundary);
|
|
1845
|
+
return out;
|
|
1846
|
+
}
|
|
1847
|
+
|
|
1848
|
+
function writeImageEntity(e) {
|
|
1849
|
+
let out = pair(100, e.type === "WIPEOUT" ? "AcDbWipeout" : "AcDbRasterImage");
|
|
1850
|
+
out += writePoint3D(10, e.insertionPoint);
|
|
1851
|
+
out += writePoint3D(11, e.uVector);
|
|
1852
|
+
out += writePoint3D(12, e.vVector);
|
|
1853
|
+
out += pairF(13, e.imageSize ? e.imageSize.u : 0);
|
|
1854
|
+
out += pairF(23, e.imageSize ? e.imageSize.v : 0);
|
|
1855
|
+
if (e.imageDefHandle) out += pair(340, e.imageDefHandle);
|
|
1856
|
+
if (e.displayFlags) out += pairI(70, e.displayFlags);
|
|
1857
|
+
if (e.clippingType) out += pairI(71, e.clippingType);
|
|
1858
|
+
if (e.brightness !== undefined) out += pairI(280, e.brightness);
|
|
1859
|
+
if (e.contrast !== undefined) out += pairI(281, e.contrast);
|
|
1860
|
+
if (e.fade !== undefined) out += pairI(282, e.fade);
|
|
1861
|
+
|
|
1862
|
+
if (e.clippingVertices) {
|
|
1863
|
+
for (const cv of e.clippingVertices) {
|
|
1864
|
+
out += pairF(14, cv.x);
|
|
1865
|
+
out += pairF(24, cv.y || 0);
|
|
1866
|
+
}
|
|
1867
|
+
}
|
|
1868
|
+
return out;
|
|
1869
|
+
}
|
|
1870
|
+
|
|
1871
|
+
function writeToleranceEntity(e) {
|
|
1872
|
+
let out = pair(100, "AcDbFcf");
|
|
1873
|
+
if (e.styleName) out += pair(3, e.styleName);
|
|
1874
|
+
out += writePoint3D(10, e.insertionPoint);
|
|
1875
|
+
if (e.text) out += pair(1, e.text);
|
|
1876
|
+
out += writePoint3D(11, e.direction);
|
|
1877
|
+
return out;
|
|
1878
|
+
}
|
|
1879
|
+
|
|
1880
|
+
function writeHelixEntity(e) {
|
|
1881
|
+
let out = pair(100, "AcDbHelix");
|
|
1882
|
+
out += writePoint3D(10, e.axisBasePoint);
|
|
1883
|
+
out += writePoint3D(11, e.startPoint);
|
|
1884
|
+
out += writePoint3D(12, e.axisVector);
|
|
1885
|
+
out += pairF(40, e.radius);
|
|
1886
|
+
out += pairF(41, e.turns);
|
|
1887
|
+
out += pairF(42, e.turnHeight);
|
|
1888
|
+
if (e.handedness !== undefined) out += pairI(290, e.handedness);
|
|
1889
|
+
if (e.constraint !== undefined) out += pairI(280, e.constraint);
|
|
1890
|
+
return out;
|
|
1891
|
+
}
|
|
1892
|
+
|
|
1893
|
+
function writeMeshEntity(e) {
|
|
1894
|
+
let out = pair(100, "AcDbSubDMesh");
|
|
1895
|
+
out += pairI(71, e.version || 2);
|
|
1896
|
+
out += pairI(72, e.subdivisionLevel || 0);
|
|
1897
|
+
|
|
1898
|
+
const verts = e.vertices || [];
|
|
1899
|
+
out += pairI(91, verts.length);
|
|
1900
|
+
for (const v of verts) {
|
|
1901
|
+
out += writePoint3D(10, v);
|
|
1902
|
+
}
|
|
1903
|
+
|
|
1904
|
+
const faces = e.faces || [];
|
|
1905
|
+
out += pairI(92, faces.length);
|
|
1906
|
+
for (const f of faces) {
|
|
1907
|
+
out += pairI(90, f);
|
|
1908
|
+
}
|
|
1909
|
+
|
|
1910
|
+
const edges = e.edges || [];
|
|
1911
|
+
out += pairI(93, edges.length);
|
|
1912
|
+
for (const ed of edges) {
|
|
1913
|
+
out += pairI(90, ed);
|
|
1914
|
+
}
|
|
1915
|
+
|
|
1916
|
+
const creases = e.edgeCreases || [];
|
|
1917
|
+
out += pairI(94, creases.length);
|
|
1918
|
+
for (const c of creases) {
|
|
1919
|
+
out += pairF(140, c);
|
|
1920
|
+
}
|
|
1921
|
+
|
|
1922
|
+
return out;
|
|
1923
|
+
}
|
|
1924
|
+
|
|
1925
|
+
function writeRegionEntity(e) {
|
|
1926
|
+
let subclass = "AcDbRegion";
|
|
1927
|
+
if (e.type === "BODY") subclass = "AcDbBody";
|
|
1928
|
+
else if (e.type === "SURFACE") subclass = "AcDbSurface";
|
|
1929
|
+
|
|
1930
|
+
let out = pair(100, subclass);
|
|
1931
|
+
if (e.modelerFormat !== undefined) out += pairI(70, e.modelerFormat);
|
|
1932
|
+
|
|
1933
|
+
const acisStr = e.acisDataString || (e.acisData || []).join("");
|
|
1934
|
+
if (acisStr) {
|
|
1935
|
+
let remaining = acisStr;
|
|
1936
|
+
while (remaining.length > 255) {
|
|
1937
|
+
out += pair(3, remaining.substring(0, 255));
|
|
1938
|
+
remaining = remaining.substring(255);
|
|
1939
|
+
}
|
|
1940
|
+
out += pair(1, remaining);
|
|
1941
|
+
}
|
|
1942
|
+
|
|
1943
|
+
return out;
|
|
1944
|
+
}
|
|
1945
|
+
|
|
1946
|
+
function writeOle2Entity(e) {
|
|
1947
|
+
let out = pair(100, "AcDbOle2Frame");
|
|
1948
|
+
out += pairI(70, e.oleType || 0);
|
|
1949
|
+
out += pairI(71, e.tileMode || 0);
|
|
1950
|
+
out += writePoint3D(10, e.upperLeftCorner);
|
|
1951
|
+
out += writePoint3D(11, e.lowerRightCorner);
|
|
1952
|
+
if (e.binaryData) {
|
|
1953
|
+
for (const bd of e.binaryData) {
|
|
1954
|
+
out += pair(1, bd);
|
|
1955
|
+
}
|
|
1956
|
+
}
|
|
1957
|
+
return out;
|
|
1958
|
+
}
|
|
1959
|
+
|
|
1960
|
+
function writeTableEntity(e) {
|
|
1961
|
+
let out = pair(100, "AcDbBlockReference");
|
|
1962
|
+
if (e.blockName) out += pair(2, e.blockName);
|
|
1963
|
+
out += writePoint3D(10, e.insertionPoint);
|
|
1964
|
+
out += pair(100, "AcDbTable");
|
|
1965
|
+
out += writePoint3D(11, e.direction);
|
|
1966
|
+
if (e.rows) out += pairI(91, e.rows);
|
|
1967
|
+
if (e.columns) out += pairI(92, e.columns);
|
|
1968
|
+
if (e.rowHeights) {
|
|
1969
|
+
for (const rh of e.rowHeights) {
|
|
1970
|
+
out += pairF(142, rh);
|
|
1971
|
+
}
|
|
1972
|
+
}
|
|
1973
|
+
if (e.columnWidths) {
|
|
1974
|
+
for (const cw of e.columnWidths) {
|
|
1975
|
+
out += pairF(141, cw);
|
|
1976
|
+
}
|
|
1977
|
+
}
|
|
1978
|
+
return out;
|
|
1979
|
+
}
|
|
1980
|
+
|
|
1981
|
+
function writeMLineEntity(e) {
|
|
1982
|
+
let out = pair(100, "AcDbMline");
|
|
1983
|
+
if (e.styleName) out += pair(2, e.styleName);
|
|
1984
|
+
if (e.styleHandle) out += pair(340, e.styleHandle);
|
|
1985
|
+
out += pairF(40, e.scale || 1);
|
|
1986
|
+
out += pairI(70, e.justification || 0);
|
|
1987
|
+
out += pairI(71, e.flags || 0);
|
|
1988
|
+
|
|
1989
|
+
const verts = e.vertices || [];
|
|
1990
|
+
out += pairI(72, verts.length);
|
|
1991
|
+
if (e.elementCount) out += pairI(73, e.elementCount);
|
|
1992
|
+
|
|
1993
|
+
out += writePoint3D(10, e.startPoint);
|
|
1994
|
+
|
|
1995
|
+
if (e.normal) {
|
|
1996
|
+
out += pairF(210, e.normal.x);
|
|
1997
|
+
out += pairF(220, e.normal.y);
|
|
1998
|
+
out += pairF(230, e.normal.z);
|
|
1999
|
+
}
|
|
2000
|
+
|
|
2001
|
+
for (const v of verts) {
|
|
2002
|
+
out += pairF(11, v.x);
|
|
2003
|
+
out += pairF(21, v.y);
|
|
2004
|
+
out += pairF(31, v.z || 0);
|
|
2005
|
+
}
|
|
2006
|
+
|
|
2007
|
+
return out;
|
|
2008
|
+
}
|
|
2009
|
+
|
|
2010
|
+
/** 通用 / 未知实体写入 */
|
|
2011
|
+
function writeGenericEntity(e) {
|
|
2012
|
+
let out = "";
|
|
2013
|
+
if (e.data) {
|
|
2014
|
+
for (const [key, val] of Object.entries(e.data)) {
|
|
2015
|
+
if (key.startsWith("code_")) {
|
|
2016
|
+
const code = parseInt(key.replace("code_", ""));
|
|
2017
|
+
const vals = [].concat(val);
|
|
2018
|
+
for (const v of vals) {
|
|
2019
|
+
out += pair(code, v);
|
|
2020
|
+
}
|
|
2021
|
+
}
|
|
2022
|
+
}
|
|
2023
|
+
}
|
|
2024
|
+
return out;
|
|
2025
|
+
}
|
|
2026
|
+
|
|
2027
|
+
// ─────────────────── OBJECTS 写入 ───────────────────
|
|
2028
|
+
|
|
2029
|
+
function writeObjects(objects) {
|
|
2030
|
+
if (!objects || objects.length === 0) return "";
|
|
2031
|
+
let out = pair(0, "SECTION") + pair(2, "OBJECTS");
|
|
2032
|
+
|
|
2033
|
+
for (const obj of objects) {
|
|
2034
|
+
out += pair(0, obj.type);
|
|
2035
|
+
if (obj.handle) out += pair(5, obj.handle);
|
|
2036
|
+
if (obj.ownerHandle) out += pair(330, obj.ownerHandle);
|
|
2037
|
+
if (obj.name) out += pair(2, obj.name);
|
|
2038
|
+
if (obj.entryName) {
|
|
2039
|
+
const names = [].concat(obj.entryName);
|
|
2040
|
+
for (const n of names) {
|
|
2041
|
+
out += pair(3, n);
|
|
2042
|
+
}
|
|
2043
|
+
}
|
|
2044
|
+
if (obj.softPointer) {
|
|
2045
|
+
const ptrs = [].concat(obj.softPointer);
|
|
2046
|
+
for (const p of ptrs) {
|
|
2047
|
+
out += pair(350, p);
|
|
2048
|
+
}
|
|
2049
|
+
}
|
|
2050
|
+
if (obj.hardPointer) {
|
|
2051
|
+
const ptrs = [].concat(obj.hardPointer);
|
|
2052
|
+
for (const p of ptrs) {
|
|
2053
|
+
out += pair(360, p);
|
|
2054
|
+
}
|
|
2055
|
+
}
|
|
2056
|
+
for (const [key, val] of Object.entries(obj)) {
|
|
2057
|
+
if (key.startsWith("code_")) {
|
|
2058
|
+
const code = parseInt(key.replace("code_", ""));
|
|
2059
|
+
const vals = [].concat(val);
|
|
2060
|
+
for (const v of vals) {
|
|
2061
|
+
out += pair(code, v);
|
|
2062
|
+
}
|
|
2063
|
+
}
|
|
2064
|
+
}
|
|
2065
|
+
}
|
|
2066
|
+
|
|
2067
|
+
out += pair(0, "ENDSEC");
|
|
2068
|
+
return out;
|
|
2069
|
+
}
|
|
2070
|
+
|
|
2071
|
+
// ─────────────────── 主入口 ───────────────────
|
|
2072
|
+
|
|
2073
|
+
/**
|
|
2074
|
+
* 将 parseDxf() 输出的数据结构写回 DXF 文本格式
|
|
2075
|
+
* @param {Object} dxfData - parseDxf() 返回的完整数据结构
|
|
2076
|
+
* @returns {string} DXF 文本内容
|
|
2077
|
+
*/
|
|
2078
|
+
function writeDxf(dxfData) {
|
|
2079
|
+
let out = "";
|
|
2080
|
+
out += writeHeader(dxfData.header);
|
|
2081
|
+
out += writeClasses(dxfData.classes);
|
|
2082
|
+
out += writeTables(dxfData.tables);
|
|
2083
|
+
out += writeBlocks(dxfData.blocks);
|
|
2084
|
+
out += writeEntitiesSection(dxfData.entities);
|
|
2085
|
+
out += writeObjects(dxfData.objects);
|
|
2086
|
+
out += pair(0, "EOF");
|
|
2087
|
+
return out;
|
|
2088
|
+
}
|
|
2089
|
+
|
|
2090
|
+
/**
|
|
2091
|
+
* ★ 改动点①: 写入文件 — 动态 import 替代 require
|
|
2092
|
+
* @param {Object} dxfData - parseDxf() 返回的完整数据结构
|
|
2093
|
+
* @param {string} filePath - 输出文件路径(仅 Node.js)
|
|
2094
|
+
*/
|
|
2095
|
+
async function writeDxfFile(dxfData, filePath) {
|
|
2096
|
+
const content = writeDxf(dxfData);
|
|
2097
|
+
if (typeof process !== "undefined" && process.versions?.node) {
|
|
2098
|
+
const { writeFile } = await import('fs/promises');
|
|
2099
|
+
await writeFile(filePath, content, "utf-8");
|
|
2100
|
+
} else {
|
|
2101
|
+
throw new Error("writeDxfFile 仅支持 Node.js 环境,浏览器请用 downloadDxfFile()");
|
|
2102
|
+
}
|
|
2103
|
+
}
|
|
2104
|
+
|
|
2105
|
+
/**
|
|
2106
|
+
* ★ 改动点③: 浏览器下载
|
|
2107
|
+
* @param {Object} dxfData - parseDxf() 返回的完整数据结构
|
|
2108
|
+
* @param {string} [filename="output.dxf"] - 下载文件名
|
|
2109
|
+
*/
|
|
2110
|
+
function downloadDxfFile(dxfData, filename = "output.dxf") {
|
|
2111
|
+
const content = writeDxf(dxfData);
|
|
2112
|
+
const blob = new Blob([content], { type: "application/dxf" });
|
|
2113
|
+
const url = URL.createObjectURL(blob);
|
|
2114
|
+
const a = document.createElement("a");
|
|
2115
|
+
a.href = url;
|
|
2116
|
+
a.download = filename;
|
|
2117
|
+
a.click();
|
|
2118
|
+
URL.revokeObjectURL(url);
|
|
2119
|
+
}
|
|
6
2120
|
|
|
7
2121
|
export { downloadDxfFile, parseDxf, writeDxf, writeDxfFile };
|