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.
- package/LICENSE +201 -0
- package/README.md +215 -0
- package/dist/archiyou.js +35969 -0
- package/dist/index.d.ts +2 -0
- package/dist/src/Annotator.d.ts +55 -0
- package/dist/src/AnnotatorBaseAnnotation.d.ts +16 -0
- package/dist/src/AnnotatorDimensionLine.d.ts +92 -0
- package/dist/src/Bbox.d.ts +126 -0
- package/dist/src/Beams.d.ts +316 -0
- package/dist/src/Brep.d.ts +152 -0
- package/dist/src/Calc.d.ts +48 -0
- package/dist/src/CalcDb.d.ts +33 -0
- package/dist/src/CalcTable.d.ts +60 -0
- package/dist/src/CalcTableIO.d.ts +130 -0
- package/dist/src/CodeParser.d.ts +58 -0
- package/dist/src/ComponentManager.d.ts +33 -0
- package/dist/src/Console.d.ts +34 -0
- package/dist/src/Doc.d.ts +181 -0
- package/dist/src/DocDocument.d.ts +27 -0
- package/dist/src/DocPDFExporter.d.ts +105 -0
- package/dist/src/DocPage.d.ts +75 -0
- package/dist/src/DocPageContainer.d.ts +65 -0
- package/dist/src/DocPageContainerGraphic.d.ts +10 -0
- package/dist/src/DocPageContainerImage.d.ts +21 -0
- package/dist/src/DocPageContainerTable.d.ts +21 -0
- package/dist/src/DocPageContainerText.d.ts +23 -0
- package/dist/src/DocPageContainerTextArea.d.ts +23 -0
- package/dist/src/DocPageContainerView.d.ts +22 -0
- package/dist/src/DocUtils.d.ts +12 -0
- package/dist/src/DocViewSVGManager.d.ts +91 -0
- package/dist/src/Edge.d.ts +190 -0
- package/dist/src/Exporter.d.ts +100 -0
- package/dist/src/Face.d.ts +134 -0
- package/dist/src/GLTFBuilder.d.ts +30 -0
- package/dist/src/IO.d.ts +87 -0
- package/dist/src/LibraryConnector.d.ts +56 -0
- package/dist/src/Make.d.ts +85 -0
- package/dist/src/MakeOperations.d.ts +32 -0
- package/dist/src/OBbox.d.ts +121 -0
- package/dist/src/Obj.d.ts +104 -0
- package/dist/src/OcLoader.d.ts +39 -0
- package/dist/src/ParamManager.d.ts +57 -0
- package/dist/src/ParamManagerOperator.d.ts +68 -0
- package/dist/src/Pipeline.d.ts +20 -0
- package/dist/src/Point.d.ts +88 -0
- package/dist/src/Runner.d.ts +230 -0
- package/dist/src/RunnerComponentImporter.d.ts +71 -0
- package/dist/src/RunnerOps.d.ts +15 -0
- package/dist/src/Script.d.ts +78 -0
- package/dist/src/ScriptOutputManager.d.ts +19 -0
- package/dist/src/ScriptOutputPath.d.ts +48 -0
- package/dist/src/ScriptParam.d.ts +78 -0
- package/dist/src/Selector.d.ts +48 -0
- package/dist/src/Services.d.ts +68 -0
- package/dist/src/Shape.d.ts +628 -0
- package/dist/src/ShapeCollection.d.ts +429 -0
- package/dist/src/Shell.d.ts +48 -0
- package/dist/src/Sketch.d.ts +162 -0
- package/dist/src/Solid.d.ts +54 -0
- package/dist/src/Vector.d.ts +167 -0
- package/dist/src/Vertex.d.ts +57 -0
- package/dist/src/VertexCollection.d.ts +11 -0
- package/dist/src/Wire.d.ts +180 -0
- package/dist/src/constants.d.ts +112 -0
- package/dist/src/decorators.d.ts +27 -0
- package/dist/src/garbageCollection.d.ts +4 -0
- package/dist/src/init.d.ts +5 -0
- package/dist/src/internal.d.ts +67 -0
- package/dist/src/models.d.ts +40 -0
- package/dist/src/typeguards.d.ts +88 -0
- package/dist/src/types.d.ts +944 -0
- package/dist/src/utils.d.ts +140 -0
- package/dist/src/wasm/build-scripts/build_wasm_base64.d.ts +8 -0
- package/dist/src/wasm/index.d.ts +8 -0
- package/dist/src/workerUtils.d.ts +14 -0
- package/dist/wasm/README.md +13 -0
- package/dist/wasm/archiyou-opencascade.d.ts +9933 -0
- package/dist/wasm/archiyou-opencascade.js +16 -0
- package/dist/wasm/archiyou-opencascade.wasm +0 -0
- package/dist/wasm/index.js +32 -0
- package/dist/wasm/node.d.ts +16 -0
- package/dist/wasm/node.js +40 -0
- package/package.json +66 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { PointLike, AnyShape, DimensionOptions, DimensionLevelSettings, Annotation, AnnotationData, AnnotationAutoDimStrategy, Brep, ShapeCollection, Bbox, DimensionLine } from './internal';
|
|
2
|
+
export declare class Annotator {
|
|
3
|
+
DIMENSION_BOX_OFFSET_DEFAULT: number;
|
|
4
|
+
_oc: any;
|
|
5
|
+
_brep: Brep;
|
|
6
|
+
name: string;
|
|
7
|
+
annotations: Array<Annotation>;
|
|
8
|
+
constructor();
|
|
9
|
+
/** Make dimension line. Is added to list automatically */
|
|
10
|
+
dimensionLine(start?: PointLike, end?: PointLike, options?: DimensionOptions, autoAdd?: boolean): DimensionLine;
|
|
11
|
+
/** Make a Dimension Line without adding to list yet! */
|
|
12
|
+
makeDimensionLine(start?: PointLike, end?: PointLike, options?: DimensionOptions): DimensionLine;
|
|
13
|
+
/** Create dimension lines for bounding box of Shape */
|
|
14
|
+
dimensionBox(shape: AnyShape): void;
|
|
15
|
+
getAnnotations(): Array<Annotation>;
|
|
16
|
+
getAnnotationsInBbox(bbox: Bbox, margin?: number): Array<Annotation>;
|
|
17
|
+
addAnnotations(annotations: Array<Annotation>): this;
|
|
18
|
+
setAnnotations(annotations: Array<Annotation>): this;
|
|
19
|
+
/** Get all annotations in one Array. See interfaces like DimensionLineData */
|
|
20
|
+
getAnnotationsData(): Array<AnnotationData>;
|
|
21
|
+
/** Reset annotations */
|
|
22
|
+
reset(): void;
|
|
23
|
+
autoDim(shapes: ShapeCollection, options?: DimensionOptions | DimensionLevelSettings, strategy?: AnnotationAutoDimStrategy): ShapeCollection | DimensionLine[];
|
|
24
|
+
/** Try to determine the best auto dimensioning strategy
|
|
25
|
+
* These strategies are now available:
|
|
26
|
+
* - Part: One clear 2D Shape (possible with holes). Dimensioning mostly focused on producing that Shape
|
|
27
|
+
* - Levels: Complex collection of Shapes. Dimensioning along levels of the collection
|
|
28
|
+
*/
|
|
29
|
+
_getAutoDimStrategy(shapes: ShapeCollection): AnnotationAutoDimStrategy;
|
|
30
|
+
/** Generate dimension lines for a 2D Part on XY plane slighly focused on production by cutting
|
|
31
|
+
* We take an approach of dimension line levels:
|
|
32
|
+
* 1. Outset bbox of Shape: the stock dimensions
|
|
33
|
+
* 2. Dimension the edges on, and parallel to the bbox outside
|
|
34
|
+
* 3. Add any dimensions of edges that are not yet done. Avoid doubles
|
|
35
|
+
*
|
|
36
|
+
* @param shapes Shape or ShapeCollection to dimension
|
|
37
|
+
* @returns ShapeCollection
|
|
38
|
+
*/
|
|
39
|
+
autoDimPart(shapes: ShapeCollection, options?: DimensionOptions): ShapeCollection;
|
|
40
|
+
/** Make (semi) automatic dimension lines through the Shapes of this collection at levels (in percentage of total size or absolute coords) along MainAxis within bbox
|
|
41
|
+
* @param options:AutoDimSettings
|
|
42
|
+
* {
|
|
43
|
+
* levels: Array< Record<MainAxis,number>
|
|
44
|
+
* minDistance: number (0-1)
|
|
45
|
+
* }
|
|
46
|
+
*
|
|
47
|
+
*/
|
|
48
|
+
autoDimLevels(collection: ShapeCollection, settings?: DimensionLevelSettings): Array<DimensionLine>;
|
|
49
|
+
/** Filter out the same annotations
|
|
50
|
+
* See isSame for config flags
|
|
51
|
+
*/
|
|
52
|
+
unique(annotations: Array<Annotation>, flags?: Record<string, any>): Array<Annotation>;
|
|
53
|
+
/** Remove annotations that have same value and are close to each other */
|
|
54
|
+
removeSameAtSmallDistance(d: number, sameFlags?: Record<string, any>): this;
|
|
55
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { AnyShape, Bbox, AnnotationType } from './internal';
|
|
2
|
+
export declare class BaseAnnotation {
|
|
3
|
+
uuid: string;
|
|
4
|
+
value: string | number;
|
|
5
|
+
_type: AnnotationType;
|
|
6
|
+
constructor(type?: AnnotationType);
|
|
7
|
+
static isAnnotation(obj: any): boolean;
|
|
8
|
+
/** Type of Annotation, reimplemented in extended classes */
|
|
9
|
+
type(): AnnotationType;
|
|
10
|
+
update(): void;
|
|
11
|
+
sameId(): string | null;
|
|
12
|
+
inBbox(bbox: Bbox): boolean;
|
|
13
|
+
toSVG(): string | null;
|
|
14
|
+
toShape(): AnyShape | null;
|
|
15
|
+
toData(): any;
|
|
16
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { DxfBlock } from '@tarikjabiri/dxf';
|
|
2
|
+
import { MainAxis, PointLike, AnyShape, AnyShapeOrCollection, ModelUnits, DimensionLineData, DimensionOptions, AnnotationType, Point, Vector, Edge, BaseAnnotation } from './internal';
|
|
3
|
+
export declare class DimensionLine extends BaseAnnotation {
|
|
4
|
+
DIMENSION_OFFSET_DEFAULT: number;
|
|
5
|
+
DIMENSION_ROUND_DEFAULT: boolean;
|
|
6
|
+
_initialized: boolean;
|
|
7
|
+
targetStart: Point;
|
|
8
|
+
targetEnd: Point;
|
|
9
|
+
targetShape: AnyShape;
|
|
10
|
+
linkedTo: AnyShapeOrCollection;
|
|
11
|
+
static: boolean;
|
|
12
|
+
units: ModelUnits;
|
|
13
|
+
offsetVec: Vector;
|
|
14
|
+
offsetLength: number;
|
|
15
|
+
ortho: boolean | MainAxis;
|
|
16
|
+
_orthoAxis: MainAxis;
|
|
17
|
+
round: boolean;
|
|
18
|
+
roundDecimals: number;
|
|
19
|
+
textSize: number;
|
|
20
|
+
interactive: boolean;
|
|
21
|
+
showUnits: boolean;
|
|
22
|
+
param: string;
|
|
23
|
+
constructor(start?: PointLike, end?: PointLike, options?: DimensionOptions);
|
|
24
|
+
/** Check if a given object is a DimensionLine */
|
|
25
|
+
static isDimensionLine(o: any): boolean;
|
|
26
|
+
/** (Re)init dimension line */
|
|
27
|
+
init(start: PointLike, end: PointLike, options?: DimensionOptions): this;
|
|
28
|
+
/** Generate a dimension line from this Edge */
|
|
29
|
+
fromEdge(edge: Edge, options?: DimensionOptions): this;
|
|
30
|
+
/** Link this Annotation to given Shape or ShapeCollection
|
|
31
|
+
* This helps with more advanced dimensioning and retrieving Dimension when exporting Shapes */
|
|
32
|
+
link(to: AnyShapeOrCollection): this;
|
|
33
|
+
/** Recurse parents to find main parent Shape of given shape */
|
|
34
|
+
_getParentShape(s: AnyShapeOrCollection): AnyShapeOrCollection | null;
|
|
35
|
+
_getDynamicValue(): number;
|
|
36
|
+
type(): AnnotationType;
|
|
37
|
+
/** Vector from target start to end, not normalized */
|
|
38
|
+
targetDir(): Vector;
|
|
39
|
+
/** Vector from dimension line start to end */
|
|
40
|
+
dir(): Vector;
|
|
41
|
+
/** Middle Point of this DimensionLine */
|
|
42
|
+
targetMiddle(): Point;
|
|
43
|
+
/** Offset Vector of length offsetLength from target points to Dimension line */
|
|
44
|
+
offset(): Vector;
|
|
45
|
+
/** Update when linked Shape is updated */
|
|
46
|
+
update(): void;
|
|
47
|
+
/** Update position after linked Shape has moved
|
|
48
|
+
* !!!! IMPORTANT !!!! Improve this method
|
|
49
|
+
*/
|
|
50
|
+
updatePosition(): void;
|
|
51
|
+
/** Calculate the direction for offsetting from target
|
|
52
|
+
* How to offset depends on dimension line type: normal, ortho
|
|
53
|
+
*/
|
|
54
|
+
_calculateOffsetVec(overwrite?: boolean): Vector;
|
|
55
|
+
/** Calculate a offset length */
|
|
56
|
+
_calculateAutoOffsetLength(): number;
|
|
57
|
+
/** The start and end point of DimensionLine in original coordinate system
|
|
58
|
+
* Where the points are depends on type of dimension line. Normal or othogonal
|
|
59
|
+
*/
|
|
60
|
+
_calculatePoint(at: 'start' | 'end'): Point;
|
|
61
|
+
/** Get rotation in SVG coordinate system (so mirror y!) */
|
|
62
|
+
getSVGRotation(): number;
|
|
63
|
+
/** Set static value */
|
|
64
|
+
setValue(v: number | string): this;
|
|
65
|
+
setOptions(o: DimensionOptions): this;
|
|
66
|
+
setOffsetVec(v: PointLike): this;
|
|
67
|
+
/** bind parameter to this dimension line and make it interactive */
|
|
68
|
+
bindParam(paramName: string): void;
|
|
69
|
+
/** Generic Shape method (every Annotation class should have this!) */
|
|
70
|
+
toShape(): Edge;
|
|
71
|
+
/** Make a Line Edge out this DimensionLine */
|
|
72
|
+
toEdge(): Edge;
|
|
73
|
+
targetEdge(): Edge;
|
|
74
|
+
sameId(flags?: Record<string, boolean>): string | null;
|
|
75
|
+
isSame(other: DimensionLine, flags?: Record<string, boolean>): boolean;
|
|
76
|
+
/** To distinguish between Dimension Lines we can calculate the y coord of the offset projected from the position */
|
|
77
|
+
_projYAxis(): number;
|
|
78
|
+
/** Output to data (to be send from Webworker to main app) */
|
|
79
|
+
toData(): DimensionLineData;
|
|
80
|
+
/** Generate SVG for this dimension line
|
|
81
|
+
* if 3D the Dimension Line is projected to XY plane
|
|
82
|
+
* NOTE: we need to transform from Archiyou coordinate system to the SVG one (flip y)
|
|
83
|
+
*/
|
|
84
|
+
toSVG(): string;
|
|
85
|
+
/** Generate a line segment in SVG (with SVG coords) */
|
|
86
|
+
_makeSvgLinePath(start: PointLike, end: PointLike): string;
|
|
87
|
+
/** Place SVG arrow on position and rotation. Tip of the arrow is pivot */
|
|
88
|
+
_makeSvgArrow(at: PointLike, flip?: boolean): string;
|
|
89
|
+
_makeSvgTextLabel(at: PointLike, text: string): string;
|
|
90
|
+
/** Export Annotation to DXF aligned dimension line */
|
|
91
|
+
toDXF(dxf: DxfBlock): this;
|
|
92
|
+
}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { AnyShape, PointLike, MainAxis, Side, Brep, Point, Vertex, Edge, Face, Solid, AnyShapeOrCollection } from './internal';
|
|
2
|
+
export declare class Bbox {
|
|
3
|
+
_oc: any;
|
|
4
|
+
_brep: Brep;
|
|
5
|
+
_ocBbox: any;
|
|
6
|
+
_parent: AnyShapeOrCollection;
|
|
7
|
+
position: Point;
|
|
8
|
+
bounds: Array<number>;
|
|
9
|
+
/** Create 2D or 3D Bbox from two Point spanning up the box */
|
|
10
|
+
constructor(min?: PointLike, max?: PointLike);
|
|
11
|
+
_clearOcBbox(): void;
|
|
12
|
+
/** Link to Shape or ShapeCollection
|
|
13
|
+
* Used to keep track of _parent chain for Bbox subshapes
|
|
14
|
+
*/
|
|
15
|
+
setParent(p: AnyShapeOrCollection): void;
|
|
16
|
+
create(min: PointLike, max: PointLike): any;
|
|
17
|
+
/** Set boundaries of Bbox from OC Bbox */
|
|
18
|
+
setBounds(): number[];
|
|
19
|
+
/** Make string hash based on values to be able to identify quickly */
|
|
20
|
+
hash(round?: boolean): string;
|
|
21
|
+
/** Copy this Bounding Box */
|
|
22
|
+
copy(): Bbox;
|
|
23
|
+
/** Update properties (bounds and position) based on _ocBbox */
|
|
24
|
+
updateFromOcBbox(): void;
|
|
25
|
+
/** Get Point of left, front, bottom corner */
|
|
26
|
+
min(): Point;
|
|
27
|
+
minAtAxis(a: MainAxis): any;
|
|
28
|
+
maxAtAxis(a: MainAxis): any;
|
|
29
|
+
/** Get maximum point (right,top,back) */
|
|
30
|
+
max(): Point;
|
|
31
|
+
minX(): number;
|
|
32
|
+
maxX(): number;
|
|
33
|
+
minY(): number;
|
|
34
|
+
maxY(): number;
|
|
35
|
+
minZ(): number;
|
|
36
|
+
maxZ(): number;
|
|
37
|
+
/** Get center of Bounding Box */
|
|
38
|
+
center(): Point;
|
|
39
|
+
/** Get height of Bounding Box */
|
|
40
|
+
height(): number;
|
|
41
|
+
/** Get depth of Bounding Box */
|
|
42
|
+
depth(): number;
|
|
43
|
+
/** Get width of Bounding Box */
|
|
44
|
+
width(): number;
|
|
45
|
+
/** Maximum size of Bbox */
|
|
46
|
+
maxSize(): number;
|
|
47
|
+
/** Maximum size of Bbox */
|
|
48
|
+
minSize(): number;
|
|
49
|
+
/** At what axis is the bbox the largest */
|
|
50
|
+
maxSizAxis(): MainAxis;
|
|
51
|
+
/** Get frontal Face (3D) or Edge (2D) */
|
|
52
|
+
front(): Vertex | Edge | Face;
|
|
53
|
+
/** Get back Face (3D) or Edge (2D) */
|
|
54
|
+
back(): Vertex | Edge | Face;
|
|
55
|
+
/** Get left Face (3D) or Edge (2D) */
|
|
56
|
+
left(): Vertex | Edge | Face;
|
|
57
|
+
/** Get left Face (3D) or Edge (2D) */
|
|
58
|
+
right(): Vertex | Edge | Face;
|
|
59
|
+
/** Get left Face (3D) or Edge (2D) */
|
|
60
|
+
top(): Vertex | Edge | Face;
|
|
61
|
+
/** Get left Face (3D) or Edge (2D) */
|
|
62
|
+
bottom(): Vertex | Edge | Face;
|
|
63
|
+
/** Get one of the 8 Vertices of the Bbox
|
|
64
|
+
* @param - a string like 'leftfront', 'bottomright'
|
|
65
|
+
* Order of sides does not matter
|
|
66
|
+
* TODO: Old method. Need refactoring!
|
|
67
|
+
*/
|
|
68
|
+
corner(where: string): Point;
|
|
69
|
+
/** Get the diagonal of Bounding Box as Vertex (zero size Bbox) or Edge */
|
|
70
|
+
diagonal(): Vertex | Edge;
|
|
71
|
+
/** Get position of Bbox based on percentages of x,y,z */
|
|
72
|
+
getPositionAtPerc(p: PointLike, ...args: any[]): Point;
|
|
73
|
+
/** Enlarge by offsetting current Bbox in all direction a given amount. Returns a new Bbox. */
|
|
74
|
+
enlarged(amount: number): Bbox;
|
|
75
|
+
/** Return a new Bbox by adding another */
|
|
76
|
+
added(other: Bbox): Bbox;
|
|
77
|
+
/** Check if Bounding Box of zero size so a Point */
|
|
78
|
+
isPoint(): boolean;
|
|
79
|
+
/** Checks if sizes along axis are zero */
|
|
80
|
+
_sizesAreZero(): Array<boolean | boolean | boolean>;
|
|
81
|
+
/** Bbox has only one size dimension (the others are zero) */
|
|
82
|
+
is1D(): boolean;
|
|
83
|
+
/** Check if Bounding Box is 2D */
|
|
84
|
+
is2D(): boolean;
|
|
85
|
+
is3D(): boolean;
|
|
86
|
+
/** The axis that is missing in 2D bbox */
|
|
87
|
+
axisMissingIn2D(): MainAxis | null;
|
|
88
|
+
axes2D(): Array<MainAxis>;
|
|
89
|
+
/** Along what axis is this 1D Bbox */
|
|
90
|
+
sizeAxis1D(): MainAxis | null;
|
|
91
|
+
/** Axis on which the bbox has a size */
|
|
92
|
+
hasAxes(): Array<MainAxis>;
|
|
93
|
+
/** Get size of current Bbox along given axis */
|
|
94
|
+
sizeAlongAxis(axis: MainAxis): number;
|
|
95
|
+
/** Get Shape from this Bounding Box */
|
|
96
|
+
shape(): Vertex | Edge | Face | Solid | null;
|
|
97
|
+
/** Make Line from 1D Bbox */
|
|
98
|
+
line(): Edge | null;
|
|
99
|
+
/** Create 2D Rectangle Face from Bbox */
|
|
100
|
+
rect(): Face;
|
|
101
|
+
/** returns a Box Shape for this Bbox if not 2D, otherwise null */
|
|
102
|
+
box(): Solid | null;
|
|
103
|
+
/** Return flipped Bbox that is mirrored in x-axis. For certain 2D ops */
|
|
104
|
+
flippedY(): Bbox;
|
|
105
|
+
/** Gets the Edge seperating width in two equal halves */
|
|
106
|
+
widthHalfLine(): Edge;
|
|
107
|
+
/** Gets the Edge seperating depth in two equal halves */
|
|
108
|
+
depthHalfLine(): Edge;
|
|
109
|
+
/** Get Sub Shapes associated with given sides
|
|
110
|
+
@param side - combinations of front|back|right|left|top|bottom
|
|
111
|
+
NOTE: we use _getSide for now - but we might refactor
|
|
112
|
+
*/
|
|
113
|
+
getSidesShape(sidesString: string): Face | Edge | Vertex;
|
|
114
|
+
/** Get individual Bbox side shapes based on sidestring
|
|
115
|
+
* @param sidesString any combination between front/back,left/right,top/bottom
|
|
116
|
+
*/
|
|
117
|
+
_getIndividualSideShapes(sidesString: string): Record<Side, Face | Edge | Vertex>;
|
|
118
|
+
/** Get area of bbox */
|
|
119
|
+
area(): number;
|
|
120
|
+
contains(other: AnyShape): boolean;
|
|
121
|
+
_containsBbox(other: Bbox): boolean;
|
|
122
|
+
toData(): Array<number>;
|
|
123
|
+
toString(): string;
|
|
124
|
+
/** Get side of Bbox - NOTE: Some sides can be zero length */
|
|
125
|
+
_getSide(side: string): Vertex | Edge | Face;
|
|
126
|
+
}
|
|
@@ -0,0 +1,316 @@
|
|
|
1
|
+
import { ArchiyouApp, AnyShape, Alignment, PointLike, Point, Vector, Edge, Wire, Face, Shell, Solid, ShapeCollection } from './internal';
|
|
2
|
+
export declare class Beams {
|
|
3
|
+
_ay: ArchiyouApp;
|
|
4
|
+
activeSection: BeamSection;
|
|
5
|
+
beams: Array<Beam>;
|
|
6
|
+
constructor(ay?: ArchiyouApp);
|
|
7
|
+
setArchiyou(ay: ArchiyouApp): void;
|
|
8
|
+
/** Set handy globals on a given context */
|
|
9
|
+
setGlobals(scope: any): void;
|
|
10
|
+
setBeamCreationMethods(): void;
|
|
11
|
+
reset(): void;
|
|
12
|
+
new(type?: BeamType, length?: number): Beam;
|
|
13
|
+
/** TODO: Resolve all joints of Beam system */
|
|
14
|
+
join(): void;
|
|
15
|
+
getLastBeam(): Beam | null;
|
|
16
|
+
getPrevBeam(b: Beam): Beam;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Beam is fully defined by:
|
|
20
|
+
*
|
|
21
|
+
* - base line: start position, length and direction (pitch and rotation)
|
|
22
|
+
* This is the diagramatic representation of a Beam and is the most important abstraction
|
|
23
|
+
* - section (2D section) and its alignment to the line
|
|
24
|
+
*
|
|
25
|
+
* Defining a Beam goes step-wise, either by settings primary properties directly
|
|
26
|
+
* but probably more by defining the type (Beam.post(), Beam.brace()) and relations.
|
|
27
|
+
*
|
|
28
|
+
* The input of the user is focused on defining the Beam (type(), length(), at()) and
|
|
29
|
+
* its context (place()) and we can determine the most probably solution based on the most practical outcomes.
|
|
30
|
+
* This operates on the diagramatic (base-line only) representation of a system of beams
|
|
31
|
+
*
|
|
32
|
+
* At the last phase of definition the user can tune the details of the Beam, which operates on the real solid
|
|
33
|
+
* representation of the beams
|
|
34
|
+
*
|
|
35
|
+
*/
|
|
36
|
+
export declare class Beam {
|
|
37
|
+
_type?: BeamType;
|
|
38
|
+
_flags?: BeamFlags;
|
|
39
|
+
_id: string;
|
|
40
|
+
_serial: number;
|
|
41
|
+
_parent: Beams;
|
|
42
|
+
_length: number;
|
|
43
|
+
_position: Point;
|
|
44
|
+
_pitch: number;
|
|
45
|
+
_rotation: number;
|
|
46
|
+
_roll: number;
|
|
47
|
+
_alignment: Alignment;
|
|
48
|
+
_shape: AnyShape;
|
|
49
|
+
_baseLine: Edge;
|
|
50
|
+
_section: BeamSection;
|
|
51
|
+
_others: Array<Beam>;
|
|
52
|
+
_relations: Array<BeamRelation>;
|
|
53
|
+
_operations: Array<BeamOperation>;
|
|
54
|
+
name: string;
|
|
55
|
+
constructor(parent: Beams);
|
|
56
|
+
length(l: number, updateShape?: boolean): this;
|
|
57
|
+
direction(): Vector;
|
|
58
|
+
center(): Point | null;
|
|
59
|
+
_setLengthFrom(start: PointLike, end: PointLike): this;
|
|
60
|
+
_getLengthFromShape(): number;
|
|
61
|
+
/** Set position of the beam */
|
|
62
|
+
at(p: PointLike): this;
|
|
63
|
+
/** Place this Beam along a Line given by start and end position */
|
|
64
|
+
along(start: PointLike, end: PointLike, autoLength?: boolean): this;
|
|
65
|
+
_updateBaseLine(): void;
|
|
66
|
+
move(p: PointLike, ...args: any[]): this;
|
|
67
|
+
/** Set absolute pitch angle in degrees of this Beam */
|
|
68
|
+
pitch(angle: number): this;
|
|
69
|
+
/** Set absolute rotation to given angle */
|
|
70
|
+
rotation(angle: number): this;
|
|
71
|
+
/** Rotate around Z-axis in degrees */
|
|
72
|
+
rotate(d: number): this;
|
|
73
|
+
/** Get start of base line of Beam
|
|
74
|
+
* Start is always the lowest, most left position of the base line
|
|
75
|
+
*/
|
|
76
|
+
start(): Point;
|
|
77
|
+
/** Get end base line of Beam */
|
|
78
|
+
end(): Point;
|
|
79
|
+
/** Make sure of the given two Points start is the most bottom and left */
|
|
80
|
+
_checkStartEnd(start: PointLike, end: PointLike): [Point, Point];
|
|
81
|
+
beam(length?: number): this;
|
|
82
|
+
post(length?: number): this;
|
|
83
|
+
stud(length?: number): this;
|
|
84
|
+
brace(length?: number): this;
|
|
85
|
+
/** Make Section Face at start position with correct orientation for the Beam
|
|
86
|
+
* NOTE: With sweep() we anticipate more complex sections, like I-beams, cylinders etc.
|
|
87
|
+
* TODO: use cache for small speed up?
|
|
88
|
+
*/
|
|
89
|
+
_getOrientatedSectionFace(): Face;
|
|
90
|
+
/** Get Section face align to center of Beam */
|
|
91
|
+
_getOrientatedSectionFaceCentered(): Face;
|
|
92
|
+
/** Get offset Vector from baseline to center of Beam section */
|
|
93
|
+
_getBaseLineToSectionCenterVec(): Vector;
|
|
94
|
+
/** Get center line of Beam */
|
|
95
|
+
_getSectionCenterToPivot(): Vector;
|
|
96
|
+
_getCenterLine(): Edge;
|
|
97
|
+
/** Set Beam solid Shape from base properties or replace if existing
|
|
98
|
+
* NOTE: base line has priority over the solid Shape!
|
|
99
|
+
*/
|
|
100
|
+
_setShape(): this;
|
|
101
|
+
/** Get normal of top face of Beam */
|
|
102
|
+
_getTopFaceNormal(): Vector;
|
|
103
|
+
/** Get (simplified) top Face of Beam */
|
|
104
|
+
_getTopTestFace(): Face;
|
|
105
|
+
/** Get the cutting top Edge given a cutting Face
|
|
106
|
+
* NOTE: Does not test if it even cuts!
|
|
107
|
+
*/
|
|
108
|
+
_getTopCutEdge(intersectionFace: Face): Edge;
|
|
109
|
+
/** Get normal of side face of Beam
|
|
110
|
+
* The main side is the one facing y=-1 when beam is places along x-axis with start at origin
|
|
111
|
+
*/
|
|
112
|
+
_getSideFaceNormal(): Vector;
|
|
113
|
+
/** Get origin for operation (a la BTLX) */
|
|
114
|
+
_getOperationOrigin(): Point;
|
|
115
|
+
_getOperationTestLine(): Edge;
|
|
116
|
+
/** Add debug shapes */
|
|
117
|
+
debug(): void;
|
|
118
|
+
/** Apply an operation to this Beam */
|
|
119
|
+
apply(op: BeamOperation): void;
|
|
120
|
+
checkDuplicateOperation(op: BeamOperation): this;
|
|
121
|
+
/** Add parametric Cut operation to Beam and update its Shape */
|
|
122
|
+
cut(start: number, angle?: number, inclination?: number): this;
|
|
123
|
+
/** Cut at point or along a given Face */
|
|
124
|
+
cutAt(other: PointLike | Face): this;
|
|
125
|
+
/** Add parametric Extend operation to Beam and update its Shape */
|
|
126
|
+
extend(amount: number, side: BeamTail): void;
|
|
127
|
+
/** Add parametric Extend operation but with a Shape as input
|
|
128
|
+
* We extend to fully overlap between this Beam and other Beam or Shape
|
|
129
|
+
*/
|
|
130
|
+
extendTo(other: Beam | AnyShape | PointLike, toOtherSide?: BeamExtendToOtherSide): this;
|
|
131
|
+
setShape(s: AnyShape): this;
|
|
132
|
+
/** Remove any shape from inner Shape
|
|
133
|
+
* TODO: Invent something with operation stack to make this parametric
|
|
134
|
+
*/
|
|
135
|
+
_subtract(other: AnyShape): this;
|
|
136
|
+
/** WARNING: Unions can be remarkably slow! */
|
|
137
|
+
_union(other: AnyShape): this;
|
|
138
|
+
/** Rebuild Shape to remove ugly edges
|
|
139
|
+
TODO: This can be improved into something that builds
|
|
140
|
+
the Beam shape from scratch by applying operations
|
|
141
|
+
*/
|
|
142
|
+
_rebuildShape(): void;
|
|
143
|
+
/** cut Shape of Beam at given Face */
|
|
144
|
+
_cutShape(at: Face): this;
|
|
145
|
+
_setFromStartEnd(): this;
|
|
146
|
+
/** Get line along axis of Beam that starts from the pivot to the end of the Beam */
|
|
147
|
+
_setBaseLine(cached?: boolean): Edge;
|
|
148
|
+
/** Get Face at start of Beam from its current Solid Shape
|
|
149
|
+
* TODO: How to deal parametrically with operations that leave a tail with multiple Faces
|
|
150
|
+
*/
|
|
151
|
+
getFaceAt(side: BeamTail): Face;
|
|
152
|
+
getFaceAtStart(): Face;
|
|
153
|
+
getFaceAtEnd(): Face;
|
|
154
|
+
type(t: BeamType, length?: number): this;
|
|
155
|
+
/**
|
|
156
|
+
* Position this Beam from the top onto one or more other beams
|
|
157
|
+
* Relations will be formed, that are resolved into joints
|
|
158
|
+
*/
|
|
159
|
+
place(others: BeamOrBeamSequence, at?: BeamBaseLineAlignment): this;
|
|
160
|
+
/** Add Relation from current Beam to others at a given location
|
|
161
|
+
* Based on the other Beams and location a BeamRelationType is determined (or manually set)
|
|
162
|
+
*/
|
|
163
|
+
_addRelation(other: Beam, at: Point, type?: BeamRelationType): void;
|
|
164
|
+
/** Relations can be either along a Beam (including start) or at the end ('on')
|
|
165
|
+
* which defines together with number of Beams the exact Relation type
|
|
166
|
+
*/
|
|
167
|
+
_getBeamRelationBaseLocation(location: BeamBaseLineAlignment): 'along' | 'on';
|
|
168
|
+
/** The point on the base line of other beams to place this beam on
|
|
169
|
+
* @return Point where this Beam is placed at
|
|
170
|
+
*/
|
|
171
|
+
_placeAt(other: Beam, atOther?: BeamBaseLineAlignment): Point;
|
|
172
|
+
/** Place this Beam in relation to two or more others
|
|
173
|
+
* @param others the other Beams to place the current at
|
|
174
|
+
@param atOther alignment where to place. Use 1 if same (like with posts) or multiple to define for all other Beams
|
|
175
|
+
*/
|
|
176
|
+
_placeAtOthers(others: Array<Beam>, atOther?: BeamBaseLineAlignment | Array<BeamBaseLineAlignment>, autoLength?: boolean): [Point, Point];
|
|
177
|
+
/** Create Diagonal between current and other beam
|
|
178
|
+
* @param endBeam
|
|
179
|
+
*/
|
|
180
|
+
diagonal(endBeam: Beam, startAt?: BeamBaseLineAlignment): this;
|
|
181
|
+
/** point along base line of Beam
|
|
182
|
+
* @param at start,end, middle/center or [0-1] or distance from start in model units (like mm)
|
|
183
|
+
*/
|
|
184
|
+
_pointAtBaseLine(at?: BeamBaseLineAlignment): Point;
|
|
185
|
+
/** Resolve (unresolved) relations to joints */
|
|
186
|
+
join(type: BeamJointType, options: BeamJointOptions): void;
|
|
187
|
+
_resolveRelationToJoint(r: BeamRelation, type: BeamJointType, options: BeamJointOptions): any;
|
|
188
|
+
/** Make Shells from Wire projections
|
|
189
|
+
* Uses the powerful Shell.fromWireframe algorithm
|
|
190
|
+
*/
|
|
191
|
+
_makeShellsFromProjections(projections: ShapeCollection, on: AnyShape): ShapeCollection;
|
|
192
|
+
_makeShellFromProjection(proj: Wire, on: AnyShape): Shell;
|
|
193
|
+
/** Get the intersection Shape of (extended) current and other beams
|
|
194
|
+
*
|
|
195
|
+
*/
|
|
196
|
+
_getExtendedIntersection(curExt: AnyShape, otherExt: AnyShape): AnyShape;
|
|
197
|
+
/**
|
|
198
|
+
* Extend current Beam a given amount or to a given Point, Wire or Face and return Shape
|
|
199
|
+
* NOTE: The direction of the Beam stays the same
|
|
200
|
+
* NOTE: Depending on the to input this returns a butt or cutted Beam - TODO: Make this more transparent
|
|
201
|
+
*/
|
|
202
|
+
_getExtendedShapeAndDir(to: number | PointLike | Wire | Face, at?: Point | BeamBaseLineAlignment): [Solid, Vector];
|
|
203
|
+
/** Simpler Shape that is extended on both sides equally */
|
|
204
|
+
_getExtendedTestShape(): Solid;
|
|
205
|
+
_getExtendedTestIntersection(to: Beam | AnyShape | PointLike): AnyShape;
|
|
206
|
+
/** Get the project Section of this Beam onto another Solid
|
|
207
|
+
* IMPORTANT: Results might be inaccurate when difference between projections are minor!
|
|
208
|
+
*/
|
|
209
|
+
_getProjectedSections(other: Solid, dir: Vector): ShapeCollection;
|
|
210
|
+
/** Get a extended Line Edge in direction of Beam along baseline */
|
|
211
|
+
_getTestBaseLine(): Edge;
|
|
212
|
+
/** A butt joint is the most simple joint with one mutual touching line or face
|
|
213
|
+
* either by combining two orthogonal Beams without any angled cuts, one beam has priority over the other
|
|
214
|
+
* Or cutting one Beam at an angle to place at the other
|
|
215
|
+
*
|
|
216
|
+
* Options (TODO):
|
|
217
|
+
* strategy: butt-only, cutone
|
|
218
|
+
* auto priority: top, horizontal
|
|
219
|
+
* location: outside, baseline
|
|
220
|
+
*/
|
|
221
|
+
_resolveJointButt(inp: BeamJointResolveInput, options?: BeamJointOptionsButt): BeamJointResult;
|
|
222
|
+
/** A miter joint is characterized by clean outside angles (see for example SVG stroke style)
|
|
223
|
+
* that can be achieved by either a symmetrical cut on both Beams
|
|
224
|
+
* or assymmetrically extending and cutting with one Beam that has priority
|
|
225
|
+
* For pitch=0 an assymmetrical Miter joint is the same as a butt joint
|
|
226
|
+
*/
|
|
227
|
+
_resolveJointMiter(inp: BeamJointResolveInput, options?: BeamJointOptions): BeamJointResult;
|
|
228
|
+
}
|
|
229
|
+
export type BeamType = 'beam' | 'post' | 'stud' | 'rafter' | 'diagonal' | 'brace' | 'nogging' | 'girt';
|
|
230
|
+
export type BeamSectionOrientation = 'flat' | 'up' | 'rect';
|
|
231
|
+
export type BeamOrBeamSequence = Array<Beam> | Beam;
|
|
232
|
+
export type BeamTail = 'start' | 'end';
|
|
233
|
+
export type BeamBaseLineAlignment = BeamTail | 'center' | 'middle' | number;
|
|
234
|
+
export type BeamRelationType = 'support' | 'on' | 'along' | 'between' | 'brace' | 'diagonal';
|
|
235
|
+
export type BeamJointType = 'butt' | 'miter' | 'lap';
|
|
236
|
+
export type BeamExtendToOtherSide = 'in' | 'out';
|
|
237
|
+
declare class BeamSection {
|
|
238
|
+
_width: number;
|
|
239
|
+
_height: number;
|
|
240
|
+
_orientation?: BeamSectionOrientation;
|
|
241
|
+
constructor(width?: number, height?: number);
|
|
242
|
+
set width(w: number);
|
|
243
|
+
set height(h: number);
|
|
244
|
+
get height(): number;
|
|
245
|
+
get width(): number;
|
|
246
|
+
_setOrientation(): BeamSectionOrientation;
|
|
247
|
+
copy(): BeamSection;
|
|
248
|
+
}
|
|
249
|
+
/** Describes a relation between two Beams at one Location
|
|
250
|
+
* Most relations already make the number of Beams implicit
|
|
251
|
+
* Like:
|
|
252
|
+
* - on: 1 other Beam
|
|
253
|
+
* - between: 2 other Beams
|
|
254
|
+
*
|
|
255
|
+
* Different Relations can be combined by location into Joints and resolved into fitting Shapes
|
|
256
|
+
*/
|
|
257
|
+
declare class BeamRelation {
|
|
258
|
+
from: Beam;
|
|
259
|
+
to: Beam;
|
|
260
|
+
at: Point;
|
|
261
|
+
type: BeamRelationType;
|
|
262
|
+
resolved: boolean;
|
|
263
|
+
constructor(from: Beam, to: Beam, type?: BeamRelationType, at?: Point);
|
|
264
|
+
}
|
|
265
|
+
/** Flags that keep track of state and behaviour of Beam */
|
|
266
|
+
interface BeamFlags {
|
|
267
|
+
fit?: boolean;
|
|
268
|
+
priority?: number;
|
|
269
|
+
placeOtherAt?: BeamBaseLineAlignment;
|
|
270
|
+
autoLength?: boolean;
|
|
271
|
+
autoRotation?: boolean;
|
|
272
|
+
autoPitch?: boolean;
|
|
273
|
+
ortho?: boolean;
|
|
274
|
+
}
|
|
275
|
+
interface BeamJointResolveInput {
|
|
276
|
+
relation: BeamRelation;
|
|
277
|
+
fromExtended: AnyShape;
|
|
278
|
+
toExtended: AnyShape;
|
|
279
|
+
intersection: AnyShape;
|
|
280
|
+
fromProjIn?: Wire;
|
|
281
|
+
fromProjOut: Wire;
|
|
282
|
+
fromProjInShell?: Shell;
|
|
283
|
+
fromProjOutShell?: Shell;
|
|
284
|
+
toProjIn?: Wire;
|
|
285
|
+
toProjOut: Wire;
|
|
286
|
+
toProjInShell?: Shell;
|
|
287
|
+
toProjOutShell?: Shell;
|
|
288
|
+
flags?: BeamJointResolveFlags;
|
|
289
|
+
}
|
|
290
|
+
interface BeamJointResolveFlags {
|
|
291
|
+
fullIntersection: boolean;
|
|
292
|
+
largestBeamIntersection: Beam;
|
|
293
|
+
orthogonal: boolean;
|
|
294
|
+
}
|
|
295
|
+
/** Specific options to solve a joint */
|
|
296
|
+
type BeamJointButtStrategy = 'butt-only' | 'cutone';
|
|
297
|
+
interface BeamJointOptions {
|
|
298
|
+
strategy?: BeamJointButtStrategy;
|
|
299
|
+
at?: 'outside' | 'baseline';
|
|
300
|
+
}
|
|
301
|
+
interface BeamJointOptionsButt extends BeamJointOptions {
|
|
302
|
+
buttAlign: BeamExtendToOtherSide;
|
|
303
|
+
}
|
|
304
|
+
interface BeamJointResult {
|
|
305
|
+
input: BeamJointResolveInput;
|
|
306
|
+
output: any;
|
|
307
|
+
}
|
|
308
|
+
declare class BeamOperation {
|
|
309
|
+
id: string;
|
|
310
|
+
type: string;
|
|
311
|
+
_btlx: boolean;
|
|
312
|
+
constructor(type: any);
|
|
313
|
+
hash(): string;
|
|
314
|
+
apply(to: Beam): this;
|
|
315
|
+
}
|
|
316
|
+
export {};
|