@mlightcad/data-model 1.3.3 → 1.3.5

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.
Files changed (344) hide show
  1. package/dist/data-model.cjs +5 -0
  2. package/dist/data-model.js +25995 -0
  3. package/dist/dxf-parser-worker.js +1715 -0
  4. package/lib/base/AcDbHostApplicationServices.d.ts +96 -0
  5. package/lib/base/AcDbHostApplicationServices.d.ts.map +1 -0
  6. package/lib/base/AcDbHostApplicationServices.js +118 -0
  7. package/lib/base/AcDbHostApplicationServices.js.map +1 -0
  8. package/lib/base/AcDbObject.d.ts +205 -0
  9. package/lib/base/AcDbObject.d.ts.map +1 -0
  10. package/lib/base/AcDbObject.js +236 -0
  11. package/lib/base/AcDbObject.js.map +1 -0
  12. package/lib/base/index.d.ts +3 -0
  13. package/lib/base/index.d.ts.map +1 -0
  14. package/lib/base/index.js +3 -0
  15. package/lib/base/index.js.map +1 -0
  16. package/lib/converter/AcDbBatchProcessing.d.ts +146 -0
  17. package/lib/converter/AcDbBatchProcessing.d.ts.map +1 -0
  18. package/lib/converter/AcDbBatchProcessing.js +272 -0
  19. package/lib/converter/AcDbBatchProcessing.js.map +1 -0
  20. package/lib/converter/AcDbDxfConverter.d.ts +272 -0
  21. package/lib/converter/AcDbDxfConverter.d.ts.map +1 -0
  22. package/lib/converter/AcDbDxfConverter.js +883 -0
  23. package/lib/converter/AcDbDxfConverter.js.map +1 -0
  24. package/lib/converter/AcDbDxfParser.d.ts +23 -0
  25. package/lib/converter/AcDbDxfParser.d.ts.map +1 -0
  26. package/lib/converter/AcDbDxfParser.js +85 -0
  27. package/lib/converter/AcDbDxfParser.js.map +1 -0
  28. package/lib/converter/AcDbEntitiyConverter.d.ts +160 -0
  29. package/lib/converter/AcDbEntitiyConverter.d.ts.map +1 -0
  30. package/lib/converter/AcDbEntitiyConverter.js +708 -0
  31. package/lib/converter/AcDbEntitiyConverter.js.map +1 -0
  32. package/lib/converter/AcDbObjectConverter.d.ts +61 -0
  33. package/lib/converter/AcDbObjectConverter.d.ts.map +1 -0
  34. package/lib/converter/AcDbObjectConverter.js +91 -0
  35. package/lib/converter/AcDbObjectConverter.js.map +1 -0
  36. package/lib/converter/AcDbRegenerator.d.ts +101 -0
  37. package/lib/converter/AcDbRegenerator.d.ts.map +1 -0
  38. package/lib/converter/AcDbRegenerator.js +334 -0
  39. package/lib/converter/AcDbRegenerator.js.map +1 -0
  40. package/lib/converter/index.d.ts +5 -0
  41. package/lib/converter/index.d.ts.map +1 -0
  42. package/lib/converter/index.js +5 -0
  43. package/lib/converter/index.js.map +1 -0
  44. package/lib/converter/worker/AcDbBaseWorker.d.ts +36 -0
  45. package/lib/converter/worker/AcDbBaseWorker.d.ts.map +1 -0
  46. package/lib/converter/worker/AcDbBaseWorker.js +93 -0
  47. package/lib/converter/worker/AcDbBaseWorker.js.map +1 -0
  48. package/lib/converter/worker/AcDbDxfParserWorker.d.ts +11 -0
  49. package/lib/converter/worker/AcDbDxfParserWorker.d.ts.map +1 -0
  50. package/lib/converter/worker/AcDbDxfParserWorker.js +75 -0
  51. package/lib/converter/worker/AcDbDxfParserWorker.js.map +1 -0
  52. package/lib/converter/worker/AcDbWorkerManager.d.ts +107 -0
  53. package/lib/converter/worker/AcDbWorkerManager.d.ts.map +1 -0
  54. package/lib/converter/worker/AcDbWorkerManager.js +360 -0
  55. package/lib/converter/worker/AcDbWorkerManager.js.map +1 -0
  56. package/lib/converter/worker/index.d.ts +3 -0
  57. package/lib/converter/worker/index.d.ts.map +1 -0
  58. package/lib/converter/worker/index.js +3 -0
  59. package/lib/converter/worker/index.js.map +1 -0
  60. package/lib/database/AcDbBlockTable.d.ts +56 -0
  61. package/lib/database/AcDbBlockTable.d.ts.map +1 -0
  62. package/lib/database/AcDbBlockTable.js +98 -0
  63. package/lib/database/AcDbBlockTable.js.map +1 -0
  64. package/lib/database/AcDbBlockTableRecord.d.ts +185 -0
  65. package/lib/database/AcDbBlockTableRecord.d.ts.map +1 -0
  66. package/lib/database/AcDbBlockTableRecord.js +261 -0
  67. package/lib/database/AcDbBlockTableRecord.js.map +1 -0
  68. package/lib/database/AcDbDatabase.d.ts +563 -0
  69. package/lib/database/AcDbDatabase.d.ts.map +1 -0
  70. package/lib/database/AcDbDatabase.js +842 -0
  71. package/lib/database/AcDbDatabase.js.map +1 -0
  72. package/lib/database/AcDbDatabaseConverter.d.ts +292 -0
  73. package/lib/database/AcDbDatabaseConverter.d.ts.map +1 -0
  74. package/lib/database/AcDbDatabaseConverter.js +448 -0
  75. package/lib/database/AcDbDatabaseConverter.js.map +1 -0
  76. package/lib/database/AcDbDatabaseConverterManager.d.ts +141 -0
  77. package/lib/database/AcDbDatabaseConverterManager.d.ts.map +1 -0
  78. package/lib/database/AcDbDatabaseConverterManager.js +173 -0
  79. package/lib/database/AcDbDatabaseConverterManager.js.map +1 -0
  80. package/lib/database/AcDbDimStyleTable.d.ts +31 -0
  81. package/lib/database/AcDbDimStyleTable.d.ts.map +1 -0
  82. package/lib/database/AcDbDimStyleTable.js +49 -0
  83. package/lib/database/AcDbDimStyleTable.js.map +1 -0
  84. package/lib/database/AcDbDimStyleTableRecord.d.ts +797 -0
  85. package/lib/database/AcDbDimStyleTableRecord.d.ts.map +1 -0
  86. package/lib/database/AcDbDimStyleTableRecord.js +1294 -0
  87. package/lib/database/AcDbDimStyleTableRecord.js.map +1 -0
  88. package/lib/database/AcDbDwgVersion.d.ts +32 -0
  89. package/lib/database/AcDbDwgVersion.d.ts.map +1 -0
  90. package/lib/database/AcDbDwgVersion.js +126 -0
  91. package/lib/database/AcDbDwgVersion.js.map +1 -0
  92. package/lib/database/AcDbLayerTable.d.ts +51 -0
  93. package/lib/database/AcDbLayerTable.d.ts.map +1 -0
  94. package/lib/database/AcDbLayerTable.js +92 -0
  95. package/lib/database/AcDbLayerTable.js.map +1 -0
  96. package/lib/database/AcDbLayerTableRecord.d.ts +278 -0
  97. package/lib/database/AcDbLayerTableRecord.d.ts.map +1 -0
  98. package/lib/database/AcDbLayerTableRecord.js +397 -0
  99. package/lib/database/AcDbLayerTableRecord.js.map +1 -0
  100. package/lib/database/AcDbLinetypeTable.d.ts +30 -0
  101. package/lib/database/AcDbLinetypeTable.d.ts.map +1 -0
  102. package/lib/database/AcDbLinetypeTable.js +48 -0
  103. package/lib/database/AcDbLinetypeTable.js.map +1 -0
  104. package/lib/database/AcDbLinetypeTableRecord.d.ts +79 -0
  105. package/lib/database/AcDbLinetypeTableRecord.d.ts.map +1 -0
  106. package/lib/database/AcDbLinetypeTableRecord.js +129 -0
  107. package/lib/database/AcDbLinetypeTableRecord.js.map +1 -0
  108. package/lib/database/AcDbSymbolTable.d.ts +199 -0
  109. package/lib/database/AcDbSymbolTable.d.ts.map +1 -0
  110. package/lib/database/AcDbSymbolTable.js +264 -0
  111. package/lib/database/AcDbSymbolTable.js.map +1 -0
  112. package/lib/database/AcDbSymbolTableRecord.d.ts +61 -0
  113. package/lib/database/AcDbSymbolTableRecord.d.ts.map +1 -0
  114. package/lib/database/AcDbSymbolTableRecord.js +82 -0
  115. package/lib/database/AcDbSymbolTableRecord.js.map +1 -0
  116. package/lib/database/AcDbTextStyleTable.d.ts +48 -0
  117. package/lib/database/AcDbTextStyleTable.d.ts.map +1 -0
  118. package/lib/database/AcDbTextStyleTable.js +112 -0
  119. package/lib/database/AcDbTextStyleTable.js.map +1 -0
  120. package/lib/database/AcDbTextStyleTableRecord.d.ts +179 -0
  121. package/lib/database/AcDbTextStyleTableRecord.d.ts.map +1 -0
  122. package/lib/database/AcDbTextStyleTableRecord.js +276 -0
  123. package/lib/database/AcDbTextStyleTableRecord.js.map +1 -0
  124. package/lib/database/AcDbViewportTable.d.ts +31 -0
  125. package/lib/database/AcDbViewportTable.d.ts.map +1 -0
  126. package/lib/database/AcDbViewportTable.js +49 -0
  127. package/lib/database/AcDbViewportTable.js.map +1 -0
  128. package/lib/database/AcDbViewportTableRecord.d.ts +154 -0
  129. package/lib/database/AcDbViewportTableRecord.d.ts.map +1 -0
  130. package/lib/database/AcDbViewportTableRecord.js +318 -0
  131. package/lib/database/AcDbViewportTableRecord.js.map +1 -0
  132. package/lib/database/index.d.ts +19 -0
  133. package/lib/database/index.d.ts.map +1 -0
  134. package/lib/database/index.js +19 -0
  135. package/lib/database/index.js.map +1 -0
  136. package/lib/entity/AcDb2dPolyline.d.ts +146 -0
  137. package/lib/entity/AcDb2dPolyline.d.ts.map +1 -0
  138. package/lib/entity/AcDb2dPolyline.js +220 -0
  139. package/lib/entity/AcDb2dPolyline.js.map +1 -0
  140. package/lib/entity/AcDb2dVertex.d.ts +143 -0
  141. package/lib/entity/AcDb2dVertex.d.ts.map +1 -0
  142. package/lib/entity/AcDb2dVertex.js +210 -0
  143. package/lib/entity/AcDb2dVertex.js.map +1 -0
  144. package/lib/entity/AcDb3dPolyline.d.ts +102 -0
  145. package/lib/entity/AcDb3dPolyline.d.ts.map +1 -0
  146. package/lib/entity/AcDb3dPolyline.js +158 -0
  147. package/lib/entity/AcDb3dPolyline.js.map +1 -0
  148. package/lib/entity/AcDb3dVertex.d.ts +83 -0
  149. package/lib/entity/AcDb3dVertex.d.ts.map +1 -0
  150. package/lib/entity/AcDb3dVertex.js +133 -0
  151. package/lib/entity/AcDb3dVertex.js.map +1 -0
  152. package/lib/entity/AcDbArc.d.ts +254 -0
  153. package/lib/entity/AcDbArc.d.ts.map +1 -0
  154. package/lib/entity/AcDbArc.js +340 -0
  155. package/lib/entity/AcDbArc.js.map +1 -0
  156. package/lib/entity/AcDbBlockReference.d.ts +190 -0
  157. package/lib/entity/AcDbBlockReference.d.ts.map +1 -0
  158. package/lib/entity/AcDbBlockReference.js +302 -0
  159. package/lib/entity/AcDbBlockReference.js.map +1 -0
  160. package/lib/entity/AcDbCircle.d.ts +186 -0
  161. package/lib/entity/AcDbCircle.d.ts.map +1 -0
  162. package/lib/entity/AcDbCircle.js +249 -0
  163. package/lib/entity/AcDbCircle.js.map +1 -0
  164. package/lib/entity/AcDbCurve.d.ts +42 -0
  165. package/lib/entity/AcDbCurve.d.ts.map +1 -0
  166. package/lib/entity/AcDbCurve.js +44 -0
  167. package/lib/entity/AcDbCurve.js.map +1 -0
  168. package/lib/entity/AcDbEllipse.d.ts +207 -0
  169. package/lib/entity/AcDbEllipse.d.ts.map +1 -0
  170. package/lib/entity/AcDbEllipse.js +272 -0
  171. package/lib/entity/AcDbEllipse.js.map +1 -0
  172. package/lib/entity/AcDbEntity.d.ts +385 -0
  173. package/lib/entity/AcDbEntity.d.ts.map +1 -0
  174. package/lib/entity/AcDbEntity.js +561 -0
  175. package/lib/entity/AcDbEntity.js.map +1 -0
  176. package/lib/entity/AcDbFace.d.ts +151 -0
  177. package/lib/entity/AcDbFace.d.ts.map +1 -0
  178. package/lib/entity/AcDbFace.js +224 -0
  179. package/lib/entity/AcDbFace.js.map +1 -0
  180. package/lib/entity/AcDbHatch.d.ts +174 -0
  181. package/lib/entity/AcDbHatch.d.ts.map +1 -0
  182. package/lib/entity/AcDbHatch.js +250 -0
  183. package/lib/entity/AcDbHatch.js.map +1 -0
  184. package/lib/entity/AcDbLeader.d.ts +243 -0
  185. package/lib/entity/AcDbLeader.d.ts.map +1 -0
  186. package/lib/entity/AcDbLeader.js +358 -0
  187. package/lib/entity/AcDbLeader.js.map +1 -0
  188. package/lib/entity/AcDbLine.d.ts +198 -0
  189. package/lib/entity/AcDbLine.d.ts.map +1 -0
  190. package/lib/entity/AcDbLine.js +300 -0
  191. package/lib/entity/AcDbLine.js.map +1 -0
  192. package/lib/entity/AcDbMText.d.ts +248 -0
  193. package/lib/entity/AcDbMText.d.ts.map +1 -0
  194. package/lib/entity/AcDbMText.js +414 -0
  195. package/lib/entity/AcDbMText.js.map +1 -0
  196. package/lib/entity/AcDbPoint.d.ts +113 -0
  197. package/lib/entity/AcDbPoint.d.ts.map +1 -0
  198. package/lib/entity/AcDbPoint.js +155 -0
  199. package/lib/entity/AcDbPoint.js.map +1 -0
  200. package/lib/entity/AcDbPolyline.d.ts +221 -0
  201. package/lib/entity/AcDbPolyline.d.ts.map +1 -0
  202. package/lib/entity/AcDbPolyline.js +301 -0
  203. package/lib/entity/AcDbPolyline.js.map +1 -0
  204. package/lib/entity/AcDbRasterImage.d.ts +216 -0
  205. package/lib/entity/AcDbRasterImage.d.ts.map +1 -0
  206. package/lib/entity/AcDbRasterImage.js +451 -0
  207. package/lib/entity/AcDbRasterImage.js.map +1 -0
  208. package/lib/entity/AcDbRay.d.ts +150 -0
  209. package/lib/entity/AcDbRay.d.ts.map +1 -0
  210. package/lib/entity/AcDbRay.js +208 -0
  211. package/lib/entity/AcDbRay.js.map +1 -0
  212. package/lib/entity/AcDbSpline.d.ts +135 -0
  213. package/lib/entity/AcDbSpline.d.ts.map +1 -0
  214. package/lib/entity/AcDbSpline.js +142 -0
  215. package/lib/entity/AcDbSpline.js.map +1 -0
  216. package/lib/entity/AcDbTable.d.ts +260 -0
  217. package/lib/entity/AcDbTable.d.ts.map +1 -0
  218. package/lib/entity/AcDbTable.js +452 -0
  219. package/lib/entity/AcDbTable.js.map +1 -0
  220. package/lib/entity/AcDbText.d.ts +388 -0
  221. package/lib/entity/AcDbText.d.ts.map +1 -0
  222. package/lib/entity/AcDbText.js +523 -0
  223. package/lib/entity/AcDbText.js.map +1 -0
  224. package/lib/entity/AcDbTrace.d.ts +193 -0
  225. package/lib/entity/AcDbTrace.d.ts.map +1 -0
  226. package/lib/entity/AcDbTrace.js +271 -0
  227. package/lib/entity/AcDbTrace.js.map +1 -0
  228. package/lib/entity/AcDbViewport.d.ts +173 -0
  229. package/lib/entity/AcDbViewport.d.ts.map +1 -0
  230. package/lib/entity/AcDbViewport.js +295 -0
  231. package/lib/entity/AcDbViewport.js.map +1 -0
  232. package/lib/entity/AcDbWipeout.d.ts +39 -0
  233. package/lib/entity/AcDbWipeout.d.ts.map +1 -0
  234. package/lib/entity/AcDbWipeout.js +70 -0
  235. package/lib/entity/AcDbWipeout.js.map +1 -0
  236. package/lib/entity/AcDbXline.d.ts +151 -0
  237. package/lib/entity/AcDbXline.d.ts.map +1 -0
  238. package/lib/entity/AcDbXline.js +209 -0
  239. package/lib/entity/AcDbXline.js.map +1 -0
  240. package/lib/entity/dimension/AcDb3PointAngularDimension.d.ts +92 -0
  241. package/lib/entity/dimension/AcDb3PointAngularDimension.d.ts.map +1 -0
  242. package/lib/entity/dimension/AcDb3PointAngularDimension.js +157 -0
  243. package/lib/entity/dimension/AcDb3PointAngularDimension.js.map +1 -0
  244. package/lib/entity/dimension/AcDbAlignedDimension.d.ts +220 -0
  245. package/lib/entity/dimension/AcDbAlignedDimension.d.ts.map +1 -0
  246. package/lib/entity/dimension/AcDbAlignedDimension.js +341 -0
  247. package/lib/entity/dimension/AcDbAlignedDimension.js.map +1 -0
  248. package/lib/entity/dimension/AcDbArcDimension.d.ts +94 -0
  249. package/lib/entity/dimension/AcDbArcDimension.d.ts.map +1 -0
  250. package/lib/entity/dimension/AcDbArcDimension.js +159 -0
  251. package/lib/entity/dimension/AcDbArcDimension.js.map +1 -0
  252. package/lib/entity/dimension/AcDbDiametricDimension.d.ts +145 -0
  253. package/lib/entity/dimension/AcDbDiametricDimension.d.ts.map +1 -0
  254. package/lib/entity/dimension/AcDbDiametricDimension.js +275 -0
  255. package/lib/entity/dimension/AcDbDiametricDimension.js.map +1 -0
  256. package/lib/entity/dimension/AcDbDimension.d.ts +257 -0
  257. package/lib/entity/dimension/AcDbDimension.d.ts.map +1 -0
  258. package/lib/entity/dimension/AcDbDimension.js +466 -0
  259. package/lib/entity/dimension/AcDbDimension.js.map +1 -0
  260. package/lib/entity/dimension/AcDbOrdinateDimension.d.ts +78 -0
  261. package/lib/entity/dimension/AcDbOrdinateDimension.d.ts.map +1 -0
  262. package/lib/entity/dimension/AcDbOrdinateDimension.js +133 -0
  263. package/lib/entity/dimension/AcDbOrdinateDimension.js.map +1 -0
  264. package/lib/entity/dimension/AcDbRadialDimension.d.ts +214 -0
  265. package/lib/entity/dimension/AcDbRadialDimension.d.ts.map +1 -0
  266. package/lib/entity/dimension/AcDbRadialDimension.js +288 -0
  267. package/lib/entity/dimension/AcDbRadialDimension.js.map +1 -0
  268. package/lib/entity/dimension/index.d.ts +8 -0
  269. package/lib/entity/dimension/index.d.ts.map +1 -0
  270. package/lib/entity/dimension/index.js +8 -0
  271. package/lib/entity/dimension/index.js.map +1 -0
  272. package/lib/entity/index.d.ts +28 -0
  273. package/lib/entity/index.d.ts.map +1 -0
  274. package/lib/entity/index.js +28 -0
  275. package/lib/entity/index.js.map +1 -0
  276. package/lib/index.d.ts +10 -0
  277. package/lib/index.d.ts.map +1 -0
  278. package/lib/index.js +10 -0
  279. package/lib/index.js.map +1 -0
  280. package/lib/misc/AcDbAngleUnits.d.ts +20 -0
  281. package/lib/misc/AcDbAngleUnits.d.ts.map +1 -0
  282. package/lib/misc/AcDbAngleUnits.js +21 -0
  283. package/lib/misc/AcDbAngleUnits.js.map +1 -0
  284. package/lib/misc/AcDbCodePage.d.ts +50 -0
  285. package/lib/misc/AcDbCodePage.d.ts.map +1 -0
  286. package/lib/misc/AcDbCodePage.js +100 -0
  287. package/lib/misc/AcDbCodePage.js.map +1 -0
  288. package/lib/misc/AcDbConstants.d.ts +24 -0
  289. package/lib/misc/AcDbConstants.d.ts.map +1 -0
  290. package/lib/misc/AcDbConstants.js +24 -0
  291. package/lib/misc/AcDbConstants.js.map +1 -0
  292. package/lib/misc/AcDbDimArrowType.d.ts +89 -0
  293. package/lib/misc/AcDbDimArrowType.d.ts.map +1 -0
  294. package/lib/misc/AcDbDimArrowType.js +90 -0
  295. package/lib/misc/AcDbDimArrowType.js.map +1 -0
  296. package/lib/misc/AcDbObjectIterator.d.ts +64 -0
  297. package/lib/misc/AcDbObjectIterator.d.ts.map +1 -0
  298. package/lib/misc/AcDbObjectIterator.js +84 -0
  299. package/lib/misc/AcDbObjectIterator.js.map +1 -0
  300. package/lib/misc/AcDbOsnapMode.d.ts +51 -0
  301. package/lib/misc/AcDbOsnapMode.d.ts.map +1 -0
  302. package/lib/misc/AcDbOsnapMode.js +52 -0
  303. package/lib/misc/AcDbOsnapMode.js.map +1 -0
  304. package/lib/misc/AcDbRenderingCache.d.ts +141 -0
  305. package/lib/misc/AcDbRenderingCache.d.ts.map +1 -0
  306. package/lib/misc/AcDbRenderingCache.js +239 -0
  307. package/lib/misc/AcDbRenderingCache.js.map +1 -0
  308. package/lib/misc/AcDbUnitsValue.d.ts +101 -0
  309. package/lib/misc/AcDbUnitsValue.d.ts.map +1 -0
  310. package/lib/misc/AcDbUnitsValue.js +121 -0
  311. package/lib/misc/AcDbUnitsValue.js.map +1 -0
  312. package/lib/misc/index.d.ts +9 -0
  313. package/lib/misc/index.d.ts.map +1 -0
  314. package/lib/misc/index.js +9 -0
  315. package/lib/misc/index.js.map +1 -0
  316. package/lib/object/AcDbDictionary.d.ts +178 -0
  317. package/lib/object/AcDbDictionary.d.ts.map +1 -0
  318. package/lib/object/AcDbDictionary.js +264 -0
  319. package/lib/object/AcDbDictionary.js.map +1 -0
  320. package/lib/object/AcDbRasterImageDef.d.ts +54 -0
  321. package/lib/object/AcDbRasterImageDef.d.ts.map +1 -0
  322. package/lib/object/AcDbRasterImageDef.js +82 -0
  323. package/lib/object/AcDbRasterImageDef.js.map +1 -0
  324. package/lib/object/index.d.ts +4 -0
  325. package/lib/object/index.d.ts.map +1 -0
  326. package/lib/object/index.js +4 -0
  327. package/lib/object/index.js.map +1 -0
  328. package/lib/object/layout/AcDbLayout.d.ts +190 -0
  329. package/lib/object/layout/AcDbLayout.d.ts.map +1 -0
  330. package/lib/object/layout/AcDbLayout.js +253 -0
  331. package/lib/object/layout/AcDbLayout.js.map +1 -0
  332. package/lib/object/layout/AcDbLayoutDictionary.d.ts +47 -0
  333. package/lib/object/layout/AcDbLayoutDictionary.d.ts.map +1 -0
  334. package/lib/object/layout/AcDbLayoutDictionary.js +122 -0
  335. package/lib/object/layout/AcDbLayoutDictionary.js.map +1 -0
  336. package/lib/object/layout/AcDbLayoutManager.d.ts +188 -0
  337. package/lib/object/layout/AcDbLayoutManager.d.ts.map +1 -0
  338. package/lib/object/layout/AcDbLayoutManager.js +245 -0
  339. package/lib/object/layout/AcDbLayoutManager.js.map +1 -0
  340. package/lib/object/layout/index.d.ts +4 -0
  341. package/lib/object/layout/index.d.ts.map +1 -0
  342. package/lib/object/layout/index.js +4 -0
  343. package/lib/object/layout/index.js.map +1 -0
  344. package/package.json +4 -4
