@design-core/core 0.0.7 → 50.1.0

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 (113) hide show
  1. package/.github/workflows/DesignCoreQA.yml +3 -0
  2. package/core/designCore.js +1 -1
  3. package/core/dimensions/alignedDimension.js +7 -7
  4. package/core/dimensions/angularDimension.js +32 -32
  5. package/core/dimensions/{baseCircularDimension.js → circularDimensionBase.js} +19 -19
  6. package/core/dimensions/diametricDimension.js +10 -10
  7. package/core/dimensions/dimension.js +42 -42
  8. package/core/dimensions/{baseDimension.js → dimensionBase.js} +17 -17
  9. package/core/dimensions/{baseLinearDimension.js → linearDimensionBase.js} +9 -9
  10. package/core/dimensions/radialDimension.js +8 -8
  11. package/core/dimensions/rotatedDimension.js +8 -8
  12. package/core/entities/arc.js +22 -22
  13. package/core/entities/arctext.js +13 -13
  14. package/core/entities/circle.js +7 -7
  15. package/core/entities/hatch.js +28 -28
  16. package/core/entities/insert.js +5 -5
  17. package/core/entities/point.js +19 -19
  18. package/core/entities/polyline.js +3 -3
  19. package/core/entities/{basePolyline.js → polylineBase.js} +18 -18
  20. package/core/entities/text.js +4 -4
  21. package/core/lib/boundingBox.js +11 -11
  22. package/core/lib/canvas.js +6 -4
  23. package/core/lib/clipboard.js +2 -2
  24. package/core/lib/dxf/dxf.js +11 -11
  25. package/core/lib/dxf/dxfIterator.js +2 -2
  26. package/core/lib/entityManager.js +19 -19
  27. package/core/lib/inputManager.js +1 -1
  28. package/core/lib/matrix.js +1 -1
  29. package/core/lib/patterns.js +1 -1
  30. package/core/lib/polylineUtils.js +9 -9
  31. package/core/lib/renderers/cairoRenderer.js +5 -5
  32. package/core/lib/renderers/canvasRenderer.js +4 -4
  33. package/core/lib/renderers/pdfRenderer.js +7 -7
  34. package/core/lib/renderers/rendererBase.js +1 -1
  35. package/core/lib/scene.js +1 -1
  36. package/core/lib/selectionManager.js +18 -18
  37. package/core/lib/utils.js +5 -5
  38. package/core/properties/property.js +1 -1
  39. package/core/properties/propertyManager.js +37 -37
  40. package/core/tables/block.js +48 -46
  41. package/core/tables/dimStyle.js +5 -5
  42. package/core/tables/ltypeManager.js +1 -1
  43. package/core/tables/vport.js +2 -2
  44. package/core/tools/chamfer.js +6 -6
  45. package/core/tools/chamferFilletBase.js +4 -4
  46. package/core/tools/copy.js +8 -8
  47. package/core/tools/copybase.js +3 -3
  48. package/core/tools/copyclip.js +3 -3
  49. package/core/tools/cornerEntity.js +2 -2
  50. package/core/tools/cutclip.js +3 -3
  51. package/core/tools/explode.js +6 -6
  52. package/core/tools/extend.js +13 -13
  53. package/core/tools/fillet.js +6 -6
  54. package/core/tools/matchProp.js +1 -1
  55. package/core/tools/mirror.js +11 -11
  56. package/core/tools/move.js +5 -5
  57. package/core/tools/offset.js +29 -29
  58. package/core/tools/purge.js +10 -10
  59. package/core/tools/rotate.js +16 -16
  60. package/core/tools/scale.js +6 -6
  61. package/core/tools/trim.js +15 -15
  62. package/cspell.json +321 -0
  63. package/package.json +1 -1
  64. package/test/dimensions/alignedDimension.test.js +3 -3
  65. package/test/dimensions/angularDimension.test.js +7 -7
  66. package/test/dimensions/diametricDimension.test.js +9 -9
  67. package/test/dimensions/dimension.test.js +12 -12
  68. package/test/dimensions/{baseDimension.test.js → dimensionBase.test.js} +12 -12
  69. package/test/dimensions/{baseLinearDimension.test.js → linearDimensionBase.test.js} +7 -7
  70. package/test/dimensions/radialDimension.test.js +9 -9
  71. package/test/dimensions/rotatedDimension.test.js +4 -4
  72. package/test/entities/arc.test.js +10 -10
  73. package/test/entities/arctext.test.js +6 -6
  74. package/test/entities/circle.test.js +18 -18
  75. package/test/entities/hatch.test.js +39 -39
  76. package/test/entities/insert.test.js +9 -9
  77. package/test/entities/point.test.js +3 -3
  78. package/test/entities/{basePolyline.test.js → polylineBase.test.js} +131 -62
  79. package/test/entities/text.test.js +19 -19
  80. package/test/integration/exportIntegration.test.js +3 -3
  81. package/test/integration/userInputIntegration.test.js +5 -5
  82. package/test/lib/boundingBox.test.js +3 -3
  83. package/test/lib/canvas.test.js +9 -9
  84. package/test/lib/inputManager.test.js +4 -4
  85. package/test/lib/scene.test.js +9 -9
  86. package/test/lib/selectionManager.test.js +3 -3
  87. package/test/lib/snapping.test.js +1 -1
  88. package/test/properties/propertyManager.test.js +22 -22
  89. package/test/renderers/pdfRenderer.test.js +2 -2
  90. package/test/tables/block.test.js +63 -14
  91. package/test/tables/layerManager.test.js +2 -2
  92. package/test/test-helpers/hatchGridRenderer.js +3 -3
  93. package/test/test-helpers/test-helpers.js +6 -6
  94. package/test/tools/chamfer.test.js +60 -60
  95. package/test/tools/chamferFilletBase.test.js +36 -36
  96. package/test/tools/copy.test.js +6 -6
  97. package/test/tools/copybase.test.js +2 -2
  98. package/test/tools/copyclip.test.js +2 -2
  99. package/test/tools/cornerEntity.test.js +8 -8
  100. package/test/tools/cutclip.test.js +2 -2
  101. package/test/tools/erase.test.js +6 -6
  102. package/test/tools/explode.test.js +2 -2
  103. package/test/tools/extend.test.js +84 -84
  104. package/test/tools/fillet.test.js +62 -62
  105. package/test/tools/matchProp.test.js +6 -6
  106. package/test/tools/mirror.test.js +26 -26
  107. package/test/tools/move.test.js +7 -7
  108. package/test/tools/offset.test.js +65 -65
  109. package/test/tools/purge.test.js +4 -4
  110. package/test/tools/rotate.test.js +10 -10
  111. package/test/tools/scale.test.js +28 -28
  112. package/test/tools/trim.test.js +109 -109
  113. package/test/tools/zoom.test.js +5 -5
