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,628 @@
1
+ import { toSVGOptions, PointLike, PointLikeOrAnyShape, AnyShape, Pivot, MainAxis, AnyShapeCollection, AnyShapeOrCollection, PointLikeOrAnyShapeOrCollection, AnyShapeOrCollectionOrSelectionString, LinearShape, ShapeType, Side, SideZ, CoordArray, ShapeClone, Link, SelectorPointRange, SelectorAxisCoord, SelectorBbox, SelectorIndex, ShapeAttributes, ObjStyle, MeshShape, FaceMesh, EdgeMesh, VertexMesh, MeshCache, Annotation, DimensionOptions, DimensionLine, BeamLikeDims, Alignment, OrientationXY, MeshingQualitySettings, Obj, Vector, Point, Bbox, OBbox, Vertex, Edge, Wire, Face, Shell, Solid, ShapeCollection, Brep } from './internal';
2
+ type IVertex = Vertex;
3
+ type IEdge = Edge;
4
+ type ISolid = Solid;
5
+ type IWire = Wire;
6
+ type IDimensionLine = DimensionLine;
7
+ export declare class Shape {
8
+ _oc: any;
9
+ _brep: Brep;
10
+ _obj: Obj;
11
+ _parent: AnyShapeOrCollection;
12
+ _ocShape: any;
13
+ _ocId: string;
14
+ _isTmp: boolean;
15
+ _cloned: ShapeClone | null;
16
+ _meshCache: MeshCache;
17
+ attributes: ShapeAttributes;
18
+ annotations: Array<Annotation>;
19
+ CLASSNAME_TO_SHAPE_ENUM_STATIC: {
20
+ [key: string]: string;
21
+ };
22
+ CLASSNAME_TO_SHAPE_ENUM: {
23
+ [key: string]: any;
24
+ };
25
+ OC_SHAPE_ENUM_TO_CLASSNAME: {
26
+ [key: string]: string;
27
+ };
28
+ constructor();
29
+ /** Make Shape from OC Shape */
30
+ _fromOcShape(ocShape?: any): AnyShapeOrCollection;
31
+ /** Update _OcShape from Shape properties */
32
+ _updateOcShape(): void;
33
+ /** Update properties from current OC Shape */
34
+ _updateFromOcShape(ocShape?: any): void;
35
+ /** Manually clear existing OC Shape */
36
+ _clearOcShape(): void;
37
+ /** Do an effort to create a Shape */
38
+ fromAll(value: any): AnyShape;
39
+ /** Class method for ease of use */
40
+ static fromAll(value: any): AnyShape;
41
+ attribute(key?: string, value?: any): any | AnyShape;
42
+ /** Alias for attribute() */
43
+ attr(key?: string, value?: any): any | AnyShape;
44
+ /** Get attributes of Shape */
45
+ attrs(): ShapeAttributes;
46
+ /** Copy attributes from other Shape */
47
+ _copyAttributes(from: Shape): void;
48
+ getCursor(): void;
49
+ /** Check and fix Shape after operation: can get overloaded in subclasses */
50
+ checkAndFix(): AnyShape;
51
+ /** Unify Shapes that are lying on the same plane and can be combined */
52
+ _unifyDomain(): AnyShape;
53
+ /** For now we don't have a sense of a pivot and thus clear position of an object, we calculate its center
54
+ We can override this in the individual subclasses.
55
+ TODO: For example an position of a Wire is probably more intuitive as its start Vertex
56
+ */
57
+ position(): Point;
58
+ /** Attach obj to Shape for adding it to the scene and styling */
59
+ object(forceNew?: boolean): Obj;
60
+ /** Set color on the Object of this Shape */
61
+ color(value: string | number): this;
62
+ /** Set dashed lines on the Object of this Shape */
63
+ dashed(): this;
64
+ /** Set stroke width of lines of Shape */
65
+ lineWidth(n: number): this;
66
+ /** Get the color of this Shape as defined in its Obj container */
67
+ getColor(): number;
68
+ _getColorRGBA(): [number, number, number, number];
69
+ /** check if Shape is co-planar and return the normal of the workingplane if so! */
70
+ workPlaneNormal(): Vector;
71
+ /**
72
+ * Some operations on Shape actually create new Shape types: For example Shape.intersections(other)
73
+ * To Updating those in place we use the Obj container of the Shape
74
+ * IMPORTANT: This is still confusing because existing references in script scope are not updated!!
75
+ */
76
+ replaceShape(newShapes: AnyShapeOrCollection): AnyShapeOrCollection;
77
+ /** We can delete a Shape from the Scene by removing it's Obj container */
78
+ removeFromScene(): void;
79
+ isEmpty(): boolean;
80
+ _setShapeEnumToClassName(): void;
81
+ /** Convert Shape to Wire (private) */
82
+ _toWire(): IWire;
83
+ /** Try to convert the current Shape to a Wire */
84
+ toWire(): IWire;
85
+ /** To have consistent API between Shape and ShapeCollection instances */
86
+ isShape(obj: any): boolean;
87
+ /** To have consistent API between Shape and ShapeCollection instances */
88
+ isShapeCollection(): boolean;
89
+ static isShape(obj: any): any;
90
+ /** Create hash for this Shape: can be used to check if an Shape is the same instance (NOTE: not that is has equal geometry!) */
91
+ _hashcode(): string;
92
+ ocGeom(): any;
93
+ type(): ShapeType;
94
+ _getShapeTypeFromOcShape(ocShape: any): string;
95
+ /** Returns subType of current Shape: For example Edge::Line */
96
+ subType(): string;
97
+ /** If Shape is beam-like */
98
+ beamLike(): boolean;
99
+ beamDims(): BeamLikeDims;
100
+ /** is this Shape 2D */
101
+ is2D(): boolean;
102
+ /** is this Shape 2D on XY plane (used for SVG export for example) */
103
+ is2DXY(): boolean;
104
+ is3D(): boolean;
105
+ /** Test if a Shape is valid
106
+ * NOTE: Since we have garbage collection on the OC Shape a Shape can become invalid
107
+ * bacause for some reason the ocShape is deleted, giving a BindingError just using the Shape
108
+ * So use this method when these errors pop up
109
+ */
110
+ valid(ocShape?: any): any;
111
+ /** For compatibility with ShapeCollection */
112
+ count(): number;
113
+ /** Length of a Shape (depending on specific class) */
114
+ length(): number;
115
+ /** The top surface area of Shape - for example the area of a Box is the top part */
116
+ area(): number;
117
+ /** The total surface Area of a Shape - for example the total surface area of Sphere is 4πr2 */
118
+ surface(): number;
119
+ /** Calculate the volume of this Shape */
120
+ volume(): number;
121
+ /** Get all Vertices of this Shape */
122
+ vertices(): AnyShapeCollection;
123
+ /** Get all Edges of this Shape */
124
+ edges(): AnyShapeCollection;
125
+ /** Get all Wires of this Shape */
126
+ wires(): AnyShapeCollection;
127
+ /** Get all Faces of this Shape */
128
+ faces(): AnyShapeCollection;
129
+ /** Get all Shells of this Shape */
130
+ shells(): AnyShapeCollection;
131
+ /** Get all Solids of this Shape */
132
+ solids(): AnyShapeCollection;
133
+ /** Calculate and set Bounding Box of Shape */
134
+ bbox(withAnnotations?: boolean): Bbox;
135
+ /** Calculate Orientated Bounding Box of Shape */
136
+ obbox(): OBbox | null;
137
+ /** Calculate center of this Shape */
138
+ center(): Point;
139
+ /** Get max Point coordinate of Bbox of this Shape */
140
+ max(): Point;
141
+ /** Get min Point of Bbox of this Shape */
142
+ min(): Point;
143
+ /** Round geometry to globally set (in OC) tolerance */
144
+ round(): Shape;
145
+ /** Copy the Shape and add it to the Scene (private) */
146
+ _copy(): this;
147
+ /** Copy the Shape and add it to the Scene */
148
+ copy(addToScene?: boolean): this;
149
+ /** Return clone of this Shape */
150
+ clone(): AnyShape;
151
+ isClone(): boolean;
152
+ /** Remove cloning properties */
153
+ cancelCloning(): void;
154
+ clonedFrom(): AnyShape;
155
+ /** Move Shape to a position by offsetting all Geometry with a Vector */
156
+ move(vector: PointLike, ...args: any[]): this;
157
+ /** Aliass for move along x-direction */
158
+ moveX(distance: number): this;
159
+ /** Aliass for move along x-direction */
160
+ moveY(distance: number): this;
161
+ /** Aliass for move along x-direction */
162
+ moveZ(distance: number): this;
163
+ /** Move a copy of the Shape */
164
+ moved(v: PointLike, ...args: any[]): this;
165
+ /** Move Shape to a specific location using the pivot as center */
166
+ moveTo(to: PointLike, ...args: any[]): this;
167
+ /** Move Shape to specific x coordinate while keeping the other coords the same */
168
+ moveToX(x: number, pivot?: Alignment): this;
169
+ /** Move Shape to specific y coordinate while keeping the other coords the same */
170
+ moveToY(y: number, pivot?: Alignment): this;
171
+ /** Move Shape to specific z coordinate while keeping the other coords the same */
172
+ moveToZ(z: number, pivot?: Alignment): this;
173
+ /** Alias for moveToX/Y/Z() */
174
+ moveToAxisCoord(axis: MainAxis, coord: number): any;
175
+ /** Move copy of the Shape to a Point in space */
176
+ movedTo(to: PointLike, ...args: any[]): this;
177
+ /** Center Shape so that the center of the Shape is at the origin */
178
+ moveToOrigin(): this;
179
+ /** Resize Shape with a given factor
180
+ TODO: different scaling factors per axis? scale(0.5,1,2)
181
+ */
182
+ scale(factor?: number, pivot?: PointLike): this;
183
+ /** Same as scale but returning a copy of Shape */
184
+ _scaled(factor?: number, pivot?: PointLike): this;
185
+ scaled(factor?: number, pivot?: PointLike): this;
186
+ /**
187
+ * Rotation around X,Y,Z axis with a given pivot (default: center)
188
+ * NOTE: because the order of these rotations if very important we don't call it just rotate.
189
+ * Use rotateX, rotateY and rotateZ to rotate around the main axis
190
+ */
191
+ rotateEuler(degX: number, degY?: number, degZ?: number, pivot?: Pivot): this;
192
+ /** Same as rotateEuler but makes a copy */
193
+ rotatedEuler(degX: number, degY: number, degZ: number, pivot: Pivot): this;
194
+ /**
195
+ * Rotate sequencely around the x,y and z axis.
196
+ * !!!! IMPORTANT: this is not the same as supplying the independant angles around the axis!
197
+ */
198
+ rotate(r: PointLike, ...args: any[]): this;
199
+ /** Rotate this Shape around the x-axis with a given angle and pivot (default: center) */
200
+ rotateX(deg: number, pivot?: Pivot): this;
201
+ /** Rotate this Shape around the y-axis with a given angle and pivot (default: center) */
202
+ rotateY(deg: number, pivot?: Pivot): this;
203
+ /** Rotate this Shape around the y-axis with a given angle and pivot (default: center) */
204
+ rotateZ(deg: number, pivot?: Pivot): this;
205
+ /** Rotates a Shape a given angle in degrees along a axis (default: Z) */
206
+ rotateAround(angle: number, axis?: PointLike, pivot?: Pivot): this;
207
+ /** Rotate Shape so that its orientated bounding box is aligned with the axes */
208
+ rotateToAxesOBbox(): this;
209
+ /** Rotate Shape to make normal of largest Face parallel to Z axis */
210
+ rotateToAlignLargestFaceToZ(): this;
211
+ /** Try to align Shape with x (horizontal) or y axis (vertical) as much as possible */
212
+ rotateToOrthoXY(o?: OrientationXY): this;
213
+ /** Rotate Shape to align as much as possible to axis
214
+ Alias for rotateToOrthoXY */
215
+ autoRotate(): this;
216
+ /** Rotate Shape to place flat on XY plane. Keeps x,y position */
217
+ rotateToLayFlat(o?: OrientationXY): this;
218
+ /** Alias for rotateToLayFlat
219
+ * Rotates a Shape to lay flat on XY plane
220
+ */
221
+ layflat(): this;
222
+ fillet(radius?: number, at?: any): this;
223
+ chamfer(radius?: number, at?: any): this;
224
+ /** Check if a Solid Shape can be seen as a simple extrusion and return the base Face */
225
+ _extrudedFace(side?: SideZ): Face | null;
226
+ /** Flatten a Shape into a copy of a Face without altering the position
227
+ * If given an axis we only select Faces that face that axis
228
+ * Otherwise we consider the Shapes as extrusions and use extrudedFace
229
+ */
230
+ _flattened(axis?: MainAxis): AnyShape;
231
+ flattened(axis?: MainAxis): AnyShape;
232
+ /**
233
+ * Move, rotate and (later) scale a Shape based on given points on the Shape and destination points
234
+ * NOTE: you need two points for 2D alignment, 3 points for 3D alignment with rotation
235
+ * TODO: Add scaling
236
+ */
237
+ alignByPoints(fromPoints: Array<Vector | Vertex | Point | Array<number> | string>, toPoints: Array<Vector | Vertex | Point | Array<number>>): this;
238
+ /** Same as alignByPoint but returns a copy and does not affect original */
239
+ alignedByPoints(fromPoints: Array<Vector | Vertex | Point | Array<number>>, toPoints: Array<Vector | Vertex | Point | Array<number>>): this;
240
+ /** Rotate this Shape by a Quaternion made by two Vectors */
241
+ rotateVecToVec(from: PointLike, to: PointLike, pivot?: PointLike): this;
242
+ /**
243
+ * Mirror Shape
244
+ * @param planeNormal The normal of the Mirror plane (not direction of orthogonal plane)
245
+ * !!!! different from Vector.mirror()
246
+ * origin: Origin of mirror plane
247
+ */
248
+ _mirrored(origin?: PointLike, normal?: PointLike): this;
249
+ mirrored(origin?: PointLike, normal?: PointLike): this;
250
+ /** Mirror Shape in X plane (x=0) with its center as pivot or given offset along x-axis */
251
+ mirrorX(offset?: number): this;
252
+ /** Create mirrored copy in X plane (x=0) with its center as pivot or given offset along x-axis */
253
+ _mirroredX(offset?: number): this;
254
+ mirroredX(offset?: number): this;
255
+ /** Mirror Shape in Y plane (y=0) with its center as pivot or given offset along y-axis */
256
+ mirrorY(offset?: number): this;
257
+ /** Create mirror copy of Shape in Y plane (y=0) with its center as pivot or given offset along y-axis */
258
+ _mirroredY(offset?: number): this;
259
+ mirroredY(offset?: number): this;
260
+ /** Mirror Shape in Z plane (z=0) with its center as pivot or given offset along z-axis */
261
+ mirrorZ(offset?: number): this;
262
+ /** Create mirror copy of Shape in Z plane (z=0) with its center as pivot or given offset along z-axis */
263
+ _mirroredZ(offset?: number): this;
264
+ /** Create mirrored copy relative to XY plane with its center as pivot and add to Scene */
265
+ mirroredZ(offset?: number): this;
266
+ extrude(amount?: number, direction?: PointLike): IEdge | Face | Shell | ISolid;
267
+ /**
268
+ * Generic Shape extrude: basically meaning pulling a shape along a Vector for a distance to create a new Shape with higher dimensions
269
+ * For example: Extrude a straight Line along a the z-axis to create a Rectangular Face
270
+ * TODO: solid flag
271
+ */
272
+ _extruded(amount?: number, direction?: PointLike): IEdge | Face | Shell | Solid;
273
+ extruded(amount?: number, direction?: PointLike): IEdge | Face | Shell | Solid;
274
+ /** Extrude this Shape towards a given Point or other Shape - we do keep the normal of the Shape if available */
275
+ extrudedTo(other: PointLikeOrAnyShapeOrCollection, ...args: any[]): null | AnyShape;
276
+ /** Offset Shape to create a new version parallel to original with a given distance and by corners of given type (arc, intersection) */
277
+ _offsetted(amount?: number, type?: string, onPlaneNormal?: PointLike): AnyShapeOrCollection;
278
+ /** Offset Shape to create a new version parallel to original with a given distance and by corners of given type (arc, intersection) */
279
+ offset(amount?: number, type?: string, onPlaneNormal?: PointLike): AnyShapeOrCollection;
280
+ offsetted(amount?: number, type?: string, onPlaneNormal?: PointLike): AnyShapeOrCollection;
281
+ /** Thicken Shell or Solid to create a hollow Solid (private) */
282
+ _shelled(amount: number, excludeFaces?: AnyShapeOrCollectionOrSelectionString, type?: string): ISolid;
283
+ /** Thicken Face, Shell or Solid to create a hollow Solid (private) */
284
+ shelled(amount: number, excludeFaces?: AnyShapeOrCollectionOrSelectionString, type?: string): ISolid;
285
+ /** Same as shelled but with replacing the original */
286
+ shell(amount: number, excludeFaces?: AnyShapeOrCollectionOrSelectionString, type?: string): ISolid;
287
+ /** Thicken a Shape depending on its type
288
+ * @param direction - all (grow from center), bottom, left, right, top
289
+ */
290
+ _thickened(amount: number, direction?: string): AnyShape;
291
+ /** Thicken a Shape depending on its type
292
+ * @param direction - all (grow from center), bottom, left, right, top
293
+ */
294
+ thickened(amount: number, direction?: string): AnyShape;
295
+ thicken(amount: number, direction?: string): AnyShape;
296
+ /** Make a new Shape by revolving a non-solid Shape around an axis given by two Points (Private) */
297
+ _revolved(angle?: number, axisStart?: PointLike, axisEnd?: PointLike): AnyShapeOrCollection;
298
+ /** Make a new Shape by revolving a non-solid Shape around an axis given by two Points */
299
+ revolved(angle?: number, axisStart?: PointLike, axisEnd?: PointLike): AnyShapeOrCollection;
300
+ _lofted(sections: AnyShapeOrCollection, solid?: boolean): Shell | Solid;
301
+ lofted(sections: AnyShapeOrCollection, solid?: boolean): void;
302
+ loft(sections: AnyShapeOrCollection, solid?: boolean): Shell | Solid;
303
+ /** Create a new Shape by sweeping a the Shape's Wire representation through a Wire Path */
304
+ _sweeped(path: LinearShape, solid?: boolean, autoRotate?: boolean, alignToPath?: string): Face | Shell | Solid;
305
+ /** Sweep and add result to Scene */
306
+ sweeped(path: LinearShape, solid?: boolean, autoRotate?: boolean, alignToPath?: string): Face | Shell | Solid;
307
+ /** Is the same Shape in OC */
308
+ same(other: AnyShape): boolean;
309
+ /** Is exactly the same Shape based on its topology/geometry
310
+ * TODO: Especially for complex Shapes this needs another look!
311
+ * NOTE: Shape.equals() is the main method, no children override it!
312
+ */
313
+ equals(other: PointLikeOrAnyShape, tolerance?: number): boolean;
314
+ /** Calculate the distance between this Shape and other */
315
+ distance(other: PointLikeOrAnyShapeOrCollection, ...args: any[]): number;
316
+ /** Internal method that really calculates distance between two single Shapes */
317
+ _distanceToShape(other: AnyShape): number;
318
+ /** Calculate the closest distance between two Shapes: returns one or more straight Link Object, where start is from the first Shape
319
+ * NOTE: If two Shapes are the same and parallel ( for example two Edges ) two links for each Vertex are returned
320
+ */
321
+ _closestLinks(other: PointLikeOrAnyShapeOrCollection): Array<Link>;
322
+ /** Returns a Link that is the shortest path from current Shape to the other */
323
+ distanceLink(other: PointLikeOrAnyShapeOrCollection): Link;
324
+ /** Directly make a line from this Shape to the closest other */
325
+ lineTo(other: PointLikeOrAnyShapeOrCollection): Shape | null;
326
+ /** Returns the Vector of closest path from current Shape to the other */
327
+ distanceVec(other: PointLikeOrAnyShapeOrCollection): Vector;
328
+ distanceX(other: PointLikeOrAnyShapeOrCollection): number;
329
+ distanceY(other: PointLikeOrAnyShapeOrCollection): number;
330
+ distanceZ(other: PointLikeOrAnyShapeOrCollection): number;
331
+ _distanceAxis(other: PointLikeOrAnyShapeOrCollection, axis: MainAxis): number;
332
+ /** Get the shortest lines from Shape to the other */
333
+ links(other: PointLikeOrAnyShapeOrCollection): Array<Link>;
334
+ /** Get closest Point on the other Shape */
335
+ closest(other: PointLikeOrAnyShapeOrCollection): Point;
336
+ closestVertex(to: PointLike): IVertex;
337
+ _subtracted(others: AnyShapeOrCollection): AnyShapeOrCollection;
338
+ subtracted(others: AnyShapeOrCollection): AnyShapeOrCollection;
339
+ subtract(others: AnyShapeOrCollection, removeOthers?: boolean): AnyShapeOrCollection;
340
+ /** Cutting in OC with two Faces does not work
341
+ * We hack a little by giving a slight height to the operants
342
+ */
343
+ _solidifyOperantFaces(others: AnyShapeCollection): AnyShapeCollection;
344
+ /** Unions one with another Shape(s) (Private method without adding to Scene) */
345
+ _unioned(other: AnyShapeOrCollection): AnyShapeOrCollection | null;
346
+ /** Unions one with another Shape */
347
+ unioned(other: AnyShapeOrCollection): AnyShapeOrCollection;
348
+ /** Alias for unioned */
349
+ combined(other: AnyShapeOrCollection): AnyShapeOrCollection;
350
+ /** Alias for unioned */
351
+ added(other: AnyShapeOrCollection): AnyShapeOrCollection;
352
+ /** Alias for unioned */
353
+ fused(other: AnyShapeOrCollection): AnyShapeOrCollection;
354
+ /** Alias for unioned */
355
+ merged(other: AnyShapeOrCollection): AnyShapeOrCollection;
356
+ /** Same as unioned but replacing current Shape in Obj */
357
+ union(other: AnyShapeOrCollection): AnyShapeOrCollection;
358
+ /** Alias for union */
359
+ combine(other: AnyShapeOrCollection): AnyShapeOrCollection;
360
+ /** Alias for union */
361
+ add(other: AnyShapeOrCollection): AnyShapeOrCollection;
362
+ /** Alias for union */
363
+ merge(other: AnyShapeOrCollection): AnyShapeOrCollection;
364
+ /** Alias for union */
365
+ fuse(other: AnyShapeOrCollection): AnyShapeOrCollection;
366
+ /** Split current Shape into multiple ones using the given other Shapes (Private method: without adding to Scene)
367
+ * The other Shapes are removed after the operation
368
+ */
369
+ _splitted(others: AnyShapeOrCollection, excludeOverlapping?: boolean): AnyShapeOrCollection;
370
+ /** Split current Shape into multiple ones using the given other Shapes */
371
+ splitted(others: AnyShapeOrCollection, excludeOverlapping?: boolean): AnyShapeOrCollection;
372
+ split(others: AnyShapeOrCollection, excludeOverlapping: boolean): AnyShapeOrCollection;
373
+ /** Limit a Shape by others: Always returns a single Shape of the same type
374
+ * @param others - If not given we get all intersecting Shapes
375
+ */
376
+ capped(others?: AnyShapeOrCollection): AnyShape;
377
+ /** Cut off Shapes orthogonally by a plane with normal parallel to axis and at level and keep the largest piece
378
+ */
379
+ cutoff(axisNormal?: MainAxis, level?: number, smallest?: boolean): this;
380
+ /** Cut current Shape by other Shape and keep the biggest part */
381
+ cutoffBy(other: AnyShape, keepSmallest?: boolean): this;
382
+ /** Alias of cutoffBy */
383
+ trim(other: AnyShape, keepSmallest?: boolean): this;
384
+ _alignPerc(a?: Alignment): Array<number>;
385
+ /**
386
+ * Align a given Shape to another by supplying a pivot for current Shape, another Shape and the alignment
387
+ * For the pivot and alignment you can supply either a string with the combinations of sides (left,right,front,back,bottom,top)
388
+ * or a array of percentage offsets to [left,front,bottom] corner or Shape
389
+ * and for linear Shapes (Edge,Wire) also start and end !!!! TODO !!!!
390
+ */
391
+ align(other: AnyShape, pivot?: Pivot, alignment?: Alignment): this;
392
+ /** Alias for align */
393
+ alignTo(other: AnyShape, pivot?: Pivot, alignment?: Alignment): this;
394
+ /** Copy and then align */
395
+ aligned(other: AnyShape, pivot?: Pivot, alignment?: Alignment): this;
396
+ _alignStringToAlignPerc(alignment: Alignment): Array<number>;
397
+ /** Returns Point at percentage of Shape Bbox */
398
+ _pointAtPerc(uvw: PointLike): Point;
399
+ /** Get a Point at a specific alignment (topbottom, left etc) */
400
+ pointAtAlignment(alignment?: Alignment): Point;
401
+ intersects(other: PointLikeOrAnyShapeOrCollection): boolean;
402
+ /** Returns the shared Shape between two Shapes (private) */
403
+ _intersections(others: PointLikeOrAnyShapeOrCollection): AnyShapeCollection;
404
+ /** Returns the shared Shape between two Shapes */
405
+ intersections(others: PointLikeOrAnyShapeOrCollection): AnyShapeCollection;
406
+ intersection(others: PointLikeOrAnyShapeOrCollection): AnyShape;
407
+ _intersection(others: PointLikeOrAnyShapeOrCollection): AnyShape;
408
+ /** Return first Shape of intersections as copy */
409
+ intersected(others: PointLikeOrAnyShapeOrCollection): AnyShape;
410
+ /** Return first Shape of intersections and replace current Shape */
411
+ intersect(others: PointLikeOrAnyShapeOrCollection): AnyShape;
412
+ /** Calculate intersection with Section algorithm: This works for all Shape types but only returns Vertices or Edges */
413
+ _intersectionsSection(other: AnyShapeOrCollection): AnyShapeCollection;
414
+ /** Calculate intersection between Shapes ( from Face onward ) based on Common algoritm */
415
+ _intersectionsCommon(other: AnyShapeOrCollection): AnyShapeCollection;
416
+ /** Tests if two Shape overlap: meaning the two Shapes have at least on Vertex in common */
417
+ overlaps(other: AnyShape): boolean;
418
+ /** Get amount of overlap [0-1] between this shape and given other */
419
+ overlapPerc(other: AnyShape): number;
420
+ /** Test if a one Shape completely contains the other.
421
+ * If other is ShapeCollection test if all its Shapes are contained by current Shape
422
+ * */
423
+ contains(other: AnyShapeOrCollection): boolean;
424
+ /** Check if this Shape is parallel with the other - the specific meaning of this is different for each Shape Type */
425
+ parallel(other: any): boolean;
426
+ /** Get all Shapes in Scene that are intersecting with this Shape */
427
+ intersecting(): AnyShapeCollection;
428
+ overlapping(): AnyShapeCollection;
429
+ /** Cast a 'Ray' (infinite Line) towards the Shape and Link information ( the hit point and support topography: Vertex, Edge, Face) */
430
+ raycast(ray: IEdge): Link;
431
+ /**
432
+ * Populate Shape (linear: Edge/Wire, planar: Face, Shell and solid) with Vertices
433
+ * Resulting Vertices include start and end Vertices
434
+ */
435
+ populated(num?: number): AnyShapeCollection;
436
+ /** Copy current Shape a number of times along X,Y,Z axis with a given spacing */
437
+ array(sizes?: PointLike, offsets?: PointLike): AnyShapeCollection;
438
+ /** Copy Shape a number of times by spacing by a certain offset Vector */
439
+ _array1D(size: number, offset: PointLike): AnyShapeCollection;
440
+ /** Alias for array along x-axis */
441
+ arrayX(size?: number, offset?: number): AnyShapeCollection;
442
+ /** Alias for array along y-axis */
443
+ arrayY(size?: number, offset?: number): AnyShapeCollection;
444
+ /** Alias for array along z-axis */
445
+ arrayZ(size?: number, offset?: number): AnyShapeCollection;
446
+ /** Copies a Shape along a linear path */
447
+ arrayAlong(path: IEdge | Wire, num: number, align?: boolean): ShapeCollection | this;
448
+ /** TODO: offer some forgiveness for treating a Shape like a ShapeCollection?
449
+ * - filter
450
+ * - first()
451
+ */
452
+ /** Get all geometries in this shape, you can specify the types (Vertex, Edge, Wire etc) */
453
+ _getEntities(type: ShapeType): AnyShapeCollection;
454
+ /** Get all subshapes of given type and those of lower types */
455
+ _getEntitiesDownFromType(type: ShapeType): AnyShapeCollection;
456
+ /** Returns type of Shape in Archiyou class name: Vertex, Edge, Wire, Face, Shell etc */
457
+ _shapeTypeEnumLookup(i: any): any;
458
+ /**
459
+ * Make specific from general Shape
460
+ * @param shape: oc.TopoDS_Shape
461
+ *
462
+ **/
463
+ _makeSpecificOcShape(ocShape: any, type?: string): any;
464
+ /** Sometimes we get a Shape instance - we can update that to the specific Shape class */
465
+ specific(): AnyShape;
466
+ /** Sometimes we get a certain Shape with only one subshape:
467
+ * like a Shell with only one Face,
468
+ * - A Wire with only one Edge
469
+ * - An Edge with only one Vertex
470
+ * Then downgrade and return a new Shape
471
+ * */
472
+ checkDowngrade(): AnyShape;
473
+ /** Get the Shapes that this Shape consists of
474
+ *
475
+ * For example: Wire => [ Edge, Edge, Edge ]
476
+ * Shell => [ Face, Face ]
477
+ */
478
+ getSubShapes(type: ShapeType): Array<Shape>;
479
+ /** Sometimes (for example in intersections) OCE returns a Compound Shape: Try to get real singular Shape */
480
+ _extractShapesFromOcCompound(ocShape: any): AnyShapeOrCollection;
481
+ _getOcShapesByType(ocShape: any, type?: string): Array<any>;
482
+ _shapeCollectionFromOcCompound(ocShapeCompound: any): ShapeCollection;
483
+ /** Check is a given string is a axis */
484
+ _checkAxis(axis: string): boolean;
485
+ /**
486
+ * Select parts of this Shape
487
+ *
488
+ * examples:
489
+ * cube.select('Edges|Z')
490
+ * cube.select('F>|front and F>|back) - multiple
491
+ *
492
+ */
493
+ select(selectString?: string): AnyShape | AnyShapeCollection;
494
+ _axisAndPlanesToVector(axis: string): Vector;
495
+ /** Selector: ParallelTo
496
+ @param to - string with axis name (X|Y|Z) or Array with coords [X,Y,Z]
497
+ */
498
+ _selectorParallelTo(shapes: AnyShapeCollection, to: MainAxis | CoordArray): AnyShapeCollection;
499
+ /** Selector: BiggestAlongAxis
500
+ Selects the Shape(s) that has the biggest coordinate along a certain axis - we use center and max
501
+ @param alongAxis: x,y or z or -x,-y,-z
502
+ */
503
+ _selectorDistanceAlongAxis(shapes: AnyShapeCollection, alongAxis: string): AnyShapeCollection;
504
+ _selectorOuterAlongAxis(shapes: AnyShapeCollection, alongAxis: MainAxis): AnyShapeCollection;
505
+ _selectorSmallestAlongAxis(shapes: AnyShapeCollection, alongAxis: MainAxis): AnyShapeCollection;
506
+ /** Selects all Shapes that have positive coordinates along given axis */
507
+ _selectorPositiveOnAxis(shapes: AnyShapeCollection, axis: MainAxis): AnyShapeCollection;
508
+ /** Selects all Shapes that have negative coordinates along given axis */
509
+ _selectorNegativeOnAxis(shapes: AnyShapeCollection, axis: MainAxis): AnyShapeCollection;
510
+ /** Selects shapes of a certain subtype */
511
+ _selectorOfSubType(shapes: AnyShapeCollection, subType: string): AnyShapeCollection;
512
+ /** Sort and select Shapes based on distance to a Point - this method combines closest or furthest */
513
+ _selectorClosestOrFurtherstTo(shapes: AnyShapeCollection, to: PointLike, type?: string): AnyShapeCollection;
514
+ _selectorClosestTo(shapes: AnyShapeCollection, to: PointLike): AnyShapeCollection;
515
+ _selectorFurthestTo(shapes: AnyShapeCollection, to: PointLike): AnyShapeCollection;
516
+ _selectorWithinRange(shapes: AnyShapeCollection, pointRange: SelectorPointRange): AnyShapeCollection;
517
+ /** Selects Shapes that intersect with the sides of the Bbox
518
+ * example: "V||fronttop"
519
+ * TODO: Really make this more robust
520
+ */
521
+ _selectorSide(shapes: AnyShapeCollection, sidesString: string): AnyShapeCollection;
522
+ /** Select Shapes that have _all_ vertices at a specific coordinate within a certain tolerance
523
+ NOTE: we might introduce a selector later where we select Shapes that intersect a certain coordinate plane
524
+ */
525
+ _selectorAtAxisCoord(shapes: AnyShapeCollection, axisCoord: SelectorAxisCoord): AnyShapeCollection;
526
+ /** Select Shapes of which all the Vertices fit inside the given Bbox coordinates: We use Bbox.contains */
527
+ _selectorInBbox(shapes: AnyShapeCollection, bboxSelector: SelectorBbox): AnyShapeCollection;
528
+ /** Select SubShapes by index or indices */
529
+ _selectorIndex(shapes: AnyShapeCollection, index: SelectorIndex): AnyShapeCollection;
530
+ /** Sorts objects by distance in a certain axis (X,Y,Z) and direcion (- or +)
531
+ * @param axisAndDirection - string with axis, direction and count: X, -Z - TODO num (unique results)[2]
532
+ */
533
+ directionMinMaxSelector(shapes: AnyShapeCollection, axisAndDirection: string): AnyShape;
534
+ /** Get side subshapes - public version of _getSide */
535
+ side(sidesString?: string): AnyShapeCollection | null;
536
+ /** Getting Side sub shapes that overlap with side of bbox
537
+ New approach that ties Vertices/Edges/Faces to sides based on distance (and some tolerance)
538
+
539
+ TODO: Visually it's evident that when a Face is touching a side, its subshapes (Edges,Vertices) need to be evaluated too!
540
+ */
541
+ _getSide(sidesString?: string): AnyShapeCollection | null;
542
+ /** Getting Side sub shapes that clearly overlaps Side of bbox
543
+ * @param sideString combination of Sides. Example: 'lefttop'
544
+ * Deprecated due to bad results
545
+ */
546
+ _getSideDeprecated(sidesString?: string): AnyShape | null;
547
+ dimension(dim?: DimensionOptions): IDimensionLine | Array<IDimensionLine>;
548
+ /** add dimension to annotations of this shape */
549
+ addAnnotations(a: Annotation | Array<Annotation>): boolean;
550
+ _updateAnnotations(): void;
551
+ autoDim(options?: DimensionOptions): void;
552
+ /** Adds current Shape by wrapping it into an object and adding it either to root Obj (=scene) or adding */
553
+ addToScene(force?: boolean): Shape;
554
+ checkObj(): Obj;
555
+ _getObjStyle(): ObjStyle;
556
+ style(newStyle: ObjStyle): Shape;
557
+ /** NOTE: We don't use set/get here, because it doesnt play well with chaining */
558
+ name(n?: string): this | string;
559
+ /** Get name of container Obj */
560
+ setName(newName?: string): this;
561
+ /** Get name of container Obj */
562
+ getName(): string | undefined;
563
+ /** Get name of container Obj */
564
+ getId(): string;
565
+ hide(): this;
566
+ show(): this;
567
+ /** Return if the Shape Obj is set visible or not */
568
+ visible(): boolean;
569
+ /** Project this 3D Shape onto the XY Plane given by a normal Vector (up is the z-axis)
570
+ * It groups the different Edge types in the returning Collection for easy extractions
571
+ * Include flag all=true to include hidden Edges
572
+ *
573
+ * IMPORTANT: Projection of a Solid that contains a certain Edge results in different alignment when projecting that Edge individually
574
+ *
575
+ * TODO: find a way to identify edges/vertices from before and after projection
576
+ * for example to preserve dimensions
577
+ * */
578
+ _project(planeNormal?: PointLike, all?: boolean): AnyShapeCollection;
579
+ /** Project this 3D Shape onto the XY Plane given by a normal Vector (up is the z-axis)
580
+ * It groups the different Edge types in the returning Collection for easy extractions */
581
+ project(planeNormal?: PointLike, all?: boolean): AnyShapeCollection;
582
+ /** Generate elevation from a given side without adding to Scene */
583
+ _elevation(side?: Side, all?: boolean): AnyShapeCollection;
584
+ /** Generate elevation from a given side and add to Scene */
585
+ elevation(side?: Side, all?: boolean): AnyShapeCollection;
586
+ /** Generate isometric view from Side or corner of ViewCube ('frontlefttop') or PointLike coordinate
587
+ * Use showHidden=true to output with hidden lines
588
+ */
589
+ _isometry(viewpoint: string | PointLike, showHidden?: boolean, transferDimensions?: boolean): AnyShapeCollection;
590
+ /** Generate isometric view from Side or corner of ViewCube ('frontlefttop') or PointLike coordinate
591
+ * Use showHidden=true to output with hidden lines
592
+ */
593
+ isometry(viewpoint?: string | PointLike, showHidden?: boolean): AnyShapeCollection;
594
+ /** Alias for isometry() */
595
+ iso(viewpoint?: string | PointLike, showHidden?: boolean): AnyShapeCollection;
596
+ /** Take Dimensions associated with current Shape to the projected 2D shape
597
+ * NOTE: We can not yet associate dimensions with ShapeCollections,
598
+ * so we link it to the specific Shape within this collection
599
+ */
600
+ _addDimensionsToProj(viewpoint: string | PointLike, projShapes: AnyShapeCollection): Array<DimensionLine>;
601
+ clearMeshCache(): void;
602
+ /** Output all Vertices of this Shape into an Array for further processing
603
+ * NOTE: Because of its importance and size we do some extra efforts here to make sure we clear all memory
604
+ */
605
+ toMeshVertices(): Array<VertexMesh>;
606
+ toMeshEdges(quality: MeshingQualitySettings): Array<EdgeMesh>;
607
+ /** Do some sanity tests on original when this Shape is cloned */
608
+ _checkCloned(): boolean;
609
+ /** Output triangulated Mesh of Faces of this Shape */
610
+ toMeshFaces(quality: MeshingQualitySettings): Array<FaceMesh>;
611
+ /**
612
+ * Exports OC data to verbose mesh data for Three JS.
613
+ * To avoid clear seperation between AY Geom library and Three we output here raw data
614
+ * There are interfaces defined in ExportModels.ts for clarity
615
+ */
616
+ toMeshShape(quality: MeshingQualitySettings): MeshShape;
617
+ /** Convenience method to save the shape to a file
618
+ * the extension determines the file format
619
+ * Supported formats: glb, svg, step, stl, dxf
620
+ */
621
+ save(filename: string, options?: any): void;
622
+ toData(): Object;
623
+ /** Output all properties of this Obj including that of its Shapes into a { key value } row. This is where Calc gets its main data from */
624
+ toTableData(): Object;
625
+ /** Export 2D Shape to SVG */
626
+ toSVG(options?: toSVGOptions): string;
627
+ }
628
+ export {};