archiyou 0.7.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 (83) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +215 -0
  3. package/dist/archiyou.js +35969 -0
  4. package/dist/index.d.ts +2 -0
  5. package/dist/src/Annotator.d.ts +55 -0
  6. package/dist/src/AnnotatorBaseAnnotation.d.ts +16 -0
  7. package/dist/src/AnnotatorDimensionLine.d.ts +92 -0
  8. package/dist/src/Bbox.d.ts +126 -0
  9. package/dist/src/Beams.d.ts +316 -0
  10. package/dist/src/Brep.d.ts +152 -0
  11. package/dist/src/Calc.d.ts +48 -0
  12. package/dist/src/CalcDb.d.ts +33 -0
  13. package/dist/src/CalcTable.d.ts +60 -0
  14. package/dist/src/CalcTableIO.d.ts +130 -0
  15. package/dist/src/CodeParser.d.ts +58 -0
  16. package/dist/src/ComponentManager.d.ts +33 -0
  17. package/dist/src/Console.d.ts +34 -0
  18. package/dist/src/Doc.d.ts +181 -0
  19. package/dist/src/DocDocument.d.ts +27 -0
  20. package/dist/src/DocPDFExporter.d.ts +105 -0
  21. package/dist/src/DocPage.d.ts +75 -0
  22. package/dist/src/DocPageContainer.d.ts +65 -0
  23. package/dist/src/DocPageContainerGraphic.d.ts +10 -0
  24. package/dist/src/DocPageContainerImage.d.ts +21 -0
  25. package/dist/src/DocPageContainerTable.d.ts +21 -0
  26. package/dist/src/DocPageContainerText.d.ts +23 -0
  27. package/dist/src/DocPageContainerTextArea.d.ts +23 -0
  28. package/dist/src/DocPageContainerView.d.ts +22 -0
  29. package/dist/src/DocUtils.d.ts +12 -0
  30. package/dist/src/DocViewSVGManager.d.ts +91 -0
  31. package/dist/src/Edge.d.ts +190 -0
  32. package/dist/src/Exporter.d.ts +100 -0
  33. package/dist/src/Face.d.ts +134 -0
  34. package/dist/src/GLTFBuilder.d.ts +30 -0
  35. package/dist/src/IO.d.ts +87 -0
  36. package/dist/src/LibraryConnector.d.ts +56 -0
  37. package/dist/src/Make.d.ts +85 -0
  38. package/dist/src/MakeOperations.d.ts +32 -0
  39. package/dist/src/OBbox.d.ts +121 -0
  40. package/dist/src/Obj.d.ts +104 -0
  41. package/dist/src/OcLoader.d.ts +39 -0
  42. package/dist/src/ParamManager.d.ts +57 -0
  43. package/dist/src/ParamManagerOperator.d.ts +68 -0
  44. package/dist/src/Pipeline.d.ts +20 -0
  45. package/dist/src/Point.d.ts +88 -0
  46. package/dist/src/Runner.d.ts +230 -0
  47. package/dist/src/RunnerComponentImporter.d.ts +71 -0
  48. package/dist/src/RunnerOps.d.ts +15 -0
  49. package/dist/src/Script.d.ts +78 -0
  50. package/dist/src/ScriptOutputManager.d.ts +19 -0
  51. package/dist/src/ScriptOutputPath.d.ts +48 -0
  52. package/dist/src/ScriptParam.d.ts +78 -0
  53. package/dist/src/Selector.d.ts +48 -0
  54. package/dist/src/Services.d.ts +68 -0
  55. package/dist/src/Shape.d.ts +628 -0
  56. package/dist/src/ShapeCollection.d.ts +429 -0
  57. package/dist/src/Shell.d.ts +48 -0
  58. package/dist/src/Sketch.d.ts +162 -0
  59. package/dist/src/Solid.d.ts +54 -0
  60. package/dist/src/Vector.d.ts +167 -0
  61. package/dist/src/Vertex.d.ts +57 -0
  62. package/dist/src/VertexCollection.d.ts +11 -0
  63. package/dist/src/Wire.d.ts +180 -0
  64. package/dist/src/constants.d.ts +112 -0
  65. package/dist/src/decorators.d.ts +27 -0
  66. package/dist/src/garbageCollection.d.ts +4 -0
  67. package/dist/src/init.d.ts +5 -0
  68. package/dist/src/internal.d.ts +67 -0
  69. package/dist/src/models.d.ts +40 -0
  70. package/dist/src/typeguards.d.ts +88 -0
  71. package/dist/src/types.d.ts +944 -0
  72. package/dist/src/utils.d.ts +140 -0
  73. package/dist/src/wasm/build-scripts/build_wasm_base64.d.ts +8 -0
  74. package/dist/src/wasm/index.d.ts +8 -0
  75. package/dist/src/workerUtils.d.ts +14 -0
  76. package/dist/wasm/README.md +13 -0
  77. package/dist/wasm/archiyou-opencascade.d.ts +9933 -0
  78. package/dist/wasm/archiyou-opencascade.js +16 -0
  79. package/dist/wasm/archiyou-opencascade.wasm +0 -0
  80. package/dist/wasm/index.js +32 -0
  81. package/dist/wasm/node.d.ts +16 -0
  82. package/dist/wasm/node.js +40 -0
  83. package/package.json +66 -0