@@ -27,6 +27,9 @@ jobs:
27
27
  node-version: ${{ matrix.node-version }}
28
28
  cache: 'npm'
29
29
 
30
+ - name: Spell Check
31
+ run: npx cspell "**/*.{js,md}" --no-progress
32
+
30
33
  - name: Circular Dependency Check
31
34
  run: npx madge --circular --extensions js .
32
35
 
@@ -11,7 +11,7 @@
11
11
  import {Core} from "core.js";
12
12
  import {DesignCore} from "designCore.js";
13
13
 
14
- // Core must be instanciated and activated before use:
14
+ // Core must be instantiated and activated before use:
15
15
  const core = new Core()
16
16
  core.activate()
17
17
 
@@ -4,7 +4,7 @@ import { Input, PromptOptions } from '../lib/inputManager.js';
4
4
  import { Logging } from '../lib/logging.js';
5
5
  import { DXFFile } from '../lib/dxf/dxfFile.js';
6
6
  import { Point } from '../entities/point.js';
7
- import { BaseLinearDimension } from './baseLinearDimension.js';
7
+ import { LinearDimensionBase } from './linearDimensionBase.js';
8
8
 
9
9
  import { DesignCore } from '../designCore.js';
10
10
  import { Property } from '../properties/property.js';
@@ -14,7 +14,7 @@ import { Property } from '../properties/property.js';
14
14
  * Aligned Dimension Entity Class
15
15
  * @extends LinearDimension
16
16
  */
