@bitbybit-dev/base 1.6.2 → 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 +40 -7
- package/lib/api/inputs/base-inputs.js +32 -0
- package/lib/api/inputs/io-inputs.d.ts +927 -59
- package/lib/api/inputs/io-inputs.js +769 -40
- package/lib/api/inputs/line-inputs.d.ts +17 -0
- package/lib/api/inputs/line-inputs.js +15 -0
- 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 +2 -0
- package/lib/api/kernel-calls/index.js +2 -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 +101 -0
- package/lib/api/kernel-calls/settings.js +123 -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/recipes/surface-mesh.d.ts +2 -1
- package/lib/api/recipes/surface-mesh.js +5 -3
- package/lib/api/resolved-inputs/index.d.ts +32 -3
- package/lib/api/services/base-bitbybit.d.ts +12 -0
- package/lib/api/services/base-bitbybit.js +19 -3
- package/lib/api/services/color.js +2 -3
- package/lib/api/services/helpers/color/color-forms.constants.d.ts +3 -0
- package/lib/api/services/helpers/color/color-forms.constants.js +3 -0
- package/lib/api/services/helpers/color/color-forms.d.ts +1 -0
- package/lib/api/services/helpers/color/color-forms.js +4 -1
- package/lib/api/services/helpers/color/css-colors.constants.d.ts +9 -0
- package/lib/api/services/helpers/color/css-colors.constants.js +158 -0
- package/lib/api/services/helpers/color/css-colors.d.ts +1 -0
- package/lib/api/services/helpers/color/css-colors.js +61 -0
- package/lib/api/services/helpers/curves/bezier-pieces.constants.d.ts +5 -0
- package/lib/api/services/helpers/curves/bezier-pieces.constants.js +5 -0
- package/lib/api/services/helpers/curves/bezier-pieces.d.ts +24 -0
- package/lib/api/services/helpers/curves/bezier-pieces.js +149 -0
- package/lib/api/services/helpers/curves/conic-arcs.constants.d.ts +5 -0
- package/lib/api/services/helpers/curves/conic-arcs.constants.js +5 -0
- package/lib/api/services/helpers/curves/conic-arcs.d.ts +26 -0
- package/lib/api/services/helpers/curves/conic-arcs.js +87 -0
- package/lib/api/services/helpers/curves/nurbs-forms.d.ts +20 -0
- package/lib/api/services/helpers/curves/nurbs-forms.js +112 -0
- package/lib/api/services/helpers/curves/nurbs.d.ts +4 -0
- package/lib/api/services/helpers/curves/nurbs.js +10 -9
- package/lib/api/services/helpers/files/drawing/drawing-budget.d.ts +3 -0
- package/lib/api/services/helpers/files/drawing/drawing-budget.js +34 -0
- 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 +21 -0
- package/lib/api/services/helpers/files/drawing/drawing-geometry.js +101 -0
- 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 +10 -0
- package/lib/api/services/helpers/files/drawing/drawing-model.js +336 -0
- 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 +117 -0
- package/lib/api/services/helpers/files/drawing/drawing-types.js +1 -0
- package/lib/api/services/helpers/files/drawing/drawing.constants.d.ts +41 -0
- package/lib/api/services/helpers/files/drawing/drawing.constants.js +46 -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-colors.d.ts +5 -0
- package/lib/api/services/helpers/files/dxf/dxf-colors.js +45 -0
- package/lib/api/services/helpers/files/dxf/dxf-entities.d.ts +21 -0
- package/lib/api/services/helpers/files/dxf/dxf-entities.js +196 -0
- package/lib/api/services/helpers/files/dxf/dxf-file-text.d.ts +1 -0
- package/lib/api/services/helpers/files/dxf/dxf-file-text.js +50 -0
- package/lib/api/services/helpers/files/dxf/dxf-generator.d.ts +2 -36
- package/lib/api/services/helpers/files/dxf/dxf-generator.js +97 -523
- 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.d.ts +6 -0
- package/lib/api/services/helpers/files/dxf/dxf-reader-dtos.js +115 -0
- package/lib/api/services/helpers/files/dxf/dxf-reader-geometry.d.ts +21 -0
- package/lib/api/services/helpers/files/dxf/dxf-reader-geometry.js +67 -0
- 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 +96 -0
- package/lib/api/services/helpers/files/dxf/dxf-reader-types.js +1 -0
- package/lib/api/services/helpers/files/dxf/dxf-reader.constants.d.ts +134 -0
- package/lib/api/services/helpers/files/dxf/dxf-reader.constants.js +95 -0
- package/lib/api/services/helpers/files/dxf/dxf-reader.d.ts +2 -0
- package/lib/api/services/helpers/files/dxf/dxf-reader.js +446 -0
- package/lib/api/services/helpers/files/dxf/dxf-tables.d.ts +29 -0
- package/lib/api/services/helpers/files/dxf/dxf-tables.js +248 -0
- package/lib/api/services/helpers/files/dxf/dxf-text.d.ts +26 -0
- package/lib/api/services/helpers/files/dxf/dxf-text.js +97 -0
- package/lib/api/services/helpers/files/dxf/dxf-tokens.d.ts +11 -0
- package/lib/api/services/helpers/files/dxf/dxf-tokens.js +89 -0
- package/lib/api/services/helpers/files/dxf/dxf.constants.d.ts +43 -1
- package/lib/api/services/helpers/files/dxf/dxf.constants.js +47 -1
- package/lib/api/services/helpers/files/file-bytes.d.ts +1 -0
- package/lib/api/services/helpers/files/file-bytes.js +15 -0
- package/lib/api/services/helpers/files/ground-axes.d.ts +2 -0
- package/lib/api/services/helpers/files/ground-axes.js +4 -0
- package/lib/api/services/helpers/files/mesh-file-axes.d.ts +7 -0
- package/lib/api/services/helpers/files/mesh-file-axes.js +17 -0
- package/lib/api/services/helpers/files/stl-axes.d.ts +4 -0
- package/lib/api/services/helpers/files/stl-axes.js +22 -0
- package/lib/api/services/helpers/files/stl-types.d.ts +7 -0
- package/lib/api/services/helpers/files/stl-types.js +1 -0
- package/lib/api/services/helpers/files/stl.constants.d.ts +11 -0
- package/lib/api/services/helpers/files/stl.constants.js +11 -0
- package/lib/api/services/helpers/files/stl.d.ts +3 -0
- package/lib/api/services/helpers/files/stl.js +93 -0
- package/lib/api/services/helpers/files/svg/svg-css.d.ts +48 -0
- package/lib/api/services/helpers/files/svg/svg-css.js +444 -0
- package/lib/api/services/helpers/files/svg/svg-dash-patterns.d.ts +2 -0
- package/lib/api/services/helpers/files/svg/svg-dash-patterns.js +35 -0
- package/lib/api/services/helpers/files/svg/svg-document.d.ts +26 -0
- package/lib/api/services/helpers/files/svg/svg-document.js +89 -0
- package/lib/api/services/helpers/files/svg/svg-memo.d.ts +1 -0
- package/lib/api/services/helpers/files/svg/svg-memo.js +8 -0
- package/lib/api/services/helpers/files/svg/svg-normalizer.d.ts +6 -0
- package/lib/api/services/helpers/files/svg/svg-normalizer.js +433 -0
- package/lib/api/services/helpers/files/svg/svg-numbers.d.ts +15 -0
- package/lib/api/services/helpers/files/svg/svg-numbers.js +61 -0
- package/lib/api/services/helpers/files/svg/svg-path-data.constants.d.ts +8 -0
- package/lib/api/services/helpers/files/svg/svg-path-data.constants.js +10 -0
- package/lib/api/services/helpers/files/svg/svg-path-data.d.ts +9 -0
- package/lib/api/services/helpers/files/svg/svg-path-data.js +203 -0
- package/lib/api/services/helpers/files/svg/svg-path-types.d.ts +33 -0
- package/lib/api/services/helpers/files/svg/svg-path-types.js +1 -0
- package/lib/api/services/helpers/files/svg/svg-reader.constants.d.ts +35 -0
- package/lib/api/services/helpers/files/svg/svg-reader.constants.js +35 -0
- package/lib/api/services/helpers/files/svg/svg-reading.constants.d.ts +9 -0
- package/lib/api/services/helpers/files/svg/svg-reading.constants.js +9 -0
- package/lib/api/services/helpers/files/svg/svg-reading.d.ts +6 -0
- package/lib/api/services/helpers/files/svg/svg-reading.js +233 -0
- package/lib/api/services/helpers/files/svg/svg-scene-types.d.ts +54 -0
- package/lib/api/services/helpers/files/svg/svg-scene-types.js +1 -0
- package/lib/api/services/helpers/files/svg/svg-shapes.d.ts +6 -0
- package/lib/api/services/helpers/files/svg/svg-shapes.js +102 -0
- package/lib/api/services/helpers/files/svg/svg-strokes.d.ts +38 -0
- package/lib/api/services/helpers/files/svg/svg-strokes.js +132 -0
- package/lib/api/services/helpers/files/svg/svg-style.d.ts +26 -0
- package/lib/api/services/helpers/files/svg/svg-style.js +211 -0
- package/lib/api/services/helpers/files/svg/svg-transform.d.ts +10 -0
- package/lib/api/services/helpers/files/svg/svg-transform.js +76 -0
- package/lib/api/services/helpers/files/svg/svg-writer.d.ts +18 -0
- package/lib/api/services/helpers/files/svg/svg-writer.js +230 -0
- package/lib/api/services/helpers/files/svg/svg-xml.d.ts +11 -0
- package/lib/api/services/helpers/files/svg/svg-xml.js +322 -0
- package/lib/api/services/helpers/files/svg/svg.constants.d.ts +14 -0
- package/lib/api/services/helpers/files/svg/svg.constants.js +14 -0
- package/lib/api/services/helpers/files/work-budget.d.ts +11 -0
- package/lib/api/services/helpers/files/work-budget.js +26 -0
- package/lib/api/services/helpers/geometry/affine2.d.ts +8 -0
- package/lib/api/services/helpers/geometry/affine2.js +18 -0
- package/lib/api/services/helpers/geometry/ellipse-arcs.d.ts +14 -0
- package/lib/api/services/helpers/geometry/ellipse-arcs.js +96 -0
- package/lib/api/services/helpers/geometry/frame-axes.d.ts +3 -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/geometry/polygon-nesting.constants.d.ts +6 -0
- package/lib/api/services/helpers/geometry/polygon-nesting.constants.js +6 -0
- package/lib/api/services/helpers/geometry/polygon-nesting.d.ts +31 -0
- package/lib/api/services/helpers/geometry/polygon-nesting.js +251 -0
- package/lib/api/services/helpers/geometry/vectors.d.ts +1 -0
- package/lib/api/services/helpers/geometry/vectors.js +6 -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 +368 -0
- package/lib/api/services/io/drawing.js +454 -0
- package/lib/api/services/io/dxf.d.ts +134 -0
- package/lib/api/services/io/dxf.js +167 -0
- package/lib/api/services/io/index.d.ts +4 -0
- package/lib/api/services/io/index.js +4 -0
- package/lib/api/services/io/io.d.ts +14 -0
- package/lib/api/services/io/io.js +15 -0
- package/lib/api/services/io/svg.d.ts +66 -0
- package/lib/api/services/io/svg.js +105 -0
- package/lib/api/services/line.d.ts +17 -0
- package/lib/api/services/line.js +20 -1
- package/lib/api/services/mesh.d.ts +19 -0
- package/lib/api/services/mesh.js +40 -0
- package/lib/api/services/point.d.ts +4 -1
- package/lib/api/services/point.js +9 -4
- package/lib/api/services/recipes.d.ts +3 -0
- package/lib/api/services/recipes.js +6 -2
- package/lib/api/services/text.d.ts +7 -4
- package/lib/api/services/text.js +14 -27
- package/package.json +1 -1
- package/lib/api/services/helpers/files/dxf/dxf.d.ts +0 -87
- package/lib/api/services/helpers/files/dxf/dxf.js +0 -111
- package/lib/api/services/io.d.ts +0 -9
- package/lib/api/services/io.js +0 -10
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as Inputs from "../inputs";
|
|
2
2
|
import type * as Models from "../models";
|
|
3
3
|
import type { Point } from "./point";
|
|
4
|
+
import type { BitbybitSettings } from "../kernel-calls/settings";
|
|
4
5
|
/**
|
|
5
6
|
* Working with text: splitting, joining, searching, trimming, padding, changing case, regular
|
|
6
7
|
* expressions and formatting with placeholders. `vectorChar` and `vectorText` turn text into line
|
|
@@ -9,7 +10,8 @@ import type { Point } from "./point";
|
|
|
9
10
|
*/
|
|
10
11
|
export declare class TextBitByBit {
|
|
11
12
|
private readonly point;
|
|
12
|
-
|
|
13
|
+
private readonly settings;
|
|
14
|
+
constructor(point: Point, settings?: () => BitbybitSettings);
|
|
13
15
|
/**
|
|
14
16
|
* Passes a text through unchanged, so a value can be given a name and reused.
|
|
15
17
|
*
|
|
@@ -484,9 +486,9 @@ export declare class TextBitByBit {
|
|
|
484
486
|
/**
|
|
485
487
|
* Draws one character as line paths with a simple stroke font.
|
|
486
488
|
*
|
|
487
|
-
* The paths lie flat on the XZ plane,
|
|
488
|
-
*
|
|
489
|
-
* mark.
|
|
489
|
+
* The paths lie flat on the XZ plane, the character `height` tall, and come with its width and
|
|
490
|
+
* height. Accented Latin letters are drawn with their marks, other unknown characters as a
|
|
491
|
+
* question mark.
|
|
490
492
|
* Example: 'A' at height 10 -> the strokes of an A, 10 units tall
|
|
491
493
|
* @param inputs - The character, its height and its offsets
|
|
492
494
|
* @returns The character's width, height and stroke paths as lists of points
|
|
@@ -522,6 +524,7 @@ export declare class TextBitByBit {
|
|
|
522
524
|
* ```
|
|
523
525
|
*/
|
|
524
526
|
vectorText(inputs: Inputs.Text.VectorTextDto): Models.Text.VectorTextData[];
|
|
527
|
+
private onGround;
|
|
525
528
|
private vectorParamsChar;
|
|
526
529
|
private translateLine;
|
|
527
530
|
}
|
package/lib/api/services/text.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import * as Inputs from "../inputs";
|
|
2
2
|
import { defaultsVectorParams } from "../models/simplex";
|
|
3
3
|
import { resolveDto } from "../kernel-calls";
|
|
4
|
+
import { pointOnGround } from "./helpers/files/ground-axes";
|
|
5
|
+
import { strokeGlyph } from "./helpers/text/stroke-font";
|
|
4
6
|
/**
|
|
5
7
|
* Working with text: splitting, joining, searching, trimming, padding, changing case, regular
|
|
6
8
|
* expressions and formatting with placeholders. `vectorChar` and `vectorText` turn text into line
|
|
@@ -8,8 +10,9 @@ import { resolveDto } from "../kernel-calls";
|
|
|
8
10
|
* 0.
|
|
9
11
|
*/
|
|
10
12
|
export class TextBitByBit {
|
|
11
|
-
constructor(point) {
|
|
13
|
+
constructor(point, settings = () => ({})) {
|
|
12
14
|
this.point = point;
|
|
15
|
+
this.settings = settings;
|
|
13
16
|
}
|
|
14
17
|
/**
|
|
15
18
|
* Passes a text through unchanged, so a value can be given a name and reused.
|
|
@@ -599,9 +602,9 @@ export class TextBitByBit {
|
|
|
599
602
|
/**
|
|
600
603
|
* Draws one character as line paths with a simple stroke font.
|
|
601
604
|
*
|
|
602
|
-
* The paths lie flat on the XZ plane,
|
|
603
|
-
*
|
|
604
|
-
* mark.
|
|
605
|
+
* The paths lie flat on the XZ plane, the character `height` tall, and come with its width and
|
|
606
|
+
* height. Accented Latin letters are drawn with their marks, other unknown characters as a
|
|
607
|
+
* question mark.
|
|
605
608
|
* Example: 'A' at height 10 -> the strokes of an A, 10 units tall
|
|
606
609
|
* @param inputs - The character, its height and its offsets
|
|
607
610
|
* @returns The character's width, height and stroke paths as lists of points
|
|
@@ -616,30 +619,11 @@ export class TextBitByBit {
|
|
|
616
619
|
vectorChar(inputs) {
|
|
617
620
|
const resolved = resolveDto(Inputs.Text.VectorCharDto, inputs);
|
|
618
621
|
const { xOffset, yOffset, font, input, height, extrudeOffset } = this.vectorParamsChar(resolved);
|
|
619
|
-
|
|
620
|
-
if (!code || !font[code]) {
|
|
621
|
-
code = 63;
|
|
622
|
-
}
|
|
623
|
-
const glyph = [].concat(font[code]);
|
|
622
|
+
const glyph = strokeGlyph(font, input.charCodeAt(0));
|
|
624
623
|
const ratio = (height - extrudeOffset) / font.height;
|
|
625
624
|
const extrudeYOffset = (extrudeOffset / 2);
|
|
626
|
-
const width = glyph.
|
|
627
|
-
const paths = [];
|
|
628
|
-
let polyline = [];
|
|
629
|
-
for (let i = 0, il = glyph.length; i < il; i += 2) {
|
|
630
|
-
const gx = ratio * glyph[i] + xOffset;
|
|
631
|
-
const gy = ratio * glyph[i + 1] + yOffset + extrudeYOffset;
|
|
632
|
-
if (glyph[i] !== undefined) {
|
|
633
|
-
polyline.push([gx, 0, gy]);
|
|
634
|
-
continue;
|
|
635
|
-
}
|
|
636
|
-
paths.push(polyline);
|
|
637
|
-
polyline = [];
|
|
638
|
-
i--;
|
|
639
|
-
}
|
|
640
|
-
if (polyline.length) {
|
|
641
|
-
paths.push(polyline);
|
|
642
|
-
}
|
|
625
|
+
const width = glyph.advance * ratio;
|
|
626
|
+
const paths = glyph.strokes.map(stroke => stroke.map(([x, y]) => this.onGround(ratio * x + xOffset, ratio * y + yOffset + extrudeYOffset)));
|
|
643
627
|
return { width, height, paths };
|
|
644
628
|
}
|
|
645
629
|
/**
|
|
@@ -749,6 +733,9 @@ export class TextBitByBit {
|
|
|
749
733
|
}
|
|
750
734
|
return lines;
|
|
751
735
|
}
|
|
736
|
+
onGround(x, y) {
|
|
737
|
+
return pointOnGround(x, y, this.settings().coordinateSystem);
|
|
738
|
+
}
|
|
752
739
|
vectorParamsChar(inputs) {
|
|
753
740
|
const params = Object.assign({}, defaultsVectorParams, inputs);
|
|
754
741
|
params.input = inputs.char || params.char;
|
|
@@ -760,7 +747,7 @@ export class TextBitByBit {
|
|
|
760
747
|
vchar.paths = vchar.paths.map((path) => {
|
|
761
748
|
const pts = this.point.translatePoints({
|
|
762
749
|
points: path,
|
|
763
|
-
translation:
|
|
750
|
+
translation: this.onGround(x, y),
|
|
764
751
|
});
|
|
765
752
|
return pts;
|
|
766
753
|
});
|
package/package.json
CHANGED
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import * as Inputs from "../../../../inputs";
|
|
2
|
-
export declare class Dxf {
|
|
3
|
-
private dxfGenerator;
|
|
4
|
-
/**
|
|
5
|
-
* Creates a line segment definition for DXF export (pass-through for validation).
|
|
6
|
-
* Example: start=[0,0], end=[10,5] → DXF line segment from origin to [10,5]
|
|
7
|
-
* @param inputs Line segment definition
|
|
8
|
-
* @returns Line segment DTO
|
|
9
|
-
* @group dxf
|
|
10
|
-
* @shortname line segment
|
|
11
|
-
* @drawable false
|
|
12
|
-
*/
|
|
13
|
-
lineSegment(inputs: Inputs.IO.DxfLineSegmentDto): Inputs.IO.DxfLineSegmentDto;
|
|
14
|
-
/**
|
|
15
|
-
* Creates an arc segment definition for DXF export (curved path between two points).
|
|
16
|
-
* Example: center=[5,5], radius=5, startAngle=0°, endAngle=90° → quarter circle arc
|
|
17
|
-
* @param inputs Arc segment definition
|
|
18
|
-
* @returns Arc segment DTO
|
|
19
|
-
* @group dxf
|
|
20
|
-
* @shortname arc segment
|
|
21
|
-
* @drawable false
|
|
22
|
-
*/
|
|
23
|
-
arcSegment(inputs: Inputs.IO.DxfArcSegmentDto): Inputs.IO.DxfArcSegmentDto;
|
|
24
|
-
/**
|
|
25
|
-
* Creates a circle segment definition for DXF export (closed circular path).
|
|
26
|
-
* Example: center=[10,10], radius=5 → full circle with diameter 10 centered at [10,10]
|
|
27
|
-
* @param inputs Circle segment definition
|
|
28
|
-
* @returns Circle segment DTO
|
|
29
|
-
* @group dxf
|
|
30
|
-
* @shortname circle segment
|
|
31
|
-
* @drawable false
|
|
32
|
-
*/
|
|
33
|
-
circleSegment(inputs: Inputs.IO.DxfCircleSegmentDto): Inputs.IO.DxfCircleSegmentDto;
|
|
34
|
-
/**
|
|
35
|
-
* Creates a polyline segment definition for DXF export (connected line segments through points).
|
|
36
|
-
* Example: points=[[0,0], [5,0], [5,5], [0,5]] → rectangular polyline path
|
|
37
|
-
* @param inputs Polyline segment definition
|
|
38
|
-
* @returns Polyline segment DTO
|
|
39
|
-
* @group dxf
|
|
40
|
-
* @shortname polyline segment
|
|
41
|
-
* @drawable false
|
|
42
|
-
*/
|
|
43
|
-
polylineSegment(inputs: Inputs.IO.DxfPolylineSegmentDto): Inputs.IO.DxfPolylineSegmentDto;
|
|
44
|
-
/**
|
|
45
|
-
* Creates a spline segment definition for DXF export (smooth curve through control points).
|
|
46
|
-
* Example: controlPoints=[[0,0], [5,10], [10,0]] → smooth curved path through points
|
|
47
|
-
* @param inputs Spline segment definition
|
|
48
|
-
* @returns Spline segment DTO
|
|
49
|
-
* @group dxf
|
|
50
|
-
* @shortname spline segment
|
|
51
|
-
* @drawable false
|
|
52
|
-
*/
|
|
53
|
-
splineSegment(inputs: Inputs.IO.DxfSplineSegmentDto): Inputs.IO.DxfSplineSegmentDto;
|
|
54
|
-
/**
|
|
55
|
-
* Creates a path from multiple segments (combines lines, arcs, circles, polylines, splines).
|
|
56
|
-
* Similar to OCCT wires - segments are connected to form a continuous or multi-part path.
|
|
57
|
-
* Example: segments=[lineSegment, arcSegment, polylineSegment] → combined path entity
|
|
58
|
-
* @param inputs Path definition with segments
|
|
59
|
-
* @returns Path DTO
|
|
60
|
-
* @group dxf
|
|
61
|
-
* @shortname path
|
|
62
|
-
* @drawable false
|
|
63
|
-
*/
|
|
64
|
-
path(inputs: Inputs.IO.DxfPathDto): Inputs.IO.DxfPathDto;
|
|
65
|
-
/**
|
|
66
|
-
* Creates a paths part with layer and color assignment for DXF organization.
|
|
67
|
-
* Groups multiple paths into a single layer with consistent styling.
|
|
68
|
-
* Example: paths=[path1, path2], layer="Outlines", color=red → grouped geometry
|
|
69
|
-
* @param inputs Paths part definition
|
|
70
|
-
* @returns Paths part DTO
|
|
71
|
-
* @group dxf
|
|
72
|
-
* @shortname paths part
|
|
73
|
-
* @drawable false
|
|
74
|
-
*/
|
|
75
|
-
pathsPart(inputs: Inputs.IO.DxfPathsPartDto): Inputs.IO.DxfPathsPartDto;
|
|
76
|
-
/**
|
|
77
|
-
* Generates a complete DXF file from paths parts (exports 2D CAD drawing format).
|
|
78
|
-
* Supports lines, arcs, circles, polylines, and splines organized in layered paths.
|
|
79
|
-
* Example: model with 3 parts on different layers → valid DXF file string for CAD software
|
|
80
|
-
* @param inputs DXF model definition
|
|
81
|
-
* @returns DXF file content as string
|
|
82
|
-
* @group dxf
|
|
83
|
-
* @shortname dxf create
|
|
84
|
-
* @drawable false
|
|
85
|
-
*/
|
|
86
|
-
dxfCreate(inputs: Inputs.IO.DxfModelDto): string;
|
|
87
|
-
}
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
import * as Inputs from "../../../../inputs";
|
|
2
|
-
import { DxfGenerator } from "./dxf-generator";
|
|
3
|
-
import { resolveDto } from "../../../../kernel-calls";
|
|
4
|
-
export class Dxf {
|
|
5
|
-
constructor() {
|
|
6
|
-
this.dxfGenerator = new DxfGenerator();
|
|
7
|
-
}
|
|
8
|
-
/**
|
|
9
|
-
* Creates a line segment definition for DXF export (pass-through for validation).
|
|
10
|
-
* Example: start=[0,0], end=[10,5] → DXF line segment from origin to [10,5]
|
|
11
|
-
* @param inputs Line segment definition
|
|
12
|
-
* @returns Line segment DTO
|
|
13
|
-
* @group dxf
|
|
14
|
-
* @shortname line segment
|
|
15
|
-
* @drawable false
|
|
16
|
-
*/
|
|
17
|
-
lineSegment(inputs) {
|
|
18
|
-
return inputs;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Creates an arc segment definition for DXF export (curved path between two points).
|
|
22
|
-
* Example: center=[5,5], radius=5, startAngle=0°, endAngle=90° → quarter circle arc
|
|
23
|
-
* @param inputs Arc segment definition
|
|
24
|
-
* @returns Arc segment DTO
|
|
25
|
-
* @group dxf
|
|
26
|
-
* @shortname arc segment
|
|
27
|
-
* @drawable false
|
|
28
|
-
*/
|
|
29
|
-
arcSegment(inputs) {
|
|
30
|
-
return inputs;
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Creates a circle segment definition for DXF export (closed circular path).
|
|
34
|
-
* Example: center=[10,10], radius=5 → full circle with diameter 10 centered at [10,10]
|
|
35
|
-
* @param inputs Circle segment definition
|
|
36
|
-
* @returns Circle segment DTO
|
|
37
|
-
* @group dxf
|
|
38
|
-
* @shortname circle segment
|
|
39
|
-
* @drawable false
|
|
40
|
-
*/
|
|
41
|
-
circleSegment(inputs) {
|
|
42
|
-
return inputs;
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Creates a polyline segment definition for DXF export (connected line segments through points).
|
|
46
|
-
* Example: points=[[0,0], [5,0], [5,5], [0,5]] → rectangular polyline path
|
|
47
|
-
* @param inputs Polyline segment definition
|
|
48
|
-
* @returns Polyline segment DTO
|
|
49
|
-
* @group dxf
|
|
50
|
-
* @shortname polyline segment
|
|
51
|
-
* @drawable false
|
|
52
|
-
*/
|
|
53
|
-
polylineSegment(inputs) {
|
|
54
|
-
const resolved = resolveDto(Inputs.IO.DxfPolylineSegmentDto, inputs);
|
|
55
|
-
return resolved;
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Creates a spline segment definition for DXF export (smooth curve through control points).
|
|
59
|
-
* Example: controlPoints=[[0,0], [5,10], [10,0]] → smooth curved path through points
|
|
60
|
-
* @param inputs Spline segment definition
|
|
61
|
-
* @returns Spline segment DTO
|
|
62
|
-
* @group dxf
|
|
63
|
-
* @shortname spline segment
|
|
64
|
-
* @drawable false
|
|
65
|
-
*/
|
|
66
|
-
splineSegment(inputs) {
|
|
67
|
-
const resolved = resolveDto(Inputs.IO.DxfSplineSegmentDto, inputs);
|
|
68
|
-
return resolved;
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* Creates a path from multiple segments (combines lines, arcs, circles, polylines, splines).
|
|
72
|
-
* Similar to OCCT wires - segments are connected to form a continuous or multi-part path.
|
|
73
|
-
* Example: segments=[lineSegment, arcSegment, polylineSegment] → combined path entity
|
|
74
|
-
* @param inputs Path definition with segments
|
|
75
|
-
* @returns Path DTO
|
|
76
|
-
* @group dxf
|
|
77
|
-
* @shortname path
|
|
78
|
-
* @drawable false
|
|
79
|
-
*/
|
|
80
|
-
path(inputs) {
|
|
81
|
-
return inputs;
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* Creates a paths part with layer and color assignment for DXF organization.
|
|
85
|
-
* Groups multiple paths into a single layer with consistent styling.
|
|
86
|
-
* Example: paths=[path1, path2], layer="Outlines", color=red → grouped geometry
|
|
87
|
-
* @param inputs Paths part definition
|
|
88
|
-
* @returns Paths part DTO
|
|
89
|
-
* @group dxf
|
|
90
|
-
* @shortname paths part
|
|
91
|
-
* @drawable false
|
|
92
|
-
*/
|
|
93
|
-
pathsPart(inputs) {
|
|
94
|
-
const resolved = resolveDto(Inputs.IO.DxfPathsPartDto, inputs);
|
|
95
|
-
return resolved;
|
|
96
|
-
}
|
|
97
|
-
/**
|
|
98
|
-
* Generates a complete DXF file from paths parts (exports 2D CAD drawing format).
|
|
99
|
-
* Supports lines, arcs, circles, polylines, and splines organized in layered paths.
|
|
100
|
-
* Example: model with 3 parts on different layers → valid DXF file string for CAD software
|
|
101
|
-
* @param inputs DXF model definition
|
|
102
|
-
* @returns DXF file content as string
|
|
103
|
-
* @group dxf
|
|
104
|
-
* @shortname dxf create
|
|
105
|
-
* @drawable false
|
|
106
|
-
*/
|
|
107
|
-
dxfCreate(inputs) {
|
|
108
|
-
const resolved = resolveDto(Inputs.IO.DxfModelDto, inputs);
|
|
109
|
-
return this.dxfGenerator.generateDxf(resolved);
|
|
110
|
-
}
|
|
111
|
-
}
|
package/lib/api/services/io.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { Dxf } from "./helpers/files/dxf/dxf";
|
|
2
|
-
/**
|
|
3
|
-
* Reading and writing files: exporting geometry to the supported formats, importing it back, and
|
|
4
|
-
* the download and upload helpers that move files between the browser and the user's machine.
|
|
5
|
-
*/
|
|
6
|
-
export declare class IoBitByBit {
|
|
7
|
-
dxf: Dxf;
|
|
8
|
-
constructor();
|
|
9
|
-
}
|
package/lib/api/services/io.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { Dxf } from "./helpers/files/dxf/dxf";
|
|
2
|
-
/**
|
|
3
|
-
* Reading and writing files: exporting geometry to the supported formats, importing it back, and
|
|
4
|
-
* the download and upload helpers that move files between the browser and the user's machine.
|
|
5
|
-
*/
|
|
6
|
-
export class IoBitByBit {
|
|
7
|
-
constructor() {
|
|
8
|
-
this.dxf = new Dxf();
|
|
9
|
-
}
|
|
10
|
-
}
|