@mlightcad/libredwg-web 0.7.12 → 0.7.14

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.
@@ -1299,6 +1299,8 @@ class LibreEntityConverter {
1299
1299
  return this.convert3dSolid(entity_tio, commonAttrs);
1300
1300
  } else if (fixedtype == Dwg_Object_Type.DWG_TYPE_ARC) {
1301
1301
  return this.convertArc(entity_tio, commonAttrs);
1302
+ } else if (fixedtype == Dwg_Object_Type.DWG_TYPE_ARCALIGNEDTEXT) {
1303
+ return this.convertArcAlignedText(entity_tio, commonAttrs);
1302
1304
  } else if (fixedtype == Dwg_Object_Type.DWG_TYPE_ATTDEF) {
1303
1305
  return this.convertAttdef(entity_tio, commonAttrs);
1304
1306
  } else if (fixedtype == Dwg_Object_Type.DWG_TYPE_CIRCLE) {
@@ -1448,6 +1450,54 @@ class LibreEntityConverter {
1448
1450
  extrusionDirection
1449
1451
  };
1450
1452
  }
1453
+ convertArcAlignedText(entity, commonAttrs) {
1454
+ const libredwg = this.libredwg;
1455
+ const numberField = (field, fallback = 0) => {
1456
+ const value = libredwg.dwg_dynapi_entity_data(entity, field);
1457
+ if (typeof value === "number" && Number.isFinite(value)) return value;
1458
+ if (typeof value === "string" && value.trim() !== "") {
1459
+ const parsed = Number(value);
1460
+ if (Number.isFinite(parsed)) return parsed;
1461
+ }
1462
+ return fallback;
1463
+ };
1464
+ const center = libredwg.dwg_dynapi_entity_data(entity, "center");
1465
+ const extrusion = libredwg.dwg_dynapi_entity_data(entity, "extrusion");
1466
+ const arcRef = libredwg.dwg_dynapi_entity_data(entity, "arc_handle");
1467
+ const xScale = numberField("xscale", 1);
1468
+ return {
1469
+ type: "ARCALIGNEDTEXT",
1470
+ ...commonAttrs,
1471
+ text: libredwg.dwg_dynapi_entity_data(entity, "text_value") ?? "",
1472
+ textSize: numberField("text_size"),
1473
+ xScale: xScale > 0 ? xScale : 1,
1474
+ characterSpacing: numberField("char_spacing"),
1475
+ styleName: libredwg.dwg_dynapi_entity_data(entity, "style") ?? "",
1476
+ fontName: libredwg.dwg_dynapi_entity_data(entity, "font_name") ?? "",
1477
+ bigFontName: libredwg.dwg_dynapi_entity_data(entity, "bigfont_name") ?? "",
1478
+ offsetFromArc: numberField("offset_from_arc"),
1479
+ rightOffset: numberField("right_offset"),
1480
+ leftOffset: numberField("left_offset"),
1481
+ center: center ?? { x: 0, y: 0, z: 0 },
1482
+ radius: libredwg.dwg_dynapi_entity_data(entity, "radius") ?? 0,
1483
+ startAngle: libredwg.dwg_dynapi_entity_data(entity, "start_angle") ?? 0,
1484
+ endAngle: libredwg.dwg_dynapi_entity_data(entity, "end_angle") ?? 0,
1485
+ extrusionDirection: extrusion ?? { x: 0, y: 0, z: 1 },
1486
+ rawTextColor: libredwg.dwg_dynapi_entity_data(entity, "color") ?? 256,
1487
+ characterSet: libredwg.dwg_dynapi_entity_data(entity, "character_set") ?? 0,
1488
+ pitchAndFamily: libredwg.dwg_dynapi_entity_data(entity, "pitch_and_family") ?? 0,
1489
+ isShx: (libredwg.dwg_dynapi_entity_data(entity, "is_shx") ?? 0) !== 0,
1490
+ isBold: (libredwg.dwg_dynapi_entity_data(entity, "is_bold") ?? 0) !== 0,
1491
+ isItalic: (libredwg.dwg_dynapi_entity_data(entity, "is_italic") ?? 0) !== 0,
1492
+ isUnderlined: (libredwg.dwg_dynapi_entity_data(entity, "is_underlined") ?? 0) !== 0,
1493
+ alignment: libredwg.dwg_dynapi_entity_data(entity, "alignment") ?? 0,
1494
+ isReverse: (libredwg.dwg_dynapi_entity_data(entity, "is_reverse") ?? 0) !== 0,
1495
+ wizardFlag: libredwg.dwg_dynapi_entity_data(entity, "wizard_flag") ?? 0,
1496
+ textPosition: libredwg.dwg_dynapi_entity_data(entity, "text_position") ?? 1,
1497
+ textDirection: libredwg.dwg_dynapi_entity_data(entity, "text_direction") ?? 1,
1498
+ arcHandle: arcRef ? libredwg.dwg_ref_get_id(arcRef) ?? "" : ""
1499
+ };
1500
+ }
1451
1501
  convertEmbeddedMText(entity, subclassName) {
1452
1502
  const libredwg = this.libredwg;
1453
1503
  const attachmentPoint = libredwg.dwg_dynapi_subclass_data(entity, subclassName, "attachment");
@@ -1997,13 +2047,21 @@ class LibreEntityConverter {
1997
2047
  const num_bulges = libredwg.dwg_dynapi_entity_data(entity, "num_bulges");
1998
2048
  const bulges_ptr = libredwg.dwg_dynapi_entity_data(entity, "bulges");
1999
2049
  const bulges = libredwg.dwg_ptr_to_double_array(bulges_ptr, num_bulges);
2050
+ const num_widths = libredwg.dwg_dynapi_entity_data(entity, "num_widths") ?? 0;
2051
+ const widths_ptr = libredwg.dwg_dynapi_entity_data(entity, "widths");
2052
+ const widthDoubles = num_widths > 0 && widths_ptr ? libredwg.dwg_ptr_to_double_array(widths_ptr, num_widths * 2) : [];
2000
2053
  points.forEach((point, index) => {
2001
- vertices.push({
2054
+ const vertex = {
2002
2055
  id: index,
2003
2056
  x: point.x,
2004
2057
  y: point.y,
2005
2058
  bulge: bulges.length > index ? bulges[index] : 0
2006
- });
2059
+ };
2060
+ if (index < num_widths && widthDoubles.length >= (index + 1) * 2) {
2061
+ vertex.startWidth = widthDoubles[index * 2];
2062
+ vertex.endWidth = widthDoubles[index * 2 + 1];
2063
+ }
2064
+ vertices.push(vertex);
2007
2065
  });
2008
2066
  return {
2009
2067
  type: "LWPOLYLINE",
@@ -2990,23 +3048,26 @@ class LibreEntityConverter {
2990
3048
  const rowCount = libredwg.dwg_dynapi_entity_data(entity, "num_rows");
2991
3049
  const columnCount = libredwg.dwg_dynapi_entity_data(entity, "num_cols");
2992
3050
  const row_heights_ptr = libredwg.dwg_dynapi_entity_data(entity, "row_heights");
2993
- const rowHeightArr = libredwg.dwg_ptr_to_double_array(
2994
- row_heights_ptr,
2995
- rowCount
2996
- );
3051
+ const rowHeightArr = libredwg.dwg_ptr_to_double_array(row_heights_ptr, rowCount);
2997
3052
  const col_widths_ptr = libredwg.dwg_dynapi_entity_data(entity, "col_widths");
2998
- const columnWidthArr = libredwg.dwg_ptr_to_double_array(
2999
- col_widths_ptr,
3000
- columnCount
3001
- );
3053
+ const columnWidthArr = libredwg.dwg_ptr_to_double_array(col_widths_ptr, columnCount);
3002
3054
  const table_style_ref = libredwg.dwg_dynapi_entity_data(entity, "tablestyle");
3003
3055
  const tableStyleId = libredwg.dwg_ref_get_id(table_style_ref) ?? "";
3004
3056
  const block_header_ref = libredwg.dwg_dynapi_entity_data(entity, "block_header");
3005
3057
  const blockRecordHandle = libredwg.dwg_ref_get_id(block_header_ref) ?? "";
3006
3058
  const overrideFlag = libredwg.dwg_dynapi_entity_data(entity, "table_flag_override");
3007
- const borderColorOverrideFlag = libredwg.dwg_dynapi_entity_data(entity, "border_color_overrides_flag");
3008
- const borderLineWeightOverrideFlag = libredwg.dwg_dynapi_entity_data(entity, "border_lineweight_overrides_flag");
3009
- const borderVisibilityOverrideFlag = libredwg.dwg_dynapi_entity_data(entity, "border_visibility_overrides_flag");
3059
+ const borderColorOverrideFlag = libredwg.dwg_dynapi_entity_data(
3060
+ entity,
3061
+ "border_color_overrides_flag"
3062
+ );
3063
+ const borderLineWeightOverrideFlag = libredwg.dwg_dynapi_entity_data(
3064
+ entity,
3065
+ "border_lineweight_overrides_flag"
3066
+ );
3067
+ const borderVisibilityOverrideFlag = libredwg.dwg_dynapi_entity_data(
3068
+ entity,
3069
+ "border_visibility_overrides_flag"
3070
+ );
3010
3071
  const num_cells = libredwg.dwg_dynapi_entity_data(entity, "num_cells");
3011
3072
  const cells_ptr = libredwg.dwg_dynapi_entity_data(entity, "cells");
3012
3073
  const cells = libredwg.dwg_ptr_to_table_cell_array(cells_ptr, num_cells);
@@ -1301,6 +1301,8 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
1301
1301
  return this.convert3dSolid(entity_tio, commonAttrs);
1302
1302
  } else if (fixedtype == Dwg_Object_Type.DWG_TYPE_ARC) {
1303
1303
  return this.convertArc(entity_tio, commonAttrs);
1304
+ } else if (fixedtype == Dwg_Object_Type.DWG_TYPE_ARCALIGNEDTEXT) {
1305
+ return this.convertArcAlignedText(entity_tio, commonAttrs);
1304
1306
  } else if (fixedtype == Dwg_Object_Type.DWG_TYPE_ATTDEF) {
1305
1307
  return this.convertAttdef(entity_tio, commonAttrs);
1306
1308
  } else if (fixedtype == Dwg_Object_Type.DWG_TYPE_CIRCLE) {
@@ -1450,6 +1452,54 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
1450
1452
  extrusionDirection
1451
1453
  };
1452
1454
  }
1455
+ convertArcAlignedText(entity, commonAttrs) {
1456
+ const libredwg = this.libredwg;
1457
+ const numberField = (field, fallback = 0) => {
1458
+ const value = libredwg.dwg_dynapi_entity_data(entity, field);
1459
+ if (typeof value === "number" && Number.isFinite(value)) return value;
1460
+ if (typeof value === "string" && value.trim() !== "") {
1461
+ const parsed = Number(value);
1462
+ if (Number.isFinite(parsed)) return parsed;
1463
+ }
1464
+ return fallback;
1465
+ };
1466
+ const center = libredwg.dwg_dynapi_entity_data(entity, "center");
1467
+ const extrusion = libredwg.dwg_dynapi_entity_data(entity, "extrusion");
1468
+ const arcRef = libredwg.dwg_dynapi_entity_data(entity, "arc_handle");
1469
+ const xScale = numberField("xscale", 1);
1470
+ return {
1471
+ type: "ARCALIGNEDTEXT",
1472
+ ...commonAttrs,
1473
+ text: libredwg.dwg_dynapi_entity_data(entity, "text_value") ?? "",
1474
+ textSize: numberField("text_size"),
1475
+ xScale: xScale > 0 ? xScale : 1,
1476
+ characterSpacing: numberField("char_spacing"),
1477
+ styleName: libredwg.dwg_dynapi_entity_data(entity, "style") ?? "",
1478
+ fontName: libredwg.dwg_dynapi_entity_data(entity, "font_name") ?? "",
1479
+ bigFontName: libredwg.dwg_dynapi_entity_data(entity, "bigfont_name") ?? "",
1480
+ offsetFromArc: numberField("offset_from_arc"),
1481
+ rightOffset: numberField("right_offset"),
1482
+ leftOffset: numberField("left_offset"),
1483
+ center: center ?? { x: 0, y: 0, z: 0 },
1484
+ radius: libredwg.dwg_dynapi_entity_data(entity, "radius") ?? 0,
1485
+ startAngle: libredwg.dwg_dynapi_entity_data(entity, "start_angle") ?? 0,
1486
+ endAngle: libredwg.dwg_dynapi_entity_data(entity, "end_angle") ?? 0,
1487
+ extrusionDirection: extrusion ?? { x: 0, y: 0, z: 1 },
1488
+ rawTextColor: libredwg.dwg_dynapi_entity_data(entity, "color") ?? 256,
1489
+ characterSet: libredwg.dwg_dynapi_entity_data(entity, "character_set") ?? 0,
1490
+ pitchAndFamily: libredwg.dwg_dynapi_entity_data(entity, "pitch_and_family") ?? 0,
1491
+ isShx: (libredwg.dwg_dynapi_entity_data(entity, "is_shx") ?? 0) !== 0,
1492
+ isBold: (libredwg.dwg_dynapi_entity_data(entity, "is_bold") ?? 0) !== 0,
1493
+ isItalic: (libredwg.dwg_dynapi_entity_data(entity, "is_italic") ?? 0) !== 0,
1494
+ isUnderlined: (libredwg.dwg_dynapi_entity_data(entity, "is_underlined") ?? 0) !== 0,
1495
+ alignment: libredwg.dwg_dynapi_entity_data(entity, "alignment") ?? 0,
1496
+ isReverse: (libredwg.dwg_dynapi_entity_data(entity, "is_reverse") ?? 0) !== 0,
1497
+ wizardFlag: libredwg.dwg_dynapi_entity_data(entity, "wizard_flag") ?? 0,
1498
+ textPosition: libredwg.dwg_dynapi_entity_data(entity, "text_position") ?? 1,
1499
+ textDirection: libredwg.dwg_dynapi_entity_data(entity, "text_direction") ?? 1,
1500
+ arcHandle: arcRef ? libredwg.dwg_ref_get_id(arcRef) ?? "" : ""
1501
+ };
1502
+ }
1453
1503
  convertEmbeddedMText(entity, subclassName) {
1454
1504
  const libredwg = this.libredwg;
1455
1505
  const attachmentPoint = libredwg.dwg_dynapi_subclass_data(entity, subclassName, "attachment");
@@ -1999,13 +2049,21 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
1999
2049
  const num_bulges = libredwg.dwg_dynapi_entity_data(entity, "num_bulges");
2000
2050
  const bulges_ptr = libredwg.dwg_dynapi_entity_data(entity, "bulges");
2001
2051
  const bulges = libredwg.dwg_ptr_to_double_array(bulges_ptr, num_bulges);
2052
+ const num_widths = libredwg.dwg_dynapi_entity_data(entity, "num_widths") ?? 0;
2053
+ const widths_ptr = libredwg.dwg_dynapi_entity_data(entity, "widths");
2054
+ const widthDoubles = num_widths > 0 && widths_ptr ? libredwg.dwg_ptr_to_double_array(widths_ptr, num_widths * 2) : [];
2002
2055
  points.forEach((point, index) => {
2003
- vertices.push({
2056
+ const vertex = {
2004
2057
  id: index,
2005
2058
  x: point.x,
2006
2059
  y: point.y,
2007
2060
  bulge: bulges.length > index ? bulges[index] : 0
2008
- });
2061
+ };
2062
+ if (index < num_widths && widthDoubles.length >= (index + 1) * 2) {
2063
+ vertex.startWidth = widthDoubles[index * 2];
2064
+ vertex.endWidth = widthDoubles[index * 2 + 1];
2065
+ }
2066
+ vertices.push(vertex);
2009
2067
  });
2010
2068
  return {
2011
2069
  type: "LWPOLYLINE",
@@ -2992,23 +3050,26 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
2992
3050
  const rowCount = libredwg.dwg_dynapi_entity_data(entity, "num_rows");
2993
3051
  const columnCount = libredwg.dwg_dynapi_entity_data(entity, "num_cols");
2994
3052
  const row_heights_ptr = libredwg.dwg_dynapi_entity_data(entity, "row_heights");
2995
- const rowHeightArr = libredwg.dwg_ptr_to_double_array(
2996
- row_heights_ptr,
2997
- rowCount
2998
- );
3053
+ const rowHeightArr = libredwg.dwg_ptr_to_double_array(row_heights_ptr, rowCount);
2999
3054
  const col_widths_ptr = libredwg.dwg_dynapi_entity_data(entity, "col_widths");
3000
- const columnWidthArr = libredwg.dwg_ptr_to_double_array(
3001
- col_widths_ptr,
3002
- columnCount
3003
- );
3055
+ const columnWidthArr = libredwg.dwg_ptr_to_double_array(col_widths_ptr, columnCount);
3004
3056
  const table_style_ref = libredwg.dwg_dynapi_entity_data(entity, "tablestyle");
3005
3057
  const tableStyleId = libredwg.dwg_ref_get_id(table_style_ref) ?? "";
3006
3058
  const block_header_ref = libredwg.dwg_dynapi_entity_data(entity, "block_header");
3007
3059
  const blockRecordHandle = libredwg.dwg_ref_get_id(block_header_ref) ?? "";
3008
3060
  const overrideFlag = libredwg.dwg_dynapi_entity_data(entity, "table_flag_override");
3009
- const borderColorOverrideFlag = libredwg.dwg_dynapi_entity_data(entity, "border_color_overrides_flag");
3010
- const borderLineWeightOverrideFlag = libredwg.dwg_dynapi_entity_data(entity, "border_lineweight_overrides_flag");
3011
- const borderVisibilityOverrideFlag = libredwg.dwg_dynapi_entity_data(entity, "border_visibility_overrides_flag");
3061
+ const borderColorOverrideFlag = libredwg.dwg_dynapi_entity_data(
3062
+ entity,
3063
+ "border_color_overrides_flag"
3064
+ );
3065
+ const borderLineWeightOverrideFlag = libredwg.dwg_dynapi_entity_data(
3066
+ entity,
3067
+ "border_lineweight_overrides_flag"
3068
+ );
3069
+ const borderVisibilityOverrideFlag = libredwg.dwg_dynapi_entity_data(
3070
+ entity,
3071
+ "border_visibility_overrides_flag"
3072
+ );
3012
3073
  const num_cells = libredwg.dwg_dynapi_entity_data(entity, "num_cells");
3013
3074
  const cells_ptr = libredwg.dwg_dynapi_entity_data(entity, "cells");
3014
3075
  const cells = libredwg.dwg_ptr_to_table_cell_array(cells_ptr, num_cells);
@@ -15,6 +15,7 @@ export declare class LibreEntityConverter {
15
15
  private convert3dFace;
16
16
  private convert3dSolid;
17
17
  private convertArc;
18
+ private convertArcAlignedText;
18
19
  private convertEmbeddedMText;
19
20
  private convertAttdef;
20
21
  private convertAttrib;
@@ -55,6 +55,9 @@ export class LibreEntityConverter {
55
55
  else if (fixedtype == Dwg_Object_Type.DWG_TYPE_ARC) {
56
56
  return this.convertArc(entity_tio, commonAttrs);
57
57
  }
58
+ else if (fixedtype == Dwg_Object_Type.DWG_TYPE_ARCALIGNEDTEXT) {
59
+ return this.convertArcAlignedText(entity_tio, commonAttrs);
60
+ }
58
61
  else if (fixedtype == Dwg_Object_Type.DWG_TYPE_ATTDEF) {
59
62
  return this.convertAttdef(entity_tio, commonAttrs);
60
63
  // libredwg stores ATTRIB as children of one INSERT entity.
@@ -241,6 +244,56 @@ export class LibreEntityConverter {
241
244
  extrusionDirection: extrusionDirection
242
245
  };
243
246
  }
247
+ convertArcAlignedText(entity, commonAttrs) {
248
+ const libredwg = this.libredwg;
249
+ const numberField = (field, fallback = 0) => {
250
+ const value = libredwg.dwg_dynapi_entity_data(entity, field);
251
+ if (typeof value === 'number' && Number.isFinite(value))
252
+ return value;
253
+ if (typeof value === 'string' && value.trim() !== '') {
254
+ const parsed = Number(value);
255
+ if (Number.isFinite(parsed))
256
+ return parsed;
257
+ }
258
+ return fallback;
259
+ };
260
+ const center = libredwg.dwg_dynapi_entity_data(entity, 'center');
261
+ const extrusion = libredwg.dwg_dynapi_entity_data(entity, 'extrusion');
262
+ const arcRef = libredwg.dwg_dynapi_entity_data(entity, 'arc_handle');
263
+ const xScale = numberField('xscale', 1);
264
+ return {
265
+ type: 'ARCALIGNEDTEXT',
266
+ ...commonAttrs,
267
+ text: libredwg.dwg_dynapi_entity_data(entity, 'text_value') ?? '',
268
+ textSize: numberField('text_size'),
269
+ xScale: xScale > 0 ? xScale : 1,
270
+ characterSpacing: numberField('char_spacing'),
271
+ styleName: libredwg.dwg_dynapi_entity_data(entity, 'style') ?? '',
272
+ fontName: libredwg.dwg_dynapi_entity_data(entity, 'font_name') ?? '',
273
+ bigFontName: libredwg.dwg_dynapi_entity_data(entity, 'bigfont_name') ?? '',
274
+ offsetFromArc: numberField('offset_from_arc'),
275
+ rightOffset: numberField('right_offset'),
276
+ leftOffset: numberField('left_offset'),
277
+ center: center ?? { x: 0, y: 0, z: 0 },
278
+ radius: libredwg.dwg_dynapi_entity_data(entity, 'radius') ?? 0,
279
+ startAngle: libredwg.dwg_dynapi_entity_data(entity, 'start_angle') ?? 0,
280
+ endAngle: libredwg.dwg_dynapi_entity_data(entity, 'end_angle') ?? 0,
281
+ extrusionDirection: extrusion ?? { x: 0, y: 0, z: 1 },
282
+ rawTextColor: libredwg.dwg_dynapi_entity_data(entity, 'color') ?? 256,
283
+ characterSet: libredwg.dwg_dynapi_entity_data(entity, 'character_set') ?? 0,
284
+ pitchAndFamily: libredwg.dwg_dynapi_entity_data(entity, 'pitch_and_family') ?? 0,
285
+ isShx: (libredwg.dwg_dynapi_entity_data(entity, 'is_shx') ?? 0) !== 0,
286
+ isBold: (libredwg.dwg_dynapi_entity_data(entity, 'is_bold') ?? 0) !== 0,
287
+ isItalic: (libredwg.dwg_dynapi_entity_data(entity, 'is_italic') ?? 0) !== 0,
288
+ isUnderlined: (libredwg.dwg_dynapi_entity_data(entity, 'is_underlined') ?? 0) !== 0,
289
+ alignment: libredwg.dwg_dynapi_entity_data(entity, 'alignment') ?? 0,
290
+ isReverse: (libredwg.dwg_dynapi_entity_data(entity, 'is_reverse') ?? 0) !== 0,
291
+ wizardFlag: libredwg.dwg_dynapi_entity_data(entity, 'wizard_flag') ?? 0,
292
+ textPosition: libredwg.dwg_dynapi_entity_data(entity, 'text_position') ?? 1,
293
+ textDirection: libredwg.dwg_dynapi_entity_data(entity, 'text_direction') ?? 1,
294
+ arcHandle: arcRef ? (libredwg.dwg_ref_get_id(arcRef) ?? '') : ''
295
+ };
296
+ }
244
297
  convertEmbeddedMText(entity, subclassName) {
245
298
  const libredwg = this.libredwg;
246
299
  const attachmentPoint = libredwg.dwg_dynapi_subclass_data(entity, subclassName, 'attachment');
@@ -835,13 +888,26 @@ export class LibreEntityConverter {
835
888
  const num_bulges = libredwg.dwg_dynapi_entity_data(entity, 'num_bulges');
836
889
  const bulges_ptr = libredwg.dwg_dynapi_entity_data(entity, 'bulges');
837
890
  const bulges = libredwg.dwg_ptr_to_double_array(bulges_ptr, num_bulges);
891
+ // Flag bit 32 = HAS_NUM_WIDTHS. Each Dwg_LWPOLYLINE_width is two BITCODE_BD
892
+ // values (start, end). Without copying these, tapered polylines (e.g. valve
893
+ // triangles) become zero-width lines after conversion.
894
+ const num_widths = libredwg.dwg_dynapi_entity_data(entity, 'num_widths') ?? 0;
895
+ const widths_ptr = libredwg.dwg_dynapi_entity_data(entity, 'widths');
896
+ const widthDoubles = num_widths > 0 && widths_ptr
897
+ ? libredwg.dwg_ptr_to_double_array(widths_ptr, num_widths * 2)
898
+ : [];
838
899
  points.forEach((point, index) => {
839
- vertices.push({
900
+ const vertex = {
840
901
  id: index,
841
902
  x: point.x,
842
903
  y: point.y,
843
904
  bulge: bulges.length > index ? bulges[index] : 0
844
- });
905
+ };
906
+ if (index < num_widths && widthDoubles.length >= (index + 1) * 2) {
907
+ vertex.startWidth = widthDoubles[index * 2];
908
+ vertex.endWidth = widthDoubles[index * 2 + 1];
909
+ }
910
+ vertices.push(vertex);
845
911
  });
846
912
  return {
847
913
  type: 'LWPOLYLINE',
@@ -1602,9 +1668,9 @@ export class LibreEntityConverter {
1602
1668
  const col_widths_ptr = libredwg.dwg_dynapi_entity_data(entity, 'col_widths');
1603
1669
  const columnWidthArr = libredwg.dwg_ptr_to_double_array(col_widths_ptr, columnCount);
1604
1670
  const table_style_ref = libredwg.dwg_dynapi_entity_data(entity, 'tablestyle');
1605
- const tableStyleId = (libredwg.dwg_ref_get_id(table_style_ref) ?? '');
1671
+ const tableStyleId = libredwg.dwg_ref_get_id(table_style_ref) ?? '';
1606
1672
  const block_header_ref = libredwg.dwg_dynapi_entity_data(entity, 'block_header');
1607
- const blockRecordHandle = (libredwg.dwg_ref_get_id(block_header_ref) ?? '');
1673
+ const blockRecordHandle = libredwg.dwg_ref_get_id(block_header_ref) ?? '';
1608
1674
  const overrideFlag = libredwg.dwg_dynapi_entity_data(entity, 'table_flag_override');
1609
1675
  const borderColorOverrideFlag = libredwg.dwg_dynapi_entity_data(entity, 'border_color_overrides_flag');
1610
1676
  const borderLineWeightOverrideFlag = libredwg.dwg_dynapi_entity_data(entity, 'border_lineweight_overrides_flag');
@@ -0,0 +1,102 @@
1
+ import { DwgPoint3D } from '../common';
2
+ import { DwgEntity } from './entity';
3
+ /**
4
+ * Express Tools arc-aligned text (DXF ARCALIGNEDTEXT / AcDbArcAlignedText).
5
+ * Doubles that the DWG stores as strings (text size, scales, offsets) are
6
+ * already parsed to numbers here.
7
+ */
8
+ export interface DwgArcAlignedTextEntity extends DwgEntity {
9
+ /**
10
+ * Entity type
11
+ */
12
+ type: 'ARCALIGNEDTEXT';
13
+ /**
14
+ * Text contents
15
+ */
16
+ text: string;
17
+ /**
18
+ * Text height
19
+ */
20
+ textSize: number;
21
+ /**
22
+ * Width factor
23
+ */
24
+ xScale: number;
25
+ /**
26
+ * Extra spacing between characters, in text-height units
27
+ */
28
+ characterSpacing: number;
29
+ /**
30
+ * Text style name
31
+ */
32
+ styleName: string;
33
+ /**
34
+ * Font file name
35
+ */
36
+ fontName: string;
37
+ /**
38
+ * Bigfont file name
39
+ */
40
+ bigFontName: string;
41
+ /**
42
+ * Offset from the reference arc
43
+ */
44
+ offsetFromArc: number;
45
+ /**
46
+ * Offset from the end of the arc
47
+ */
48
+ rightOffset: number;
49
+ /**
50
+ * Offset from the start of the arc
51
+ */
52
+ leftOffset: number;
53
+ /**
54
+ * Center of the reference arc (in OCS)
55
+ */
56
+ center: DwgPoint3D;
57
+ /**
58
+ * Radius of the reference arc
59
+ */
60
+ radius: number;
61
+ /**
62
+ * Start angle of the reference arc
63
+ */
64
+ startAngle: number;
65
+ /**
66
+ * End angle of the reference arc
67
+ */
68
+ endAngle: number;
69
+ /**
70
+ * Extrusion direction (optional; default = 0, 0, 1)
71
+ */
72
+ extrusionDirection: DwgPoint3D;
73
+ /**
74
+ * Raw text color: 0 ByBlock, 256 ByLayer, 1-255 ACI, or a true-color method
75
+ */
76
+ rawTextColor: number;
77
+ characterSet: number;
78
+ pitchAndFamily: number;
79
+ isShx: boolean;
80
+ isBold: boolean;
81
+ isItalic: boolean;
82
+ isUnderlined: boolean;
83
+ /**
84
+ * 1 Fit, 2 Left, 3 Right, 4 Center
85
+ */
86
+ alignment: number;
87
+ isReverse: boolean;
88
+ wizardFlag: number;
89
+ /**
90
+ * 1 OnConvexSide, 2 OnConcaveSide
91
+ */
92
+ textPosition: number;
93
+ /**
94
+ * 1 OutwardFromCenter, 2 InwardToTheCenter
95
+ */
96
+ textDirection: number;
97
+ /**
98
+ * Handle of the associated ARC, if any
99
+ */
100
+ arcHandle: string;
101
+ }
102
+ //# sourceMappingURL=arcAlignedText.d.ts.map
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=arcAlignedText.js.map
@@ -1,5 +1,6 @@
1
1
  export * from './3dface';
2
2
  export * from './arc';
3
+ export * from './arcAlignedText';
3
4
  export * from './attdef';
4
5
  export * from './attrib';
5
6
  export * from './circle';
@@ -1,5 +1,6 @@
1
1
  export * from './3dface';
2
2
  export * from './arc';
3
+ export * from './arcAlignedText';
3
4
  export * from './attdef';
4
5
  export * from './attrib';
5
6
  export * from './circle';
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.12",
6
+ "version": "0.7.14",
7
7
  "author": "MLight Lee <mlight.lee@outlook.com>",
8
8
  "type": "module",
9
9
  "engines": {