17
- export class AlignedDimension extends BaseLinearDimension {
17
+ export class AlignedDimension extends LinearDimensionBase {
18
18
  /**
19
19
  * Create an Aligned Dimension
20
20
  * @param {Array} data
@@ -72,19 +72,19 @@ export class AlignedDimension extends BaseLinearDimension {
72
72
 
73
73
  /**
74
74
  * Get sequenced points from user selection
75
- * @param {any} items
75
+ * @param {any} entities
76
76
  * @param {Point} textPos
77
77
  * @return {Array} array of points
78
78
  */
79
- static getPointsFromSelection(items, textPos) {
79
+ static getPointsFromSelection(entities, textPos) {
80
80
  const points = [];
81
- const item = items[0];
81
+ const entity = entities[0];
82
82
 
83
- const Pt13 = item.points[0];
83
+ const Pt13 = entity.points[0];
84
84
  Pt13.sequence = 13;
85
85
  points.push(Pt13);
86
86
 
87
- const Pt14 = item.points[1];
87
+ const Pt14 = entity.points[1];
88
88
  Pt14.sequence = 14;
89
89
  points.push(Pt14);
90
90
 
@@ -2,12 +2,12 @@
2
2
  import { Utils } from '../lib/utils.js';
3
3
  import { Strings } from '../lib/strings.js';
4
4
  import { Arc } from '../entities/arc.js';
5
- import { BasePolyline } from '../entities/basePolyline.js';
5
+ import { PolylineBase } from '../entities/polylineBase.js';
6
6
  import { Line } from '../entities/line.js';
7
7
  import { Input, PromptOptions } from '../lib/inputManager.js';
8
8
  import { Logging } from '../lib/logging.js';
9
9
  import { DXFFile } from '../lib/dxf/dxfFile.js';
10
- import { BaseDimension } from './baseDimension.js';
10
+ import { DimensionBase } from './dimensionBase.js';
11
11
  import { Intersection } from '../lib/intersect.js';
12
12
  import { Point } from '../entities/point.js';
13
13
 
@@ -18,9 +18,9 @@ import { Property } from '../properties/property.js';
18
18
 
19
19
  /**
20
20
  * Angular Dimension Entity Class
21
- * @extends BaseDimension
21
+ * @extends DimensionBase
22
22
  */
23
- export class AngularDimension extends BaseDimension {
23
+ export class AngularDimension extends DimensionBase {
24
24
  /**
25
25
  * Create an Angular Dimension
26
26
  * @param {Array} data
@@ -62,25 +62,25 @@ export class AngularDimension extends BaseDimension {
62
62
 
63
63
  const op = new PromptOptions(Strings.Input.SELECT, [Input.Type.SINGLESELECTION]);
64
64
  const selection = await DesignCore.Scene.inputManager.requestInput(op);
65
- let selectedItem = DesignCore.Scene.entities.get(selection.selectedItemIndex);
65
+ let selectedEntity = DesignCore.Scene.entities.get(selection.selectedEntityIndex);
66
66
 
67
- if ([Line, BasePolyline].some((entity) => selectedItem instanceof entity)) {
68
- if (selectedItem instanceof BasePolyline) {
67
+ if ([Line, PolylineBase].some((entity) => selectedEntity instanceof entity)) {
68
+ if (selectedEntity instanceof PolylineBase) {
69
69
  // get the segment closest to the mouse point
70
- const segment = selectedItem.getClosestSegment(selection.selectedPoint);
70
+ const segment = selectedEntity.getClosestSegment(selection.selectedPoint);
71
71
 
72
72
  if (segment instanceof Line) {
73
- // update the selected item to be the polyline arc segment
74
- selectedItem = segment;
73
+ // update the selected entity to be the polyline arc segment
74
+ selectedEntity = segment;
75
75
  }
76
76
  }
77
77
 
78
- if (selectedItem instanceof Line) {
79
- Pt15 = selectedItem.points[0];
78
+ if (selectedEntity instanceof Line) {
79
+ Pt15 = selectedEntity.points[0];
80
80
  Pt15.sequence = 15;
81
81
  this.points.push(Pt15);
82
82
 
83
- Pt10 = selectedItem.points[1];
83
+ Pt10 = selectedEntity.points[1];
84
84
  Pt10.sequence = 10;
85
85
  this.points.push(Pt10);
86
86
  }
@@ -91,24 +91,24 @@ export class AngularDimension extends BaseDimension {
91
91
  DesignCore.Scene.selectionManager.reset();
92
92
  const op1 = new PromptOptions(Strings.Input.SELECT, [Input.Type.SINGLESELECTION]);
93
93
  const selection2 = await DesignCore.Scene.inputManager.requestInput(op1);
94
- let selectedItem = DesignCore.Scene.entities.get(selection2.selectedItemIndex);
94
+ let selectedEntity = DesignCore.Scene.entities.get(selection2.selectedEntityIndex);
95
95
 
96
- if ([Line, BasePolyline].some((entity) => selectedItem instanceof entity)) {
97
- if (selectedItem instanceof BasePolyline) {
96
+ if ([Line, PolylineBase].some((entity) => selectedEntity instanceof entity)) {
97
+ if (selectedEntity instanceof PolylineBase) {
98
98
  // get the segment closest to the mouse point
99
- const segment = selectedItem.getClosestSegment(selection2.selectedPoint);
99
+ const segment = selectedEntity.getClosestSegment(selection2.selectedPoint);
100
100
 
101
101
  if (segment instanceof Line) {
102
- // update the selected item to be the polyline arc segment
103
- selectedItem = segment;
102
+ // update the selected entity to be the polyline arc segment
103
+ selectedEntity = segment;
104
104
  }
105
105
  }
106
- if (selectedItem instanceof Line) {
107
- Pt13 = selectedItem.points[0];
106
+ if (selectedEntity instanceof Line) {
107
+ Pt13 = selectedEntity.points[0];
108
108
  Pt13.sequence = 13;
109
109
  this.points.push(Pt13);
110
110
 
111
- Pt14 = selectedItem.points[1];
111
+ Pt14 = selectedEntity.points[1];
112
112
  Pt14.sequence = 14;
113
113
  this.points.push(Pt14);
114
114
  }
@@ -153,23 +153,23 @@ export class AngularDimension extends BaseDimension {
153
153
 
154
154
  /**
155
155
  * Get sequenced points from user selection
156
- * @param {any} items
156
+ * @param {any} entities
157
157
  * @param {Point} textPos
158
158
  * @return {Array} array of points
159
159
  */
160
- static getPointsFromSelection(items, textPos) {
161
- // Transform the items into points
162
- // Do nothing more than transform the items into points
160
+ static getPointsFromSelection(entities, textPos) {
161
+ // Transform the entities into points
162
+ // Do nothing more than transform the entities into points
163
163
 
164
164
  const points = [];
165
- const item1 = items[0];
166
- const item2 = items[1];
165
+ const entity1 = entities[0];
166
+ const entity2 = entities[1];
167
167
 
168
- const tempPt15 = item1.points[0];
169
- const tempPt10 = item1.points[1];
168
+ const tempPt15 = entity1.points[0];
169
+ const tempPt10 = entity1.points[1];
170
170
 
171
- const tempPt13 = item2.points[0];
172
- const tempPt14 = item2.points[1];
171
+ const tempPt13 = entity2.points[0];
172
+ const tempPt14 = entity2.points[1];
173
173
 
174
174
  // Check the lines intersect
175
175
  const intersect = Intersection.intersectSegmentSegment(tempPt15, tempPt10, tempPt13, tempPt14, false, true);
@@ -1,14 +1,14 @@
1
1
  import { Strings } from '../lib/strings.js';
2
2
  import { Circle } from '../entities/circle.js';
3
3
  import { Arc } from '../entities/arc.js';
4
- import { BasePolyline } from '../entities/basePolyline.js';
4
+ import { PolylineBase } from '../entities/polylineBase.js';
5
5
  import { Line } from '../entities/line.js';
6
6
  import { Text } from '../entities/text.js';
7
7
  import { Point } from '../entities/point.js';
8
8
  import { Intersection } from '../lib/intersect.js';
9
9
  import { Input, PromptOptions } from '../lib/inputManager.js';
10
10
  import { Logging } from '../lib/logging.js';
11
- import { BaseDimension } from './baseDimension.js';
11
+ import { DimensionBase } from './dimensionBase.js';
12
12
 
13
13
  import { DesignCore } from '../designCore.js';
14
14
  import { Property } from '../properties/property.js';
@@ -16,9 +16,9 @@ import { Property } from '../properties/property.js';
16
16
 
17
17
  /**
18
18
  * Base Class for Circular Dimensions - Radius and Diameter
19
- * @extends BaseDimension
19
+ * @extends DimensionBase
20
20
  */
21
- export class BaseCircularDimension extends BaseDimension {
21
+ export class CircularDimensionBase extends DimensionBase {
22
22
  /**
23
23
  * Circular Dimension Constructor
24
24
  * @param {Array} data
@@ -44,25 +44,25 @@ export class BaseCircularDimension extends BaseDimension {
44
44
  const op = new PromptOptions(Strings.Input.SELECT, [Input.Type.SINGLESELECTION]);
45
45
  const selection = await DesignCore.Scene.inputManager.requestInput(op);
46
46
 
47
- let selectedItem = DesignCore.Scene.entities.get(selection.selectedItemIndex);
47
+ let selectedEntity = DesignCore.Scene.entities.get(selection.selectedEntityIndex);
48
48
 
49
- if ([Circle, Arc, BasePolyline].some((entity) => selectedItem instanceof entity)) {
50
- if (selectedItem instanceof BasePolyline) {
49
+ if ([Circle, Arc, PolylineBase].some((entity) => selectedEntity instanceof entity)) {
50
+ if (selectedEntity instanceof PolylineBase) {
51
51
  // get the segment closest to the mouse point
52
- const segment = selectedItem.getClosestSegment(selection.selectedPoint);
52
+ const segment = selectedEntity.getClosestSegment(selection.selectedPoint);
53
53
 
54
54
  if (segment instanceof Arc) {
55
- // update the selected item to be the polyline arc segment
56
- selectedItem = segment;
55
+ // update the selected entity to be the polyline arc segment
56
+ selectedEntity = segment;
57
57
  }
58
58
  }
59
59
 
60
- if (selectedItem instanceof Circle || selectedItem instanceof Arc) {
61
- Pt15 = selectedItem.points[1];
60
+ if (selectedEntity instanceof Circle || selectedEntity instanceof Arc) {
61
+ Pt15 = selectedEntity.points[1];
62
62
  Pt15.sequence = 15;
63
63
  this.points.push(Pt15);
64
64
 
65
- Pt10 = selectedItem.points[0];
65
+ Pt10 = selectedEntity.points[0];
66
66
  Pt10.sequence = 10;
67
67
  this.points.push(Pt10);
68
68
  }
@@ -111,7 +111,7 @@ export class BaseCircularDimension extends BaseDimension {
111
111
  const entities = [];
112
112
 
113
113
  const Pt15 = this.getPointBySequence(this.points, 15); // radius point
114
- const Pt10 = this.getPointBySequence(this.points, 10); // center point for radial dim or radial point for diameteric dim
114
+ const Pt10 = this.getPointBySequence(this.points, 10); // centre point for radial dim or radial point for diametric dim
115
115
  let Pt11 = this.getPointBySequence(this.points, 11); // text position
116
116
 
117
117
  // Style values
@@ -192,7 +192,7 @@ export class BaseCircularDimension extends BaseDimension {
192
192
 
193
193
  // DIMTAD - Text vertical position
194
194
  switch (DIMTAD) {
195
- case 0: // 0 = Centers the dimension text between the extension lines.
195
+ case 0: // 0 = Centres the dimension text between the extension lines.
196
196
  break;
197
197
  case 1: // 1 = Places the dimension text above the dimension line except when the dimension line is not horizontal and text inside the extension lines is forced horizontal ( DIMTIH = 1).
198
198
  textPosition = textPosition.project(textAboveDirection, textAboveDistance);
@@ -231,13 +231,13 @@ export class BaseCircularDimension extends BaseDimension {
231
231
  if (!DIMTOFL) {
232
232
  // Add the centre mark for circular dimensions
233
233
 
234
- let center = Pt10;
234
+ let centre = Pt10;
235
235
 
236
- // center point is mid point for diametric dimensions
236
+ // centre point is mid point for diametric dimensions
237
237
  if (this.dimType.getBaseDimType() === 3) {
238
- center = Pt10.midPoint(Pt15);
238
+ centre = Pt10.midPoint(Pt15);
239
239
  }
240
- entities.push(...this.getCentreMark(center));
240
+ entities.push(...this.getCentreMark(centre));
241
241
  }
242
242
 
243
243
  return entities;
@@ -1,12 +1,12 @@
1
1
  import { DXFFile } from '../lib/dxf/dxfFile.js';
2
- import { BaseCircularDimension } from './baseCircularDimension.js';
2
+ import { CircularDimensionBase } from './circularDimensionBase.js';
3
3
  import { Property } from '../properties/property.js';
4
4
 
5
5
  /**
6
6
  * Diametric Dimension Entity Class
7
- * @extends BaseCircularDimension
7
+ * @extends CircularDimensionBase
8
8
  */
9
- export class DiametricDimension extends BaseCircularDimension {
9
+ export class DiametricDimension extends CircularDimensionBase {
10
10
  /**
11
11
  * Create a Diametric Dimension
12
12
  * @param {Array} data
@@ -30,22 +30,22 @@ export class DiametricDimension extends BaseCircularDimension {
30
30
 
31
31
  /**
32
32
  * Get sequenced points from user selection
33
- * @param {any} items
33
+ * @param {any} entities
34
34
  * @param {Point} textPos
35
35
  * @return {Array} array of points
36
36
  */
37
- static getPointsFromSelection(items, textPos) {
38
- const item = items[0];
39
- const center = item.points[0];
37
+ static getPointsFromSelection(entities, textPos) {
38
+ const entity = entities[0];
39
+ const centre = entity.points[0];
40
40
 
41
41
  const Pt11 = textPos;
42
42
  Pt11.sequence = 11;
43
43
 
44
- const angle = Pt11.angle(center);
45
- const Pt10 = center.project(angle, item.getRadius());
44
+ const angle = Pt11.angle(centre);
45
+ const Pt10 = centre.project(angle, entity.getRadius());
46
46
  Pt10.sequence = 10;
47
47
  // Pt15 should be closest point to the text position
48
- const Pt15 = center.project(angle - Math.PI, item.getRadius());
48
+ const Pt15 = centre.project(angle - Math.PI, entity.getRadius());
49
49
  Pt15.sequence = 15;
50
50
 
51
51
  const points = [Pt10, Pt15, Pt11];
@@ -1,4 +1,4 @@
1
- import { BaseDimension } from './baseDimension.js';
1
+ import { DimensionBase } from './dimensionBase.js';
2
2
  import { AlignedDimension } from './alignedDimension.js';
3
3
  import { DiametricDimension } from './diametricDimension.js';
4
4
  import { AngularDimension } from './angularDimension.js';
@@ -8,7 +8,7 @@ import { RotatedDimension } from './rotatedDimension.js';
8
8
  import { Arc } from '../entities/arc.js';
9
9
  import { Circle } from '../entities/circle.js';
10
10
  import { Line } from '../entities/line.js';
11
- import { BasePolyline } from '../entities/basePolyline.js';
11
+ import { PolylineBase } from '../entities/polylineBase.js';
12
12
  import { Point } from '../entities/point.js';
13
13
 
14
14
  import { Strings } from '../lib/strings.js';
@@ -24,9 +24,9 @@ import { DimType } from '../properties/dimType.js';
24
24
 
25
25
  /**
26
26
  * Dimension Entity Class
27
- * @extends BaseDimension
27
+ * @extends DimensionBase
28
28
  */
29
- export class Dimension extends BaseDimension {
29
+ export class Dimension extends DimensionBase {
30
30
  /**
31
31
  * Create a Dimension
32
32
  * @param {Array} data
@@ -48,13 +48,13 @@ export class Dimension extends BaseDimension {
48
48
  writable: true,
49
49
  });
50
50
 
51
- Object.defineProperty(this, 'selectedItems', {
51
+ Object.defineProperty(this, 'selectedEntities', {
52
52
  value: [],
53
53
  writable: true,
54
54
  });
55
55
 
56
56
  if (data) {
57
- const item = new this.dimensionMap[DimType.getBaseType(this.dimType.getBaseDimType())](data);
57
+ const entity = new this.dimensionMap[DimType.getBaseType(this.dimType.getBaseDimType())](data);
58
58
 
59
59
  // find the block linked to this dimension
60
60
  const linkedBlockIndex = DesignCore.Scene.entities.find('BLOCK', 'name', data[2]);
@@ -64,7 +64,7 @@ export class Dimension extends BaseDimension {
64
64
  DesignCore.Scene.entities.remove(linkedBlockIndex[0]);
65
65
  }
66
66
 
67
- return item;
67
+ return entity;
68
68
  }
69
69
  }
70
70
 
@@ -104,51 +104,51 @@ export class Dimension extends BaseDimension {
104
104
  if (pt14 === undefined) return;
105
105
  // Create a temporary line using the selected points
106
106
  const tempLine = new Line({ points: [input1, pt14] });
107
- this.selectedItems.push(tempLine);
107
+ this.selectedEntities.push(tempLine);
108
108
  }
109
109
 
110
110
  if (input1 instanceof SingleSelection) {
111
- const selectedItem = DesignCore.Scene.entities.get(input1.selectedItemIndex);
111
+ const selectedEntity = DesignCore.Scene.entities.get(input1.selectedEntityIndex);
112
112
 
113
113
  // check the selected entity is supported
114
- if ([Line, Circle, Arc, BasePolyline].some((entity) => selectedItem instanceof entity)) {
114
+ if ([Line, Circle, Arc, PolylineBase].some((entity) => selectedEntity instanceof entity)) {
115
115
  // set the dimension type
116
- if (selectedItem instanceof Line) {
116
+ if (selectedEntity instanceof Line) {
117
117
  this.dimType.setDimType(1);
118
- this.selectedItems.push(selectedItem);
118
+ this.selectedEntities.push(selectedEntity);
119
119
  inputValid = true;
120
120
  }
121
121
 
122
- if (selectedItem instanceof Circle) {
122
+ if (selectedEntity instanceof Circle) {
123
123
  this.dimType.setDimType(3);
124
- this.selectedItems.push(selectedItem);
124
+ this.selectedEntities.push(selectedEntity);
125
125
  inputValid = true;
126
126
  }
127
127
 
128
- if (selectedItem instanceof Arc) {
128
+ if (selectedEntity instanceof Arc) {
129
129
  this.dimType.setDimType(4);
130
- this.selectedItems.push(selectedItem);
130
+ this.selectedEntities.push(selectedEntity);
131
131
  inputValid = true;
132
132
  }
133
133
 
134
- if (selectedItem instanceof BasePolyline) {
134
+ if (selectedEntity instanceof PolylineBase) {
135
135
  // get the segment closest to the mouse point
136
- const segment = selectedItem.getClosestSegment(input1.selectedPoint);
136
+ const segment = selectedEntity.getClosestSegment(input1.selectedPoint);
137
137
 
138
138
  if (segment instanceof Line) {
139
139
  this.dimType.setDimType(1);
140
- this.selectedItems.push(segment);
140
+ this.selectedEntities.push(segment);
141
141
  inputValid = true;
142
142
  }
143
143
 
144
144
  if (segment instanceof Arc) {
145
145
  this.dimType.setDimType(4);
146
- this.selectedItems.push(segment);
146
+ this.selectedEntities.push(segment);
147
147
  inputValid = true;
148
148
  }
149
149
  }
150
150
  } else {
151
- const msg = `${this.type} - ${Strings.Error.INVALIDTYPE}: ${selectedItem.type}`;
151
+ const msg = `${this.type} - ${Strings.Error.INVALIDTYPE}: ${selectedEntity.type}`;
152
152
  DesignCore.Core.notify(msg);
153
153
  DesignCore.Scene.selectionManager.reset();
154
154
  }
@@ -162,12 +162,12 @@ export class Dimension extends BaseDimension {
162
162
  let op2 = new PromptOptions(Strings.Input.DIMENSION, [Input.Type.POINT]);
163
163
 
164
164
  // Angular dimension prompt: select a second line for an angular dimension or location for the text position
165
- if ((this.selectedItems[0] instanceof Line) && this.selectedItems.length < 2) {
165
+ if ((this.selectedEntities[0] instanceof Line) && this.selectedEntities.length < 2) {
166
166
  op2 = new PromptOptions(`${Strings.Input.DIMENSION} or ${Strings.Input.SELECT}`, [Input.Type.POINT, Input.Type.SINGLESELECTION]);
167
167
  }
168
168
 
169
169
  // diametric prompt: select radial or diametric type dimension or location for the the text position
170
- if (this.selectedItems[0] instanceof Circle) {
170
+ if (this.selectedEntities[0] instanceof Circle) {
171
171
  const options = this.dimType.getBaseDimType() === 3 ? ['Radius'] : ['Diameter'];
172
172
  op2 = new PromptOptions(`${Strings.Input.DIMENSION}`, [Input.Type.POINT], options);
173
173
  }
@@ -178,19 +178,19 @@ export class Dimension extends BaseDimension {
178
178
  if (Input.getType(input2) === Input.Type.POINT) {
179
179
  const Pt11 = input2;
180
180
 
181
- // if selected items are available, get the points from the selected items
182
- // dimensions can be created from point selection only, therefore selected items may not be available
183
- if (this.selectedItems.length) {
181
+ // if selected entities are available, get the points from the selected entities
182
+ // dimensions can be created from point selection only, therefore selected entities may not be available
183
+ if (this.selectedEntities.length) {
184
184
  // for linear dimensions, determine if aligned or rotated based on mouse position
185
185
  if (this.dimType.getBaseDimType() === 0 || this.dimType.getBaseDimType() === 1) {
186
- const Pt13 = this.selectedItems[0].points[0];
187
- const Pt14 = this.selectedItems[0].points[1];
186
+ const Pt13 = this.selectedEntities[0].points[0];
187
+ const Pt14 = this.selectedEntities[0].points[1];
188
188
  const linearDimTypeNumber = this.getLinearDimensionType(Pt13, Pt14, Pt11);
189
189
  this.dimType.setDimType(linearDimTypeNumber);
190
190
  }
191
191
 
192
192
  const dimensionType = this.dimensionMap[this.dimType.getBaseDimType()]; // TODO: use this.dimensionMap.name?
193
- this.points.push(...dimensionType.getPointsFromSelection(this.selectedItems, Pt11));
193
+ this.points.push(...dimensionType.getPointsFromSelection(this.selectedEntities, Pt11));
194
194
  }
195
195
  }
196
196
 
@@ -206,20 +206,20 @@ export class Dimension extends BaseDimension {
206
206
  }
207
207
 
208
208
  if (Input.getType(input2) === Input.Type.SINGLESELECTION) {
209
- let selectedItem2 = DesignCore.Scene.entities.get(input2.selectedItemIndex);
210
- if ([Line, BasePolyline].some((entity) => selectedItem2 instanceof entity)) {
209
+ let selectedEntity2 = DesignCore.Scene.entities.get(input2.selectedEntityIndex);
210
+ if ([Line, PolylineBase].some((entity) => selectedEntity2 instanceof entity)) {
211
211
  // if a polyline is selected, get the segment closest to the mouse point
212
- if (selectedItem2 instanceof BasePolyline) {
212
+ if (selectedEntity2 instanceof PolylineBase) {
213
213
  // get the segment closest to the mouse point
214
- const segment = selectedItem2.getClosestSegment(input2.selectedPoint);
214
+ const segment = selectedEntity2.getClosestSegment(input2.selectedPoint);
215
215
 
216
216
  if (segment instanceof Line) {
217
- selectedItem2 = segment;
217
+ selectedEntity2 = segment;
218
218
  }
219
219
  }
220
220
  // Check lines intersect
221
- const line1 = { start: this.selectedItems[0].points[0], end: this.selectedItems[0].points[1] };
222
- const line2 = { start: selectedItem2.points[0], end: selectedItem2.points[1] };
221
+ const line1 = { start: this.selectedEntities[0].points[0], end: this.selectedEntities[0].points[1] };
222
+ const line2 = { start: selectedEntity2.points[0], end: selectedEntity2.points[1] };
223
223
 
224
224
  // Check the lines are not parallel - Can't dimension parallel lines
225
225
  const lineOneSlope = (line1.end.y - line1.start.y) / (line1.end.x - line1.start.x);
@@ -229,7 +229,7 @@ export class Dimension extends BaseDimension {
229
229
  const intersect = Intersection.intersectSegmentSegment(line1.start, line1.end, line2.start, line2.end, false, true);
230
230
  if (intersect.points.length >= 1) {
231
231
  // add line to selection
232
- this.selectedItems.push(selectedItem2);
232
+ this.selectedEntities.push(selectedEntity2);
233
233
  // Two lines selected - switch to angular dimension
234
234
  this.dimType.setDimType(2);
235
235
  }
@@ -239,7 +239,7 @@ export class Dimension extends BaseDimension {
239
239
  DesignCore.Scene.selectionManager.removeLastSelection();
240
240
  }
241
241
  } else {
242
- const msg = `${this.type} - ${Strings.Error.INVALIDTYPE}: ${selectedItem2.type}`;
242
+ const msg = `${this.type} - ${Strings.Error.INVALIDTYPE}: ${selectedEntity2.type}`;
243
243
  DesignCore.Core.notify(msg);
244
244
  DesignCore.Scene.selectionManager.reset();
245
245
  }
@@ -280,7 +280,7 @@ export class Dimension extends BaseDimension {
280
280
  * Preview the entity during creation
281
281
  */
282
282
  preview() {
283
- if (this.selectedItems.length) {
283
+ if (this.selectedEntities.length) {
284
284
  let dimTypeNumber = this.dimType.getBaseDimType();
285
285
 
286
286
  const Pt11 = DesignCore.Mouse.pointOnScene();
@@ -288,8 +288,8 @@ export class Dimension extends BaseDimension {
288
288
 
289
289
  if (dimTypeNumber === 0 || dimTypeNumber === 1) {
290
290
  // for linear dimensions, determine if aligned or rotated based on mouse position
291
- const Pt13 = this.selectedItems[0].points[0];
292
- const Pt14 = this.selectedItems[0].points[1];
291
+ const Pt13 = this.selectedEntities[0].points[0];
292
+ const Pt14 = this.selectedEntities[0].points[1];
293
293
  dimTypeNumber = this.getLinearDimensionType(Pt13, Pt14, Pt11);
294
294
  }
295
295
  // get the dimension class
@@ -297,7 +297,7 @@ export class Dimension extends BaseDimension {
297
297
  // get the dimension type as a string
298
298
  const dimensionTypeString = dimensionType.register().command;
299
299
  // get the points for the dimension
300
- const points = dimensionType.getPointsFromSelection(this.selectedItems, Pt11);
300
+ const points = dimensionType.getPointsFromSelection(this.selectedEntities, Pt11);
301
301
  // create the temporary dimension
302
302
  DesignCore.Scene.previewEntities.create(dimensionTypeString, { points: points, dimensionStyle: this.getProperty(Property.Names.DIMENSIONSTYLE) });
303
303
  }