@bitbybit-dev/base 1.7.0 → 1.8.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/NOTICE +24 -0
- package/README.md +3 -1
- package/lib/api/GlobalCDNProvider.js +1 -1
- package/lib/api/inputs/base-inputs.d.ts +20 -0
- package/lib/api/inputs/base-inputs.js +22 -0
- package/lib/api/inputs/io-inputs.d.ts +408 -8
- package/lib/api/inputs/io-inputs.js +344 -7
- package/lib/api/inputs/mesh-inputs.d.ts +20 -1
- package/lib/api/inputs/mesh-inputs.js +23 -0
- package/lib/api/inputs/recipes-inputs.d.ts +13 -5
- package/lib/api/inputs/recipes-inputs.js +10 -5
- package/lib/api/kernel-calls/index.d.ts +1 -0
- package/lib/api/kernel-calls/index.js +1 -0
- package/lib/api/kernel-calls/resolve-dto.d.ts +3 -1
- package/lib/api/kernel-calls/resolve-dto.js +7 -2
- package/lib/api/kernel-calls/settings.d.ts +19 -0
- package/lib/api/kernel-calls/up-axis-aliases.d.ts +25 -0
- package/lib/api/kernel-calls/up-axis-aliases.js +70 -0
- package/lib/api/models/simplex.d.ts +2 -0
- package/lib/api/models/simplex.js +10 -1
- package/lib/api/resolved-inputs/index.d.ts +11 -2
- package/lib/api/services/helpers/curves/conic-arcs.d.ts +3 -1
- package/lib/api/services/helpers/curves/conic-arcs.js +4 -2
- package/lib/api/services/helpers/files/drawing/drawing-budget.js +16 -6
- package/lib/api/services/helpers/files/drawing/drawing-dimension.constants.d.ts +14 -0
- package/lib/api/services/helpers/files/drawing/drawing-dimension.constants.js +14 -0
- package/lib/api/services/helpers/files/drawing/drawing-dimension.d.ts +4 -0
- package/lib/api/services/helpers/files/drawing/drawing-dimension.js +271 -0
- package/lib/api/services/helpers/files/drawing/drawing-geometry.d.ts +3 -0
- package/lib/api/services/helpers/files/drawing/drawing-geometry.js +28 -11
- package/lib/api/services/helpers/files/drawing/drawing-hatch.d.ts +10 -0
- package/lib/api/services/helpers/files/drawing/drawing-hatch.js +123 -0
- package/lib/api/services/helpers/files/drawing/drawing-loops.d.ts +3 -0
- package/lib/api/services/helpers/files/drawing/drawing-loops.js +91 -0
- package/lib/api/services/helpers/files/drawing/drawing-model.d.ts +6 -1
- package/lib/api/services/helpers/files/drawing/drawing-model.js +97 -13
- package/lib/api/services/helpers/files/drawing/drawing-scale.d.ts +2 -0
- package/lib/api/services/helpers/files/drawing/drawing-scale.js +47 -0
- package/lib/api/services/helpers/files/drawing/drawing-text.d.ts +9 -0
- package/lib/api/services/helpers/files/drawing/drawing-text.js +25 -0
- package/lib/api/services/helpers/files/drawing/drawing-types.d.ts +57 -0
- package/lib/api/services/helpers/files/drawing/drawing.constants.d.ts +13 -0
- package/lib/api/services/helpers/files/drawing/drawing.constants.js +17 -0
- package/lib/api/services/helpers/files/dxf/dxf-annotations.d.ts +5 -0
- package/lib/api/services/helpers/files/dxf/dxf-annotations.js +96 -0
- package/lib/api/services/helpers/files/dxf/dxf-entities.d.ts +5 -1
- package/lib/api/services/helpers/files/dxf/dxf-entities.js +5 -2
- package/lib/api/services/helpers/files/dxf/dxf-generator.js +26 -10
- package/lib/api/services/helpers/files/dxf/dxf-reader-annotations.d.ts +9 -0
- package/lib/api/services/helpers/files/dxf/dxf-reader-annotations.js +312 -0
- package/lib/api/services/helpers/files/dxf/dxf-reader-dtos.js +37 -3
- package/lib/api/services/helpers/files/dxf/dxf-reader-segments.d.ts +9 -0
- package/lib/api/services/helpers/files/dxf/dxf-reader-segments.js +151 -0
- package/lib/api/services/helpers/files/dxf/dxf-reader-types.d.ts +27 -0
- package/lib/api/services/helpers/files/dxf/dxf-reader.constants.d.ts +63 -0
- package/lib/api/services/helpers/files/dxf/dxf-reader.constants.js +17 -0
- package/lib/api/services/helpers/files/dxf/dxf-reader.d.ts +1 -1
- package/lib/api/services/helpers/files/dxf/dxf-reader.js +71 -181
- package/lib/api/services/helpers/files/dxf/dxf-tables.d.ts +2 -0
- package/lib/api/services/helpers/files/dxf/dxf-tables.js +5 -4
- package/lib/api/services/helpers/files/dxf/dxf-tokens.d.ts +2 -0
- package/lib/api/services/helpers/files/dxf/dxf-tokens.js +25 -1
- package/lib/api/services/helpers/files/dxf/dxf.constants.d.ts +11 -0
- package/lib/api/services/helpers/files/dxf/dxf.constants.js +13 -0
- package/lib/api/services/helpers/files/svg/svg-strokes.d.ts +1 -1
- package/lib/api/services/helpers/files/svg/svg-strokes.js +47 -23
- package/lib/api/services/helpers/files/svg/svg-writer.d.ts +2 -0
- package/lib/api/services/helpers/files/svg/svg-writer.js +100 -23
- package/lib/api/services/helpers/files/svg/svg.constants.d.ts +2 -1
- package/lib/api/services/helpers/files/svg/svg.constants.js +2 -1
- package/lib/api/services/helpers/geometry/loop-fill.d.ts +2 -0
- package/lib/api/services/helpers/geometry/loop-fill.js +37 -0
- package/lib/api/services/helpers/helper-types.d.ts +33 -0
- package/lib/api/services/helpers/text/stroke-font.d.ts +6 -0
- package/lib/api/services/helpers/text/stroke-font.js +177 -0
- package/lib/api/services/helpers/text/stroke-letters.constants.d.ts +2 -0
- package/lib/api/services/helpers/text/stroke-letters.constants.js +18 -0
- package/lib/api/services/helpers/text/stroke-marks.constants.d.ts +14 -0
- package/lib/api/services/helpers/text/stroke-marks.constants.js +34 -0
- package/lib/api/services/io/drawing.d.ts +198 -0
- package/lib/api/services/io/drawing.js +242 -0
- package/lib/api/services/io/dxf.d.ts +3 -3
- package/lib/api/services/io/dxf.js +4 -4
- package/lib/api/services/io/svg.d.ts +13 -11
- package/lib/api/services/io/svg.js +15 -12
- package/lib/api/services/mesh.d.ts +19 -0
- package/lib/api/services/mesh.js +40 -0
- package/lib/api/services/recipes.js +3 -2
- package/lib/api/services/text.d.ts +3 -3
- package/lib/api/services/text.js +7 -25
- package/package.json +1 -1
package/NOTICE
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
NOTICE - third-party material in @bitbybit-dev/base
|
|
2
|
+
===================================================
|
|
3
|
+
|
|
4
|
+
The TypeScript and JavaScript in this package are MIT-licensed (see LICENSE). It carries the font
|
|
5
|
+
data below, which keeps its own terms.
|
|
6
|
+
|
|
7
|
+
1. Hershey fonts
|
|
8
|
+
Terms: the Hershey Fonts may be used by anyone for any purpose, commercial or otherwise,
|
|
9
|
+
provided that the acknowledgements below are distributed with the font data, and
|
|
10
|
+
that the data is not converted into the format distributed by the U.S. NTIS. These
|
|
11
|
+
are the terms in full; there is no separate license text.
|
|
12
|
+
Acknowledgements:
|
|
13
|
+
- The Hershey Fonts were originally created by Dr. A. V. Hershey while working at the
|
|
14
|
+
U. S. National Bureau of Standards.
|
|
15
|
+
- The format of the Font data in this distribution was originally created by James
|
|
16
|
+
Hurt, Cognition, Inc., 900 Technology Park Drive, Billerica, MA 01821
|
|
17
|
+
(mit-eddie!ci-dandelion!hurt).
|
|
18
|
+
Source: http://paulbourke.net/dataformats/hershey/, by way of the OpenJSCAD project
|
|
19
|
+
(https://github.com/jscad/OpenJSCAD.org), which publishes the data under the MIT
|
|
20
|
+
License.
|
|
21
|
+
Usage: the strokes and advance widths of the simplex font (lib/api/models/simplex.js), which
|
|
22
|
+
the text services draw and measure single-line text with.
|
|
23
|
+
|
|
24
|
+
For questions about licensing, contact info@bitbybit.dev.
|
package/README.md
CHANGED
|
@@ -116,4 +116,6 @@ This package is part of the open-source Bitbybit ecosystem. Your subscription he
|
|
|
116
116
|
|
|
117
117
|
## License
|
|
118
118
|
|
|
119
|
-
MIT © [Bit By Bit Developers](https://bitbybit.dev)
|
|
119
|
+
MIT © [Bit By Bit Developers](https://bitbybit.dev)
|
|
120
|
+
|
|
121
|
+
The simplex stroke font the text services draw with is Hershey font data; `NOTICE` carries its terms and acknowledgements.
|
|
@@ -1078,4 +1078,24 @@ export declare namespace Base {
|
|
|
1078
1078
|
leftHanded = "leftHanded",
|
|
1079
1079
|
rightHanded = "rightHanded"
|
|
1080
1080
|
}
|
|
1081
|
+
/**
|
|
1082
|
+
* How a result is turned between the two up axes geometry comes in: `keep` leaves it as it is,
|
|
1083
|
+
* `zUpToYUp` turns a Z-up file or recipe into this library's Y-up, and `yUpToZUp` turns a Y-up
|
|
1084
|
+
* model into Z-up for a tool that treats Z as up. Each method says which of them it takes.
|
|
1085
|
+
*/
|
|
1086
|
+
enum upAxisConversionEnum {
|
|
1087
|
+
keep = "keep",
|
|
1088
|
+
zUpToYUp = "zUpToYUp",
|
|
1089
|
+
yUpToZUp = "yUpToZUp"
|
|
1090
|
+
}
|
|
1091
|
+
/**
|
|
1092
|
+
* How closed loops decide what lies inside them. Under `evenOdd` a point is inside when a ray
|
|
1093
|
+
* from it crosses the loops an odd number of times, whichever way each loop runs, so the loop
|
|
1094
|
+
* inside an `O` leaves its middle open; under `nonZero` the loops' directions count, and a loop
|
|
1095
|
+
* inside another running the same way fills it.
|
|
1096
|
+
*/
|
|
1097
|
+
enum loopFillRuleEnum {
|
|
1098
|
+
evenOdd = "evenOdd",
|
|
1099
|
+
nonZero = "nonZero"
|
|
1100
|
+
}
|
|
1081
1101
|
}
|
|
@@ -71,4 +71,26 @@ export var Base;
|
|
|
71
71
|
coordinateSystemEnum["leftHanded"] = "leftHanded";
|
|
72
72
|
coordinateSystemEnum["rightHanded"] = "rightHanded";
|
|
73
73
|
})(coordinateSystemEnum = Base.coordinateSystemEnum || (Base.coordinateSystemEnum = {}));
|
|
74
|
+
/**
|
|
75
|
+
* How a result is turned between the two up axes geometry comes in: `keep` leaves it as it is,
|
|
76
|
+
* `zUpToYUp` turns a Z-up file or recipe into this library's Y-up, and `yUpToZUp` turns a Y-up
|
|
77
|
+
* model into Z-up for a tool that treats Z as up. Each method says which of them it takes.
|
|
78
|
+
*/
|
|
79
|
+
let upAxisConversionEnum;
|
|
80
|
+
(function (upAxisConversionEnum) {
|
|
81
|
+
upAxisConversionEnum["keep"] = "keep";
|
|
82
|
+
upAxisConversionEnum["zUpToYUp"] = "zUpToYUp";
|
|
83
|
+
upAxisConversionEnum["yUpToZUp"] = "yUpToZUp";
|
|
84
|
+
})(upAxisConversionEnum = Base.upAxisConversionEnum || (Base.upAxisConversionEnum = {}));
|
|
85
|
+
/**
|
|
86
|
+
* How closed loops decide what lies inside them. Under `evenOdd` a point is inside when a ray
|
|
87
|
+
* from it crosses the loops an odd number of times, whichever way each loop runs, so the loop
|
|
88
|
+
* inside an `O` leaves its middle open; under `nonZero` the loops' directions count, and a loop
|
|
89
|
+
* inside another running the same way fills it.
|
|
90
|
+
*/
|
|
91
|
+
let loopFillRuleEnum;
|
|
92
|
+
(function (loopFillRuleEnum) {
|
|
93
|
+
loopFillRuleEnum["evenOdd"] = "evenOdd";
|
|
94
|
+
loopFillRuleEnum["nonZero"] = "nonZero";
|
|
95
|
+
})(loopFillRuleEnum = Base.loopFillRuleEnum || (Base.loopFillRuleEnum = {}));
|
|
74
96
|
})(Base || (Base = {}));
|
|
@@ -15,6 +15,32 @@ export declare namespace IO {
|
|
|
15
15
|
center = "center",
|
|
16
16
|
dotted = "dotted"
|
|
17
17
|
}
|
|
18
|
+
/**
|
|
19
|
+
* What a hatch fills its region with: `solid` ink, or lines `spacing` apart - `ansi31` one run
|
|
20
|
+
* of lines, `ansi32` lines in pairs a third of the spacing apart, `ansi37` two runs crossing at
|
|
21
|
+
* right angles.
|
|
22
|
+
*
|
|
23
|
+
* The second line of each `ansi32` pair is drawn whole, where the ANSI32 of CAD programs dashes
|
|
24
|
+
* it; a DXF file names the pattern ANSI32 at its standard scale.
|
|
25
|
+
* @beta
|
|
26
|
+
*/
|
|
27
|
+
enum hatchPatternEnum {
|
|
28
|
+
solid = "solid",
|
|
29
|
+
ansi31 = "ansi31",
|
|
30
|
+
ansi32 = "ansi32",
|
|
31
|
+
ansi37 = "ansi37"
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* What a dimension measures: a `linear` distance between two points, the `diameter` or the
|
|
35
|
+
* `radius` of a circle, or the `angle` between two arms that meet at a point.
|
|
36
|
+
* @beta
|
|
37
|
+
*/
|
|
38
|
+
enum dimensionKindEnum {
|
|
39
|
+
linear = "linear",
|
|
40
|
+
diameter = "diameter",
|
|
41
|
+
radius = "radius",
|
|
42
|
+
angular = "angular"
|
|
43
|
+
}
|
|
18
44
|
/**
|
|
19
45
|
* A straight line in a drawing path, from `start` to `end`. Points may carry a Z coordinate; one
|
|
20
46
|
* without it lies at Z 0.
|
|
@@ -224,11 +250,155 @@ export declare namespace IO {
|
|
|
224
250
|
segments: (DrawingLineSegmentDto | DrawingArcSegmentDto | DrawingCircleSegmentDto | DrawingPolylineSegmentDto | DrawingSplineSegmentDto | DrawingEllipseSegmentDto)[];
|
|
225
251
|
}
|
|
226
252
|
/**
|
|
227
|
-
* A
|
|
228
|
-
*
|
|
253
|
+
* A line of text, in the stroke font `text.vectorText` draws.
|
|
254
|
+
*
|
|
255
|
+
* SVG draws its strokes; DXF writes a text fitted to their width. Accented Latin letters are
|
|
256
|
+
* drawn; a character the font lacks is a question mark, an emoji two.
|
|
257
|
+
* @beta
|
|
258
|
+
*/
|
|
259
|
+
class DrawingTextDto {
|
|
260
|
+
constructor(text?: string, position?: Base.Point2 | Base.Point3, height?: number, anchor?: "start" | "middle" | "end", rotation?: number, widthFactor?: number);
|
|
261
|
+
/**
|
|
262
|
+
* The text, one line of it: a control character, such as a line break, a tab or U+0085, is
|
|
263
|
+
* refused; a line separator is drawn as a question mark.
|
|
264
|
+
* @default undefined
|
|
265
|
+
*/
|
|
266
|
+
text: string;
|
|
267
|
+
/**
|
|
268
|
+
* The point on the baseline the text is placed by; `anchor` says which point of the line it is.
|
|
269
|
+
* @default undefined
|
|
270
|
+
*/
|
|
271
|
+
position: Base.Point2 | Base.Point3;
|
|
272
|
+
/**
|
|
273
|
+
* The height of a capital letter, in drawing units.
|
|
274
|
+
* @default 3.5
|
|
275
|
+
* @minimum 0
|
|
276
|
+
* @exclusiveMinimum true
|
|
277
|
+
*/
|
|
278
|
+
height?: number | undefined;
|
|
279
|
+
/**
|
|
280
|
+
* Which point of the baseline `position` is: where the text starts, its middle or its end.
|
|
281
|
+
* @default start
|
|
282
|
+
*/
|
|
283
|
+
anchor?: "start" | "middle" | "end" | undefined;
|
|
284
|
+
/**
|
|
285
|
+
* The angle of the baseline in degrees, counterclockwise from the X axis.
|
|
286
|
+
* @default 0
|
|
287
|
+
*/
|
|
288
|
+
rotation?: number | undefined;
|
|
289
|
+
/**
|
|
290
|
+
* How wide the letters are drawn against their natural width: below 1 narrows a text to fit a
|
|
291
|
+
* cell, above 1 widens it.
|
|
292
|
+
* @default 1
|
|
293
|
+
* @minimum 0
|
|
294
|
+
* @exclusiveMinimum true
|
|
295
|
+
*/
|
|
296
|
+
widthFactor?: number | undefined;
|
|
297
|
+
}
|
|
298
|
+
/**
|
|
299
|
+
* The room a drawing text takes, as `io.drawing.textSize` measures it.
|
|
300
|
+
* @beta
|
|
301
|
+
*/
|
|
302
|
+
class DrawingTextSizeDto {
|
|
303
|
+
/**
|
|
304
|
+
* The length of the text along its baseline, in drawing units.
|
|
305
|
+
* @default undefined
|
|
306
|
+
*/
|
|
307
|
+
width: number;
|
|
308
|
+
/**
|
|
309
|
+
* How far the font's highest ink rises above the baseline: a little more than `height`, which
|
|
310
|
+
* marks over capitals and tall signs use.
|
|
311
|
+
* @default undefined
|
|
312
|
+
*/
|
|
313
|
+
above: number;
|
|
314
|
+
/**
|
|
315
|
+
* How far the font's lowest ink drops below the baseline, where the tail of a `g` or a `y` ends.
|
|
316
|
+
* @default undefined
|
|
317
|
+
*/
|
|
318
|
+
below: number;
|
|
319
|
+
}
|
|
320
|
+
/**
|
|
321
|
+
* A hatched region of a drawing part: what its boundaries enclose, filled with a pattern.
|
|
322
|
+
*
|
|
323
|
+
* A boundary inside another cuts a hole, and one whose ends do not meet is closed by a
|
|
324
|
+
* straight line.
|
|
325
|
+
* @beta
|
|
326
|
+
*/
|
|
327
|
+
class DrawingHatchDto {
|
|
328
|
+
constructor(boundaries?: DrawingPathDto[], pattern?: hatchPatternEnum, angle?: number, spacing?: number);
|
|
329
|
+
/**
|
|
330
|
+
* The closed paths that bound the region, in the drawing's XY plane.
|
|
331
|
+
* @default undefined
|
|
332
|
+
*/
|
|
333
|
+
boundaries: DrawingPathDto[];
|
|
334
|
+
/**
|
|
335
|
+
* What the region is filled with.
|
|
336
|
+
* @default ansi31
|
|
337
|
+
*/
|
|
338
|
+
pattern?: hatchPatternEnum | undefined;
|
|
339
|
+
/**
|
|
340
|
+
* The angle of the pattern's lines in degrees, counterclockwise from the X axis; `solid`
|
|
341
|
+
* ignores it.
|
|
342
|
+
* @default 45
|
|
343
|
+
*/
|
|
344
|
+
angle?: number | undefined;
|
|
345
|
+
/**
|
|
346
|
+
* The distance between the pattern's lines, in drawing units; `solid` ignores it. DXF writes
|
|
347
|
+
* it as a scale of the pattern in `acad.pat` for an inch drawing, in `acadiso.pat` otherwise.
|
|
348
|
+
* @default 3
|
|
349
|
+
* @minimum 0
|
|
350
|
+
* @exclusiveMinimum true
|
|
351
|
+
*/
|
|
352
|
+
spacing?: number | undefined;
|
|
353
|
+
}
|
|
354
|
+
/**
|
|
355
|
+
* A hatch and how closely its curved boundaries are followed, for `io.drawing.clippedHatchLines`,
|
|
356
|
+
* which clips the pattern's lines to the region, and `io.drawing.hatchOutlines`, which gives the
|
|
357
|
+
* region's outlines as points.
|
|
358
|
+
* @beta
|
|
359
|
+
*/
|
|
360
|
+
class DrawingHatchRegionDto {
|
|
361
|
+
constructor(boundaries?: DrawingPathDto[], pattern?: hatchPatternEnum, angle?: number, spacing?: number, tolerance?: number);
|
|
362
|
+
/**
|
|
363
|
+
* The closed paths that bound the region, in the drawing's XY plane; a boundary inside another
|
|
364
|
+
* cuts a hole, and one inside that hole is filled again.
|
|
365
|
+
* @default undefined
|
|
366
|
+
*/
|
|
367
|
+
boundaries: DrawingPathDto[];
|
|
368
|
+
/**
|
|
369
|
+
* What the region is filled with; `solid` has no lines.
|
|
370
|
+
* @default ansi31
|
|
371
|
+
*/
|
|
372
|
+
pattern?: hatchPatternEnum | undefined;
|
|
373
|
+
/**
|
|
374
|
+
* The angle of the pattern's lines in degrees, counterclockwise from the X axis.
|
|
375
|
+
* @default 45
|
|
376
|
+
*/
|
|
377
|
+
angle?: number | undefined;
|
|
378
|
+
/**
|
|
379
|
+
* The distance between the pattern's lines, in drawing units.
|
|
380
|
+
* @default 3
|
|
381
|
+
* @minimum 0
|
|
382
|
+
* @exclusiveMinimum true
|
|
383
|
+
*/
|
|
384
|
+
spacing?: number | undefined;
|
|
385
|
+
/**
|
|
386
|
+
* How far, in drawing units, the outline may stray from a curved boundary: arcs, circles,
|
|
387
|
+
* ellipses and splines become straight pieces this close to the curve.
|
|
388
|
+
* @default 0.01
|
|
389
|
+
* @minimum 0
|
|
390
|
+
* @exclusiveMinimum true
|
|
391
|
+
* @maximum Infinity
|
|
392
|
+
* @step 0.001
|
|
393
|
+
*/
|
|
394
|
+
tolerance?: number | undefined;
|
|
395
|
+
}
|
|
396
|
+
/**
|
|
397
|
+
* A part of a drawing: paths, texts and hatches on one layer, in one color, line type and line
|
|
398
|
+
* weight, which `io.dxf.dxfCreate` writes as DXF and `io.svg.svgCreate` as SVG.
|
|
229
399
|
*/
|
|
230
400
|
class DrawingPartDto {
|
|
231
|
-
constructor(layer?: string, color?: Base.Color, paths?: DrawingPathDto[], lineType?: lineTypeEnum);
|
|
401
|
+
constructor(layer?: string, color?: Base.Color, paths?: DrawingPathDto[], lineType?: lineTypeEnum, lineWeight?: number, texts?: DrawingTextDto[], hatches?: DrawingHatchDto[]);
|
|
232
402
|
/**
|
|
233
403
|
* The layer the paths go on. Parts may share a layer, which takes the first part's color and
|
|
234
404
|
* line type; every part's paths keep their own.
|
|
@@ -250,6 +420,207 @@ export declare namespace IO {
|
|
|
250
420
|
* @default continuous
|
|
251
421
|
*/
|
|
252
422
|
lineType?: lineTypeEnum | undefined;
|
|
423
|
+
/**
|
|
424
|
+
* How wide the part's lines and text strokes are, in drawing units. Left out, the writer's own
|
|
425
|
+
* width is used: the drawing's `strokeWidth` in SVG, the layer's in DXF.
|
|
426
|
+
* @default undefined
|
|
427
|
+
* @optional true
|
|
428
|
+
* @minimum 0
|
|
429
|
+
* @exclusiveMinimum true
|
|
430
|
+
* @beta
|
|
431
|
+
*/
|
|
432
|
+
lineWeight?: number | undefined;
|
|
433
|
+
/**
|
|
434
|
+
* Lines of text on the part's layer, in its color.
|
|
435
|
+
* @default undefined
|
|
436
|
+
* @optional true
|
|
437
|
+
* @beta
|
|
438
|
+
*/
|
|
439
|
+
texts?: DrawingTextDto[] | undefined;
|
|
440
|
+
/**
|
|
441
|
+
* Hatched regions on the part's layer, in its color.
|
|
442
|
+
* @default undefined
|
|
443
|
+
* @optional true
|
|
444
|
+
* @beta
|
|
445
|
+
*/
|
|
446
|
+
hatches?: DrawingHatchDto[] | undefined;
|
|
447
|
+
}
|
|
448
|
+
/**
|
|
449
|
+
* Drawing parts and the one factor `io.drawing.scaleParts` scales them by about the origin, such
|
|
450
|
+
* as 1/25.4 to turn a drawing in millimetres into inches before writing it.
|
|
451
|
+
* @beta
|
|
452
|
+
*/
|
|
453
|
+
class DrawingScalePartsDto {
|
|
454
|
+
constructor(parts?: DrawingPartDto[], factor?: number);
|
|
455
|
+
/**
|
|
456
|
+
* The parts to scale; they stay as they are and scaled copies come back.
|
|
457
|
+
* @default undefined
|
|
458
|
+
*/
|
|
459
|
+
parts: DrawingPartDto[];
|
|
460
|
+
/**
|
|
461
|
+
* What every length is multiplied by: 2 doubles the drawing, 25.4 turns inches into
|
|
462
|
+
* millimetres.
|
|
463
|
+
* @default 1
|
|
464
|
+
* @minimum 0
|
|
465
|
+
* @exclusiveMinimum true
|
|
466
|
+
*/
|
|
467
|
+
factor?: number | undefined;
|
|
468
|
+
}
|
|
469
|
+
/**
|
|
470
|
+
* A dimension in the drawing's plane for `io.drawing.dimensionPicture`, which draws it, and
|
|
471
|
+
* `io.drawing.dimensionExtent`, which measures the box it fills: what it measures, between which
|
|
472
|
+
* points, and the size of its text and arrows.
|
|
473
|
+
* @beta
|
|
474
|
+
*/
|
|
475
|
+
class DrawingDimensionDto {
|
|
476
|
+
constructor(kind?: dimensionKindEnum, start?: Base.Point2, end?: Base.Point2, direction?: Base.Vector2, offset?: number, angle?: number, value?: number, decimalPlaces?: number, upperTolerance?: number, lowerTolerance?: number, textHeight?: number, arrowLength?: number);
|
|
477
|
+
/**
|
|
478
|
+
* What the dimension measures; it decides what `start`, `end`, `offset` and `angle` mean.
|
|
479
|
+
* @default linear
|
|
480
|
+
*/
|
|
481
|
+
kind?: dimensionKindEnum | undefined;
|
|
482
|
+
/**
|
|
483
|
+
* For `linear`, the first point measured; for `diameter`, `radius` and `angular`, the center of
|
|
484
|
+
* the circle or the point where the two arms of the angle meet.
|
|
485
|
+
* @default undefined
|
|
486
|
+
*/
|
|
487
|
+
start: Base.Point2;
|
|
488
|
+
/**
|
|
489
|
+
* For `linear`, the second point measured; for `diameter` and `radius`, a point on the circle; for
|
|
490
|
+
* `angular`, a point on the first arm, where the arc passes.
|
|
491
|
+
* @default undefined
|
|
492
|
+
*/
|
|
493
|
+
end: Base.Point2;
|
|
494
|
+
/**
|
|
495
|
+
* For `linear`, the direction measured along, such as [1, 0] for a horizontal dimension; left
|
|
496
|
+
* out, from `start` to `end`. Other kinds ignore it.
|
|
497
|
+
* @default undefined
|
|
498
|
+
* @optional true
|
|
499
|
+
*/
|
|
500
|
+
direction?: Base.Vector2 | undefined;
|
|
501
|
+
/**
|
|
502
|
+
* For `linear`, how far the dimension line stands from `start`, in drawing units, to the left of
|
|
503
|
+
* `direction`; negative puts it right. Other kinds ignore it.
|
|
504
|
+
* @default 10
|
|
505
|
+
* @minimum -Infinity
|
|
506
|
+
* @maximum Infinity
|
|
507
|
+
*/
|
|
508
|
+
offset?: number | undefined;
|
|
509
|
+
/**
|
|
510
|
+
* For `angular`, the angle in degrees from the first arm, the one through `end`,
|
|
511
|
+
* counterclockwise to the second arm. Other kinds ignore it.
|
|
512
|
+
* @default 90
|
|
513
|
+
* @minimum 0
|
|
514
|
+
* @maximum 360
|
|
515
|
+
* @exclusiveMinimum true
|
|
516
|
+
* @exclusiveMaximum true
|
|
517
|
+
*/
|
|
518
|
+
angle?: number | undefined;
|
|
519
|
+
/**
|
|
520
|
+
* The number written; left out, the one measured. A diameter is written after the diameter
|
|
521
|
+
* sign, a radius after R, an angle before the degree sign.
|
|
522
|
+
* @default undefined
|
|
523
|
+
* @optional true
|
|
524
|
+
*/
|
|
525
|
+
value?: number | undefined;
|
|
526
|
+
/**
|
|
527
|
+
* How many decimals the value keeps; trailing zeros are dropped, so 15.50 shows as 15.5.
|
|
528
|
+
* @default 2
|
|
529
|
+
* @minimum 0
|
|
530
|
+
* @maximum 15
|
|
531
|
+
* @step 1
|
|
532
|
+
*/
|
|
533
|
+
decimalPlaces?: number | undefined;
|
|
534
|
+
/**
|
|
535
|
+
* How far above the value the measure may lie, written `+0.1`, or `±0.1` when equal to
|
|
536
|
+
* `lowerTolerance`; 0 when only `lowerTolerance` is given.
|
|
537
|
+
* @default undefined
|
|
538
|
+
* @optional true
|
|
539
|
+
* @minimum 0
|
|
540
|
+
*/
|
|
541
|
+
upperTolerance?: number | undefined;
|
|
542
|
+
/**
|
|
543
|
+
* How far below the value the measure may lie, as an amount, written `-0.05`; 0 when only
|
|
544
|
+
* `upperTolerance` is given. Without either, no tolerance is written.
|
|
545
|
+
* @default undefined
|
|
546
|
+
* @optional true
|
|
547
|
+
* @minimum 0
|
|
548
|
+
*/
|
|
549
|
+
lowerTolerance?: number | undefined;
|
|
550
|
+
/**
|
|
551
|
+
* The height of the text's digits, in drawing units; the gaps around the lines are sized from it.
|
|
552
|
+
* @default 3.5
|
|
553
|
+
* @minimum 0
|
|
554
|
+
* @exclusiveMinimum true
|
|
555
|
+
*/
|
|
556
|
+
textHeight?: number | undefined;
|
|
557
|
+
/**
|
|
558
|
+
* The length of each arrowhead, in drawing units; each is a third as wide as it is long. Left
|
|
559
|
+
* out, it is `textHeight`.
|
|
560
|
+
* @default undefined
|
|
561
|
+
* @optional true
|
|
562
|
+
* @minimum 0
|
|
563
|
+
* @exclusiveMinimum true
|
|
564
|
+
*/
|
|
565
|
+
arrowLength?: number | undefined;
|
|
566
|
+
}
|
|
567
|
+
/**
|
|
568
|
+
* The box a dimension's picture fills, as `io.drawing.dimensionExtent` and
|
|
569
|
+
* `io.drawing.dimensionPicture` measure it, by its lowest and highest corner.
|
|
570
|
+
* @beta
|
|
571
|
+
*/
|
|
572
|
+
class DrawingExtentDto {
|
|
573
|
+
/**
|
|
574
|
+
* The corner with the least X and the least Y.
|
|
575
|
+
* @default undefined
|
|
576
|
+
*/
|
|
577
|
+
min: Base.Point2;
|
|
578
|
+
/**
|
|
579
|
+
* The corner with the greatest X and the greatest Y.
|
|
580
|
+
* @default undefined
|
|
581
|
+
*/
|
|
582
|
+
max: Base.Point2;
|
|
583
|
+
}
|
|
584
|
+
/**
|
|
585
|
+
* A dimension drawn by `io.drawing.dimensionPicture`: its lines, its arrowheads as loops to
|
|
586
|
+
* fill, its text as strokes and as a drawing text, and the box all of it fills.
|
|
587
|
+
* @beta
|
|
588
|
+
*/
|
|
589
|
+
class DrawingDimensionPictureDto {
|
|
590
|
+
/**
|
|
591
|
+
* The dimension line, or its arc, and the extension lines, each a polyline of two or more
|
|
592
|
+
* points without two neighbours in one place.
|
|
593
|
+
* @default undefined
|
|
594
|
+
*/
|
|
595
|
+
lines: Base.Point2[][];
|
|
596
|
+
/**
|
|
597
|
+
* The arrowheads, each a closed triangle running counterclockwise, its first point not repeated;
|
|
598
|
+
* the first point of each is its tip.
|
|
599
|
+
* @default undefined
|
|
600
|
+
*/
|
|
601
|
+
fills: Base.Point2[][];
|
|
602
|
+
/**
|
|
603
|
+
* The text's letters as strokes, each a polyline of two or more points, as
|
|
604
|
+
* `io.drawing.textStrokes` draws `text`.
|
|
605
|
+
* @default undefined
|
|
606
|
+
*/
|
|
607
|
+
textStrokes: Base.Point2[][];
|
|
608
|
+
/**
|
|
609
|
+
* The text as a drawing text, placed and turned so it reads from left to right or from bottom
|
|
610
|
+
* to top, for a drawing part's `texts`.
|
|
611
|
+
* @default undefined
|
|
612
|
+
*/
|
|
613
|
+
text: DrawingTextDto;
|
|
614
|
+
/**
|
|
615
|
+
* The middle of the box the text fills.
|
|
616
|
+
* @default undefined
|
|
617
|
+
*/
|
|
618
|
+
textPoint: Base.Point2;
|
|
619
|
+
/**
|
|
620
|
+
* The box the lines, the arrowheads and the text fill together.
|
|
621
|
+
* @default undefined
|
|
622
|
+
*/
|
|
623
|
+
extent: DrawingExtentDto;
|
|
253
624
|
}
|
|
254
625
|
/**
|
|
255
626
|
* A straight line in a drawing path, under its former DXF name.
|
|
@@ -317,10 +688,11 @@ export declare namespace IO {
|
|
|
317
688
|
}
|
|
318
689
|
/**
|
|
319
690
|
* A whole DXF drawing for `io.dxf.dxfCreate`: its path parts by layer and color, and the color
|
|
320
|
-
* format, the version and the unit to write.
|
|
691
|
+
* format, the version and the unit to write. In inches it is marked imperial, so hatch scales
|
|
692
|
+
* count from inch patterns.
|
|
321
693
|
*/
|
|
322
694
|
class DxfModelDto {
|
|
323
|
-
constructor(dxfPathsParts?: DrawingPartDto[], colorFormat?: "aci" | "truecolor", acadVersion?: "AC1009" | "AC1015", unit?: Base.unitOfLengthEnum, curveTolerance?: number);
|
|
695
|
+
constructor(dxfPathsParts?: DrawingPartDto[], colorFormat?: "aci" | "truecolor", acadVersion?: "AC1009" | "AC1015", unit?: Base.unitOfLengthEnum, curveTolerance?: number, lineTypeScale?: number);
|
|
324
696
|
/**
|
|
325
697
|
* Array of path parts, each containing paths with segments
|
|
326
698
|
* @default undefined
|
|
@@ -353,6 +725,16 @@ export declare namespace IO {
|
|
|
353
725
|
* @exclusiveMinimum true
|
|
354
726
|
*/
|
|
355
727
|
curveTolerance?: number | undefined;
|
|
728
|
+
/**
|
|
729
|
+
* The length of one unit of a dash pattern, in drawing units: `hidden` is 2 units of dash
|
|
730
|
+
* and 1 of gap. Left out, a two-hundredth of the drawing's size.
|
|
731
|
+
* @default undefined
|
|
732
|
+
* @optional true
|
|
733
|
+
* @minimum 0
|
|
734
|
+
* @exclusiveMinimum true
|
|
735
|
+
* @beta
|
|
736
|
+
*/
|
|
737
|
+
lineTypeScale?: number | undefined;
|
|
356
738
|
}
|
|
357
739
|
/**
|
|
358
740
|
* The text of a DXF file for `io.dxf.dxfRead`, which reads its drawing into path parts, and
|
|
@@ -378,7 +760,8 @@ export declare namespace IO {
|
|
|
378
760
|
*/
|
|
379
761
|
class DxfDrawingDto {
|
|
380
762
|
/**
|
|
381
|
-
* The parts, one for each layer, color and line type that holds anything
|
|
763
|
+
* The parts, one for each layer, color and line type that holds anything: each entity one path,
|
|
764
|
+
* each text and hatch in its part's `texts` and `hatches`.
|
|
382
765
|
* @default undefined
|
|
383
766
|
*/
|
|
384
767
|
parts: DrawingPartDto[];
|
|
@@ -404,7 +787,7 @@ export declare namespace IO {
|
|
|
404
787
|
* unit that gives it its true size, and how wide the lines and the border are.
|
|
405
788
|
*/
|
|
406
789
|
class SvgModelDto {
|
|
407
|
-
constructor(parts?: DrawingPartDto[], unit?: Base.unitOfLengthEnum, strokeWidth?: number, margin?: number, tolerance?: number);
|
|
790
|
+
constructor(parts?: DrawingPartDto[], unit?: Base.unitOfLengthEnum, strokeWidth?: number, margin?: number, tolerance?: number, lineTypeScale?: number);
|
|
408
791
|
/**
|
|
409
792
|
* The parts of the drawing; each layer becomes a group that Inkscape reads as a layer.
|
|
410
793
|
* @default undefined
|
|
@@ -442,12 +825,22 @@ export declare namespace IO {
|
|
|
442
825
|
* @exclusiveMinimum true
|
|
443
826
|
*/
|
|
444
827
|
tolerance?: number | undefined;
|
|
828
|
+
/**
|
|
829
|
+
* The length of one unit of a dash pattern, in drawing units: `hidden` is 2 units of dash
|
|
830
|
+
* and 1 of gap. Left out, a two-hundredth of the drawing's size.
|
|
831
|
+
* @default undefined
|
|
832
|
+
* @optional true
|
|
833
|
+
* @minimum 0
|
|
834
|
+
* @exclusiveMinimum true
|
|
835
|
+
* @beta
|
|
836
|
+
*/
|
|
837
|
+
lineTypeScale?: number | undefined;
|
|
445
838
|
}
|
|
446
839
|
/**
|
|
447
840
|
* One drawing path for `io.svg.pathData`, and how its coordinates are written.
|
|
448
841
|
*/
|
|
449
842
|
class SvgPathDataDto {
|
|
450
|
-
constructor(path?: DrawingPathDto, flipY?: boolean, tolerance?: number);
|
|
843
|
+
constructor(path?: DrawingPathDto, flipY?: boolean, tolerance?: number, cubicsOnly?: boolean);
|
|
451
844
|
/**
|
|
452
845
|
* The path to write as SVG path data.
|
|
453
846
|
* @default undefined
|
|
@@ -467,6 +860,13 @@ export declare namespace IO {
|
|
|
467
860
|
* @exclusiveMinimum true
|
|
468
861
|
*/
|
|
469
862
|
tolerance?: number | undefined;
|
|
863
|
+
/**
|
|
864
|
+
* When true, every curve is written as cubic Beziers (`C`), arcs within `tolerance`, for
|
|
865
|
+
* renderers that draw only lines and cubics.
|
|
866
|
+
* @default false
|
|
867
|
+
* @beta
|
|
868
|
+
*/
|
|
869
|
+
cubicsOnly?: boolean | undefined;
|
|
470
870
|
}
|
|
471
871
|
/**
|
|
472
872
|
* The text of an SVG file for `io.svg.svgRead`, which reads its drawing into path parts, with the
|