@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.
Files changed (204) hide show
  1. package/NOTICE +24 -0
  2. package/README.md +3 -1
  3. package/lib/api/GlobalCDNProvider.js +1 -1
  4. package/lib/api/inputs/base-inputs.d.ts +40 -7
  5. package/lib/api/inputs/base-inputs.js +32 -0
  6. package/lib/api/inputs/io-inputs.d.ts +927 -59
  7. package/lib/api/inputs/io-inputs.js +769 -40
  8. package/lib/api/inputs/line-inputs.d.ts +17 -0
  9. package/lib/api/inputs/line-inputs.js +15 -0
  10. package/lib/api/inputs/mesh-inputs.d.ts +20 -1
  11. package/lib/api/inputs/mesh-inputs.js +23 -0
  12. package/lib/api/inputs/recipes-inputs.d.ts +13 -5
  13. package/lib/api/inputs/recipes-inputs.js +10 -5
  14. package/lib/api/kernel-calls/index.d.ts +2 -0
  15. package/lib/api/kernel-calls/index.js +2 -0
  16. package/lib/api/kernel-calls/resolve-dto.d.ts +3 -1
  17. package/lib/api/kernel-calls/resolve-dto.js +7 -2
  18. package/lib/api/kernel-calls/settings.d.ts +101 -0
  19. package/lib/api/kernel-calls/settings.js +123 -0
  20. package/lib/api/kernel-calls/up-axis-aliases.d.ts +25 -0
  21. package/lib/api/kernel-calls/up-axis-aliases.js +70 -0
  22. package/lib/api/models/simplex.d.ts +2 -0
  23. package/lib/api/models/simplex.js +10 -1
  24. package/lib/api/recipes/surface-mesh.d.ts +2 -1
  25. package/lib/api/recipes/surface-mesh.js +5 -3
  26. package/lib/api/resolved-inputs/index.d.ts +32 -3
  27. package/lib/api/services/base-bitbybit.d.ts +12 -0
  28. package/lib/api/services/base-bitbybit.js +19 -3
  29. package/lib/api/services/color.js +2 -3
  30. package/lib/api/services/helpers/color/color-forms.constants.d.ts +3 -0
  31. package/lib/api/services/helpers/color/color-forms.constants.js +3 -0
  32. package/lib/api/services/helpers/color/color-forms.d.ts +1 -0
  33. package/lib/api/services/helpers/color/color-forms.js +4 -1
  34. package/lib/api/services/helpers/color/css-colors.constants.d.ts +9 -0
  35. package/lib/api/services/helpers/color/css-colors.constants.js +158 -0
  36. package/lib/api/services/helpers/color/css-colors.d.ts +1 -0
  37. package/lib/api/services/helpers/color/css-colors.js +61 -0
  38. package/lib/api/services/helpers/curves/bezier-pieces.constants.d.ts +5 -0
  39. package/lib/api/services/helpers/curves/bezier-pieces.constants.js +5 -0
  40. package/lib/api/services/helpers/curves/bezier-pieces.d.ts +24 -0
  41. package/lib/api/services/helpers/curves/bezier-pieces.js +149 -0
  42. package/lib/api/services/helpers/curves/conic-arcs.constants.d.ts +5 -0
  43. package/lib/api/services/helpers/curves/conic-arcs.constants.js +5 -0
  44. package/lib/api/services/helpers/curves/conic-arcs.d.ts +26 -0
  45. package/lib/api/services/helpers/curves/conic-arcs.js +87 -0
  46. package/lib/api/services/helpers/curves/nurbs-forms.d.ts +20 -0
  47. package/lib/api/services/helpers/curves/nurbs-forms.js +112 -0
  48. package/lib/api/services/helpers/curves/nurbs.d.ts +4 -0
  49. package/lib/api/services/helpers/curves/nurbs.js +10 -9
  50. package/lib/api/services/helpers/files/drawing/drawing-budget.d.ts +3 -0
  51. package/lib/api/services/helpers/files/drawing/drawing-budget.js +34 -0
  52. package/lib/api/services/helpers/files/drawing/drawing-dimension.constants.d.ts +14 -0
  53. package/lib/api/services/helpers/files/drawing/drawing-dimension.constants.js +14 -0
  54. package/lib/api/services/helpers/files/drawing/drawing-dimension.d.ts +4 -0
  55. package/lib/api/services/helpers/files/drawing/drawing-dimension.js +271 -0
  56. package/lib/api/services/helpers/files/drawing/drawing-geometry.d.ts +21 -0
  57. package/lib/api/services/helpers/files/drawing/drawing-geometry.js +101 -0
  58. package/lib/api/services/helpers/files/drawing/drawing-hatch.d.ts +10 -0
  59. package/lib/api/services/helpers/files/drawing/drawing-hatch.js +123 -0
  60. package/lib/api/services/helpers/files/drawing/drawing-loops.d.ts +3 -0
  61. package/lib/api/services/helpers/files/drawing/drawing-loops.js +91 -0
  62. package/lib/api/services/helpers/files/drawing/drawing-model.d.ts +10 -0
  63. package/lib/api/services/helpers/files/drawing/drawing-model.js +336 -0
  64. package/lib/api/services/helpers/files/drawing/drawing-scale.d.ts +2 -0
  65. package/lib/api/services/helpers/files/drawing/drawing-scale.js +47 -0
  66. package/lib/api/services/helpers/files/drawing/drawing-text.d.ts +9 -0
  67. package/lib/api/services/helpers/files/drawing/drawing-text.js +25 -0
  68. package/lib/api/services/helpers/files/drawing/drawing-types.d.ts +117 -0
  69. package/lib/api/services/helpers/files/drawing/drawing-types.js +1 -0
  70. package/lib/api/services/helpers/files/drawing/drawing.constants.d.ts +41 -0
  71. package/lib/api/services/helpers/files/drawing/drawing.constants.js +46 -0
  72. package/lib/api/services/helpers/files/dxf/dxf-annotations.d.ts +5 -0
  73. package/lib/api/services/helpers/files/dxf/dxf-annotations.js +96 -0
  74. package/lib/api/services/helpers/files/dxf/dxf-colors.d.ts +5 -0
  75. package/lib/api/services/helpers/files/dxf/dxf-colors.js +45 -0
  76. package/lib/api/services/helpers/files/dxf/dxf-entities.d.ts +21 -0
  77. package/lib/api/services/helpers/files/dxf/dxf-entities.js +196 -0
  78. package/lib/api/services/helpers/files/dxf/dxf-file-text.d.ts +1 -0
  79. package/lib/api/services/helpers/files/dxf/dxf-file-text.js +50 -0
  80. package/lib/api/services/helpers/files/dxf/dxf-generator.d.ts +2 -36
  81. package/lib/api/services/helpers/files/dxf/dxf-generator.js +97 -523
  82. package/lib/api/services/helpers/files/dxf/dxf-reader-annotations.d.ts +9 -0
  83. package/lib/api/services/helpers/files/dxf/dxf-reader-annotations.js +312 -0
  84. package/lib/api/services/helpers/files/dxf/dxf-reader-dtos.d.ts +6 -0
  85. package/lib/api/services/helpers/files/dxf/dxf-reader-dtos.js +115 -0
  86. package/lib/api/services/helpers/files/dxf/dxf-reader-geometry.d.ts +21 -0
  87. package/lib/api/services/helpers/files/dxf/dxf-reader-geometry.js +67 -0
  88. package/lib/api/services/helpers/files/dxf/dxf-reader-segments.d.ts +9 -0
  89. package/lib/api/services/helpers/files/dxf/dxf-reader-segments.js +151 -0
  90. package/lib/api/services/helpers/files/dxf/dxf-reader-types.d.ts +96 -0
  91. package/lib/api/services/helpers/files/dxf/dxf-reader-types.js +1 -0
  92. package/lib/api/services/helpers/files/dxf/dxf-reader.constants.d.ts +134 -0
  93. package/lib/api/services/helpers/files/dxf/dxf-reader.constants.js +95 -0
  94. package/lib/api/services/helpers/files/dxf/dxf-reader.d.ts +2 -0
  95. package/lib/api/services/helpers/files/dxf/dxf-reader.js +446 -0
  96. package/lib/api/services/helpers/files/dxf/dxf-tables.d.ts +29 -0
  97. package/lib/api/services/helpers/files/dxf/dxf-tables.js +248 -0
  98. package/lib/api/services/helpers/files/dxf/dxf-text.d.ts +26 -0
  99. package/lib/api/services/helpers/files/dxf/dxf-text.js +97 -0
  100. package/lib/api/services/helpers/files/dxf/dxf-tokens.d.ts +11 -0
  101. package/lib/api/services/helpers/files/dxf/dxf-tokens.js +89 -0
  102. package/lib/api/services/helpers/files/dxf/dxf.constants.d.ts +43 -1
  103. package/lib/api/services/helpers/files/dxf/dxf.constants.js +47 -1
  104. package/lib/api/services/helpers/files/file-bytes.d.ts +1 -0
  105. package/lib/api/services/helpers/files/file-bytes.js +15 -0
  106. package/lib/api/services/helpers/files/ground-axes.d.ts +2 -0
  107. package/lib/api/services/helpers/files/ground-axes.js +4 -0
  108. package/lib/api/services/helpers/files/mesh-file-axes.d.ts +7 -0
  109. package/lib/api/services/helpers/files/mesh-file-axes.js +17 -0
  110. package/lib/api/services/helpers/files/stl-axes.d.ts +4 -0
  111. package/lib/api/services/helpers/files/stl-axes.js +22 -0
  112. package/lib/api/services/helpers/files/stl-types.d.ts +7 -0
  113. package/lib/api/services/helpers/files/stl-types.js +1 -0
  114. package/lib/api/services/helpers/files/stl.constants.d.ts +11 -0
  115. package/lib/api/services/helpers/files/stl.constants.js +11 -0
  116. package/lib/api/services/helpers/files/stl.d.ts +3 -0
  117. package/lib/api/services/helpers/files/stl.js +93 -0
  118. package/lib/api/services/helpers/files/svg/svg-css.d.ts +48 -0
  119. package/lib/api/services/helpers/files/svg/svg-css.js +444 -0
  120. package/lib/api/services/helpers/files/svg/svg-dash-patterns.d.ts +2 -0
  121. package/lib/api/services/helpers/files/svg/svg-dash-patterns.js +35 -0
  122. package/lib/api/services/helpers/files/svg/svg-document.d.ts +26 -0
  123. package/lib/api/services/helpers/files/svg/svg-document.js +89 -0
  124. package/lib/api/services/helpers/files/svg/svg-memo.d.ts +1 -0
  125. package/lib/api/services/helpers/files/svg/svg-memo.js +8 -0
  126. package/lib/api/services/helpers/files/svg/svg-normalizer.d.ts +6 -0
  127. package/lib/api/services/helpers/files/svg/svg-normalizer.js +433 -0
  128. package/lib/api/services/helpers/files/svg/svg-numbers.d.ts +15 -0
  129. package/lib/api/services/helpers/files/svg/svg-numbers.js +61 -0
  130. package/lib/api/services/helpers/files/svg/svg-path-data.constants.d.ts +8 -0
  131. package/lib/api/services/helpers/files/svg/svg-path-data.constants.js +10 -0
  132. package/lib/api/services/helpers/files/svg/svg-path-data.d.ts +9 -0
  133. package/lib/api/services/helpers/files/svg/svg-path-data.js +203 -0
  134. package/lib/api/services/helpers/files/svg/svg-path-types.d.ts +33 -0
  135. package/lib/api/services/helpers/files/svg/svg-path-types.js +1 -0
  136. package/lib/api/services/helpers/files/svg/svg-reader.constants.d.ts +35 -0
  137. package/lib/api/services/helpers/files/svg/svg-reader.constants.js +35 -0
  138. package/lib/api/services/helpers/files/svg/svg-reading.constants.d.ts +9 -0
  139. package/lib/api/services/helpers/files/svg/svg-reading.constants.js +9 -0
  140. package/lib/api/services/helpers/files/svg/svg-reading.d.ts +6 -0
  141. package/lib/api/services/helpers/files/svg/svg-reading.js +233 -0
  142. package/lib/api/services/helpers/files/svg/svg-scene-types.d.ts +54 -0
  143. package/lib/api/services/helpers/files/svg/svg-scene-types.js +1 -0
  144. package/lib/api/services/helpers/files/svg/svg-shapes.d.ts +6 -0
  145. package/lib/api/services/helpers/files/svg/svg-shapes.js +102 -0
  146. package/lib/api/services/helpers/files/svg/svg-strokes.d.ts +38 -0
  147. package/lib/api/services/helpers/files/svg/svg-strokes.js +132 -0
  148. package/lib/api/services/helpers/files/svg/svg-style.d.ts +26 -0
  149. package/lib/api/services/helpers/files/svg/svg-style.js +211 -0
  150. package/lib/api/services/helpers/files/svg/svg-transform.d.ts +10 -0
  151. package/lib/api/services/helpers/files/svg/svg-transform.js +76 -0
  152. package/lib/api/services/helpers/files/svg/svg-writer.d.ts +18 -0
  153. package/lib/api/services/helpers/files/svg/svg-writer.js +230 -0
  154. package/lib/api/services/helpers/files/svg/svg-xml.d.ts +11 -0
  155. package/lib/api/services/helpers/files/svg/svg-xml.js +322 -0
  156. package/lib/api/services/helpers/files/svg/svg.constants.d.ts +14 -0
  157. package/lib/api/services/helpers/files/svg/svg.constants.js +14 -0
  158. package/lib/api/services/helpers/files/work-budget.d.ts +11 -0
  159. package/lib/api/services/helpers/files/work-budget.js +26 -0
  160. package/lib/api/services/helpers/geometry/affine2.d.ts +8 -0
  161. package/lib/api/services/helpers/geometry/affine2.js +18 -0
  162. package/lib/api/services/helpers/geometry/ellipse-arcs.d.ts +14 -0
  163. package/lib/api/services/helpers/geometry/ellipse-arcs.js +96 -0
  164. package/lib/api/services/helpers/geometry/frame-axes.d.ts +3 -1
  165. package/lib/api/services/helpers/geometry/loop-fill.d.ts +2 -0
  166. package/lib/api/services/helpers/geometry/loop-fill.js +37 -0
  167. package/lib/api/services/helpers/geometry/polygon-nesting.constants.d.ts +6 -0
  168. package/lib/api/services/helpers/geometry/polygon-nesting.constants.js +6 -0
  169. package/lib/api/services/helpers/geometry/polygon-nesting.d.ts +31 -0
  170. package/lib/api/services/helpers/geometry/polygon-nesting.js +251 -0
  171. package/lib/api/services/helpers/geometry/vectors.d.ts +1 -0
  172. package/lib/api/services/helpers/geometry/vectors.js +6 -0
  173. package/lib/api/services/helpers/helper-types.d.ts +33 -0
  174. package/lib/api/services/helpers/text/stroke-font.d.ts +6 -0
  175. package/lib/api/services/helpers/text/stroke-font.js +177 -0
  176. package/lib/api/services/helpers/text/stroke-letters.constants.d.ts +2 -0
  177. package/lib/api/services/helpers/text/stroke-letters.constants.js +18 -0
  178. package/lib/api/services/helpers/text/stroke-marks.constants.d.ts +14 -0
  179. package/lib/api/services/helpers/text/stroke-marks.constants.js +34 -0
  180. package/lib/api/services/io/drawing.d.ts +368 -0
  181. package/lib/api/services/io/drawing.js +454 -0
  182. package/lib/api/services/io/dxf.d.ts +134 -0
  183. package/lib/api/services/io/dxf.js +167 -0
  184. package/lib/api/services/io/index.d.ts +4 -0
  185. package/lib/api/services/io/index.js +4 -0
  186. package/lib/api/services/io/io.d.ts +14 -0
  187. package/lib/api/services/io/io.js +15 -0
  188. package/lib/api/services/io/svg.d.ts +66 -0
  189. package/lib/api/services/io/svg.js +105 -0
  190. package/lib/api/services/line.d.ts +17 -0
  191. package/lib/api/services/line.js +20 -1
  192. package/lib/api/services/mesh.d.ts +19 -0
  193. package/lib/api/services/mesh.js +40 -0
  194. package/lib/api/services/point.d.ts +4 -1
  195. package/lib/api/services/point.js +9 -4
  196. package/lib/api/services/recipes.d.ts +3 -0
  197. package/lib/api/services/recipes.js +6 -2
  198. package/lib/api/services/text.d.ts +7 -4
  199. package/lib/api/services/text.js +14 -27
  200. package/package.json +1 -1
  201. package/lib/api/services/helpers/files/dxf/dxf.d.ts +0 -87
  202. package/lib/api/services/helpers/files/dxf/dxf.js +0 -111
  203. package/lib/api/services/io.d.ts +0 -9
  204. 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
- constructor(point: Point);
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, scaled so the character is `height` tall, and are
488
- * returned with the character's width and height. An unknown character is drawn as a question
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
  }
@@ -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, scaled so the character is `height` tall, and are
603
- * returned with the character's width and height. An unknown character is drawn as a question
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
- let code = input.charCodeAt(0);
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.shift() * ratio;
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: [x, 0, y],
750
+ translation: this.onGround(x, y),
764
751
  });
765
752
  return pts;
766
753
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bitbybit-dev/base",
3
- "version": "1.6.2",
3
+ "version": "1.8.0",
4
4
  "description": "Bit By Bit Developers Base CAD Library to Program Geometry",
5
5
  "homepage": "https://docs.bitbybit.dev/modules/Bit",
6
6
  "main": "index.js",
@@ -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
- }
@@ -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
- }
@@ -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
- }