@design-core/core 0.0.6 → 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.
- package/.eslintrc.json +4 -0
- package/.github/workflows/DesignCoreQA.yml +3 -0
- package/TODO.md +49 -6
- package/core/core/core.js +0 -3
- package/core/designCore.js +1 -1
- package/core/dimensions/alignedDimension.js +12 -11
- package/core/dimensions/angularDimension.js +38 -37
- package/core/dimensions/{baseCircularDimension.js → circularDimensionBase.js} +22 -21
- package/core/dimensions/diametricDimension.js +14 -13
- package/core/dimensions/dimension.js +62 -55
- package/core/dimensions/{baseDimension.js → dimensionBase.js} +73 -107
- package/core/dimensions/{baseLinearDimension.js → linearDimensionBase.js} +15 -14
- package/core/dimensions/radialDimension.js +12 -11
- package/core/dimensions/rotatedDimension.js +20 -19
- package/core/entities/arc.js +123 -156
- package/core/entities/arctext.js +222 -184
- package/core/entities/circle.js +77 -99
- package/core/entities/entity.js +114 -93
- package/core/entities/hatch.js +346 -273
- package/core/entities/insert.js +68 -83
- package/core/entities/line.js +21 -142
- package/core/entities/lwpolyline.js +16 -11
- package/core/entities/point.js +19 -19
- package/core/entities/polyline.js +7 -7
- package/core/entities/{basePolyline.js → polylineBase.js} +47 -299
- package/core/entities/rectangle.js +3 -1
- package/core/entities/solid.js +6 -15
- package/core/entities/text.js +190 -201
- package/core/lib/auxiliary/rubberBand.js +32 -0
- package/core/lib/auxiliary/selectionWindow.js +63 -0
- package/core/lib/auxiliary/snapPoint.js +113 -0
- package/core/lib/auxiliary/trackingLine.js +76 -0
- package/core/lib/boundingBox.js +11 -11
- package/core/lib/canvas.js +232 -168
- package/core/lib/clipboard.js +9 -3
- package/core/lib/colour.js +16 -0
- package/core/lib/commandLine.js +1 -6
- package/core/lib/commandManager.js +18 -8
- package/core/lib/constants.js +28 -0
- package/core/lib/dxf/dxf.js +15 -14
- package/core/lib/dxf/dxfIterator.js +2 -2
- package/core/lib/entityManager.js +33 -26
- package/core/lib/inputManager.js +36 -12
- package/core/lib/intersect.js +25 -0
- package/core/lib/matrix.js +1 -1
- package/core/lib/patterns.js +9 -2
- package/core/lib/plotOptions.js +67 -0
- package/core/lib/polylineUtils.js +75 -0
- package/core/lib/renderers/cairoRenderer.js +371 -0
- package/core/lib/renderers/canvasRenderer.js +315 -0
- package/core/lib/renderers/pdfRenderer.js +366 -0
- package/core/lib/renderers/rendererBase.js +284 -0
- package/core/lib/renderers/svgRenderer.js +343 -0
- package/core/lib/scene.js +28 -6
- package/core/lib/selectionManager.js +20 -20
- package/core/lib/settings.js +4 -2
- package/core/lib/snapping.js +4 -191
- package/core/lib/stateManager.js +30 -1
- package/core/lib/utils.js +26 -7
- package/core/properties/entityProperties.js +104 -0
- package/core/properties/property.js +106 -2
- package/core/properties/propertyManager.js +60 -44
- package/core/tables/block.js +50 -81
- package/core/tables/dimStyle.js +5 -5
- package/core/tables/endblk.js +1 -1
- package/core/tables/layer.js +8 -0
- package/core/tables/ltypeManager.js +1 -1
- package/core/tables/styleManagerBase.js +3 -2
- package/core/tables/tableManagerBase.js +8 -3
- package/core/tables/vport.js +2 -2
- package/core/tools/chamfer.js +117 -143
- package/core/tools/chamferFilletBase.js +138 -37
- package/core/tools/copy.js +11 -11
- package/core/tools/copybase.js +3 -3
- package/core/tools/copyclip.js +3 -3
- package/core/tools/cornerEntity.js +2 -2
- package/core/tools/cutclip.js +3 -3
- package/core/tools/explode.js +7 -7
- package/core/tools/extend.js +138 -25
- package/core/tools/fillet.js +92 -189
- package/core/tools/matchProp.js +3 -12
- package/core/tools/mirror.js +15 -14
- package/core/tools/move.js +8 -8
- package/core/tools/offset.js +31 -33
- package/core/tools/pasteclip.js +1 -1
- package/core/tools/purge.js +10 -10
- package/core/tools/rotate.js +19 -16
- package/core/tools/scale.js +7 -7
- package/core/tools/trim.js +271 -29
- package/core/tools/zoom.js +1 -1
- package/cspell.json +321 -0
- package/jest.config.js +6 -0
- package/package.json +5 -3
- package/test/dimensions/alignedDimension.test.js +17 -10
- package/test/dimensions/angularDimension.test.js +13 -13
- package/test/dimensions/diametricDimension.test.js +15 -15
- package/test/dimensions/dimension.test.js +12 -12
- package/test/dimensions/{baseDimension.test.js → dimensionBase.test.js} +73 -12
- package/test/dimensions/linearDimensionBase.test.js +62 -0
- package/test/dimensions/radialDimension.test.js +15 -15
- package/test/dimensions/rotatedDimension.test.js +18 -11
- package/test/entities/arc.test.js +83 -86
- package/test/entities/arctext.test.js +184 -57
- package/test/entities/circle.test.js +68 -96
- package/test/entities/entity.test.js +42 -8
- package/test/entities/hatch.test.js +569 -96
- package/test/entities/insert.test.js +99 -4
- package/test/entities/line.test.js +15 -41
- package/test/entities/lwpolyline.test.js +104 -0
- package/test/entities/point.test.js +3 -3
- package/test/entities/polyline.test.js +11 -0
- package/test/entities/{basePolyline.test.js → polylineBase.test.js} +192 -57
- package/test/entities/rectangle.test.js +11 -0
- package/test/entities/solid.test.js +1 -1
- package/test/entities/text.test.js +302 -77
- package/test/integration/exportIntegration.reference.dxf +9 -9
- package/test/integration/exportIntegration.test.js +5 -5
- package/test/integration/intersectionIntegration.test.js +4 -5
- package/test/integration/pdfRendererIntegration.reference.pdf +17709 -0
- package/test/integration/pdfRendererIntegration.test.js +61 -0
- package/test/integration/svgRendererIntegration.reference.svg +3343 -0
- package/test/integration/svgRendererIntegration.test.js +61 -0
- package/test/integration/userInputIntegration.reference.dxf +1165 -105
- package/test/integration/userInputIntegration.test.js +239 -132
- package/test/lib/boundingBox.test.js +3 -3
- package/test/lib/canvas.test.js +744 -125
- package/test/lib/constants.test.js +27 -0
- package/test/lib/entityManager.test.js +4 -4
- package/test/lib/inputManager.test.js +81 -20
- package/test/lib/intersect.test.js +83 -0
- package/test/lib/plotOptions.test.js +179 -0
- package/test/lib/rubberBand.test.js +84 -0
- package/test/lib/scene.test.js +9 -9
- package/test/lib/selectionManager.test.js +3 -3
- package/test/lib/settings.test.js +5 -6
- package/test/lib/snapping.test.js +72 -130
- package/test/lib/stateManager.test.js +7 -7
- package/test/lib/utils.test.js +36 -2
- package/test/properties/entityProperties.test.js +132 -0
- package/test/properties/property.test.js +53 -0
- package/test/properties/propertyManager.test.js +25 -25
- package/test/renderers/canvasRenderer.test.js +317 -0
- package/test/renderers/pdfRenderer.test.js +271 -0
- package/test/renderers/rendererBase.test.js +213 -0
- package/test/renderers/svgRenderer.test.js +326 -0
- package/test/tables/block.test.js +92 -13
- package/test/tables/endblk.test.js +2 -2
- package/test/tables/layer.test.js +30 -0
- package/test/tables/layerManager.test.js +2 -2
- package/test/test-helpers/hatchGridRenderer.js +180 -0
- package/test/test-helpers/test-helpers.js +158 -6
- package/test/tools/chamfer.test.js +273 -51
- package/test/tools/chamferFilletBase.test.js +125 -36
- package/test/tools/copy.test.js +8 -8
- package/test/tools/copybase.test.js +2 -2
- package/test/tools/copyclip.test.js +2 -2
- package/test/tools/cornerEntity.test.js +8 -8
- package/test/tools/cutclip.test.js +2 -2
- package/test/tools/erase.test.js +6 -6
- package/test/tools/explode.test.js +5 -5
- package/test/tools/extend.test.js +373 -42
- package/test/tools/fillet.test.js +230 -49
- package/test/tools/matchProp.test.js +11 -11
- package/test/tools/mirror.test.js +39 -39
- package/test/tools/move.test.js +7 -7
- package/test/tools/offset.test.js +222 -55
- package/test/tools/pasteclip.test.js +5 -5
- package/test/tools/purge.test.js +4 -4
- package/test/tools/rotate.test.js +39 -9
- package/test/tools/scale.test.js +33 -33
- package/test/tools/trim.test.js +579 -53
- package/test/tools/zoom.test.js +12 -12
- package/core/lib/selectionWindow.js +0 -83
|
@@ -3,17 +3,19 @@ import { Line } from '../entities/line.js';
|
|
|
3
3
|
import { Text } from '../entities/text.js';
|
|
4
4
|
import { Input, PromptOptions } from '../lib/inputManager.js';
|
|
5
5
|
import { Logging } from '../lib/logging.js';
|
|
6
|
-
import {
|
|
6
|
+
import { DimensionBase } from './dimensionBase.js';
|
|
7
7
|
import { Point } from '../entities/point.js';
|
|
8
8
|
|
|
9
9
|
import { DesignCore } from '../designCore.js';
|
|
10
|
+
import { Property } from '../properties/property.js';
|
|
10
11
|
import { Utils } from '../lib/utils.js';
|
|
12
|
+
import { RubberBand } from '../lib/auxiliary/rubberBand.js';
|
|
11
13
|
|
|
12
14
|
/**
|
|
13
15
|
* Aligned Dimension Entity Class
|
|
14
|
-
* @extends
|
|
16
|
+
* @extends DimensionBase
|
|
15
17
|
*/
|
|
16
|
-
export class
|
|
18
|
+
export class LinearDimensionBase extends DimensionBase {
|
|
17
19
|
/**
|
|
18
20
|
* Create an Aligned Dimension
|
|
19
21
|
* @param {Array} data
|
|
@@ -29,7 +31,7 @@ export class BaseLinearDimension extends BaseDimension {
|
|
|
29
31
|
async execute() {
|
|
30
32
|
try {
|
|
31
33
|
DesignCore.Scene.selectionManager.reset();
|
|
32
|
-
this.
|
|
34
|
+
this.setProperty(Property.Names.DIMENSIONSTYLE, DesignCore.DimStyleManager.getCstyle());
|
|
33
35
|
this.dimType.setDimType(0); // Rotated dimension
|
|
34
36
|
|
|
35
37
|
const op = new PromptOptions(Strings.Input.START, [Input.Type.POINT]);
|
|
@@ -60,10 +62,9 @@ export class BaseLinearDimension extends BaseDimension {
|
|
|
60
62
|
* Preview the entity during creation
|
|
61
63
|
*/
|
|
62
64
|
preview() {
|
|
63
|
-
if (this.points.length
|
|
65
|
+
if (this.points.length === 1) {
|
|
64
66
|
const mousePoint = DesignCore.Mouse.pointOnScene();
|
|
65
|
-
|
|
66
|
-
DesignCore.Scene.tempEntities.create('Line', { points: points });
|
|
67
|
+
DesignCore.Scene.auxiliaryEntities.add(new RubberBand([this.points.at(0), mousePoint]));
|
|
67
68
|
}
|
|
68
69
|
|
|
69
70
|
if (this.points.length > 1) {
|
|
@@ -71,7 +72,7 @@ export class BaseLinearDimension extends BaseDimension {
|
|
|
71
72
|
pt11.sequence = 11;
|
|
72
73
|
const tempLine = new Line({ points: [...this.points] });
|
|
73
74
|
const points = this.constructor.getPointsFromSelection([tempLine], pt11);
|
|
74
|
-
DesignCore.Scene.
|
|
75
|
+
DesignCore.Scene.previewEntities.create(this.type, { points: points, dimensionStyle: this.getProperty(Property.Names.DIMENSIONSTYLE) });
|
|
75
76
|
}
|
|
76
77
|
}
|
|
77
78
|
|
|
@@ -155,7 +156,7 @@ export class BaseLinearDimension extends BaseDimension {
|
|
|
155
156
|
const midPoint = Pt13e.midPoint(Pt14e);
|
|
156
157
|
|
|
157
158
|
// set the dimension line angle. This is required for rotated dimension dxf definition
|
|
158
|
-
this.
|
|
159
|
+
this.setProperty(Property.Names.LINEARDIMANGLE, Utils.radians2degrees(dimLineAngle));
|
|
159
160
|
|
|
160
161
|
// Approximate text width based on height using the formatted dimension value i.e with units, precision and symbols
|
|
161
162
|
const approxTextWidth = Text.getApproximateWidth(this.getDimensionValue(dimension), DIMTXT);
|
|
@@ -189,7 +190,7 @@ export class BaseLinearDimension extends BaseDimension {
|
|
|
189
190
|
const outsideOffsetDirection = Pt11.distance(Pt13e) < Pt11.distance(Pt14e) ? reverseDimLineAngle : dimLineAngle;
|
|
190
191
|
|
|
191
192
|
switch (DIMJUST) {
|
|
192
|
-
case 0: // 0 =
|
|
193
|
+
case 0: // 0 = Centre-justified between extension lines
|
|
193
194
|
if (textOutSide) {
|
|
194
195
|
textPosition = midPoint.project(outsideOffsetDirection, outsideOffsetDistance);
|
|
195
196
|
}
|
|
@@ -236,7 +237,7 @@ export class BaseLinearDimension extends BaseDimension {
|
|
|
236
237
|
|
|
237
238
|
// DIMTAD - Text vertical position
|
|
238
239
|
switch (DIMTAD) {
|
|
239
|
-
case 0: // 0 =
|
|
240
|
+
case 0: // 0 = Centres the dimension text between the extension lines.
|
|
240
241
|
break;
|
|
241
242
|
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).
|
|
242
243
|
textPosition = textPosition.project(textAboveDirection, textAboveDistance);
|
|
@@ -300,8 +301,8 @@ export class BaseLinearDimension extends BaseDimension {
|
|
|
300
301
|
dimLineTwoEnd = Pt14e;
|
|
301
302
|
}
|
|
302
303
|
// get the distance to extend the dimension line
|
|
303
|
-
// when text is vertically
|
|
304
|
-
// when text is not vertically
|
|
304
|
+
// when text is vertically centred trim the dimension line back from the text position
|
|
305
|
+
// when text is not vertically centred extend the dimension line beyond the text position by half the text width
|
|
305
306
|
const dimlineExtendDistance = textDimlineIntersection.isSame(textPosition) ? approxTextHalfWidth + DIMGAP : -approxTextHalfWidth;
|
|
306
307
|
|
|
307
308
|
if (Pt11.distance(Pt13e) < Pt11.distance(Pt14e)) {
|
|
@@ -313,7 +314,7 @@ export class BaseLinearDimension extends BaseDimension {
|
|
|
313
314
|
}
|
|
314
315
|
}
|
|
315
316
|
|
|
316
|
-
// split the dimension line when the text is
|
|
317
|
+
// split the dimension line when the text is centred vertically
|
|
317
318
|
if (textIsOnInternalDimLine) {
|
|
318
319
|
dimLineOneEnd = dimLineOneEnd.project(reverseDimLineAngle, approxTextWidth * 0.6);
|
|
319
320
|
dimLineTwoEnd = dimLineTwoEnd.project(dimLineAngle, approxTextWidth * 0.6);
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
|
|
2
2
|
import { DXFFile } from '../lib/dxf/dxfFile.js';
|
|
3
|
-
import {
|
|
3
|
+
import { CircularDimensionBase } from './circularDimensionBase.js';
|
|
4
|
+
import { Property } from '../properties/property.js';
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* Radial Dimension Entity Class
|
|
7
|
-
* @extends
|
|
8
|
+
* @extends CircularDimensionBase
|
|
8
9
|
*/
|
|
9
|
-
export class RadialDimension extends
|
|
10
|
+
export class RadialDimension extends CircularDimensionBase {
|
|
10
11
|
/**
|
|
11
12
|
* Create a Radial Dimension
|
|
12
13
|
* @param {Array} data
|
|
@@ -30,17 +31,17 @@ export class RadialDimension extends BaseCircularDimension {
|
|
|
30
31
|
|
|
31
32
|
/**
|
|
32
33
|
* Get sequenced points from user selection
|
|
33
|
-
* @param {any}
|
|
34
|
+
* @param {any} entities
|
|
34
35
|
* @param {Point} textPos
|
|
35
36
|
* @return {Array} array of points
|
|
36
37
|
*/
|
|
37
|
-
static getPointsFromSelection(
|
|
38
|
-
const
|
|
38
|
+
static getPointsFromSelection(entities, textPos) {
|
|
39
|
+
const entity = entities[0];
|
|
39
40
|
const Pt11 = textPos;
|
|
40
41
|
Pt11.sequence = 11;
|
|
41
|
-
const Pt10 =
|
|
42
|
+
const Pt10 = entity.points[0]; // Centre
|
|
42
43
|
Pt10.sequence = 10;
|
|
43
|
-
const Pt15 = Pt10.project(Pt10.angle(Pt11),
|
|
44
|
+
const Pt15 = Pt10.project(Pt10.angle(Pt11), entity.getRadius());// Radius
|
|
44
45
|
Pt15.sequence = 15;
|
|
45
46
|
|
|
46
47
|
const points = [Pt10, Pt15, Pt11];
|
|
@@ -57,10 +58,10 @@ export class RadialDimension extends BaseCircularDimension {
|
|
|
57
58
|
const Pt15 = this.getPointBySequence(this.points, 15);
|
|
58
59
|
|
|
59
60
|
file.writeGroupCode('0', 'DIMENSION');
|
|
60
|
-
file.writeGroupCode('5', this.
|
|
61
|
+
file.writeGroupCode('5', this.getProperty(Property.Names.HANDLE), DXFFile.Version.R2000); // Handle
|
|
61
62
|
file.writeGroupCode('100', 'AcDbEntity', DXFFile.Version.R2000);
|
|
62
63
|
file.writeGroupCode('100', 'AcDbDimension', DXFFile.Version.R2000);
|
|
63
|
-
file.writeGroupCode('8', this.
|
|
64
|
+
file.writeGroupCode('8', this.getProperty(Property.Names.LAYER));
|
|
64
65
|
// file.writeGroupCode('2', this.blockName); // Block not required
|
|
65
66
|
file.writeGroupCode('10', Pt10.x); // X - Start of Dimension Line
|
|
66
67
|
file.writeGroupCode('20', Pt10.y); // Y
|
|
@@ -69,7 +70,7 @@ export class RadialDimension extends BaseCircularDimension {
|
|
|
69
70
|
file.writeGroupCode('21', Pt11.y); // Y
|
|
70
71
|
file.writeGroupCode('31', '0.0'); // Z
|
|
71
72
|
file.writeGroupCode('70', this.dimType.getDimType()); // DIMENSION TYPE
|
|
72
|
-
file.writeGroupCode('3', this.
|
|
73
|
+
file.writeGroupCode('3', this.getProperty(Property.Names.DIMENSIONSTYLE)); // DIMENSION STYLE
|
|
73
74
|
file.writeGroupCode('100', 'AcDbRadialDimension', DXFFile.Version.R2000);
|
|
74
75
|
file.writeGroupCode('15', Pt15.x); // X - End of Dimension Line
|
|
75
76
|
file.writeGroupCode('25', Pt15.y); // Y
|
|
@@ -4,16 +4,18 @@ 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 {
|
|
7
|
+
import { LinearDimensionBase } from './linearDimensionBase.js';
|
|
8
8
|
|
|
9
9
|
import { DesignCore } from '../designCore.js';
|
|
10
|
+
import { Property } from '../properties/property.js';
|
|
11
|
+
import { RubberBand } from '../lib/auxiliary/rubberBand.js';
|
|
10
12
|
|
|
11
13
|
|
|
12
14
|
/**
|
|
13
15
|
* Rotated Dimension Entity Class
|
|
14
|
-
* @extends
|
|
16
|
+
* @extends LinearDimensionBase
|
|
15
17
|
*/
|
|
16
|
-
export class RotatedDimension extends
|
|
18
|
+
export class RotatedDimension extends LinearDimensionBase {
|
|
17
19
|
/**
|
|
18
20
|
* Create an Rotated Dimension
|
|
19
21
|
* @param {Array} data
|
|
@@ -42,12 +44,12 @@ export class RotatedDimension extends BaseLinearDimension {
|
|
|
42
44
|
async execute() {
|
|
43
45
|
try {
|
|
44
46
|
DesignCore.Scene.selectionManager.reset();
|
|
45
|
-
this.
|
|
47
|
+
this.setProperty(Property.Names.DIMENSIONSTYLE, DesignCore.DimStyleManager.getCstyle());
|
|
46
48
|
this.dimType.setDimType(0); // Rotated dimension
|
|
47
49
|
|
|
48
50
|
const opAngle = new PromptOptions(Strings.Input.ROTATION, [Input.Type.NUMBER]);
|
|
49
51
|
const angleValue = await DesignCore.Scene.inputManager.requestInput(opAngle);
|
|
50
|
-
this.
|
|
52
|
+
this.setProperty(Property.Names.LINEARDIMANGLE, Number(angleValue) || 0);
|
|
51
53
|
|
|
52
54
|
const op = new PromptOptions(Strings.Input.START, [Input.Type.POINT]);
|
|
53
55
|
const pt13 = await DesignCore.Scene.inputManager.requestInput(op);
|
|
@@ -65,7 +67,7 @@ export class RotatedDimension extends BaseLinearDimension {
|
|
|
65
67
|
this.points.push(pt11);
|
|
66
68
|
|
|
67
69
|
const tempLine = new Line({ points: [pt13, pt14] });
|
|
68
|
-
this.points = RotatedDimension.getPointsFromSelection([tempLine], pt11, this.
|
|
70
|
+
this.points = RotatedDimension.getPointsFromSelection([tempLine], pt11, this.getProperty(Property.Names.LINEARDIMANGLE));
|
|
69
71
|
|
|
70
72
|
DesignCore.Scene.inputManager.executeCommand(this);
|
|
71
73
|
} catch (err) {
|
|
@@ -75,20 +77,20 @@ export class RotatedDimension extends BaseLinearDimension {
|
|
|
75
77
|
|
|
76
78
|
/**
|
|
77
79
|
* Get sequenced points from user selection
|
|
78
|
-
* @param {any}
|
|
80
|
+
* @param {any} entities
|
|
79
81
|
* @param {Point} textPos
|
|
80
82
|
* @param {number} angle - rotation angle in degrees (default 0 = horizontal)
|
|
81
83
|
* @return {Array} array of points
|
|
82
84
|
*/
|
|
83
|
-
static getPointsFromSelection(
|
|
85
|
+
static getPointsFromSelection(entities, textPos, angle = 0) {
|
|
84
86
|
const points = [];
|
|
85
|
-
const
|
|
87
|
+
const entity = entities[0];
|
|
86
88
|
|
|
87
|
-
const Pt13 =
|
|
89
|
+
const Pt13 = entity.points[0];
|
|
88
90
|
Pt13.sequence = 13;
|
|
89
91
|
points.push(Pt13);
|
|
90
92
|
|
|
91
|
-
const Pt14 =
|
|
93
|
+
const Pt14 = entity.points[1];
|
|
92
94
|
Pt14.sequence = 14;
|
|
93
95
|
points.push(Pt14);
|
|
94
96
|
|
|
@@ -117,16 +119,15 @@ export class RotatedDimension extends BaseLinearDimension {
|
|
|
117
119
|
preview() {
|
|
118
120
|
if (this.points.length === 1) {
|
|
119
121
|
const mousePoint = DesignCore.Mouse.pointOnScene();
|
|
120
|
-
|
|
121
|
-
DesignCore.Scene.tempEntities.create('Line', { points: points });
|
|
122
|
+
DesignCore.Scene.auxiliaryEntities.add(new RubberBand([this.points.at(0), mousePoint]));
|
|
122
123
|
}
|
|
123
124
|
|
|
124
125
|
if (this.points.length > 1) {
|
|
125
126
|
const pt11 = DesignCore.Mouse.pointOnScene();
|
|
126
127
|
pt11.sequence = 11;
|
|
127
128
|
const tempLine = new Line({ points: [this.points[0], this.points[1]] });
|
|
128
|
-
const points = RotatedDimension.getPointsFromSelection([tempLine], pt11, this.
|
|
129
|
-
DesignCore.Scene.
|
|
129
|
+
const points = RotatedDimension.getPointsFromSelection([tempLine], pt11, this.getProperty(Property.Names.LINEARDIMANGLE));
|
|
130
|
+
DesignCore.Scene.previewEntities.create(this.type, { points: points, dimensionStyle: this.getProperty(Property.Names.DIMENSIONSTYLE) });
|
|
130
131
|
}
|
|
131
132
|
}
|
|
132
133
|
|
|
@@ -141,10 +142,10 @@ export class RotatedDimension extends BaseLinearDimension {
|
|
|
141
142
|
const Pt14 = this.getPointBySequence(this.points, 14);
|
|
142
143
|
|
|
143
144
|
file.writeGroupCode('0', 'DIMENSION');
|
|
144
|
-
file.writeGroupCode('5', this.
|
|
145
|
+
file.writeGroupCode('5', this.getProperty(Property.Names.HANDLE), DXFFile.Version.R2000); // Handle
|
|
145
146
|
file.writeGroupCode('100', 'AcDbEntity', DXFFile.Version.R2000);
|
|
146
147
|
file.writeGroupCode('100', 'AcDbDimension', DXFFile.Version.R2000);
|
|
147
|
-
file.writeGroupCode('8', this.
|
|
148
|
+
file.writeGroupCode('8', this.getProperty(Property.Names.LAYER));
|
|
148
149
|
// file.writeGroupCode('2', this.blockName); // Block not required
|
|
149
150
|
file.writeGroupCode('10', Pt10.x); // X - definition / arrow point
|
|
150
151
|
file.writeGroupCode('20', Pt10.y); // Y
|
|
@@ -153,7 +154,7 @@ export class RotatedDimension extends BaseLinearDimension {
|
|
|
153
154
|
file.writeGroupCode('21', Pt11.y); // Y
|
|
154
155
|
file.writeGroupCode('31', '0.0'); // Z
|
|
155
156
|
file.writeGroupCode('70', this.dimType.getDimType()); // DIMENSION TYPE
|
|
156
|
-
file.writeGroupCode('3', this.
|
|
157
|
+
file.writeGroupCode('3', this.getProperty(Property.Names.DIMENSIONSTYLE)); // DIMENSION STYLE
|
|
157
158
|
file.writeGroupCode('100', 'AcDbAlignedDimension', DXFFile.Version.R2000);
|
|
158
159
|
file.writeGroupCode('13', Pt13.x); // X - start point of first extension line
|
|
159
160
|
file.writeGroupCode('23', Pt13.y); // Y
|
|
@@ -161,7 +162,7 @@ export class RotatedDimension extends BaseLinearDimension {
|
|
|
161
162
|
file.writeGroupCode('14', Pt14.x); // X - start point of second extension line
|
|
162
163
|
file.writeGroupCode('24', Pt14.y); // Y
|
|
163
164
|
file.writeGroupCode('34', '0.0'); // Z
|
|
164
|
-
file.writeGroupCode('50', this.
|
|
165
|
+
file.writeGroupCode('50', this.getProperty(Property.Names.LINEARDIMANGLE)); // Utils.radians2degrees(Pt13.angle(Pt14))); // Rotation angle
|
|
165
166
|
file.writeGroupCode('100', 'AcDbRotatedDimension', DXFFile.Version.R2000);
|
|
166
167
|
}
|
|
167
168
|
}
|