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,56 @@
1
+ import { Script } from './internal';
2
+ export declare class LibraryConnector {
3
+ DEFAULT_LIBRARY_URL: string;
4
+ LIBRARY_ENDPOINTS: {
5
+ v1: {
6
+ all: string;
7
+ };
8
+ v2: {
9
+ all: string;
10
+ };
11
+ };
12
+ domain: string;
13
+ version: 'v1' | 'v2';
14
+ constructor(domain?: string);
15
+ /**
16
+ * Detect if a string is a domain (with or without protocol). Returns the origin string or false.
17
+ * Accepts:
18
+ * - example.com
19
+ * - https://example.com
20
+ * - http://example.com:8080
21
+ * - sub.domain.example.com/
22
+ *
23
+ * Rejects strings that contain path segments beyond an optional trailing slash:
24
+ * - https://example.com/path -> false
25
+ */
26
+ _validateDomain(value: string): string | false;
27
+ /** Just request base url and see if we get some results */
28
+ connect(): Promise<boolean>;
29
+ _getLibraryVersion(info?: Record<string, any>): 'v1' | 'v2' | null;
30
+ /** Get all script versions */
31
+ getAllScripts(): Promise<Array<Script>>;
32
+ /** Get only the latest script versions */
33
+ getLatestScripts(): Promise<Array<Script>>;
34
+ /** Get specific script */
35
+ getScript(author: string, name: string, version?: string): Promise<Script | null>;
36
+ getLatestScript(author: string, name: string): Promise<Script | null>;
37
+ getScriptVersions(author: string, name: string): Promise<Array<string>>;
38
+ /** Readout basic info on Library */
39
+ printLibraryOverview(): Promise<void>;
40
+ /** Get script from a URL
41
+ *
42
+ * If no https://domain is given, default library URL is used
43
+ * Otherwise a new instance of LibraryConnector is created for that domain
44
+ *
45
+ * @param path - path to fetch the script from
46
+ *
47
+ * examples:
48
+ * - https://pub.archiyou.com/archiyou/simplestep
49
+ * - https://pubv2.archiyou.com/archiyou/simplestep/0.9.1 or https://pub.archiyou.com/archiyou/simplestep:0.9.1
50
+ * - archiyou/simplestep (default library)
51
+ *
52
+
53
+ * @returns Promise<Script> - The script object with code and params
54
+ */
55
+ getScriptFromUrl(url: string): Promise<Script>;
56
+ }
@@ -0,0 +1,85 @@
1
+ import { ConsoleMessage, ArchiyouApp, Point, Face, ShapeCollection, Table } from './internal';
2
+ export type Alignment2D = 'topleft' | 'topright' | 'bottomleft' | 'bottomright';
3
+ /** Statistics on last make operation, including error messages and important metrics
4
+ * stats can be accessed after the operation at make.stats
5
+ * this mechanism avoids any complex return values
6
+ */
7
+ export interface MakeStats {
8
+ messages: Array<ConsoleMessage>;
9
+ efficiency: number;
10
+ wastedArea: number;
11
+ wastedVolume: number;
12
+ numStock: number;
13
+ full?: ShapeCollection;
14
+ cut?: ShapeCollection;
15
+ fitted?: ShapeCollection;
16
+ extra?: ShapeCollection;
17
+ waste?: ShapeCollection;
18
+ }
19
+ export interface Layout2DOptions {
20
+ start: Alignment2D;
21
+ direction: 'horizontal' | 'vertical';
22
+ width: number;
23
+ height: number;
24
+ stockWidth?: number;
25
+ stockHeight?: number;
26
+ grid?: number;
27
+ gridOffset?: number;
28
+ secondaryGrid?: number;
29
+ secondaryGridOffset?: number;
30
+ seamsStartOffset?: number;
31
+ leftover?: boolean;
32
+ cutMargin?: number;
33
+ stats?: boolean;
34
+ }
35
+ export declare function Layout2DOptions(o: any): o is Layout2DOptions;
36
+ export interface PartListOptions {
37
+ sortBy: 'part' | 'section' | 'length' | 'quantity';
38
+ }
39
+ export interface WallOpening {
40
+ left: number;
41
+ sill: number;
42
+ width: number;
43
+ height: number;
44
+ }
45
+ export declare class Make {
46
+ LAYOUT2D_BOX_DEFAULT_FITTING_MARGIN_SIZE: number;
47
+ _ay: ArchiyouApp;
48
+ stats: MakeStats;
49
+ constructor(ay?: ArchiyouApp);
50
+ setArchiyou(ay: ArchiyouApp): void;
51
+ resetStats(): MakeStats;
52
+ _alignment2DToPoint(a: Alignment2D, width: number, height: number): Point;
53
+ _checkLayoutOptions(o: Layout2DOptions): Layout2DOptions;
54
+ _layout2DBoxesNewBox(cursor: Point, o: Layout2DOptions, leftOverSize?: number): Face;
55
+ _layout2DBoxes(o?: Layout2DOptions): ShapeCollection;
56
+ /** Calculate stats of layout2DBoxes operation */
57
+ _layout2DBoxesStats(o?: Layout2DOptions): MakeStats;
58
+ /** Public method to generate rectangular boarding on rectangle plane on XY plane
59
+ * Generates statistics on waste, cuts etc at make.stats
60
+ */
61
+ boarding(o?: Layout2DOptions): ShapeCollection;
62
+ _boarding(o?: Layout2DOptions): ShapeCollection;
63
+ /** Find a 2D strut length and angle that exactly fits diagonally in given space
64
+ * NOTE: It's easy to see how it works if you consider the special circumstances
65
+ * of width=spaceWidth, width=spaceHeight and angle(spaceWidth,spaceHeight) = 45 deg
66
+ */
67
+ fitRectStrut(width: number, space: Array<number | number>, withSpace?: boolean): Face | ShapeCollection;
68
+ /** Make simple rectangular frame of width, height, depth and thickness at origin position
69
+ * prio sets what members have priority (default: horizontal)
70
+ * Frame is parallel to the front side
71
+ */
72
+ rectFrame(width: number, height: number, depth: number, thickness: number, prio?: 'horizontal' | 'vertical'): ShapeCollection;
73
+ /** Make an advanced wood frame for a wall
74
+ * starting from origin with centerline along x-axis
75
+ * returns ShapeCollection and puts messages inside console
76
+ */
77
+ wallFrame(width: number, height: number, depth: number, studThickness: number, grid: number, openings?: Array<WallOpening>): ShapeCollection;
78
+ /** Generate part list Calc table from ShapeCollection for beam-like shapes
79
+ * For optimal information gathering:
80
+ * - Beam-like shapes only
81
+ * - group shapes into groups (will be used for part names)
82
+ * - name individual shapes (will be used as subpart name)
83
+ */
84
+ partList(shapes: ShapeCollection, name?: string): Table;
85
+ }
@@ -0,0 +1,32 @@
1
+ import { Make, Point, Vector, Face, AnyShape } from './internal';
2
+ type OperationShapeType = 'beam' | 'board' | null;
3
+ type OperationRefPlane = {
4
+ origin: Point;
5
+ xDir: Vector;
6
+ yDir: Vector;
7
+ zDir: Vector;
8
+ face: Face;
9
+ };
10
+ export declare class MakeOperations {
11
+ _make: Make;
12
+ constructor(make: Make);
13
+ /** Operation: Cut
14
+ * Cross cut with cutting plane center at (x,y,z) on shape reference plane
15
+ * and plane rotation
16
+ */
17
+ cut(shape: AnyShape, params: {
18
+ x: number;
19
+ y: number;
20
+ z: number;
21
+ angle?: number;
22
+ secondaryAngle?: number;
23
+ }): AnyShape | null;
24
+ /** Calculate the base information for a operation
25
+ * What the ShapeType is and the local reference plane
26
+ */
27
+ _setOperationBase(shape: AnyShape): {
28
+ type: OperationShapeType;
29
+ ref: OperationRefPlane;
30
+ };
31
+ }
32
+ export {};
@@ -0,0 +1,121 @@
1
+ import { PointLike, MainAxis, Point, Vector, Shape, Edge, Face, Solid, AnyShape } from './internal';
2
+ export declare class OBbox {
3
+ _oc: any;
4
+ _geom: any;
5
+ _ocOBbox: any;
6
+ position: Point;
7
+ /** Create 2D or 3D Bbox from a Shape */
8
+ constructor(shape: AnyShape);
9
+ create(shape: AnyShape): this;
10
+ /** Set public properties from _ocOBbox */
11
+ _setFromOcOBbox(): void;
12
+ /** Get center of Orientated Bounding Box */
13
+ center(): Point;
14
+ /** Get corner Points of Bbox in global coordinate system */
15
+ corners(): Array<Point>;
16
+ /** Return X axis normal of this OBbox, mostly along global x-axis */
17
+ xDir(): Vector;
18
+ /** Return Y axis normal of this OBbox */
19
+ yDir(): Vector;
20
+ /** Return Z axis normal of this OBbox */
21
+ zDir(): Vector;
22
+ width(): number;
23
+ depth(): number;
24
+ height(): number;
25
+ copy(): void;
26
+ /** Get Point of left, front, bottom corner in global coordinate system */
27
+ min(): Point;
28
+ minAtAxis(a: MainAxis): void;
29
+ maxAtAxis(a: MainAxis): void;
30
+ /** Get maximum point (right,top,back) */
31
+ max(): Point;
32
+ minX(): number;
33
+ maxX(): number;
34
+ minY(): number;
35
+ maxY(): number;
36
+ minZ(): number;
37
+ maxZ(): number;
38
+ /** Maximum size of Bbox */
39
+ maxSize(): number;
40
+ /** Maximum size of Bbox */
41
+ minSize(): number;
42
+ /** Get frontal Face (3D) or Edge (2D) */
43
+ front(): void;
44
+ /** Get back Face (3D) or Edge (2D) */
45
+ back(): void;
46
+ /** Get left Face (3D) or Edge (2D) */
47
+ left(): void;
48
+ /** Get left Face (3D) or Edge (2D) */
49
+ right(): void;
50
+ /** Get left Face (3D) or Edge (2D) */
51
+ top(): void;
52
+ /** Get left Face (3D) or Edge (2D) */
53
+ bottom(): void;
54
+ /** Get one of the 8 Vertices of the Bbox
55
+ * @param - a string like 'leftfront', 'bottomright'
56
+ * Order of sides does not matter
57
+ */
58
+ corner(where: string): void;
59
+ /** Get the diagonal of Orientated Bounding Box as Vertex (zero size Bbox) or Edge */
60
+ diagonal(): void;
61
+ /** Get position of Bbox based on percentages of x,y,z */
62
+ getPositionAtPerc(p: PointLike, ...args: any[]): void;
63
+ /** Enlarge by offsetting current Bbox in all direction a given amount. Returns a new Bbox. */
64
+ enlarged(amount: number): void;
65
+ /** Return a new Bbox by adding another */
66
+ added(other: OBbox): void;
67
+ /** Check if Orientated Bounding Box of zero size so a Point */
68
+ isPoint(): boolean;
69
+ /** Check if Orientated Bounding Box is 2D */
70
+ is2D(): boolean;
71
+ /** Check if Orientated Bounding Box is 3D */
72
+ is3D(): boolean;
73
+ /** Checks if sizes along axis are zero */
74
+ _sizesAreZero(): Array<boolean | boolean | boolean>;
75
+ /** Bbox has only one size dimension (the others are zero) */
76
+ is1D(): boolean;
77
+ /** The axis that is missing in 2D bbox */
78
+ axisMissingIn2D(): MainAxis | null;
79
+ /** Along what axis is this 1D Bbox */
80
+ sizeAxis1D(): MainAxis | null;
81
+ /** Axis on which the bbox has a size */
82
+ hasAxes(): Array<MainAxis>;
83
+ /** Get size of current Bbox along given axis */
84
+ sizeAlongAxis(axis: MainAxis): number;
85
+ /** Get Shape from this Orientated Bounding Box */
86
+ shape(): Edge | Face | Solid | null;
87
+ /** Alias for shape() */
88
+ toShape(): Edge | Face | Solid | null;
89
+ /** Make Line from 1D Bbox */
90
+ line(): Edge | null;
91
+ /** Create 2D Rectangle Face from Bbox */
92
+ rect(): Face;
93
+ /** returns a Box Shape for this Bbox if not 2D, otherwise null
94
+ * NOTE: Don't automatically add to scene
95
+ */
96
+ box(): Solid | null;
97
+ /** Return flipped Bbox that is mirrored in x-axis. For certain 2D ops */
98
+ flippedY(): void;
99
+ /** Gets the Edge seperating width in two equal halves */
100
+ widthHalfLine(): Edge;
101
+ /** Gets the Edge seperating depth in two equal halves */
102
+ depthHalfLine(): Edge;
103
+ /** Get Sub Shapes associated with given sides
104
+ @param side - combinations of front|back|right|left|top|bottom
105
+ NOTE: we use _getSide for now - but we might refactor
106
+ */
107
+ getSidesShape(sidesString: string): void;
108
+ /** Get individual Bbox side shapes based on sidestring
109
+ * @param sidesString any combination between front/back,left/right,top/bottom
110
+ */
111
+ _getIndividualSideShapes(sidesString: string): void;
112
+ /** Get area of bbox */
113
+ area(): number | null;
114
+ volume(): number | null;
115
+ contains(other: Shape): void;
116
+ _containsOBbox(other: OBbox): void;
117
+ toData(): Array<Array<number>>;
118
+ toString(): string;
119
+ /** Get side of OBbox - NOTE: Some sides can be zero length */
120
+ _getSide(side: string): void;
121
+ }
@@ -0,0 +1,104 @@
1
+ import { ShapeCollection, Brep, PointLike, AnyShape, AnyShapeOrCollection, MeshShape, MeshShapeBuffer, SceneGraphNode, BaseStyle, ObjStyle, MeshingQualitySettings } from './internal';
2
+ export declare class Obj {
3
+ DEFAULT_OBJ_STYLE: ObjStyle;
4
+ DEFAULT_BASE_STYLE: BaseStyle;
5
+ _oc: any;
6
+ _brep: Brep;
7
+ _id: string;
8
+ _name: string;
9
+ _shapeType: string;
10
+ _isLayer: boolean;
11
+ _visible: boolean;
12
+ _style: ObjStyle;
13
+ _shapes: ShapeCollection;
14
+ _parent: Obj;
15
+ _children: Array<Obj>;
16
+ constructor(shapes?: AnyShapeOrCollection);
17
+ /** Try to get as many properties for easy introspection */
18
+ _setProps(): void;
19
+ /** Set this Obj as a child of another */
20
+ setParent(parent: Obj): void;
21
+ /** Add Obj with its children to active layer */
22
+ addToScene(): void;
23
+ /** Get or set style
24
+ * NOTE: We don't use get/setters because we want to be able to return Obj for setter
25
+ */
26
+ style(newStyle: BaseStyle | ObjStyle): Obj;
27
+ /** set Color for Obj/Layer. Shortcut of style */
28
+ color(newColor: string | number | Array<number>): Obj;
29
+ /** set Lines to dashed (keeps existing styling) */
30
+ dashed(): Obj;
31
+ /** set strokeWidth in mm while keeping the rest of existing styling */
32
+ lineWidth(n: number): Obj;
33
+ /** Get current Obj color or the one that is defined by one of the parents up the hierarchy */
34
+ getColor(): number;
35
+ /** Internal: get RGBA values of current color in range [0-1] for RGB and A*/
36
+ _getColorRGBA(): [number, number, number, number];
37
+ /** Compile different parameters into a ObjStyle instance */
38
+ _compileStyle(newStyle?: ObjStyle | BaseStyle): ObjStyle;
39
+ /** Check and normalize ObjStyle values (mostly colors) in place */
40
+ _checkObjStyle(style: ObjStyle): ObjStyle;
41
+ move(v: PointLike): void;
42
+ rotate(t: any): void;
43
+ /** get/setter method for name property */
44
+ name(name?: string): string | Obj;
45
+ get id(): string;
46
+ hide(): any;
47
+ show(): any;
48
+ add(o: Obj): Obj;
49
+ /** Remove an object from children */
50
+ remove(o: Obj): void;
51
+ has(o: Obj): boolean;
52
+ /** Gets the direct children of this Obj */
53
+ children(): Array<Obj>;
54
+ /** Alias for children() */
55
+ nodes(): Array<Obj>;
56
+ /** Recursively get all Objs in this Obj container */
57
+ descendants(): Array<Obj>;
58
+ /** Return shapes of this Obj
59
+ @param all (default:true) also those of descendant Objs
60
+ */
61
+ shapes(all?: boolean): ShapeCollection;
62
+ /** Get all shapes of this Obj including its descendant Obj's returned as grouped ShapeCollection
63
+ * TODO: Do we need Shape.valid() - It's slow!
64
+ */
65
+ allShapesCollection(): ShapeCollection;
66
+ /** DEBUG: Sometimes weird Objs are created */
67
+ isCircular(): boolean;
68
+ /** Get all Shapes within this Obj and its children Objs */
69
+ allShapes(): ShapeCollection;
70
+ getObjByName(name?: string): Obj;
71
+ /** Empty Obj container by releasing all OC Shapes and then removing JS references */
72
+ empty(): Obj;
73
+ /** Add a Shape to this object */
74
+ addShape(shape: AnyShape): Obj;
75
+ /** Remove all Shapes */
76
+ clearShapes(): Obj;
77
+ /** Delete Shapes
78
+ * Mostly removing OC classes, JS objects are picked up by garbage collection
79
+ */
80
+ clearOcShapes(): this;
81
+ /** Get type of Shape(s) in this Object */
82
+ shapeType(): string;
83
+ /** Does this Obj contain multiple Shapes */
84
+ isLayer(): boolean;
85
+ /**
86
+ * Sometimes a Shape changes - it can then change its own reference inside a Obj container
87
+ * @param newShape Can be both a Shape and ShapeCollection - that will be converted by ShapeCollection()
88
+ *
89
+ * */
90
+ _updateShapes(shapes: AnyShapeOrCollection): void;
91
+ /** Output all mesh data from Shape in this Obj and its children */
92
+ toMeshShapes(quality?: MeshingQualitySettings): Array<MeshShape>;
93
+ toMeshShapeBuffer(quality: MeshingQualitySettings): MeshShapeBuffer;
94
+ /** Turn Obj containing shape/shapeCollection of other Objs into a graph which we can use to show in a menu */
95
+ toGraph(): SceneGraphNode;
96
+ /** Output all properties of this Obj including that of its Shapes into a { key value } row */
97
+ toData(): Object;
98
+ toString(): string;
99
+ /**
100
+ * Export Obj tree structure with raw shapes that will be recreated in other scope
101
+ * NOTE: is this needed?
102
+ * */
103
+ toComponentGraph(component: string, parentNode?: Object): Object;
104
+ }
@@ -0,0 +1,39 @@
1
+ /** IMPORTANT:
2
+ *
3
+ * Statically importing WASM related modules gives errors while building archiyou as a module
4
+ * Vite creates base64 versions of the archiyou-opencascade.js which is not what we want
5
+ * Underneath are all dynamically imported modules
6
+ */
7
+ export class OcLoader {
8
+ SHAPE_TOLERANCE: number;
9
+ RUN_TEST: boolean;
10
+ ocJsModulePath: string;
11
+ ocJsNodeModulePath: string;
12
+ ocWasmModulePath: string;
13
+ _oc: any;
14
+ loaded: boolean;
15
+ startLoadAt: any;
16
+ /** Load synchronous */
17
+ load(onLoaded: any): void;
18
+ /** Load async */
19
+ loadAsync(): Promise<any>;
20
+ _getContext(): "webworker" | "browser" | "node";
21
+ /** Load OpenCascade module synchronous and run function when loading is done
22
+ * This still uses the standard OC.js method, because alternatives with dynamic imports
23
+ * are not working well in browser
24
+ */
25
+ _loadOcBrowser(onLoaded: any): void;
26
+ /** Load OpenCascade module async
27
+ * Uses static import for maximum compatibility
28
+ * This can work in Webpack 4 and above, Vite and Node environments
29
+ */
30
+ _loadOcBrowserAsync(): Promise<any>;
31
+ /** Load OpenCascade in Node context */
32
+ _loadOcNodeAsync(): Promise<any>;
33
+ _loadOcNode(onLoaded: any): void;
34
+ /** When OC is loaded, we set a couple of things */
35
+ _onOcLoaded(oc: any, onLoaded: any): any;
36
+ _getAbsPath(filepath: any): Promise<any>;
37
+ runTest(): void;
38
+ searchMethod(s: any): string[];
39
+ }
@@ -0,0 +1,57 @@
1
+ import { ScriptParam, ScriptParamData, ParamOperation, ParamManagerOperator } from './internal';
2
+ /** Main ParamManager
3
+ * Maintains all ParamManagerOperators
4
+ */
5
+ export declare class ParamManager {
6
+ PARAM_SIGNIFIER: string;
7
+ parent: any;
8
+ paramOperators: Array<ParamManagerOperator>;
9
+ /** Set up ParamManager with current params */
10
+ constructor(params?: Array<ScriptParam>);
11
+ setParent(scope: any): this;
12
+ /** Compare managedParams with original ones of ParamManager and update params array in place
13
+ * If needed forcing reactivity by creating copies
14
+ * returns new or changed params
15
+ */
16
+ static updateParamsWithManaged(currentParams: Array<ScriptParam>, managedParams?: Record<ParamOperation, Array<ScriptParam>>, forceReactivity?: boolean): Array<ScriptParam>;
17
+ /** Add or update Param and return what was done (update, new, null) */
18
+ addParam(p: ScriptParam): ParamOperation | null;
19
+ deleteParam(name: string): this;
20
+ /** Update ParamEntryController if needed and return updated or not */
21
+ updateParam(p: ScriptParam): boolean;
22
+ _paramNameExists(p: ScriptParam): boolean;
23
+ /** Utility to easily get target Params */
24
+ getParams(): Array<ScriptParam>;
25
+ /** Utility to easily get target Params by name */
26
+ getParamsMap(): Record<string, ScriptParam>;
27
+ getParamController(name: string): ParamManagerOperator;
28
+ /** Programmatically define a param: from simple to advanced
29
+ * This can be used to define complex Parameters that can't be defined by the menu
30
+ *
31
+ * @example myParamManager.define({ name: 'testnum', type: 'number'})
32
+ * @example myParamManager.define({ name: 'mylist', type: 'list', listElem:
33
+ * {
34
+ * type: 'object',
35
+ * schema: { w: { type: 'number', default: 100 },
36
+ * h: { type: 'number', default: 200, start: 50, end: 300 }
37
+ * }})
38
+ */
39
+ define(p: ScriptParam): this;
40
+ /** Return Params that we operated upon */
41
+ getOperatedParamsByOperation(): Record<ParamOperation, Array<ScriptParamData>>;
42
+ /** If this ParamManager is in a worker scope */
43
+ inWorker(): boolean;
44
+ /** Set Param read and write as globals on worker scope (in this.parent)
45
+ * NOTE: We can not really work with Proxies here because we can not really set a Param global (ie. $TEST)
46
+ * on this scope that is not a Proxy. Proxies can only target Objects
47
+ Use $PARAMS.$TEST.set() to set a value
48
+ */
49
+ setParamGlobalsInScope(scope?: any): boolean;
50
+ /** Compare two params (either Param or ScriptParam) */
51
+ equalParams(param1: ScriptParam, param2: ScriptParam): boolean;
52
+ /** Set quick references from this instance to the values of params
53
+ This is used to control Params directly (through ParamManagerOperator)
54
+ The user can write values for example with $PARAMS.$TEST.set(50)
55
+ */
56
+ setParamControlRefs(): void;
57
+ }
@@ -0,0 +1,68 @@
1
+ import { ParamManager, ParamOperation, ScriptParam, ScriptParamData } from './internal';
2
+ export declare class ParamManagerOperator {
3
+ PARAM_TYPES: string[];
4
+ PARAM_TYPE_DEFAULT_LENGTH: number;
5
+ BASE_TYPE_PARAM_CHECKS: {
6
+ number: string;
7
+ boolean: string;
8
+ options: string;
9
+ list: string;
10
+ object: string;
11
+ };
12
+ name: string;
13
+ originalParam: ScriptParam;
14
+ targetParam: ScriptParam;
15
+ value: any;
16
+ manager: ParamManager;
17
+ operation: ParamOperation;
18
+ constructor(manager: ParamManager, p?: ScriptParam);
19
+ setOperation(op: ParamOperation): void;
20
+ /** Set value of Parameter */
21
+ set(v: any): any;
22
+ /** Insert a value into List Param */
23
+ push(v: any): any;
24
+ /** Directly make Param visible */
25
+ visible(): void;
26
+ /** Directly make Param invisible */
27
+ hide(): void;
28
+ /** Directly enable Param */
29
+ enable(): void;
30
+ /** Directly disable Param */
31
+ disable(): void;
32
+ /** Conditional visibility */
33
+ visibleIf(b: boolean): void;
34
+ /** Set behaviour that controls enable flag of this Param */
35
+ enableIf(b: boolean): void;
36
+ /** Set behaviour that controls value attribute of this Param */
37
+ valueOn(fn: (curParam: ScriptParam, params?: Record<string, ScriptParam>) => boolean): void;
38
+ /** Forward properties on this controller to target Param obj */
39
+ _setParamProps(): void;
40
+ /** Had this operator any operations */
41
+ paramOperated(): boolean;
42
+ /** Compare target Param with original one */
43
+ paramChanged(): boolean;
44
+ /** Evaluate behaviour and return changed param
45
+ * @params a map for easy access: params.TEST.value
46
+ */
47
+ paramToData(param: ScriptParam): ScriptParamData;
48
+ /** Export to raw Param data for output
49
+ * NOTE: We use ScriptParam here that is used for IO, but in App it is transformed back to Param
50
+ */
51
+ toData(): ScriptParamData;
52
+ /** Adding to lists create unending loops
53
+ * We check if the last element is the same
54
+ * TODO: Make a better solution
55
+ */
56
+ _checkIfListElemExistsLast(v: Record<string, any>): boolean;
57
+ /** Check Param input, if param is not set, the target Param is used */
58
+ _checkParamInput(v: any, p?: ScriptParam): boolean;
59
+ _checkNumParamInput(v: any, p?: ScriptParam): boolean;
60
+ _checkBoolParamInput(v: any, p?: ScriptParam): boolean;
61
+ _checkOptionsParamInput(v: any, p?: ScriptParam): boolean;
62
+ _checkListParamInput(v: any, p?: ScriptParam): boolean;
63
+ /** Check input against schema */
64
+ _checkObjParamInput(v: any, p?: ScriptParam): boolean;
65
+ _getObjValueByPath(path: string, obj: Object): any;
66
+ _checkParam(p: ScriptParam): ScriptParam;
67
+ getScope(): string;
68
+ }
@@ -0,0 +1,20 @@
1
+ import { ShapeCollection, Brep } from './internal';
2
+ export declare class Pipeline {
3
+ _oc: any;
4
+ _brep: Brep;
5
+ name: string;
6
+ _shapes: ShapeCollection;
7
+ _function: () => ShapeCollection;
8
+ /** Create a Pipeline */
9
+ constructor(name?: string);
10
+ /** Things for the pipeline to do
11
+ * NOTE: the given function is executed in the WebWorker global scope,
12
+ * IMPORTANT: While previously defined variables from the main script scope are accessible,
13
+ * it is STRONGLY ADVISED to only use variables defined within the pipeline function itself,
14
+ * or passed as arguments to it. This avoids unexpected behavior due to variable scope issues.
15
+ *
16
+ */
17
+ do(fn: () => ShapeCollection): this;
18
+ /** Run pipeline and get a ShapeCollection back */
19
+ run(): ShapeCollection;
20
+ }
@@ -0,0 +1,88 @@
1
+ import { MainAxis, PointLike, Cursor, AnyShapeOrCollection, Plane, Vector, Vertex } from './internal';
2
+ import { gp_Pnt, gp_Vec } from './wasm/archiyou-opencascade';
3
+ export declare class Point {
4
+ _x: number;
5
+ _y: number;
6
+ _z: number;
7
+ _oc: any;
8
+ _cursor: Cursor;
9
+ constructor(p?: PointLike, ...args: any[]);
10
+ static isPoint(obj: any): boolean;
11
+ /** Create a Point from a PointLike (see typings.ts) */
12
+ fromPointLike(p?: PointLike, ...args: any[]): Point | Vector;
13
+ /** Set cursor on this Point instance, so we can make relative coords */
14
+ cursor(cursor: Point | Cursor): Point;
15
+ /** Class method */
16
+ static fromPointLike(v: any, ...args: any[]): Point;
17
+ get x(): number;
18
+ get y(): number;
19
+ get z(): number;
20
+ set x(x: number);
21
+ set y(y: number);
22
+ set z(z: number);
23
+ /** Sets x,y,z components of Point */
24
+ set(point: PointLike, ...args: any[]): Point;
25
+ /** Sets x component of Point */
26
+ setX(x: number): Point;
27
+ /** Sets y component of Point */
28
+ setY(y: number): Point;
29
+ /** Sets z component of Point */
30
+ setZ(z: number): Point;
31
+ setComponent(a: MainAxis, v: number): Point;
32
+ isOrigin(): boolean;
33
+ _fromOcPoint(ocPoint: any): Vector | Point;
34
+ _fromOcXYZ(ocXYZ: any): Vector | Point;
35
+ _toOcPoint(): gp_Pnt;
36
+ _toOcVector(): gp_Vec;
37
+ _toOcDir(): any;
38
+ toArray(): [number, number, number];
39
+ toVector(): Vector;
40
+ /** Transform Point to new Vertex without adding to Scene */
41
+ _toVertex(): Vertex;
42
+ /** Transform Point to new Vertex and add to Scene */
43
+ toVertex(): Vertex;
44
+ copy(): Point;
45
+ /** Add a PointLike to this Vector */
46
+ add(v: PointLike, ...args: any[]): Point;
47
+ /** Add PointLike to this one and return a new Vector */
48
+ added(v: PointLike, ...args: any[]): Point;
49
+ /** Move Point */
50
+ move(vec: PointLike, ...args: any[]): Point;
51
+ /** Move Point along x axis */
52
+ moveX(dx: number): Point;
53
+ /** Move Point along y axis */
54
+ moveY(dy: number): Point;
55
+ /** Move Point along y axis */
56
+ moveZ(dz: number): Point;
57
+ moved(vec: PointLike, ...args: any[]): Point;
58
+ /** Test if given entity has equivalent geometry as current Point */
59
+ equals(other: PointLike, ...args: any[]): boolean;
60
+ /** Test if given PointLike entity has equivalent geometry with a tolerance */
61
+ equalsTolerance(other: PointLike, tolerance: number): boolean;
62
+ distance(other: PointLike): number;
63
+ /** We got a Point array with relative coordinates: resolve into real numbers based on previous Point
64
+ *
65
+ * 2 Types:
66
+ * - cartesian ['+10','-10']
67
+ * - polar coordinates ['100<30'] or ['100<<20'] (relative angle)
68
+ */
69
+ _arrayResolveRelativeCoordinates(pointArr: Array<string | number>, cursor?: Cursor): Array<number>;
70
+ /** Calculate orthogonal projections from this Point to Edges/Wires of a given Shape or ShapeCollection
71
+ A projected Point from an original Point to a Curve is the point on a other Shape
72
+ where the line between the two points is perpendicular to the Curve at the projected Point
73
+ */
74
+ project(to: AnyShapeOrCollection): Array<Point>;
75
+ /** Flip x-coordinate */
76
+ flippedX(): Point;
77
+ /** Flip y-coordinate */
78
+ flippedY(): Point;
79
+ /** Flip z-coordinate */
80
+ flippedZ(): Point;
81
+ /** Does current Point share plane with the other */
82
+ sharedPlane(other: PointLike): Plane;
83
+ round(): Point;
84
+ rounded(): Point;
85
+ toData(): number[];
86
+ /** Export entity and minimal data as string (used for outputting on console and hashing ) */
87
+ toString(): string;
88
+ }