@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.
- package/dist/data-model.cjs +5 -0
- package/dist/data-model.js +25995 -0
- package/dist/dxf-parser-worker.js +1715 -0
- package/lib/base/AcDbHostApplicationServices.d.ts +96 -0
- package/lib/base/AcDbHostApplicationServices.d.ts.map +1 -0
- package/lib/base/AcDbHostApplicationServices.js +118 -0
- package/lib/base/AcDbHostApplicationServices.js.map +1 -0
- package/lib/base/AcDbObject.d.ts +205 -0
- package/lib/base/AcDbObject.d.ts.map +1 -0
- package/lib/base/AcDbObject.js +236 -0
- package/lib/base/AcDbObject.js.map +1 -0
- package/lib/base/index.d.ts +3 -0
- package/lib/base/index.d.ts.map +1 -0
- package/lib/base/index.js +3 -0
- package/lib/base/index.js.map +1 -0
- package/lib/converter/AcDbBatchProcessing.d.ts +146 -0
- package/lib/converter/AcDbBatchProcessing.d.ts.map +1 -0
- package/lib/converter/AcDbBatchProcessing.js +272 -0
- package/lib/converter/AcDbBatchProcessing.js.map +1 -0
- package/lib/converter/AcDbDxfConverter.d.ts +272 -0
- package/lib/converter/AcDbDxfConverter.d.ts.map +1 -0
- package/lib/converter/AcDbDxfConverter.js +883 -0
- package/lib/converter/AcDbDxfConverter.js.map +1 -0
- package/lib/converter/AcDbDxfParser.d.ts +23 -0
- package/lib/converter/AcDbDxfParser.d.ts.map +1 -0
- package/lib/converter/AcDbDxfParser.js +85 -0
- package/lib/converter/AcDbDxfParser.js.map +1 -0
- package/lib/converter/AcDbEntitiyConverter.d.ts +160 -0
- package/lib/converter/AcDbEntitiyConverter.d.ts.map +1 -0
- package/lib/converter/AcDbEntitiyConverter.js +708 -0
- package/lib/converter/AcDbEntitiyConverter.js.map +1 -0
- package/lib/converter/AcDbObjectConverter.d.ts +61 -0
- package/lib/converter/AcDbObjectConverter.d.ts.map +1 -0
- package/lib/converter/AcDbObjectConverter.js +91 -0
- package/lib/converter/AcDbObjectConverter.js.map +1 -0
- package/lib/converter/AcDbRegenerator.d.ts +101 -0
- package/lib/converter/AcDbRegenerator.d.ts.map +1 -0
- package/lib/converter/AcDbRegenerator.js +334 -0
- package/lib/converter/AcDbRegenerator.js.map +1 -0
- package/lib/converter/index.d.ts +5 -0
- package/lib/converter/index.d.ts.map +1 -0
- package/lib/converter/index.js +5 -0
- package/lib/converter/index.js.map +1 -0
- package/lib/converter/worker/AcDbBaseWorker.d.ts +36 -0
- package/lib/converter/worker/AcDbBaseWorker.d.ts.map +1 -0
- package/lib/converter/worker/AcDbBaseWorker.js +93 -0
- package/lib/converter/worker/AcDbBaseWorker.js.map +1 -0
- package/lib/converter/worker/AcDbDxfParserWorker.d.ts +11 -0
- package/lib/converter/worker/AcDbDxfParserWorker.d.ts.map +1 -0
- package/lib/converter/worker/AcDbDxfParserWorker.js +75 -0
- package/lib/converter/worker/AcDbDxfParserWorker.js.map +1 -0
- package/lib/converter/worker/AcDbWorkerManager.d.ts +107 -0
- package/lib/converter/worker/AcDbWorkerManager.d.ts.map +1 -0
- package/lib/converter/worker/AcDbWorkerManager.js +360 -0
- package/lib/converter/worker/AcDbWorkerManager.js.map +1 -0
- package/lib/converter/worker/index.d.ts +3 -0
- package/lib/converter/worker/index.d.ts.map +1 -0
- package/lib/converter/worker/index.js +3 -0
- package/lib/converter/worker/index.js.map +1 -0
- package/lib/database/AcDbBlockTable.d.ts +56 -0
- package/lib/database/AcDbBlockTable.d.ts.map +1 -0
- package/lib/database/AcDbBlockTable.js +98 -0
- package/lib/database/AcDbBlockTable.js.map +1 -0
- package/lib/database/AcDbBlockTableRecord.d.ts +185 -0
- package/lib/database/AcDbBlockTableRecord.d.ts.map +1 -0
- package/lib/database/AcDbBlockTableRecord.js +261 -0
- package/lib/database/AcDbBlockTableRecord.js.map +1 -0
- package/lib/database/AcDbDatabase.d.ts +563 -0
- package/lib/database/AcDbDatabase.d.ts.map +1 -0
- package/lib/database/AcDbDatabase.js +842 -0
- package/lib/database/AcDbDatabase.js.map +1 -0
- package/lib/database/AcDbDatabaseConverter.d.ts +292 -0
- package/lib/database/AcDbDatabaseConverter.d.ts.map +1 -0
- package/lib/database/AcDbDatabaseConverter.js +448 -0
- package/lib/database/AcDbDatabaseConverter.js.map +1 -0
- package/lib/database/AcDbDatabaseConverterManager.d.ts +141 -0
- package/lib/database/AcDbDatabaseConverterManager.d.ts.map +1 -0
- package/lib/database/AcDbDatabaseConverterManager.js +173 -0
- package/lib/database/AcDbDatabaseConverterManager.js.map +1 -0
- package/lib/database/AcDbDimStyleTable.d.ts +31 -0
- package/lib/database/AcDbDimStyleTable.d.ts.map +1 -0
- package/lib/database/AcDbDimStyleTable.js +49 -0
- package/lib/database/AcDbDimStyleTable.js.map +1 -0
- package/lib/database/AcDbDimStyleTableRecord.d.ts +797 -0
- package/lib/database/AcDbDimStyleTableRecord.d.ts.map +1 -0
- package/lib/database/AcDbDimStyleTableRecord.js +1294 -0
- package/lib/database/AcDbDimStyleTableRecord.js.map +1 -0
- package/lib/database/AcDbDwgVersion.d.ts +32 -0
- package/lib/database/AcDbDwgVersion.d.ts.map +1 -0
- package/lib/database/AcDbDwgVersion.js +126 -0
- package/lib/database/AcDbDwgVersion.js.map +1 -0
- package/lib/database/AcDbLayerTable.d.ts +51 -0
- package/lib/database/AcDbLayerTable.d.ts.map +1 -0
- package/lib/database/AcDbLayerTable.js +92 -0
- package/lib/database/AcDbLayerTable.js.map +1 -0
- package/lib/database/AcDbLayerTableRecord.d.ts +278 -0
- package/lib/database/AcDbLayerTableRecord.d.ts.map +1 -0
- package/lib/database/AcDbLayerTableRecord.js +397 -0
- package/lib/database/AcDbLayerTableRecord.js.map +1 -0
- package/lib/database/AcDbLinetypeTable.d.ts +30 -0
- package/lib/database/AcDbLinetypeTable.d.ts.map +1 -0
- package/lib/database/AcDbLinetypeTable.js +48 -0
- package/lib/database/AcDbLinetypeTable.js.map +1 -0
- package/lib/database/AcDbLinetypeTableRecord.d.ts +79 -0
- package/lib/database/AcDbLinetypeTableRecord.d.ts.map +1 -0
- package/lib/database/AcDbLinetypeTableRecord.js +129 -0
- package/lib/database/AcDbLinetypeTableRecord.js.map +1 -0
- package/lib/database/AcDbSymbolTable.d.ts +199 -0
- package/lib/database/AcDbSymbolTable.d.ts.map +1 -0
- package/lib/database/AcDbSymbolTable.js +264 -0
- package/lib/database/AcDbSymbolTable.js.map +1 -0
- package/lib/database/AcDbSymbolTableRecord.d.ts +61 -0
- package/lib/database/AcDbSymbolTableRecord.d.ts.map +1 -0
- package/lib/database/AcDbSymbolTableRecord.js +82 -0
- package/lib/database/AcDbSymbolTableRecord.js.map +1 -0
- package/lib/database/AcDbTextStyleTable.d.ts +48 -0
- package/lib/database/AcDbTextStyleTable.d.ts.map +1 -0
- package/lib/database/AcDbTextStyleTable.js +112 -0
- package/lib/database/AcDbTextStyleTable.js.map +1 -0
- package/lib/database/AcDbTextStyleTableRecord.d.ts +179 -0
- package/lib/database/AcDbTextStyleTableRecord.d.ts.map +1 -0
- package/lib/database/AcDbTextStyleTableRecord.js +276 -0
- package/lib/database/AcDbTextStyleTableRecord.js.map +1 -0
- package/lib/database/AcDbViewportTable.d.ts +31 -0
- package/lib/database/AcDbViewportTable.d.ts.map +1 -0
- package/lib/database/AcDbViewportTable.js +49 -0
- package/lib/database/AcDbViewportTable.js.map +1 -0
- package/lib/database/AcDbViewportTableRecord.d.ts +154 -0
- package/lib/database/AcDbViewportTableRecord.d.ts.map +1 -0
- package/lib/database/AcDbViewportTableRecord.js +318 -0
- package/lib/database/AcDbViewportTableRecord.js.map +1 -0
- package/lib/database/index.d.ts +19 -0
- package/lib/database/index.d.ts.map +1 -0
- package/lib/database/index.js +19 -0
- package/lib/database/index.js.map +1 -0
- package/lib/entity/AcDb2dPolyline.d.ts +146 -0
- package/lib/entity/AcDb2dPolyline.d.ts.map +1 -0
- package/lib/entity/AcDb2dPolyline.js +220 -0
- package/lib/entity/AcDb2dPolyline.js.map +1 -0
- package/lib/entity/AcDb2dVertex.d.ts +143 -0
- package/lib/entity/AcDb2dVertex.d.ts.map +1 -0
- package/lib/entity/AcDb2dVertex.js +210 -0
- package/lib/entity/AcDb2dVertex.js.map +1 -0
- package/lib/entity/AcDb3dPolyline.d.ts +102 -0
- package/lib/entity/AcDb3dPolyline.d.ts.map +1 -0
- package/lib/entity/AcDb3dPolyline.js +158 -0
- package/lib/entity/AcDb3dPolyline.js.map +1 -0
- package/lib/entity/AcDb3dVertex.d.ts +83 -0
- package/lib/entity/AcDb3dVertex.d.ts.map +1 -0
- package/lib/entity/AcDb3dVertex.js +133 -0
- package/lib/entity/AcDb3dVertex.js.map +1 -0
- package/lib/entity/AcDbArc.d.ts +254 -0
- package/lib/entity/AcDbArc.d.ts.map +1 -0
- package/lib/entity/AcDbArc.js +340 -0
- package/lib/entity/AcDbArc.js.map +1 -0
- package/lib/entity/AcDbBlockReference.d.ts +190 -0
- package/lib/entity/AcDbBlockReference.d.ts.map +1 -0
- package/lib/entity/AcDbBlockReference.js +302 -0
- package/lib/entity/AcDbBlockReference.js.map +1 -0
- package/lib/entity/AcDbCircle.d.ts +186 -0
- package/lib/entity/AcDbCircle.d.ts.map +1 -0
- package/lib/entity/AcDbCircle.js +249 -0
- package/lib/entity/AcDbCircle.js.map +1 -0
- package/lib/entity/AcDbCurve.d.ts +42 -0
- package/lib/entity/AcDbCurve.d.ts.map +1 -0
- package/lib/entity/AcDbCurve.js +44 -0
- package/lib/entity/AcDbCurve.js.map +1 -0
- package/lib/entity/AcDbEllipse.d.ts +207 -0
- package/lib/entity/AcDbEllipse.d.ts.map +1 -0
- package/lib/entity/AcDbEllipse.js +272 -0
- package/lib/entity/AcDbEllipse.js.map +1 -0
- package/lib/entity/AcDbEntity.d.ts +385 -0
- package/lib/entity/AcDbEntity.d.ts.map +1 -0
- package/lib/entity/AcDbEntity.js +561 -0
- package/lib/entity/AcDbEntity.js.map +1 -0
- package/lib/entity/AcDbFace.d.ts +151 -0
- package/lib/entity/AcDbFace.d.ts.map +1 -0
- package/lib/entity/AcDbFace.js +224 -0
- package/lib/entity/AcDbFace.js.map +1 -0
- package/lib/entity/AcDbHatch.d.ts +174 -0
- package/lib/entity/AcDbHatch.d.ts.map +1 -0
- package/lib/entity/AcDbHatch.js +250 -0
- package/lib/entity/AcDbHatch.js.map +1 -0
- package/lib/entity/AcDbLeader.d.ts +243 -0
- package/lib/entity/AcDbLeader.d.ts.map +1 -0
- package/lib/entity/AcDbLeader.js +358 -0
- package/lib/entity/AcDbLeader.js.map +1 -0
- package/lib/entity/AcDbLine.d.ts +198 -0
- package/lib/entity/AcDbLine.d.ts.map +1 -0
- package/lib/entity/AcDbLine.js +300 -0
- package/lib/entity/AcDbLine.js.map +1 -0
- package/lib/entity/AcDbMText.d.ts +248 -0
- package/lib/entity/AcDbMText.d.ts.map +1 -0
- package/lib/entity/AcDbMText.js +414 -0
- package/lib/entity/AcDbMText.js.map +1 -0
- package/lib/entity/AcDbPoint.d.ts +113 -0
- package/lib/entity/AcDbPoint.d.ts.map +1 -0
- package/lib/entity/AcDbPoint.js +155 -0
- package/lib/entity/AcDbPoint.js.map +1 -0
- package/lib/entity/AcDbPolyline.d.ts +221 -0
- package/lib/entity/AcDbPolyline.d.ts.map +1 -0
- package/lib/entity/AcDbPolyline.js +301 -0
- package/lib/entity/AcDbPolyline.js.map +1 -0
- package/lib/entity/AcDbRasterImage.d.ts +216 -0
- package/lib/entity/AcDbRasterImage.d.ts.map +1 -0
- package/lib/entity/AcDbRasterImage.js +451 -0
- package/lib/entity/AcDbRasterImage.js.map +1 -0
- package/lib/entity/AcDbRay.d.ts +150 -0
- package/lib/entity/AcDbRay.d.ts.map +1 -0
- package/lib/entity/AcDbRay.js +208 -0
- package/lib/entity/AcDbRay.js.map +1 -0
- package/lib/entity/AcDbSpline.d.ts +135 -0
- package/lib/entity/AcDbSpline.d.ts.map +1 -0
- package/lib/entity/AcDbSpline.js +142 -0
- package/lib/entity/AcDbSpline.js.map +1 -0
- package/lib/entity/AcDbTable.d.ts +260 -0
- package/lib/entity/AcDbTable.d.ts.map +1 -0
- package/lib/entity/AcDbTable.js +452 -0
- package/lib/entity/AcDbTable.js.map +1 -0
- package/lib/entity/AcDbText.d.ts +388 -0
- package/lib/entity/AcDbText.d.ts.map +1 -0
- package/lib/entity/AcDbText.js +523 -0
- package/lib/entity/AcDbText.js.map +1 -0
- package/lib/entity/AcDbTrace.d.ts +193 -0
- package/lib/entity/AcDbTrace.d.ts.map +1 -0
- package/lib/entity/AcDbTrace.js +271 -0
- package/lib/entity/AcDbTrace.js.map +1 -0
- package/lib/entity/AcDbViewport.d.ts +173 -0
- package/lib/entity/AcDbViewport.d.ts.map +1 -0
- package/lib/entity/AcDbViewport.js +295 -0
- package/lib/entity/AcDbViewport.js.map +1 -0
- package/lib/entity/AcDbWipeout.d.ts +39 -0
- package/lib/entity/AcDbWipeout.d.ts.map +1 -0
- package/lib/entity/AcDbWipeout.js +70 -0
- package/lib/entity/AcDbWipeout.js.map +1 -0
- package/lib/entity/AcDbXline.d.ts +151 -0
- package/lib/entity/AcDbXline.d.ts.map +1 -0
- package/lib/entity/AcDbXline.js +209 -0
- package/lib/entity/AcDbXline.js.map +1 -0
- package/lib/entity/dimension/AcDb3PointAngularDimension.d.ts +92 -0
- package/lib/entity/dimension/AcDb3PointAngularDimension.d.ts.map +1 -0
- package/lib/entity/dimension/AcDb3PointAngularDimension.js +157 -0
- package/lib/entity/dimension/AcDb3PointAngularDimension.js.map +1 -0
- package/lib/entity/dimension/AcDbAlignedDimension.d.ts +220 -0
- package/lib/entity/dimension/AcDbAlignedDimension.d.ts.map +1 -0
- package/lib/entity/dimension/AcDbAlignedDimension.js +341 -0
- package/lib/entity/dimension/AcDbAlignedDimension.js.map +1 -0
- package/lib/entity/dimension/AcDbArcDimension.d.ts +94 -0
- package/lib/entity/dimension/AcDbArcDimension.d.ts.map +1 -0
- package/lib/entity/dimension/AcDbArcDimension.js +159 -0
- package/lib/entity/dimension/AcDbArcDimension.js.map +1 -0
- package/lib/entity/dimension/AcDbDiametricDimension.d.ts +145 -0
- package/lib/entity/dimension/AcDbDiametricDimension.d.ts.map +1 -0
- package/lib/entity/dimension/AcDbDiametricDimension.js +275 -0
- package/lib/entity/dimension/AcDbDiametricDimension.js.map +1 -0
- package/lib/entity/dimension/AcDbDimension.d.ts +257 -0
- package/lib/entity/dimension/AcDbDimension.d.ts.map +1 -0
- package/lib/entity/dimension/AcDbDimension.js +466 -0
- package/lib/entity/dimension/AcDbDimension.js.map +1 -0
- package/lib/entity/dimension/AcDbOrdinateDimension.d.ts +78 -0
- package/lib/entity/dimension/AcDbOrdinateDimension.d.ts.map +1 -0
- package/lib/entity/dimension/AcDbOrdinateDimension.js +133 -0
- package/lib/entity/dimension/AcDbOrdinateDimension.js.map +1 -0
- package/lib/entity/dimension/AcDbRadialDimension.d.ts +214 -0
- package/lib/entity/dimension/AcDbRadialDimension.d.ts.map +1 -0
- package/lib/entity/dimension/AcDbRadialDimension.js +288 -0
- package/lib/entity/dimension/AcDbRadialDimension.js.map +1 -0
- package/lib/entity/dimension/index.d.ts +8 -0
- package/lib/entity/dimension/index.d.ts.map +1 -0
- package/lib/entity/dimension/index.js +8 -0
- package/lib/entity/dimension/index.js.map +1 -0
- package/lib/entity/index.d.ts +28 -0
- package/lib/entity/index.d.ts.map +1 -0
- package/lib/entity/index.js +28 -0
- package/lib/entity/index.js.map +1 -0
- package/lib/index.d.ts +10 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +10 -0
- package/lib/index.js.map +1 -0
- package/lib/misc/AcDbAngleUnits.d.ts +20 -0
- package/lib/misc/AcDbAngleUnits.d.ts.map +1 -0
- package/lib/misc/AcDbAngleUnits.js +21 -0
- package/lib/misc/AcDbAngleUnits.js.map +1 -0
- package/lib/misc/AcDbCodePage.d.ts +50 -0
- package/lib/misc/AcDbCodePage.d.ts.map +1 -0
- package/lib/misc/AcDbCodePage.js +100 -0
- package/lib/misc/AcDbCodePage.js.map +1 -0
- package/lib/misc/AcDbConstants.d.ts +24 -0
- package/lib/misc/AcDbConstants.d.ts.map +1 -0
- package/lib/misc/AcDbConstants.js +24 -0
- package/lib/misc/AcDbConstants.js.map +1 -0
- package/lib/misc/AcDbDimArrowType.d.ts +89 -0
- package/lib/misc/AcDbDimArrowType.d.ts.map +1 -0
- package/lib/misc/AcDbDimArrowType.js +90 -0
- package/lib/misc/AcDbDimArrowType.js.map +1 -0
- package/lib/misc/AcDbObjectIterator.d.ts +64 -0
- package/lib/misc/AcDbObjectIterator.d.ts.map +1 -0
- package/lib/misc/AcDbObjectIterator.js +84 -0
- package/lib/misc/AcDbObjectIterator.js.map +1 -0
- package/lib/misc/AcDbOsnapMode.d.ts +51 -0
- package/lib/misc/AcDbOsnapMode.d.ts.map +1 -0
- package/lib/misc/AcDbOsnapMode.js +52 -0
- package/lib/misc/AcDbOsnapMode.js.map +1 -0
- package/lib/misc/AcDbRenderingCache.d.ts +141 -0
- package/lib/misc/AcDbRenderingCache.d.ts.map +1 -0
- package/lib/misc/AcDbRenderingCache.js +239 -0
- package/lib/misc/AcDbRenderingCache.js.map +1 -0
- package/lib/misc/AcDbUnitsValue.d.ts +101 -0
- package/lib/misc/AcDbUnitsValue.d.ts.map +1 -0
- package/lib/misc/AcDbUnitsValue.js +121 -0
- package/lib/misc/AcDbUnitsValue.js.map +1 -0
- package/lib/misc/index.d.ts +9 -0
- package/lib/misc/index.d.ts.map +1 -0
- package/lib/misc/index.js +9 -0
- package/lib/misc/index.js.map +1 -0
- package/lib/object/AcDbDictionary.d.ts +178 -0
- package/lib/object/AcDbDictionary.d.ts.map +1 -0
- package/lib/object/AcDbDictionary.js +264 -0
- package/lib/object/AcDbDictionary.js.map +1 -0
- package/lib/object/AcDbRasterImageDef.d.ts +54 -0
- package/lib/object/AcDbRasterImageDef.d.ts.map +1 -0
- package/lib/object/AcDbRasterImageDef.js +82 -0
- package/lib/object/AcDbRasterImageDef.js.map +1 -0
- package/lib/object/index.d.ts +4 -0
- package/lib/object/index.d.ts.map +1 -0
- package/lib/object/index.js +4 -0
- package/lib/object/index.js.map +1 -0
- package/lib/object/layout/AcDbLayout.d.ts +190 -0
- package/lib/object/layout/AcDbLayout.d.ts.map +1 -0
- package/lib/object/layout/AcDbLayout.js +253 -0
- package/lib/object/layout/AcDbLayout.js.map +1 -0
- package/lib/object/layout/AcDbLayoutDictionary.d.ts +47 -0
- package/lib/object/layout/AcDbLayoutDictionary.d.ts.map +1 -0
- package/lib/object/layout/AcDbLayoutDictionary.js +122 -0
- package/lib/object/layout/AcDbLayoutDictionary.js.map +1 -0
- package/lib/object/layout/AcDbLayoutManager.d.ts +188 -0
- package/lib/object/layout/AcDbLayoutManager.d.ts.map +1 -0
- package/lib/object/layout/AcDbLayoutManager.js +245 -0
- package/lib/object/layout/AcDbLayoutManager.js.map +1 -0
- package/lib/object/layout/index.d.ts +4 -0
- package/lib/object/layout/index.d.ts.map +1 -0
- package/lib/object/layout/index.js +4 -0
- package/lib/object/layout/index.js.map +1 -0
- 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
|