@mlightcad/libredwg-web 0.7.6 → 0.7.7

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.
@@ -1277,6 +1277,8 @@ class LibreEntityConverter {
1277
1277
  return this.convertAlignedDimension(entity_tio, commonAttrs);
1278
1278
  } else if (fixedtype == Dwg_Object_Type.DWG_TYPE_DIMENSION_ANG3PT) {
1279
1279
  return this.convert3PointAngularDimension(entity_tio, commonAttrs);
1280
+ } else if (fixedtype == Dwg_Object_Type.DWG_TYPE_DIMENSION_ANG2LN) {
1281
+ return this.convert2LineAngularDimension(entity_tio, commonAttrs);
1280
1282
  } else if (fixedtype == Dwg_Object_Type.DWG_TYPE_DIMENSION_DIAMETER) {
1281
1283
  return this.convertDiameterDimension(entity_tio, commonAttrs);
1282
1284
  } else if (fixedtype == Dwg_Object_Type.DWG_TYPE_DIMENSION_ORDINATE) {
@@ -1524,6 +1526,27 @@ class LibreEntityConverter {
1524
1526
  arcPoint
1525
1527
  };
1526
1528
  }
1529
+ convert2LineAngularDimension(entity, commonAttrs) {
1530
+ const libredwg = this.libredwg;
1531
+ const dimensionCommonAttrs = this.getDimensionCommonAttrs(entity);
1532
+ const xline1Start = libredwg.dwg_dynapi_entity_data(entity, "xline1start_pt");
1533
+ const xline1End = libredwg.dwg_dynapi_entity_data(entity, "xline1end_pt");
1534
+ const xline2Start = libredwg.dwg_dynapi_entity_data(entity, "xline2start_pt");
1535
+ const xline2End = libredwg.dwg_dynapi_entity_data(entity, "xline2end_pt");
1536
+ const vertexPoint = libredwg.dwg_dynapi_entity_data(entity, "def_pt");
1537
+ if (xline2End) {
1538
+ dimensionCommonAttrs.definitionPoint = xline2End;
1539
+ }
1540
+ return {
1541
+ subclassMarker: "AcDb2LineAngularDimension",
1542
+ ...commonAttrs,
1543
+ ...dimensionCommonAttrs,
1544
+ subDefinitionPoint1: xline1Start ?? xline1End ?? vertexPoint ?? xline2End,
1545
+ subDefinitionPoint2: xline2Start ?? xline2End ?? vertexPoint ?? xline1End,
1546
+ centerPoint: vertexPoint ?? xline2Start ?? xline1End ?? xline2End,
1547
+ arcPoint: xline2End ?? dimensionCommonAttrs.definitionPoint
1548
+ };
1549
+ }
1527
1550
  convertDiameterDimension(entity, commonAttrs) {
1528
1551
  const libredwg = this.libredwg;
1529
1552
  const dimensionCommonAttrs = this.getDimensionCommonAttrs(entity);
@@ -1279,6 +1279,8 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
1279
1279
  return this.convertAlignedDimension(entity_tio, commonAttrs);
1280
1280
  } else if (fixedtype == Dwg_Object_Type.DWG_TYPE_DIMENSION_ANG3PT) {
1281
1281
  return this.convert3PointAngularDimension(entity_tio, commonAttrs);
1282
+ } else if (fixedtype == Dwg_Object_Type.DWG_TYPE_DIMENSION_ANG2LN) {
1283
+ return this.convert2LineAngularDimension(entity_tio, commonAttrs);
1282
1284
  } else if (fixedtype == Dwg_Object_Type.DWG_TYPE_DIMENSION_DIAMETER) {
1283
1285
  return this.convertDiameterDimension(entity_tio, commonAttrs);
1284
1286
  } else if (fixedtype == Dwg_Object_Type.DWG_TYPE_DIMENSION_ORDINATE) {
@@ -1526,6 +1528,27 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
1526
1528
  arcPoint
1527
1529
  };
1528
1530
  }