@@ -0,0 +1,708 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import { SmoothType, VertexFlag } from '@mlightcad/dxf-json';
13
+ import { AcGeCircArc2d, AcGeEllipseArc2d, AcGeLine2d, AcGeLoop2d, AcGeMathUtil, AcGePoint2d, AcGePoint3d, AcGePolyline2d, AcGeSpline3d, AcGeVector2d, AcGeVector3d } from '@mlightcad/geometry-engine';
14
+ import { AcDb2dPolyline, AcDb3dPolyline, AcDb3PointAngularDimension, AcDbAlignedDimension, AcDbArc, AcDbBlockReference, AcDbCircle, AcDbDiametricDimension, AcDbEllipse, AcDbFace, AcDbHatch, AcDbLeader, AcDbLine, AcDbMText, AcDbOrdinateDimension, AcDbPoint, AcDbPoly2dType, AcDbPoly3dType, AcDbPolyline, AcDbRadialDimension, AcDbRasterImage, AcDbRay, AcDbSpline, AcDbTable, AcDbText, AcDbTrace, AcDbViewport, AcDbWipeout, AcDbXline } from '../entity';
15
+ /**
16
+ * Converts DXF entities to AcDbEntity objects.
17
+ *
18
+ * This class provides functionality to convert various DXF entity types
19
+ * (such as lines, circles, arcs, text, etc.) into their corresponding
20
+ * AcDbEntity objects. It handles the conversion of geometric data,
21
+ * properties, and attributes from DXF format to the internal database format.
22
+ *
23
+ * @example
24
+ * ```typescript
25
+ * const converter = new AcDbEntityConverter();
26
+ * const dxfEntity = { type: 'LINE', startPoint: [0, 0, 0], endPoint: [10, 10, 0] };
27
+ * const acDbEntity = converter.convert(dxfEntity);
28
+ * ```
29
+ */
30
+ var AcDbEntityConverter = /** @class */ (function () {
31
+ function AcDbEntityConverter() {
32
+ }
33
+ /**
34
+ * Converts a DXF entity to an AcDbEntity.
35
+ *
36
+ * This method takes a DXF entity and converts it to the corresponding
37
+ * AcDbEntity type. It first creates the entity using createEntity(),
38
+ * then processes common attributes using processCommonAttrs().
39
+ *
40
+ * @param entity - The DXF entity to convert
41
+ * @returns The converted AcDbEntity, or null if conversion fails
42
+ *
43
+ * @example
44
+ * ```typescript
45
+ * const dxfLine = { type: 'LINE', startPoint: [0, 0, 0], endPoint: [10, 10, 0] };
46
+ * const acDbLine = converter.convert(dxfLine);
47
+ * if (acDbLine) {
48
+ * console.log('Converted to:', acDbLine.type);
49
+ * }
50
+ * ```
51
+ */
52
+ AcDbEntityConverter.prototype.convert = function (entity) {
53
+ var dbEntity = this.createEntity(entity);
54
+ if (dbEntity) {
55
+ this.processCommonAttrs(entity, dbEntity);
56
+ }
57
+ return dbEntity;
58
+ };
59
+ /**
60
+ * Creates the corresponding drawing database entity from DXF format data.
61
+ *
62
+ * This method acts as a factory that routes DXF entities to their specific
63
+ * conversion methods based on the entity type. It handles all supported
64
+ * DXF entity types including geometric entities, text entities, and special entities.
65
+ *
66
+ * @param entity - Input entity data in DXF format
67
+ * @returns The converted drawing database entity, or null if the entity type is not supported
68
+ *
69
+ * @example
70
+ * ```typescript
71
+ * const dxfEntity = { type: 'CIRCLE', center: [0, 0, 0], radius: 5 };
72
+ * const acDbEntity = converter.createEntity(dxfEntity);
73
+ * ```
74
+ */
75
+ AcDbEntityConverter.prototype.createEntity = function (entity) {
76
+ if (entity.type == '3DFACE') {
77
+ return this.convertFace(entity);
78
+ }
79
+ else if (entity.type == 'ARC') {
80
+ return this.convertArc(entity);
81
+ }
82
+ else if (entity.type == 'CIRCLE') {
83
+ return this.convertCirle(entity);
84
+ }
85
+ else if (entity.type == 'DIMENSION') {
86
+ return this.convertDimension(entity);
87
+ }
88
+ else if (entity.type == 'ELLIPSE') {
89
+ return this.convertEllipse(entity);
90
+ }
91
+ else if (entity.type == 'HATCH') {
92
+ return this.convertHatch(entity);
93
+ }
94
+ else if (entity.type == 'IMAGE') {
95
+ return this.convertImage(entity);
96
+ }
97
+ else if (entity.type == 'LEADER') {
98
+ return this.convertLeader(entity);
99
+ }
100
+ else if (entity.type == 'LINE') {
101
+ return this.convertLine(entity);
102
+ }
103
+ else if (entity.type == 'LWPOLYLINE') {
104
+ return this.convertLWPolyline(entity);
105
+ }
106
+ else if (entity.type == 'MTEXT') {
107
+ return this.convertMText(entity);
108
+ }
109
+ else if (entity.type == 'POLYLINE') {
110
+ return this.convertPolyline(entity);
111
+ }
112
+ else if (entity.type == 'POINT') {
113
+ return this.convertPoint(entity);
114
+ }
115
+ else if (entity.type == 'RAY') {
116
+ return this.convertRay(entity);
117
+ }
118
+ else if (entity.type == 'SPLINE') {
119
+ return this.convertSpline(entity);
120
+ }
121
+ else if (entity.type == 'ACAD_TABLE') {
122
+ return this.convertTable(entity);
123
+ }
124
+ else if (entity.type == 'TEXT') {
125
+ return this.convertText(entity);
126
+ }
127
+ else if (entity.type == 'SOLID') {
128
+ return this.convertSolid(entity);
129
+ }
130
+ else if (entity.type == 'VIEWPORT') {
131
+ return this.convertViewport(entity);
132
+ }
133
+ else if (entity.type == 'WIPEOUT') {
134
+ return this.convertWipeout(entity);
135
+ }
136
+ else if (entity.type == 'XLINE') {
137
+ return this.convertXline(entity);
138
+ }
139
+ else if (entity.type == 'INSERT') {
140
+ return this.convertBlockReference(entity);
141
+ }
142
+ return null;
143
+ };
144
+ /**
145
+ * Converts a DXF 3DFACE entity to an AcDbFace.
146
+ *
147
+ * @param face - The DXF 3DFace entity to convert
148
+ * @returns The converted AcDbFace entity
149
+ */
150
+ AcDbEntityConverter.prototype.convertFace = function (face) {
151
+ var dbEntity = new AcDbFace();
152
+ face.vertices.forEach(function (vertex, index) {
153
+ return dbEntity.setVertexAt(index, vertex);
154
+ });
155
+ return dbEntity;
156
+ };
157
+ /**
158
+ * Converts a DXF arc entity to an AcDbArc.
159
+ *
160
+ * @param arc - The DXF arc entity to convert
161
+ * @returns The converted AcDbArc entity
162
+ *
163
+ * @example
164
+ * ```typescript
165
+ * const dxfArc = { type: 'ARC', center: [0, 0, 0], radius: 5, startAngle: 0, endAngle: 90 };
166
+ * const acDbArc = converter.convertArc(dxfArc);
167
+ * ```
168
+ */
169
+ AcDbEntityConverter.prototype.convertArc = function (arc) {
170
+ var dbEntity = new AcDbArc(arc.center, arc.radius, AcGeMathUtil.degToRad(arc.startAngle), AcGeMathUtil.degToRad(arc.endAngle));
171
+ return dbEntity;
172
+ };
173
+ /**
174
+ * Converts a DXF circle entity to an AcDbCircle.
175
+ *
176
+ * @param circle - The DXF circle entity to convert
177
+ * @returns The converted AcDbCircle entity
178
+ *
179
+ * @example
180
+ * ```typescript
181
+ * const dxfCircle = { type: 'CIRCLE', center: [0, 0, 0], radius: 5 };
182
+ * const acDbCircle = converter.convertCirle(dxfCircle);
183
+ * ```
184
+ */
185
+ AcDbEntityConverter.prototype.convertCirle = function (circle) {
186
+ var dbEntity = new AcDbCircle(circle.center, circle.radius);
187
+ return dbEntity;
188
+ };
189
+ /**
190
+ * Converts a DXF ellipse entity to an AcDbEllipse.
191
+ *
192
+ * @param ellipse - The DXF ellipse entity to convert
193
+ * @returns The converted AcDbEllipse entity
194
+ *
195
+ * @example
196
+ * ```typescript
197
+ * const dxfEllipse = { type: 'ELLIPSE', center: [0, 0, 0], majorAxisEndPoint: [5, 0, 0] };
198
+ * const acDbEllipse = converter.convertEllipse(dxfEllipse);
199
+ * ```
200
+ */
201
+ AcDbEntityConverter.prototype.convertEllipse = function (ellipse) {
202
+ var _a;
203
+ var majorAxis = new AcGeVector3d(ellipse.majorAxisEndPoint);
204
+ var majorAxisRadius = majorAxis.length();
205
+ var dbEntity = new AcDbEllipse(ellipse.center, (_a = ellipse.extrusionDirection) !== null && _a !== void 0 ? _a : AcGeVector3d.Z_AXIS, majorAxis, majorAxisRadius, majorAxisRadius * ellipse.axisRatio, ellipse.startAngle, ellipse.endAngle);
206
+ return dbEntity;
207
+ };
208
+ AcDbEntityConverter.prototype.convertLine = function (line) {
209
+ var start = line.startPoint;
210
+ var end = line.endPoint;
211
+ var dbEntity = new AcDbLine(new AcGePoint3d(start.x, start.y, start.z || 0), new AcGePoint3d(end.x, end.y, end.z || 0));
212
+ return dbEntity;
213
+ };
214
+ AcDbEntityConverter.prototype.convertSpline = function (spline) {
215
+ // Catch error to construct spline because it maybe one spline in one block.
216
+ // If don't catch the error, the block conversion may be interruptted.
217
+ try {
218
+ if (spline.numberOfControlPoints > 0 && spline.numberOfKnots > 0) {
219
+ return new AcDbSpline(spline.controlPoints, spline.knots, spline.weights, spline.degree, !!(spline.flag & 0x01));
220
+ }
221
+ else if (spline.numberOfFitPoints > 0) {
222
+ var fitPoints = this.numberArrayToPointArray(spline.fitPoints, spline.numberOfFitPoints);
223
+ if (fitPoints != null) {
224
+ return new AcDbSpline(fitPoints, 'Uniform', spline.degree, !!(spline.flag & 0x01));
225
+ }
226
+ }
227
+ }
228
+ catch (error) {
229
+ console.log("Failed to convert spline with error: ".concat(error));
230
+ }
231
+ return null;
232
+ };
233
+ AcDbEntityConverter.prototype.convertPoint = function (point) {
234
+ var dbEntity = new AcDbPoint();
235
+ dbEntity.position = point.position;
236
+ return dbEntity;
237
+ };
238
+ AcDbEntityConverter.prototype.convertSolid = function (solid) {
239
+ var dbEntity = new AcDbTrace();
240
+ solid.points.forEach(function (point, index) { return dbEntity.setPointAt(index, point); });
241
+ dbEntity.thickness = solid.thickness;
242
+ return dbEntity;
243
+ };
244
+ AcDbEntityConverter.prototype.convertPolyline = function (polyline) {
245
+ // Polyline flag (bit-coded; default = 0):
246
+ // https://help.autodesk.com/view/OARX/2023/ENU/?guid=GUID-ABF6B778-BE20-4B49-9B58-A94E64CEFFF3
247
+ //
248
+ // 1 = This is a closed polyline (or a polygon mesh closed in the M direction)
249
+ // 2 = Curve-fit vertices have been added
250
+ // 4 = Spline-fit vertices have been added
251
+ // 8 = This is a 3D polyline
252
+ // 16 = This is a 3D polygon mesh
253
+ // 32 = The polygon mesh is closed in the N direction
254
+ // 64 = The polyline is a polyface mesh
255
+ // 128 = The linetype pattern is generated continuously around the vertices of this polyline
256
+ var isClosed = !!(polyline.flag & 0x01);
257
+ var is3dPolyline = !!(polyline.flag & 0x08);
258
+ // Filter out spline control points
259
+ var vertices = [];
260
+ var bulges = [];
261
+ polyline.vertices.map(function (vertex) {
262
+ var _a;
263
+ if (!(vertex.flag & VertexFlag.SPLINE_CONTROL_POINT)) {
264
+ vertices.push({
265
+ x: vertex.x,
266
+ y: vertex.y,
267
+ z: vertex.z
268
+ });
269
+ bulges.push((_a = vertex.bulge) !== null && _a !== void 0 ? _a : 0);
270
+ }
271
+ });
272
+ if (is3dPolyline) {
273
+ var polyType = AcDbPoly3dType.SimplePoly;
274
+ if (polyline.flag & 0x04) {
275
+ if (polyline.smoothType == SmoothType.CUBIC) {
276
+ polyType = AcDbPoly3dType.CubicSplinePoly;
277
+ }
278
+ else if (polyline.smoothType == SmoothType.QUADRATIC) {
279
+ polyType = AcDbPoly3dType.QuadSplinePoly;
280
+ }
281
+ }
282
+ return new AcDb3dPolyline(polyType, vertices, isClosed);
283
+ }
284
+ else {
285
+ var polyType = AcDbPoly2dType.SimplePoly;
286
+ if (polyline.flag & 0x02) {
287
+ polyType = AcDbPoly2dType.FitCurvePoly;
288
+ }
289
+ else if (polyline.flag & 0x04) {
290
+ if (polyline.smoothType == SmoothType.CUBIC) {
291
+ polyType = AcDbPoly2dType.CubicSplinePoly;
292
+ }
293
+ else if (polyline.smoothType == SmoothType.QUADRATIC) {
294
+ polyType = AcDbPoly2dType.QuadSplinePoly;
295
+ }
296
+ }
297
+ return new AcDb2dPolyline(polyType, vertices, 0, isClosed, polyline.startWidth, polyline.endWidth, bulges);
298
+ }
299
+ };
300
+ AcDbEntityConverter.prototype.convertLWPolyline = function (polyline) {
301
+ var dbEntity = new AcDbPolyline();
302
+ dbEntity.closed = !!(polyline.flag & 0x01);
303
+ polyline.vertices.forEach(function (vertex, index) {
304
+ dbEntity.addVertexAt(index, new AcGePoint2d(vertex.x, vertex.y), vertex.bulge, vertex.startWidth, vertex.endWidth);
305
+ });
306
+ return dbEntity;
307
+ };
308
+ AcDbEntityConverter.prototype.convertHatch = function (hatch) {
309
+ var _a;
310
+ var dbEntity = new AcDbHatch();
311
+ (_a = hatch.definitionLines) === null || _a === void 0 ? void 0 : _a.forEach(function (item) {
312
+ dbEntity.definitionLines.push({
313
+ angle: item.angle,
314
+ origin: item.base,
315
+ delta: item.offset,
316
+ dashPattern: item.numberOfDashLengths > 0 ? item.dashLengths : []
317
+ });
318
+ });
319
+ dbEntity.hatchStyle = hatch.hatchStyle;
320
+ dbEntity.patternName = hatch.patternName;
321
+ dbEntity.patternType = hatch.patternType;
322
+ dbEntity.patternAngle = hatch.patternAngle == null ? 0 : hatch.patternAngle;
323
+ dbEntity.patternScale = hatch.patternScale == null ? 0 : hatch.patternScale;
324
+ var paths = hatch.boundaryPaths;
325
+ paths.forEach(function (path) {
326
+ var flag = path.boundaryPathTypeFlag;
327
+ // Check whether it is a polyline
328
+ if (flag & 0x02) {
329
+ var polylinePath = path;
330
+ var polyline_1 = new AcGePolyline2d();
331
+ polyline_1.closed = polylinePath.isClosed;
332
+ polylinePath.vertices.forEach(function (vertex, index) {
333
+ polyline_1.addVertexAt(index, {
334
+ x: vertex.x,
335
+ y: vertex.y,
336
+ bulge: vertex.bulge
337
+ });
338
+ });
339
+ dbEntity.add(polyline_1);
340
+ }
341
+ else {
342
+ var edgePath = path;
343
+ var loop_1 = new AcGeLoop2d();
344
+ edgePath.edges.forEach(function (edge) {
345
+ if (edge.type == 1) {
346
+ var line = edge;
347
+ loop_1.add(new AcGeLine2d(line.start, line.end));
348
+ }
349
+ else if (edge.type == 2) {
350
+ var arc = edge;
351
+ loop_1.add(new AcGeCircArc2d(arc.center, arc.radius, AcGeMathUtil.degToRad(arc.startAngle || 0), AcGeMathUtil.degToRad(arc.endAngle || 0), !arc.isCCW));
352
+ }
353
+ else if (edge.type == 3) {
354
+ var ellipse = edge;
355
+ var majorAxis = new AcGeVector2d();
356
+ majorAxis.subVectors(ellipse.end, ellipse.center);
357
+ var majorAxisRadius = Math.sqrt(Math.pow(ellipse.end.x, 2) + Math.pow(ellipse.end.y, 2));
358
+ // Property name 'lengthOfMinorAxis' is really confusing.
359
+ // Actually length of minor axis means percentage of major axis length.
360
+ var minorAxisRadius = majorAxisRadius * ellipse.lengthOfMinorAxis;
361
+ var startAngle = AcGeMathUtil.degToRad(ellipse.startAngle || 0);
362
+ var endAngle = AcGeMathUtil.degToRad(ellipse.endAngle || 0);
363
+ var rotation = Math.atan2(ellipse.end.y, ellipse.end.x);
364
+ if (!ellipse.isCCW) {
365
+ // when clockwise, need to handle start/end angles
366
+ startAngle = Math.PI * 2 - startAngle;
367
+ endAngle = Math.PI * 2 - endAngle;
368
+ }
369
+ loop_1.add(new AcGeEllipseArc2d(__assign(__assign({}, ellipse.center), { z: 0 }), majorAxisRadius, minorAxisRadius, startAngle, endAngle, !ellipse.isCCW, rotation));
370
+ }
371
+ else if (edge.type == 4) {
372
+ var spline = edge;
373
+ if (spline.numberOfControlPoints > 0 && spline.numberOfKnots > 0) {
374
+ var controlPoints = spline.controlPoints.map(function (item) {
375
+ return {
376
+ x: item.x,
377
+ y: item.y,
378
+ z: 0
379
+ };
380
+ });
381
+ var hasWeights_1 = true;
382
+ var weights = spline.controlPoints.map(function (item) {
383
+ if (item.weight == null)
384
+ hasWeights_1 = false;
385
+ return item.weight || 1;
386
+ });
387
+ loop_1.add(new AcGeSpline3d(controlPoints, spline.knots, hasWeights_1 ? weights : undefined));
388
+ }
389
+ else if (spline.numberOfFitData > 0) {
390
+ var fitPoints = spline.fitDatum.map(function (item) {
391
+ return {
392
+ x: item.x,
393
+ y: item.y,
394
+ z: 0
395
+ };
396
+ });
397
+ loop_1.add(new AcGeSpline3d(fitPoints, 'Uniform'));
398
+ }
399
+ }
400
+ });
401
+ dbEntity.add(loop_1);
402
+ }
403
+ });
404
+ return dbEntity;
405
+ };
406
+ AcDbEntityConverter.prototype.convertTable = function (table) {
407
+ var dbEntity = new AcDbTable(table.name, table.rowCount, table.columnCount);
408
+ dbEntity.attachmentPoint =
409
+ table.attachmentPoint;
410
+ dbEntity.position.copy(table.startPoint);
411
+ table.columnWidthArr.forEach(function (width, index) {
412
+ return dbEntity.setColumnWidth(index, width);
413
+ });
414
+ table.rowHeightArr.forEach(function (height, index) {
415
+ return dbEntity.setRowHeight(index, height);
416
+ });
417
+ table.cells.forEach(function (cell, index) {
418
+ dbEntity.setCell(index, cell);
419
+ });
420
+ return dbEntity;
421
+ };
422
+ AcDbEntityConverter.prototype.convertText = function (text) {
423
+ var _a, _b;
424
+ var dbEntity = new AcDbText();
425
+ dbEntity.textString = text.text;
426
+ dbEntity.styleName = text.styleName;
427
+ dbEntity.height = text.textHeight;
428
+ dbEntity.position.copy(text.startPoint);
429
+ dbEntity.rotation = AcGeMathUtil.degToRad(text.rotation || 0);
430
+ dbEntity.oblique = (_a = text.obliqueAngle) !== null && _a !== void 0 ? _a : 0;
431
+ dbEntity.thickness = text.thickness;
432
+ dbEntity.horizontalMode = text.halign;
433
+ dbEntity.verticalMode = text.valign;
434
+ dbEntity.widthFactor = (_b = text.xScale) !== null && _b !== void 0 ? _b : 1;
435
+ return dbEntity;
436
+ };
437
+ AcDbEntityConverter.prototype.convertMText = function (mtext) {
438
+ var dbEntity = new AcDbMText();
439
+ dbEntity.contents = mtext.text;
440
+ if (mtext.styleName != null) {
441
+ dbEntity.styleName = mtext.styleName;
442
+ }
443
+ dbEntity.height = mtext.height;
444
+ dbEntity.width = mtext.width;
445
+ dbEntity.rotation = AcGeMathUtil.degToRad(mtext.rotation || 0);
446
+ dbEntity.location = mtext.insertionPoint;
447
+ dbEntity.attachmentPoint =
448
+ mtext.attachmentPoint;
449
+ if (mtext.direction) {
450
+ dbEntity.direction = new AcGeVector3d(mtext.direction);
451
+ }
452
+ dbEntity.drawingDirection =
453
+ mtext.drawingDirection;
454
+ return dbEntity;
455
+ };
456
+ AcDbEntityConverter.prototype.convertLeader = function (leader) {
457
+ var dbEntity = new AcDbLeader();
458
+ leader.vertices.forEach(function (point) {
459
+ dbEntity.appendVertex(point);
460
+ });
461
+ dbEntity.hasArrowHead = leader.isArrowheadEnabled;
462
+ dbEntity.hasHookLine = leader.isHooklineExists;
463
+ dbEntity.isSplined = leader.isSpline;
464
+ dbEntity.dimensionStyle = leader.styleName;
465
+ dbEntity.annoType =
466
+ leader.leaderCreationFlag;
467
+ return dbEntity;
468
+ };
469
+ AcDbEntityConverter.prototype.convertDimension = function (dimension) {
470
+ if (dimension.subclassMarker == 'AcDbAlignedDimension' ||
471
+ dimension.subclassMarker == 'AcDbRotatedDimension') {
472
+ var entity = dimension;
473
+ var dbEntity = new AcDbAlignedDimension(entity.subDefinitionPoint1, entity.subDefinitionPoint2, entity.definitionPoint);
474
+ dbEntity.rotation = AcGeMathUtil.degToRad(entity.rotationAngle || 0);
475
+ this.processDimensionCommonAttrs(dimension, dbEntity);
476
+ return dbEntity;
477
+ }
478
+ else if (dimension.subclassMarker == 'AcDb3PointAngularDimension') {
479
+ var entity = dimension;
480
+ var dbEntity = new AcDb3PointAngularDimension(entity.centerPoint, entity.subDefinitionPoint1, entity.subDefinitionPoint2, entity.definitionPoint);
481
+ this.processDimensionCommonAttrs(dimension, dbEntity);
482
+ return dbEntity;
483
+ }
484
+ else if (dimension.subclassMarker == 'AcDbOrdinateDimension') {
485
+ var entity = dimension;
486
+ var dbEntity = new AcDbOrdinateDimension(entity.subDefinitionPoint1, entity.subDefinitionPoint2);
487
+ this.processDimensionCommonAttrs(dimension, dbEntity);
488
+ return dbEntity;
489
+ }
490
+ else if (dimension.subclassMarker == 'AcDbRadialDimension') {
491
+ var entity = dimension;
492
+ var dbEntity = new AcDbRadialDimension(entity.definitionPoint, entity.centerPoint, entity.leaderLength);
493
+ this.processDimensionCommonAttrs(dimension, dbEntity);
494
+ return dbEntity;
495
+ }
496
+ else if (dimension.subclassMarker == 'AcDbDiametricDimension') {
497
+ var entity = dimension;
498
+ var dbEntity = new AcDbDiametricDimension(entity.definitionPoint, entity.centerPoint, entity.leaderLength);
499
+ this.processDimensionCommonAttrs(dimension, dbEntity);
500
+ return dbEntity;
501
+ }
502
+ return null;
503
+ };
504
+ AcDbEntityConverter.prototype.processImage = function (image, dbImage) {
505
+ dbImage.position.copy(image.position);
506
+ dbImage.brightness = image.brightness;
507
+ dbImage.contrast = image.contrast;
508
+ dbImage.fade = image.fade;
509
+ dbImage.isShownClipped = (image.flags | 0x0004) > 0;
510
+ dbImage.isImageShown = (image.flags | 0x0003) > 0;
511
+ dbImage.isImageTransparent = (image.flags | 0x0008) > 0;
512
+ dbImage.imageDefId = image.imageDefHandle;
513
+ dbImage.isClipped = image.isClipped;
514
+ image.clippingBoundaryPath.forEach(function (point) {
515
+ dbImage.clipBoundary.push(new AcGePoint2d(point));
516
+ });
517
+ // Calculate the scale factors
518
+ dbImage.width =
519
+ Math.sqrt(Math.pow(image.uPixel.x, 2) + Math.pow(image.uPixel.y, 2) + Math.pow(image.uPixel.z, 2)) * image.imageSize.x;
520
+ dbImage.height =
521
+ Math.sqrt(Math.pow(image.vPixel.x, 2) + Math.pow(image.vPixel.y, 2) + Math.pow(image.vPixel.z, 2)) * image.imageSize.y;
522
+ // Calculate the rotation angle
523
+ // Rotation is determined by the angle of the U-vector relative to the X-axis
524
+ dbImage.rotation = Math.atan2(image.uPixel.y, image.uPixel.x);
525
+ };
526
+ AcDbEntityConverter.prototype.convertImage = function (image) {
527
+ var dbImage = new AcDbRasterImage();
528
+ this.processImage(image, dbImage);
529
+ dbImage.clipBoundaryType =
530
+ image.clippingBoundaryType;
531
+ return dbImage;
532
+ };
533
+ AcDbEntityConverter.prototype.processWipeout = function (wipeout, dbWipeout) {
534
+ dbWipeout.position.copy(wipeout.position);
535
+ dbWipeout.brightness = wipeout.brightness;
536
+ dbWipeout.contrast = wipeout.contrast;
537
+ dbWipeout.fade = wipeout.fade;
538
+ dbWipeout.isShownClipped = (wipeout.displayFlag | 0x0004) > 0;
539
+ dbWipeout.isImageShown = (wipeout.displayFlag | 0x0003) > 0;
540
+ dbWipeout.isImageTransparent = (wipeout.displayFlag | 0x0008) > 0;
541
+ dbWipeout.imageDefId = wipeout.imageDefHardId;
542
+ dbWipeout.isClipped = wipeout.isClipping;
543
+ wipeout.boundary.forEach(function (point) {
544
+ dbWipeout.clipBoundary.push(new AcGePoint2d(point));
545
+ });
546
+ dbWipeout.clipBoundaryType =
547
+ wipeout.boundaryType;
548
+ // Calculate the scale factors
549
+ dbWipeout.width =
550
+ Math.sqrt(Math.pow(wipeout.uDirection.x, 2) +
551
+ Math.pow(wipeout.uDirection.y, 2) +
552
+ Math.pow(wipeout.uDirection.z, 2)) * wipeout.imageSize.x;
553
+ dbWipeout.height =
554
+ Math.sqrt(Math.pow(wipeout.vDirection.x, 2) +
555
+ Math.pow(wipeout.vDirection.y, 2) +
556
+ Math.pow(wipeout.vDirection.z, 2)) * wipeout.imageSize.y;
557
+ // Calculate the rotation angle
558
+ // Rotation is determined by the angle of the U-vector relative to the X-axis
559
+ dbWipeout.rotation = Math.atan2(wipeout.uDirection.y, wipeout.uDirection.x);
560
+ };
561
+ AcDbEntityConverter.prototype.convertWipeout = function (wipeout) {
562
+ var dbWipeout = new AcDbWipeout();
563
+ this.processWipeout(wipeout, dbWipeout);
564
+ return dbWipeout;
565
+ };
566
+ AcDbEntityConverter.prototype.convertViewport = function (viewport) {
567
+ var dbViewport = new AcDbViewport();
568
+ dbViewport.number = viewport.viewportId;
569
+ dbViewport.centerPoint.copy(viewport.viewportCenter);
570
+ dbViewport.height = viewport.height;
571
+ dbViewport.width = viewport.width;
572
+ dbViewport.viewCenter.copy(viewport.displayCenter);
573
+ dbViewport.viewHeight = viewport.viewHeight;
574
+ return dbViewport;
575
+ };
576
+ AcDbEntityConverter.prototype.convertRay = function (ray) {
577
+ var dbRay = new AcDbRay();
578
+ dbRay.basePoint.copy(ray.position);
579
+ dbRay.unitDir.copy(ray.direction);
580
+ return dbRay;
581
+ };
582
+ AcDbEntityConverter.prototype.convertXline = function (xline) {
583
+ var dbXline = new AcDbXline();
584
+ dbXline.basePoint.copy(xline.position);
585
+ dbXline.unitDir.copy(xline.direction);
586
+ return dbXline;
587
+ };
588
+ AcDbEntityConverter.prototype.convertBlockReference = function (blockReference) {
589
+ var _a;
590
+ var dbBlockReference = new AcDbBlockReference(blockReference.name);
591
+ if (blockReference.insertionPoint)
592
+ dbBlockReference.position.copy(blockReference.insertionPoint);
593
+ dbBlockReference.scaleFactors.x = blockReference.xScale || 1;
594
+ dbBlockReference.scaleFactors.y = blockReference.yScale || 1;
595
+ dbBlockReference.scaleFactors.z = blockReference.zScale || 1;
596
+ dbBlockReference.rotation =
597
+ blockReference.rotation != null
598
+ ? AcGeMathUtil.degToRad(blockReference.rotation)
599
+ : 0;
600
+ dbBlockReference.normal.copy((_a = blockReference.extrusionDirection) !== null && _a !== void 0 ? _a : { x: 0, y: 0, z: 1 });
601
+ return dbBlockReference;
602
+ };
603
+ AcDbEntityConverter.prototype.processDimensionCommonAttrs = function (entity, dbEntity) {
604
+ dbEntity.dimBlockId = entity.name;
605
+ dbEntity.textPosition.copy(entity.textPoint);
606
+ dbEntity.textRotation = entity.textRotation || 0;
607
+ if (entity.textLineSpacingFactor) {
608
+ dbEntity.textLineSpacingFactor = entity.textLineSpacingFactor;
609
+ }
610
+ if (entity.textLineSpacingStyle) {
611
+ dbEntity.textLineSpacingStyle =
612
+ entity.textLineSpacingStyle;
613
+ }
614
+ dbEntity.dimensionStyleName = entity.styleName;
615
+ dbEntity.dimensionText = entity.text || '';
616
+ dbEntity.measurement = entity.measurement;
617
+ };
618
+ /**
619
+ * Processes common attributes from a DXF entity to an AcDbEntity.
620
+ *
621
+ * This method copies common properties like layer, object ID, owner ID,
622
+ * linetype, lineweight, color, visibility, and transparency from the
623
+ * DXF entity to the corresponding AcDbEntity.
624
+ *
625
+ * @param entity - The source DXF entity
626
+ * @param dbEntity - The target AcDbEntity to populate
627
+ *
628
+ * @example
629
+ * ```typescript
630
+ * converter.processCommonAttrs(dxfEntity, acDbEntity);
631
+ * ```
632
+ */
633
+ AcDbEntityConverter.prototype.processCommonAttrs = function (entity, dbEntity) {
634
+ dbEntity.layer = entity.layer || '0';
635
+ // I found some dxf file may have entity without handle. If so, let's use objectId
636
+ // created by AcDbObject constructor instead.
637
+ if (entity.handle)
638
+ dbEntity.objectId = entity.handle;
639
+ dbEntity.ownerId = entity.ownerBlockRecordSoftId || '';
640
+ if (entity.lineType != null) {
641
+ dbEntity.lineType = entity.lineType;
642
+ }
643
+ if (entity.lineweight != null) {
644
+ dbEntity.lineWeight = entity.lineweight;
645
+ }
646
+ if (entity.lineTypeScale != null) {
647
+ dbEntity.linetypeScale = entity.lineTypeScale;
648
+ }
649
+ if (entity.color != null) {
650
+ dbEntity.color.color = entity.color;
651
+ }
652
+ if (entity.colorIndex != null) {
653
+ dbEntity.color.colorIndex = entity.colorIndex;
654
+ }
655
+ if (entity.colorName != null) {
656
+ dbEntity.color.colorName = entity.colorName;
657
+ }
658
+ if (entity.isVisible != null) {
659
+ dbEntity.visibility = entity.isVisible;
660
+ }
661
+ if (entity.transparency != null) {
662
+ dbEntity.transparency = entity.transparency;
663
+ }
664
+ };
665
+ /**
666
+ * Converts a number array to an array of 3D points.
667
+ *
668
+ * This utility method takes a flat array of numbers and converts it to
669
+ * an array of AcGePoint3dLike objects. It automatically detects whether
670
+ * the input represents 2D or 3D points based on the array length and
671
+ * number of points.
672
+ *
673
+ * @param numbers - Flat array of numbers representing point coordinates
674
+ * @param numberOfPoints - Expected number of points in the array
675
+ * @returns Array of AcGePoint3dLike objects, or undefined if the conversion fails
676
+ *
677
+ * @example
678
+ * ```typescript
679
+ * const numbers = [0, 0, 10, 10, 20, 20]; // 3 points in 2D
680
+ * const points = converter.numberArrayToPointArray(numbers, 3);
681
+ * // Returns: [{x: 0, y: 0, z: 0}, {x: 10, y: 10, z: 0}, {x: 20, y: 20, z: 0}]
682
+ * ```
683
+ */
684
+ AcDbEntityConverter.prototype.numberArrayToPointArray = function (numbers, numberOfPoints) {
685
+ var count = numbers.length;
686
+ var dimension = 0;
687
+ if (count / 2 == numberOfPoints) {
688
+ dimension = 2;
689
+ }
690
+ else if (count / 3 == numberOfPoints) {
691
+ dimension = 3;
692
+ }
693
+ if (dimension == 0)
694
+ return undefined;
695
+ var points = [];
696
+ for (var index = 0, size = count / dimension; index < size; ++index) {
697
+ points.push({
698
+ x: numbers[index * dimension],
699
+ y: numbers[index * dimension + 1],
700
+ z: dimension == 3 ? numbers[index * dimension + 2] : 0
701
+ });
702
+ }
703
+ return points;
704
+ };
705
+ return AcDbEntityConverter;
706
+ }());
707
+ export { AcDbEntityConverter };
708
+ //# sourceMappingURL=AcDbEntitiyConverter.js.map