@@ -0,0 +1,944 @@
1
+ import { Point, Vector, Shape, Vertex, Edge, Wire, Face, Shell, Solid, ShapeCollection, VertexCollection, Bbox, BaseAnnotation, ParamManager, Obj, Script, ScriptParam, ScriptData, Brep, Doc, Beams, Container, DimensionLine, CodeParser, Exporter, Make, Calc, Db as CalcDb, View, Runner, Services, ScriptParamData } from './internal';
2
+ import { Console } from './Console';
3
+ export declare const ALL_SHAPE_NAMES: string[];
4
+ export declare const AXIS_TO_VECS: {
5
+ x: number[];
6
+ '-x': number[];
7
+ y: number[];
8
+ '-y': number[];
9
+ z: number[];
10
+ '-z': number[];
11
+ xy: number[];
12
+ xz: number[];
13
+ yz: number[];
14
+ };
15
+ export declare const SIDES: string[];
16
+ export declare const SIDE_TO_AXIS: {
17
+ [key: string]: string;
18
+ };
19
+ export declare const ALIGNMENTS_ADD_TO_SIDES: string[];
20
+ export type ModelUnits = 'mm' | 'cm' | 'dm' | 'm' | 'km' | 'in' | 'ft' | 'yd' | 'mi';
21
+ export type Units = DocUnits | ModelUnits;
22
+ export type UnitsWithPerc = Units | '%';
23
+ export type Coord = number | string;
24
+ export type MainAxis = 'x' | 'y' | 'z';
25
+ export type Plane = 'xy' | 'xz' | 'yz';
26
+ export type Axis = 'x' | '-x' | 'y' | '-y' | 'z' | '-z' | Plane;
27
+ export type SideX = 'left' | 'right';
28
+ export type SideY = 'front' | 'back';
29
+ export type SideZ = 'top' | 'bottom';
30
+ export type Side = SideX | SideY | SideZ;
31
+ export type SketchPlaneName = Plane | Side;
32
+ export type CoordArray = [Coord, Coord, Coord];
33
+ export type PointLike = Coord | Array<Coord> | Vector | Point | Vertex;
34
+ export type PointLikeSequence = Array<PointLike> | ShapeCollection;
35
+ export type ShapeType = 'Vertex' | 'Edge' | 'Wire' | 'Face' | 'Shell' | 'Solid';
36
+ export type ShapeTypes = Array<ShapeType>;
37
+ export type LinearShape = Edge | Wire;
38
+ export type PointLikeOrAnyShape = PointLike | AnyShape;
39
+ export type AnyShape = Shape | Vertex | Edge | Wire | Face | Shell | Solid;
40
+ export type AnyTypedShape = Vertex | Edge | Wire | Face | Shell | Solid;
41
+ export type AnyShapeCollection = ShapeCollection | VertexCollection;
42
+ export type AnyShapeSequence = AnyShapeCollection | Array<AnyShape>;
43
+ export type AnyShapeOrCollection = AnyShape | AnyShapeCollection;
44
+ export type AnyShapeOrSequence = AnyShape | AnyShapeSequence;
45
+ export type PointLikeOrVertexCollection = PointLike | VertexCollection;
46
+ export type PointLikeOrAnyShapeOrCollection = PointLike | AnyShape | AnyShapeCollection;
47
+ export type ColorInput = string | number;
48
+ export type Pivot = PointLike | string;
49
+ export type Alignment = string | PointLike;
50
+ export type BboxAlignment = Array<number> | Alignment;
51
+ export type LinearShapeTail = 'start' | 'end';
52
+ export type ThickenDirection = 'all' | 'center' | PointLike | Side;
53
+ export type OrientationXY = 'horizontal' | 'vertical';
54
+ export type SelectionString = string;
55
+ export type AnyShapeOrCollectionOrSelectionString = AnyShape | AnyShapeCollection | SelectionString;
56
+ export type PointLikeOrAnyShapeOrCollectionOrSelectionString = PointLikeOrAnyShapeOrCollection | SelectionString;
57
+ export type MakeShapeCollectionInput = PointLikeOrAnyShapeOrCollection | PointLikeSequence | Array<PointLikeOrAnyShapeOrCollection | PointLikeSequence>;
58
+ export type MakeWireInput = PointLikeSequence | AnyShapeOrCollection | Array<PointLikeSequence | AnyShapeOrCollection>;
59
+ export type MakeFaceInput = Wire | PointLikeSequence | AnyShapeSequence;
60
+ export type MakeShellInput = Array<Face | Edge> | ShapeCollection;
61
+ export type MakeSolidInput = Array<Shell> | ShapeCollection;
62
+ /** Pipelines are calculations that need to run to generate certain outputs */
63
+ export type PipelineType = 'docs' | '3dprint' | 'cnc' | 'techdraw' | 'laser';
64
+ /** Saved Scripts by Version */
65
+ export interface ScriptVersion {
66
+ id?: string;
67
+ file_id?: string;
68
+ user_id?: string;
69
+ user_name?: string;
70
+ file_name?: string;
71
+ prev_version_id?: string;
72
+ created_at?: string;
73
+ updated_at?: string;
74
+ params?: Array<ScriptParam>;
75
+ code: string;
76
+ shared?: boolean;
77
+ shared_version_tag?: string;
78
+ shared_auto_sync?: boolean;
79
+ shared_category?: string;
80
+ shared_description?: string;
81
+ }
82
+ /** After execution of the script (on client or server) we fill in some metadata */
83
+ export interface ScriptMeta {
84
+ units: ModelUnits;
85
+ pipelines: Array<string>;
86
+ metrics: Array<string>;
87
+ tables: Array<string>;
88
+ docs: Array<string>;
89
+ numShapes?: number;
90
+ bbox?: Array<number | number | number | number | number | number>;
91
+ }
92
+ /** Information on how the Script is published
93
+ * If null then the script is not published
94
+ * Before publishing the script is executed and validated, so here we also add information
95
+ * that comes out of execution
96
+ */
97
+ export interface ScriptPublished {
98
+ title?: string;
99
+ version: string;
100
+ libraryUrl?: string;
101
+ url?: string;
102
+ published?: Date;
103
+ description?: string;
104
+ public?: boolean;
105
+ params?: Record<string, any>;
106
+ presets?: Array<string>;
107
+ }
108
+ /** A group of all modules of Archiyou for easy access */
109
+ export interface ArchiyouApp {
110
+ oc?: any;
111
+ worker?: any;
112
+ runner?: Runner;
113
+ scope?: any;
114
+ brep?: Brep;
115
+ doc?: Doc;
116
+ console?: Console;
117
+ executor?: CodeParser;
118
+ exporter?: Exporter;
119
+ calc?: Calc;
120
+ make?: Make;
121
+ services?: Services;
122
+ gizmos?: Array<Gizmo>;
123
+ beams?: Beams;
124
+ paramManager?: ParamManager;
125
+ config?: Record<string, any>;
126
+ }
127
+ export interface ArchiyouAppInfoBbox {
128
+ min: Array<number | number | number>;
129
+ max: Array<number | number | number>;
130
+ width: number;
131
+ height: number;
132
+ }
133
+ export type ArchiyouOutputFormatType = 'step' | 'stl' | 'gltf';
134
+ export interface ArchiyouOutputSettings {
135
+ metrics?: boolean;
136
+ tables?: boolean;
137
+ docs?: boolean | Array<string>;
138
+ pipelines?: boolean | Array<string>;
139
+ formats?: boolean | Array<ArchiyouOutputFormatType>;
140
+ messages?: boolean | Array<ConsoleMessageType>;
141
+ }
142
+ export type ConsoleMessageType = 'info' | 'geom' | 'user' | 'warn' | 'error' | 'exec';
143
+ /** A console Message */
144
+ export interface ConsoleMessage {
145
+ type: ConsoleMessageType;
146
+ time: string;
147
+ from: string;
148
+ message: string;
149
+ }
150
+ /** Special Archiyou data inserted into asset.archiyou
151
+ TODO: We use RunnerScriptExecutionResult internally - which has a lot of overlap with this
152
+ When we start using GLB format internally these types will merge
153
+ */
154
+ export interface ArchiyouData {
155
+ scenegraph: SceneGraphNode;
156
+ gizmos: Array<Gizmo>;
157
+ annotations: Array<DimensionLineData>;
158
+ docs: {
159
+ [key: string]: DocData;
160
+ };
161
+ errors?: Array<StatementResult>;
162
+ messages?: Array<ConsoleMessage>;
163
+ metrics?: Record<string, Metric>;
164
+ tables?: {
165
+ [key: string]: any;
166
+ };
167
+ managedParams?: Record<ParamOperation, Array<ScriptParamData>>;
168
+ }
169
+ /** TODO */
170
+ export interface ExportSVGOptions {
171
+ }
172
+ export interface ExportGLTFOptions {
173
+ binary?: boolean;
174
+ quality?: MeshingQualitySettings;
175
+ archiyouFormat?: boolean;
176
+ archiyouOutput?: ArchiyouOutputSettings;
177
+ includePointsAndLines?: boolean;
178
+ extraShapesAsPointLines?: boolean;
179
+ }
180
+ /** Archiyou-specific information in GLTF */
181
+ export interface ArchiyouData {
182
+ scenegraph: SceneGraphNode;
183
+ gizmos: Array<Gizmo>;
184
+ annotations: Array<DimensionLineData>;
185
+ docs: {
186
+ [key: string]: DocData;
187
+ };
188
+ errors?: Array<StatementResult>;
189
+ messages?: Array<ConsoleMessage>;
190
+ tables?: {
191
+ [key: string]: any;
192
+ };
193
+ }
194
+ export type EngineStateStatus = 'init' | 'loaded' | 'executing' | 'executed';
195
+ export interface EngineState {
196
+ engine: 'cloud' | 'local';
197
+ status?: EngineStateStatus;
198
+ executionTime?: number | undefined;
199
+ statements?: Array<StatementResult>;
200
+ }
201
+ export interface MeshingQuality {
202
+ }
203
+ export interface ComputeTask {
204
+ uuid?: string;
205
+ type: string;
206
+ user_id?: string;
207
+ broker_id?: string;
208
+ client_id?: string;
209
+ created_at?: Date;
210
+ params?: Array<ScriptParam>;
211
+ code: string;
212
+ }
213
+ export interface RunnerScriptExecutionResult {
214
+ created_at: Date;
215
+ status: 'success' | 'error';
216
+ duration: number;
217
+ request: RunnerScriptExecutionRequest;
218
+ scenegraph?: SceneGraphNode;
219
+ gizmos?: Array<Gizmo>;
220
+ annotations?: Array<any>;
221
+ managedParams?: Record<ParamOperation, Array<ScriptParamData>>;
222
+ statements?: Array<StatementResult>;
223
+ errors?: Array<StatementResult>;
224
+ warnings?: Array<string>;
225
+ messages?: Array<ConsoleMessage>;
226
+ meta?: ScriptMeta;
227
+ outputs?: Array<ScriptOutputData>;
228
+ }
229
+ /** Results of component execution
230
+ * This is a flattened version of RunnerScriptExecutionResult for direct use in execution scope
231
+ * Any output is in internal format
232
+ * - models -> Obj (which contains Shapes)
233
+ * - metrics -> Record<string,Metric>
234
+ * - tables -> CalcTable (or CalcDb?)
235
+ * - docs -> Doc
236
+ *
237
+ */
238
+ export type ImportComponentOutput = Obj | Record<string, Metric> | Calc | Doc | null;
239
+ export interface ImportComponentResultPipeline {
240
+ model?: Obj | null;
241
+ metrics?: Record<string, Metric> | null;
242
+ tables?: CalcDb | null;
243
+ docs?: Doc | null;
244
+ }
245
+ /** Result with multiple pipelines */
246
+ export type ImportComponentResultPipelines = Record<string, ImportComponentResultPipeline>;
247
+ /** Combined type: direct output, per pipeline or multiple pipelines */
248
+ export type ImportComponentResult = ImportComponentOutput | ImportComponentResultPipeline | ImportComponentResultPipelines;
249
+ export type ParamType = 'number' | 'boolean' | 'text' | 'options' | 'list' | 'object';
250
+ export type ParamOperation = 'new' | 'updated' | 'deleted';
251
+ /** Target of a Param behaviour */
252
+ export type ParamBehaviourTarget = 'visible' | 'enable' | 'value' | 'values' | 'start' | 'end' | 'options';
253
+ /** A way to define nested ParamObjects, either user in a single entry or list
254
+ * NOTE: For now we don't allow nested structures (so no ParamObj containing other ParamObj field)
255
+ */
256
+ export type ParamObjectSchema = Record<string, ScriptParam>;
257
+ /** All possible attributes for Shapes */
258
+ export interface ShapeAttributes {
259
+ hidden?: boolean;
260
+ outline?: boolean;
261
+ visible?: boolean;
262
+ dashed?: boolean;
263
+ }
264
+ /** A cursor in a coordinate system. Used in Sketcher and others in the future */
265
+ export interface Cursor {
266
+ point: Point;
267
+ direction?: Vector;
268
+ }
269
+ export interface PolarCoord {
270
+ length: number;
271
+ angle: number;
272
+ relativeAngle?: boolean;
273
+ }
274
+ /** Represents a link between two Shapes */
275
+ export interface Link {
276
+ from: Point;
277
+ to: Point;
278
+ fromSupport: Vertex | Edge | Face;
279
+ toSupport: Vertex | Edge | Face;
280
+ fromParams: Array<number>;
281
+ toParams: Array<number>;
282
+ distance: number;
283
+ }
284
+ export interface SceneGraphNode {
285
+ name: string;
286
+ type: string;
287
+ nodes: Array<SceneGraphNode>;
288
+ details?: SceneGraphNodeDetails;
289
+ }
290
+ export interface SceneGraphNodeDetails {
291
+ visible?: boolean;
292
+ color?: number;
293
+ subType?: string;
294
+ numVertices?: number;
295
+ numEdges?: number;
296
+ numWires?: number;
297
+ }
298
+ export interface BaseStyle {
299
+ color?: number | string;
300
+ opacity?: number;
301
+ size?: number;
302
+ dashed?: boolean;
303
+ width?: number;
304
+ }
305
+ export interface ObjStyle {
306
+ point?: BaseStyle;
307
+ line?: BaseStyle;
308
+ fill?: BaseStyle;
309
+ }
310
+ export interface Gizmo {
311
+ name: string;
312
+ _id?: string;
313
+ axis: string;
314
+ position: Array<number>;
315
+ domains: Array<number>;
316
+ step: number;
317
+ toParams: Object;
318
+ _curPosition?: Array<number>;
319
+ _index?: number;
320
+ _obj?: any;
321
+ _dummy?: any;
322
+ _domainBounds?: Array<Array<any>>;
323
+ _paramValues: Object;
324
+ }
325
+ /** For applying select strings */
326
+ export interface Selection {
327
+ string: SelectionString;
328
+ targetShape: string;
329
+ singleResult?: boolean;
330
+ paramValue?: any;
331
+ selectorMethod?: any;
332
+ selectedShapes?: Shape | ShapeCollection;
333
+ }
334
+ export interface SelectionShapeTargetSetting {
335
+ single?: boolean;
336
+ targetShapeType: string;
337
+ ignoreCase?: boolean;
338
+ }
339
+ export interface SelectorSetting {
340
+ testLong: string;
341
+ testShort: string;
342
+ params: Array<string>;
343
+ worksOn: Array<string>;
344
+ selectorMethod: string;
345
+ }
346
+ export interface SelectorPointRange {
347
+ point?: Array<number>;
348
+ operator?: string;
349
+ range?: number;
350
+ }
351
+ export interface SelectorAxisCoord {
352
+ axis?: 'x' | 'y' | 'z';
353
+ coord?: number;
354
+ tolerance: number;
355
+ }
356
+ export interface SelectorBbox {
357
+ from?: Array<number>;
358
+ to?: Array<number>;
359
+ }
360
+ export interface SelectorIndex {
361
+ indices?: Array<number>;
362
+ }
363
+ export interface ShapeClone {
364
+ from: AnyShape;
365
+ transformations: Array<any>;
366
+ }
367
+ /** The Script seperated into statements */
368
+ export interface Statement {
369
+ code: string;
370
+ startIndex?: number;
371
+ endIndex?: number;
372
+ lineStart?: number;
373
+ lineEnd?: number;
374
+ columnStartIndex?: number;
375
+ columnEndIndex?: number;
376
+ }
377
+ export interface StatementResult extends Statement {
378
+ status: 'error' | 'success';
379
+ message?: string;
380
+ duration?: number;
381
+ durationPerc?: number;
382
+ }
383
+ /** Bring all annotations in one type */
384
+ export type AnnotationType = 'base' | 'dimensionLine' | 'label';
385
+ export type Annotation = BaseAnnotation | DimensionLine;
386
+ export type AnnotationData = DimensionLineData;
387
+ export type AnnotationAutoDimStrategy = 'part' | 'levels';
388
+ /** Exporting DimensionLine instances as data */
389
+ export interface DimensionLineData {
390
+ _id?: string;
391
+ _type?: AnnotationType;
392
+ start: [number, number, number];
393
+ end: [number, number, number];
394
+ targetStart: [number, number, number];
395
+ targetEnd: [number, number, number];
396
+ targetDir: [number, number, number];
397
+ dir: [number, number, number];
398
+ value: number;
399
+ static?: boolean;
400
+ units?: string;
401
+ offsetVec?: [number, number, number];
402
+ offsetLength?: number;
403
+ offset?: Array<number | number | number>;
404
+ interactive: boolean;
405
+ round?: boolean;
406
+ roundDecimals?: number;
407
+ param: string;
408
+ _labelPosition?: Array<number | number | number>;
409
+ showUnits?: boolean;
410
+ }
411
+ /** Used with Shape.dimension() as options
412
+ * NOTE: update typeguards when adding fields to this
413
+ */
414
+ export interface DimensionOptions {
415
+ units?: ModelUnits;
416
+ offset?: number;
417
+ offsetVec?: Vector;
418
+ ortho?: boolean | MainAxis;
419
+ roundDecimals?: number;
420
+ }
421
+ export interface DimensionLevel {
422
+ axis: MainAxis;
423
+ at: number;
424
+ coordType?: 'relative' | 'absolute';
425
+ align?: 'min' | 'auto' | 'max' | false | true;
426
+ minDistance?: number;
427
+ offset?: number;
428
+ showLine?: boolean;
429
+ }
430
+ export interface DimensionLevelSettings {
431
+ levels: Array<DimensionLevel>;
432
+ }
433
+ export type DocUnits = 'mm' | 'cm' | 'inch' | 'pnt';
434
+ export type DocUnitsWithPerc = DocUnits | '%';
435
+ export type PercentageString = string;
436
+ export type ValueWithUnitsString = number | string;
437
+ export type WidthHeightInput = number | PercentageString | ValueWithUnitsString;
438
+ export type ContainerTableInput = string | DataRows;
439
+ export interface DocSettings {
440
+ proxy: string;
441
+ }
442
+ export interface DocData {
443
+ name: string;
444
+ units: DocUnits;
445
+ pages: Array<PageData>;
446
+ modelUnits: ModelUnits;
447
+ }
448
+ export interface DocPipeline {
449
+ fn: () => any;
450
+ done: boolean;
451
+ }
452
+ export type PageSize = 'A0' | 'A1' | 'A2' | 'A3' | 'A4' | 'A5' | 'A6' | 'A7';
453
+ export type PageOrientation = 'landscape' | 'portrait';
454
+ export type PageSide = 'width' | 'height';
455
+ export type AnyPageContainer = Container | View;
456
+ export interface PageData {
457
+ _entity: 'page';
458
+ name: string;
459
+ size: PageSize;
460
+ width: number;
461
+ height: number;
462
+ orientation: PageOrientation;
463
+ padding: Array<number | number>;
464
+ containers: Array<ContainerData>;
465
+ variables?: {
466
+ [key: string]: any;
467
+ };
468
+ docUnits: DocUnits;
469
+ }
470
+ export type ContainerType = 'view' | 'image' | 'text' | 'textarea' | 'table' | 'graphic';
471
+ export type ContainerHAlignment = 'left' | 'center' | 'right';
472
+ export type ContainerVAlignment = 'top' | 'center' | 'bottom';
473
+ export type ContainerAlignment = [ContainerHAlignment, ContainerVAlignment];
474
+ export type ContainerSide = 'width' | 'height';
475
+ export type ZoomRelativeTo = 'container' | 'world';
476
+ export type ScaleInput = 'auto' | number;
477
+ export type ContainerSizeRelativeTo = 'page' | 'page-content-area';
478
+ export type ContainerPositionCoordRel = number;
479
+ export type ContainerPositionCoordAbs = number | string;
480
+ export type ContainerPositionRel = Array<number | number>;
481
+ export type ContainerPositionAbs = Array<string | string>;
482
+ export type ContainerPositionLike = ContainerPositionRel | ContainerAlignment | ContainerPositionAbs;
483
+ export type ContainerData = {
484
+ _entity: string;
485
+ name: string;
486
+ parent?: string;
487
+ type: ContainerType;
488
+ width: number;
489
+ widthRelativeTo: ContainerSizeRelativeTo;
490
+ widthAbs?: number;
491
+ height: number;
492
+ heightRelativeTo: ContainerSizeRelativeTo;
493
+ heightAbs?: number;
494
+ position: ContainerPositionRel;
495
+ pivot: ContainerPositionRel;
496
+ border?: boolean;
497
+ borderStyle?: DocPathStyle;
498
+ frame?: any;
499
+ index?: number;
500
+ contentAlign: ContainerAlignment;
501
+ content: any;
502
+ zoomLevel?: ScaleInput;
503
+ zoomRelativeTo?: ZoomRelativeTo;
504
+ docUnits: DocUnits;
505
+ modelUnits: ModelUnits;
506
+ caption?: string;
507
+ title?: string;
508
+ _domElem?: HTMLDivElement;
509
+ };
510
+ export interface Frame {
511
+ color: string;
512
+ thickness: number;
513
+ shape: 'rect' | 'circle';
514
+ }
515
+ export interface ContainerContent {
516
+ source?: string;
517
+ format?: 'jpg' | 'svg' | 'png';
518
+ data: any;
519
+ settings: {
520
+ [key: string]: any;
521
+ };
522
+ }
523
+ export type ImageOptionsFit = 'fill' | 'contain' | 'cover';
524
+ export declare function isImageOptionsFit(o: any): o is ImageOptionsFit;
525
+ export interface ImageOptions {
526
+ fit?: ImageOptionsFit;
527
+ align?: ContainerAlignment;
528
+ opacity?: number;
529
+ brightness?: number;
530
+ contrast?: number;
531
+ saturation?: number;
532
+ grayscale?: number;
533
+ }
534
+ export interface TableContainerOptions {
535
+ fontsize?: number;
536
+ fontcolor?: string;
537
+ }
538
+ export type TextAreaAlign = 'left' | 'right' | 'center' | 'fill';
539
+ export type TextBaseline = 'alphabetic' | 'ideographic' | 'bottom' | 'top' | 'middle' | 'hanging';
540
+ export interface TextOptions {
541
+ size?: number | string;
542
+ color?: string;
543
+ width?: number;
544
+ height?: number;
545
+ bold?: boolean;
546
+ underline?: boolean;
547
+ strike?: boolean;
548
+ oblique?: boolean;
549
+ align?: TextAreaAlign;
550
+ baseline?: TextBaseline;
551
+ angle?: number;
552
+ }
553
+ export type DocGraphicType = 'rect' | 'circle' | 'ellipse' | 'line' | 'hline' | 'vline' | 'triangle';
554
+ export interface DocGraphicInputBase {
555
+ type?: DocGraphicType;
556
+ units?: DocUnitsWithPerc;
557
+ style?: DocPathStyle;
558
+ data?: any;
559
+ }
560
+ export interface DocGraphicInputRect extends DocGraphicInputBase {
561
+ width: number;
562
+ height: number;
563
+ round?: number;
564
+ }
565
+ export interface DocGraphicInputCircle extends DocGraphicInputBase {
566
+ radius: number;
567
+ }
568
+ export interface DocGraphicInputLine extends DocGraphicInputBase {
569
+ start: [number, number];
570
+ end: [number, number];
571
+ }
572
+ export interface DocGraphicInputOrthoLine extends DocGraphicInputBase {
573
+ length: number | string;
574
+ thickness: number | string;
575
+ color: string;
576
+ }
577
+ export interface toSVGOptions {
578
+ all?: boolean;
579
+ only2D?: boolean;
580
+ annotations?: boolean;
581
+ fills?: boolean;
582
+ outlines?: boolean;
583
+ }
584
+ export interface SVGtoPDFtransform {
585
+ svgUnits: string;
586
+ scale: number;
587
+ translateX: number;
588
+ translateY: number;
589
+ containerTranslateX: number;
590
+ containerTranslateY: number;
591
+ boundBy: 'width' | 'height';
592
+ contentOffsetX: number;
593
+ contentOffsetY: number;
594
+ }
595
+ export interface toDXFOptions {
596
+ all?: boolean;
597
+ annotations?: boolean;
598
+ }
599
+ export interface TextAreaOptions {
600
+ size?: number | string;
601
+ color?: string;
602
+ align?: TextAreaAlign;
603
+ }
604
+ /** Important data of created ContainerBlock */
605
+ export interface ContainerBlock {
606
+ width: number;
607
+ height: number;
608
+ x: number;
609
+ y: number;
610
+ pivot: [number, number];
611
+ bbox?: [number, number, number, number];
612
+ }
613
+ export interface TitleBlockInput {
614
+ title?: string;
615
+ designer?: string;
616
+ logoUrl?: string;
617
+ designLicense?: PublishLicense;
618
+ manualLicense?: PublishLicense;
619
+ }
620
+ export interface LabelBlockOptions {
621
+ x?: string | number;
622
+ y?: string | number;
623
+ width?: string | number;
624
+ pivot?: [number, number];
625
+ textSize?: string | number;
626
+ secondaryTextSize?: string | number;
627
+ labelSize?: string | number;
628
+ numTextLines?: number;
629
+ margin?: number | string;
630
+ line?: boolean;
631
+ }
632
+ export interface VertexMesh {
633
+ objId: string;
634
+ ocId: string;
635
+ vertices: Array<number>;
636
+ indexInShape: number;
637
+ }
638
+ export interface EdgeMesh {
639
+ objId: string;
640
+ ocId: string;
641
+ vertices: Array<number>;
642
+ indexInShape: number;
643
+ }
644
+ export interface FaceMesh {
645
+ objId: string;
646
+ ocId: string;
647
+ numTriangles: number;
648
+ vertices: Array<number>;
649
+ normals: Array<number>;
650
+ uvCoords: Array<number>;
651
+ triangleIndices: Array<number>;
652
+ indexInShape: number;
653
+ }
654
+ export interface MeshCache {
655
+ vertices: Array<VertexMesh> | null;
656
+ edges: Array<EdgeMesh> | null;
657
+ faces: Array<FaceMesh> | null;
658
+ }
659
+ /** MeshShape is a very verbose format in which to save Shape Mesh data
660
+ * Inclusing for every Vertex, Edge and Face:
661
+ * - objId
662
+ * - ocId
663
+ * - vertex or vertices
664
+ *
665
+ * NOTE: is it really needed?
666
+ */
667
+ export interface MeshShape {
668
+ objId: string;
669
+ vertices: Array<VertexMesh>;
670
+ edges: Array<EdgeMesh>;
671
+ faces: Array<FaceMesh>;
672
+ style?: ObjStyle;
673
+ }
674
+ export interface MeshInfo {
675
+ objId: string;
676
+ shapeId: number;
677
+ subShapeType: 'Face' | 'Edge' | 'Vertex';
678
+ indexInShape: number;
679
+ color?: number;
680
+ faceGroupVertexIndices?: number;
681
+ edgeGroupLineSegmentsRange?: Array<number>;
682
+ }
683
+ export interface MeshShapeBufferStats {
684
+ numVertices: number;
685
+ numEdges: number;
686
+ numLines?: number;
687
+ numTriangles: number;
688
+ numFaces: number;
689
+ numShapes: number;
690
+ }
691
+ /** New optimized Mesh buffer: combines all Vertices, Edges and Face triangles in one buffer */
692
+ export interface MeshShapeBuffer {
693
+ verticesBuffer: Array<number>;
694
+ verticesInfo: Array<MeshInfo>;
695
+ edgesBuffer: Array<number>;
696
+ lineEdgesInfo: Array<MeshInfo>;
697
+ trianglesVertices: Array<number>;
698
+ trianglesVertexColors: Array<number>;
699
+ triangleIndices: Array<number>;
700
+ triangleNormals: Array<number>;
701
+ triangleUVs: Array<number>;
702
+ trianglesInfo: Array<MeshInfo>;
703
+ stats: MeshShapeBufferStats;
704
+ }
705
+ export interface MeshingQualitySettings {
706
+ linearDeflection: number;
707
+ angularDeflection: number;
708
+ tolerance: number;
709
+ edgeMinimalPoints: number;
710
+ edgeMinimalLength: number;
711
+ }
712
+ export interface SelectedMeshShapeInfo {
713
+ meshInfo: MeshInfo;
714
+ stats: MeshShapeBufferStats;
715
+ }
716
+ export interface Obbox {
717
+ center: Point;
718
+ width: number;
719
+ depth: number;
720
+ height: number;
721
+ xDirection: Vector;
722
+ yDirection: Vector;
723
+ zDirection: Vector;
724
+ }
725
+ export interface BeamLikeDims {
726
+ small: number;
727
+ mid: number;
728
+ length: number;
729
+ }
730
+ /** Configurator on how to draw shapes on documents (HTML or PDF)
731
+ * These settings correspond to the style functions of jsPDF (with some exceptions!)
732
+ */
733
+ export interface DocPathStyle {
734
+ lineWidth?: number;
735
+ lineCap?: 'butt' | 'round' | 'bevel';
736
+ lineJoin?: 'butt' | 'round' | 'bevel';
737
+ lineDashPattern?: Array<number | number>;
738
+ strokeColor?: string;
739
+ strokeOpacity?: number;
740
+ fillColor?: string;
741
+ fillOpacity?: number;
742
+ dash?: Array<number>;
743
+ }
744
+ export interface PDFLinePath {
745
+ path: string;
746
+ style: DocPathStyle;
747
+ }
748
+ export type LayoutOrderType = 'line' | 'grid' | 'binpack' | 'nest';
749
+ export interface LayoutOptions {
750
+ autoRotate?: boolean;
751
+ flatten?: boolean;
752
+ stockWidth?: number;
753
+ stockHeight?: number;
754
+ groupSame?: boolean;
755
+ margin?: number;
756
+ center?: boolean;
757
+ algo?: any;
758
+ drawStock?: boolean;
759
+ }
760
+ export interface Layout {
761
+ type?: LayoutOrderType;
762
+ options: LayoutOptions;
763
+ flatten: boolean;
764
+ }
765
+ export type DataRowColumnValue = {
766
+ [key: string]: any;
767
+ };
768
+ export type DataRowValues = Array<any>;
769
+ export type DataRowsColumnValue = Array<DataRowColumnValue>;
770
+ export type DataRowsValues = Array<DataRowValues>;
771
+ export type DataRows = DataRowsColumnValue | DataRowsValues;
772
+ export type MetricName = 'cost_material' | 'cost_labor' | 'production_time' | 'price_est' | 'price' | 'weight' | 'volume' | 'size' | 'r-value';
773
+ /** Metric is a element that outputs data in some way */
774
+ export interface Metric {
775
+ name: MetricName;
776
+ label: string;
777
+ type: 'text' | 'bar' | 'line' | 'radar';
778
+ data: number | string | Array<number | string>;
779
+ options: TextMetricOptions;
780
+ _component: string;
781
+ }
782
+ export interface MetricOptionsBase {
783
+ label: string;
784
+ }
785
+ /** Options for TextMetric */
786
+ export interface TextMetricOptions extends MetricOptionsBase {
787
+ label: string;
788
+ icon: string;
789
+ color: any;
790
+ pre: string;
791
+ unit: string;
792
+ }
793
+ export type MetricOptions = TextMetricOptions;
794
+ /** Get data from table location */
795
+ export interface TableLocation {
796
+ location: string;
797
+ table: any;
798
+ column?: string;
799
+ row?: number;
800
+ data: any | Array<any>;
801
+ }
802
+ export interface CalcData {
803
+ tables: Object;
804
+ metrics: Object;
805
+ }
806
+ export type PublishLicense = 'unknown' | 'copyright' | 'trademarked' | 'CC BY' | 'CC BY-SA' | 'CC BY-ND' | 'CC BY-NC' | 'CC BY-NC-SA' | 'CC BY-NC-ND' | 'CC0';
807
+ export interface PublishScriptSettings extends ArchiyouOutputSettings {
808
+ fulFillments: Array<any>;
809
+ }
810
+ export type PublishScript = {
811
+ id?: string;
812
+ name: string;
813
+ title?: string;
814
+ author?: string;
815
+ org?: string;
816
+ url?: string;
817
+ description?: string;
818
+ created_at?: Date;
819
+ updated_at?: Date;
820
+ version?: string;
821
+ prev_version?: string;
822
+ safe?: boolean;
823
+ published?: boolean;
824
+ units?: string;
825
+ params?: {
826
+ [key: string]: ScriptParamData;
827
+ };
828
+ param_presets?: {
829
+ [key: string]: {
830
+ [key: string]: Record<string, any>;
831
+ };
832
+ };
833
+ public_code?: boolean;
834
+ public_code_url?: string;
835
+ code: string;
836
+ cad_engine?: string;
837
+ cad_engine_version?: string;
838
+ cad_engine_config?: PublishScriptSettings;
839
+ meta?: {
840
+ [key: string]: any;
841
+ };
842
+ };
843
+ export type RunnerExecutionContext = 'local' | 'worker';
844
+ export type RunnerRole = 'manager' | 'worker' | 'single';
845
+ export type ModelFormat = 'buffer' | 'glb' | 'svg';
846
+ export interface RunnerOptions {
847
+ context?: RunnerExecutionContext;
848
+ }
849
+ export interface RunnerActiveScope {
850
+ name: string;
851
+ context: RunnerExecutionContext;
852
+ }
853
+ /** Basic structure of scope */
854
+ export interface RunnerScriptScopeState extends ProxyConstructor {
855
+ _scope: string;
856
+ _main: boolean;
857
+ ay: ArchiyouApp;
858
+ console: Console;
859
+ brep: Brep;
860
+ doc: Doc;
861
+ calc: Calc;
862
+ exporter: Exporter;
863
+ make: Make;
864
+ Vector: typeof Vector;
865
+ Point: typeof Point;
866
+ Bbox: typeof Bbox;
867
+ Edge: typeof Edge;
868
+ Vertex: typeof Vertex;
869
+ Wire: typeof Wire;
870
+ Face: typeof Face;
871
+ Shell: typeof Shell;
872
+ Solid: typeof Solid;
873
+ ShapeCollection: typeof ShapeCollection;
874
+ Obj: typeof Obj;
875
+ }
876
+ /** Simplified version of Script(Version) */
877
+ export interface RunnerScript {
878
+ code: string;
879
+ params?: Record<string, ScriptParamData>;
880
+ }
881
+ /** Request results from executing a script */
882
+ export interface RunnerScriptExecutionRequest {
883
+ script: Script | ScriptData;
884
+ component?: string;
885
+ params?: Record<string, any>;
886
+ preset?: string;
887
+ variantId?: string;
888
+ mode?: 'main' | 'component';
889
+ outputs?: Array<string>;
890
+ cache?: boolean;
891
+ messages?: Array<ConsoleMessageType>;
892
+ forceFileResponse?: boolean;
893
+ _onDone?: ((result: RunnerScriptExecutionResult) => any);
894
+ }
895
+ export type ScriptOutputCategory = 'model' | 'metrics' | 'tables' | 'docs';
896
+ export type ScriptOutputFormatInternal = 'internal';
897
+ export type ScriptOutputFormatModel = 'buffer' | 'glb' | 'step' | 'stl' | 'svg' | 'dae' | 'obj' | 'dxf';
898
+ export type ScriptOutputFormatMetric = 'json' | 'xlsx';
899
+ export type ScriptOutputFormatTable = 'json' | 'xlsx' | 'gsheets';
900
+ export type ScriptOutputFormatDoc = 'json' | 'pdf';
901
+ export type ScriptOutputFormat = ScriptOutputFormatInternal | ScriptOutputFormatModel | ScriptOutputFormatMetric | ScriptOutputFormatTable | ScriptOutputFormatDoc;
902
+ /** Data only representation of ScriptOutputPath class */
903
+ export interface ScriptOutputPathData {
904
+ requestedPath: string;
905
+ resolvedPath: string;
906
+ pipeline: string | null;
907
+ category: ScriptOutputCategory | null;
908
+ entityName: string | null;
909
+ format: ScriptOutputFormat | null;
910
+ formatOptions: Record<string, any>;
911
+ }
912
+ /** Data output of a script based on given path */
913
+ export interface ScriptOutputData {
914
+ path: ScriptOutputPathData;
915
+ output: string | ArrayBuffer | Record<string, any> | ScriptOutputDataWrapper;
916
+ }
917
+ /** Wraps different output data with information
918
+ * When we apply an encoding (like base64) we apply extra data to the wrapper
919
+ */
920
+ export interface ScriptOutputDataWrapper {
921
+ type?: string;
922
+ encoding?: 'base64';
923
+ data: any | string | ArrayBuffer;
924
+ length?: number;
925
+ }
926
+ export interface ExecutionRequestOutputFormatGLTFOptions {
927
+ binary?: boolean;
928
+ data?: boolean;
929
+ metrics?: boolean;
930
+ tables?: boolean;
931
+ docs?: boolean;
932
+ pointAndLines?: boolean;
933
+ shapesAsPointAndLines?: boolean;
934
+ }
935
+ /** Message from Worker to Manager */
936
+ export interface RunnerWorkerMessage {
937
+ type: 'init' | 'loaded' | 'executing' | 'stopped' | 'executed' | 'console' | 'save-step' | 'save-stl' | 'save-gltf' | 'save-svg' | 'save-svg-2d';
938
+ payload: any;
939
+ }
940
+ /** Message from Manager to Worker */
941
+ export interface RunnerManagerMessage {
942
+ type: 'init' | 'load' | 'execute' | 'stop' | 'export-to-step' | 'export-to-stl' | 'export-to-gltf' | 'export-to-svg' | 'export-to-svg-2d';
943
+ payload?: any;
944
+ }