1531
+ convert2LineAngularDimension(entity, commonAttrs) {
1532
+ const libredwg = this.libredwg;
1533
+ const dimensionCommonAttrs = this.getDimensionCommonAttrs(entity);
1534
+ const xline1Start = libredwg.dwg_dynapi_entity_data(entity, "xline1start_pt");
1535
+ const xline1End = libredwg.dwg_dynapi_entity_data(entity, "xline1end_pt");
1536
+ const xline2Start = libredwg.dwg_dynapi_entity_data(entity, "xline2start_pt");
1537
+ const xline2End = libredwg.dwg_dynapi_entity_data(entity, "xline2end_pt");
1538
+ const vertexPoint = libredwg.dwg_dynapi_entity_data(entity, "def_pt");
1539
+ if (xline2End) {
1540
+ dimensionCommonAttrs.definitionPoint = xline2End;
1541
+ }
1542
+ return {
1543
+ subclassMarker: "AcDb2LineAngularDimension",
1544
+ ...commonAttrs,
1545
+ ...dimensionCommonAttrs,
1546
+ subDefinitionPoint1: xline1Start ?? xline1End ?? vertexPoint ?? xline2End,
1547
+ subDefinitionPoint2: xline2Start ?? xline2End ?? vertexPoint ?? xline1End,
1548
+ centerPoint: vertexPoint ?? xline2Start ?? xline1End ?? xline2End,
1549
+ arcPoint: xline2End ?? dimensionCommonAttrs.definitionPoint
1550
+ };
1551
+ }
1529
1552
  convertDiameterDimension(entity, commonAttrs) {
1530
1553
  const libredwg = this.libredwg;
1531
1554
  const dimensionCommonAttrs = this.getDimensionCommonAttrs(entity);
@@ -20,6 +20,7 @@ export declare class LibreEntityConverter {
20
20
  private convertCircle;
21
21
  private convertAlignedDimension;
22
22
  private convert3PointAngularDimension;
23
+ private convert2LineAngularDimension;
23
24
  private convertDiameterDimension;
24
25
  private convertOrdinateDimension;
25
26
  private convertRadiusDimension;
@@ -69,6 +69,9 @@ export class LibreEntityConverter {
69
69
  else if (fixedtype == Dwg_Object_Type.DWG_TYPE_DIMENSION_ANG3PT) {
70
70
  return this.convert3PointAngularDimension(entity_tio, commonAttrs);
71
71
  }
72
+ else if (fixedtype == Dwg_Object_Type.DWG_TYPE_DIMENSION_ANG2LN) {
73
+ return this.convert2LineAngularDimension(entity_tio, commonAttrs);
74
+ }
72
75
  else if (fixedtype == Dwg_Object_Type.DWG_TYPE_DIMENSION_DIAMETER) {
73
76
  return this.convertDiameterDimension(entity_tio, commonAttrs);
74
77
  }
@@ -376,6 +379,29 @@ export class LibreEntityConverter {
376
379
  arcPoint: arcPoint
377
380
  };
378
381
  }
382
+ convert2LineAngularDimension(entity, commonAttrs) {
383
+ const libredwg = this.libredwg;
384
+ const dimensionCommonAttrs = this.getDimensionCommonAttrs(entity);
385
+ const xline1Start = libredwg.dwg_dynapi_entity_data(entity, 'xline1start_pt');
386
+ const xline1End = libredwg.dwg_dynapi_entity_data(entity, 'xline1end_pt');
387
+ const xline2Start = libredwg.dwg_dynapi_entity_data(entity, 'xline2start_pt');
388
+ const xline2End = libredwg.dwg_dynapi_entity_data(entity, 'xline2end_pt');
389
+ const vertexPoint = libredwg.dwg_dynapi_entity_data(entity, 'def_pt');
390
+ // For 2-line angular dimensions DXF group 10 is the arc location (xline2end_pt),
391
+ // not def_pt which stores the dimension line location (DXF group 16).
392
+ if (xline2End) {
393
+ dimensionCommonAttrs.definitionPoint = xline2End;
394
+ }
395
+ return {
396
+ subclassMarker: 'AcDb2LineAngularDimension',
397
+ ...commonAttrs,
398
+ ...dimensionCommonAttrs,
399
+ subDefinitionPoint1: xline1Start ?? xline1End ?? vertexPoint ?? xline2End,
400
+ subDefinitionPoint2: xline2Start ?? xline2End ?? vertexPoint ?? xline1End,
401
+ centerPoint: vertexPoint ?? xline2Start ?? xline1End ?? xline2End,
402
+ arcPoint: xline2End ?? dimensionCommonAttrs.definitionPoint
403
+ };
404
+ }
379
405
  convertDiameterDimension(entity, commonAttrs) {
380
406
  const libredwg = this.libredwg;
381
407
  const dimensionCommonAttrs = this.getDimensionCommonAttrs(entity);
@@ -166,7 +166,7 @@ export interface DwgAngularDimensionEntity extends DwgDimensionEntityCommon {
166
166
  /**
167
167
  * Subclass marker (AcDb3PointAngularDimension)
168
168
  */
169
- subclassMarker: 'AcDb3PointAngularDimension';
169
+ subclassMarker: 'AcDb3PointAngularDimension' | 'AcDb2LineAngularDimension';
170
170
  /**
171
171
  * Definition point for linear and angular dimensions (in WCS)
172
172
  */
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "A DWG/DXF JavaScript parser based on libredwg",
4
4
  "license": "GPL-3.0",
5
5
  "private": false,
6
- "version": "0.7.6",
6
+ "version": "0.7.7",
7
7
  "author": "MLight Lee <mlight.lee@outlook.com>",
8
8
  "type": "module",
9
9
  "engines": {