@margoengine/brep 0.0.0-stage → 1.0.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/NOTICE +14 -0
- package/README.md +200 -2
- package/dist/geometry/curves.d.ts +31 -0
- package/dist/geometry/exact.d.ts +6 -0
- package/dist/geometry/nurbs.d.ts +35 -0
- package/dist/geometry/read.d.ts +22 -0
- package/dist/geometry/surfaces.d.ts +75 -0
- package/dist/geometry/vec.d.ts +33 -0
- package/dist/iges/file.d.ts +66 -0
- package/dist/iges/geometry.d.ts +148 -0
- package/dist/iges/shapes.d.ts +30 -0
- package/dist/iges/step.d.ts +19 -0
- package/dist/index.d.ts +90 -0
- package/dist/index.js +16185 -0
- package/dist/jt/codec.d.ts +29 -0
- package/dist/jt/file.d.ts +70 -0
- package/dist/jt/lsg.d.ts +82 -0
- package/dist/jt/lzma.d.ts +22 -0
- package/dist/jt/mesh.d.ts +17 -0
- package/dist/jt/read.d.ts +68 -0
- package/dist/mesh/cdt.d.ts +41 -0
- package/dist/mesh/tessellate.d.ts +106 -0
- package/dist/mesh/validate.d.ts +45 -0
- package/dist/model/blend.d.ts +38 -0
- package/dist/model/boolean.d.ts +37 -0
- package/dist/model/build.d.ts +75 -0
- package/dist/model/check.d.ts +8 -0
- package/dist/model/distance.d.ts +28 -0
- package/dist/model/export.d.ts +17 -0
- package/dist/model/faces.d.ts +183 -0
- package/dist/model/geometry.d.ts +103 -0
- package/dist/model/import.d.ts +30 -0
- package/dist/model/index.d.ts +27 -0
- package/dist/model/intersect.d.ts +28 -0
- package/dist/model/loft.d.ts +12 -0
- package/dist/model/march.d.ts +20 -0
- package/dist/model/mass.d.ts +28 -0
- package/dist/model/offset-surface.d.ts +16 -0
- package/dist/model/offset.d.ts +39 -0
- package/dist/model/seams.d.ts +26 -0
- package/dist/model/setback.d.ts +12 -0
- package/dist/model/sew.d.ts +47 -0
- package/dist/model/sweep.d.ts +37 -0
- package/dist/model/topology.d.ts +116 -0
- package/dist/model/validate.d.ts +16 -0
- package/dist/sat/read.d.ts +16 -0
- package/dist/step/file.d.ts +82 -0
- package/dist/step/structure.d.ts +131 -0
- package/dist/step/write.d.ts +57 -0
- package/dist/xt/read.d.ts +22 -0
- package/dist/xt/schema.d.ts +18 -0
- package/dist/xt/step.d.ts +19 -0
- package/package.json +50 -4
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/** A parameter value: a number (integers, reals and pointers), a string, or null for a defaulted field. */
|
|
2
|
+
export type IGESValue = number | string | null;
|
|
3
|
+
/** One entity: its Directory Entry fields and its parameters. */
|
|
4
|
+
export interface IGESEntity {
|
|
5
|
+
/** The sequence number of its first Directory Entry line (odd): what pointers to it hold. */
|
|
6
|
+
readonly de: number;
|
|
7
|
+
readonly type: number;
|
|
8
|
+
readonly form: number;
|
|
9
|
+
/** Directory Entry pointer to its Transformation Matrix (Type 124), or 0. */
|
|
10
|
+
readonly transform: number;
|
|
11
|
+
/** Colour number (1 black ... 8 white) or a negated pointer to a Color Definition (Type 314), 0 when none. */
|
|
12
|
+
readonly color: number;
|
|
13
|
+
readonly level: number;
|
|
14
|
+
/** Blank status: true when the sending system does not display it. */
|
|
15
|
+
readonly blanked: boolean;
|
|
16
|
+
/** Subordinate entity switch: 0 independent, 1 physically, 2 logically, 3 both dependent. */
|
|
17
|
+
readonly subordinate: number;
|
|
18
|
+
/** Entity use flag: 0 geometry, 1 annotation, 2 definition, 3 other, 4 logical, 5 2D parametric, 6 construction. */
|
|
19
|
+
readonly use: number;
|
|
20
|
+
readonly label: string;
|
|
21
|
+
readonly subscript: number;
|
|
22
|
+
/** The parameter data after the entity type number (index 0 is the specification's index 1). */
|
|
23
|
+
readonly params: readonly IGESValue[];
|
|
24
|
+
}
|
|
25
|
+
/** The Global Section. */
|
|
26
|
+
export interface IGESGlobal {
|
|
27
|
+
readonly parameterDelimiter: string;
|
|
28
|
+
readonly recordDelimiter: string;
|
|
29
|
+
readonly sender: string;
|
|
30
|
+
readonly fileName: string;
|
|
31
|
+
readonly system: string;
|
|
32
|
+
readonly preprocessor: string;
|
|
33
|
+
/** Model space units per real-world unit (0.125: one model unit is 8 real-world units). */
|
|
34
|
+
readonly modelScale: number;
|
|
35
|
+
/** The units flag (1 inches ... 11 microinches; 3 means the units name says). */
|
|
36
|
+
readonly unitsFlag: number;
|
|
37
|
+
readonly unitsName: string;
|
|
38
|
+
/** Millimetres per model unit, from the units flag (or name). */
|
|
39
|
+
readonly millimetres: number;
|
|
40
|
+
/** Minimum user-intended resolution, in model units (0 when not given). */
|
|
41
|
+
readonly resolution: number;
|
|
42
|
+
/** Approximate maximum coordinate, in model units (0 when not given). */
|
|
43
|
+
readonly maxCoordinate: number;
|
|
44
|
+
readonly author: string;
|
|
45
|
+
readonly organization: string;
|
|
46
|
+
/** Specification version flag (11 for 5.3). */
|
|
47
|
+
readonly version: number;
|
|
48
|
+
/** Every Global field in order (index 0 is field 1). */
|
|
49
|
+
readonly fields: readonly IGESValue[];
|
|
50
|
+
}
|
|
51
|
+
/** A parsed IGES file. */
|
|
52
|
+
export interface IGESFile {
|
|
53
|
+
/** The Start Section's text, one line per line. */
|
|
54
|
+
readonly start: string;
|
|
55
|
+
readonly global: IGESGlobal;
|
|
56
|
+
/** Entities by the sequence number of their first Directory Entry line. */
|
|
57
|
+
readonly entities: ReadonlyMap<number, IGESEntity>;
|
|
58
|
+
}
|
|
59
|
+
/** Whether `input` (text or bytes) starts like an IGES file: a Start (or Flag) line with its sequence number, then Global lines. */
|
|
60
|
+
export declare function isIGES(input: string | ArrayBuffer | ArrayBufferView): boolean;
|
|
61
|
+
/**
|
|
62
|
+
* Reads an IGES 5.3 file in the Fixed (ASCII) Format: its Start and Global sections and every entity's Directory Entry
|
|
63
|
+
* and parameters. Text or bytes (read as ISO 8859-1). Throws a TypeError that names the line for a malformed file, and
|
|
64
|
+
* for the Compressed and Binary formats (save the file in the fixed ASCII format).
|
|
65
|
+
*/
|
|
66
|
+
export declare function readIGES(input: string | ArrayBuffer | ArrayBufferView): IGESFile;
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
export type V3 = number[];
|
|
2
|
+
/** An affine map x' = R x + t (R row-major), with its uniform scale (cube root of |det R|). */
|
|
3
|
+
export interface Xf {
|
|
4
|
+
readonly r: readonly number[];
|
|
5
|
+
readonly t: readonly number[];
|
|
6
|
+
}
|
|
7
|
+
export declare const identity: Xf;
|
|
8
|
+
export declare const scaling: (k: number) => Xf;
|
|
9
|
+
/** outer after inner: x -> outer(inner(x)). */
|
|
10
|
+
export declare function compose(outer: Xf, inner: Xf): Xf;
|
|
11
|
+
export declare const apply: (m: Xf, p: readonly number[]) => V3;
|
|
12
|
+
export declare const rotate: (m: Xf, v: readonly number[]) => V3;
|
|
13
|
+
export declare const scaleOf: (m: Xf) => number;
|
|
14
|
+
export declare const add: (a: readonly number[], b: readonly number[]) => V3;
|
|
15
|
+
export declare const sub: (a: readonly number[], b: readonly number[]) => V3;
|
|
16
|
+
export declare const mul: (a: readonly number[], s: number) => V3;
|
|
17
|
+
export declare const dot: (a: readonly number[], b: readonly number[]) => number;
|
|
18
|
+
export declare const cross: (a: readonly number[], b: readonly number[]) => V3;
|
|
19
|
+
export declare const len: (a: readonly number[]) => number;
|
|
20
|
+
export declare const dist: (a: readonly number[], b: readonly number[]) => number;
|
|
21
|
+
export declare const unit: (a: readonly number[]) => V3;
|
|
22
|
+
/** Any unit vector perpendicular to unit vector n. */
|
|
23
|
+
export declare const perpendicular: (n: readonly number[]) => V3;
|
|
24
|
+
/** A B-spline curve: degree, full knot vector, Cartesian control points, weights when rational, its used range. */
|
|
25
|
+
export interface Nurbs {
|
|
26
|
+
readonly p: number;
|
|
27
|
+
readonly U: readonly number[];
|
|
28
|
+
readonly P: readonly V3[];
|
|
29
|
+
readonly W?: readonly number[];
|
|
30
|
+
readonly t0: number;
|
|
31
|
+
readonly t1: number;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* A model-space curve. `conic` is c + cos(t) X + sin(t) Y for t0 <= t <= t1 (circles and ellipses, X and Y not
|
|
35
|
+
* necessarily perpendicular after a transform); `native` on a chain says its parameter is the IGES one throughout.
|
|
36
|
+
*/
|
|
37
|
+
export type Curve3 = {
|
|
38
|
+
readonly kind: 'line';
|
|
39
|
+
readonly a: V3;
|
|
40
|
+
readonly b: V3;
|
|
41
|
+
} | {
|
|
42
|
+
readonly kind: 'conic';
|
|
43
|
+
readonly c: V3;
|
|
44
|
+
readonly X: V3;
|
|
45
|
+
readonly Y: V3;
|
|
46
|
+
readonly t0: number;
|
|
47
|
+
readonly t1: number;
|
|
48
|
+
} | {
|
|
49
|
+
readonly kind: 'nurbs';
|
|
50
|
+
readonly n: Nurbs;
|
|
51
|
+
} | {
|
|
52
|
+
readonly kind: 'poly';
|
|
53
|
+
readonly pts: readonly V3[];
|
|
54
|
+
} | {
|
|
55
|
+
readonly kind: 'chain';
|
|
56
|
+
readonly parts: readonly Curve3[];
|
|
57
|
+
};
|
|
58
|
+
/** The curve's parameter range (a chain's runs its parts' ranges end to end, as IGES 102 does). */
|
|
59
|
+
export declare function domain(c: Curve3): [number, number];
|
|
60
|
+
/** The point at t (in the curve's own parameter). */
|
|
61
|
+
export declare function pointAt(c: Curve3, t: number): V3;
|
|
62
|
+
export declare const startOf: (c: Curve3) => V3;
|
|
63
|
+
export declare const endOf: (c: Curve3) => V3;
|
|
64
|
+
/** The curve under an affine map. */
|
|
65
|
+
export declare function transformCurve(c: Curve3, m: Xf): Curve3;
|
|
66
|
+
/** A rough length (chords through 33 samples per part). */
|
|
67
|
+
export declare function lengthOf(c: Curve3): number;
|
|
68
|
+
/** The pieces an edge loop is made of: a chain's parts, a polyline's segments, with pieces shorter than `tol` left out. */
|
|
69
|
+
export declare function pieces(c: Curve3, tol: number): Curve3[];
|
|
70
|
+
/** Homogeneous Bezier pieces of one degree with their parameter breaks (pieces.length + 1 of them). */
|
|
71
|
+
export interface Beziers {
|
|
72
|
+
readonly p: number;
|
|
73
|
+
readonly segs: number[][][];
|
|
74
|
+
readonly breaks: number[];
|
|
75
|
+
}
|
|
76
|
+
/** Splits a homogeneous Bezier piece at local parameter s (de Casteljau). */
|
|
77
|
+
export declare function splitBezier(seg: number[][], s: number): [number[][], number[][]];
|
|
78
|
+
export declare function raiseTo(b: Beziers, p: number): Beziers;
|
|
79
|
+
/** Joins Bezier pieces into one B-spline (interior knots of multiplicity p). */
|
|
80
|
+
export declare function fromBeziers(b: Beziers): Nurbs;
|
|
81
|
+
/** Exact Bezier pieces of any curve (parameters run as the curve's own, a chain's end to end). */
|
|
82
|
+
export declare function beziersOfCurve(c: Curve3): Beziers | undefined;
|
|
83
|
+
/** The curve as one exact B-spline (a chain's pieces raised to one degree), or undefined. */
|
|
84
|
+
export declare function nurbsOf(c: Curve3): Nurbs | undefined;
|
|
85
|
+
/**
|
|
86
|
+
* A cubic B-spline through f over [t0, t1]: Hermite pieces with numerical end tangents, halved until each stays
|
|
87
|
+
* within `tol` of f at its quarter points (at most 10 halvings, 2048 pieces).
|
|
88
|
+
*/
|
|
89
|
+
export declare function fit(f: (t: number) => V3, t0: number, t1: number, tol: number, start?: number): Nurbs;
|
|
90
|
+
/** A B-spline surface: degrees, full knot vectors, control net with u varying fastest (index j * nu + i). */
|
|
91
|
+
export interface NurbsSurface {
|
|
92
|
+
readonly pu: number;
|
|
93
|
+
readonly pv: number;
|
|
94
|
+
readonly U: readonly number[];
|
|
95
|
+
readonly V: readonly number[];
|
|
96
|
+
readonly nu: number;
|
|
97
|
+
readonly nv: number;
|
|
98
|
+
readonly P: readonly V3[];
|
|
99
|
+
readonly W?: readonly number[];
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* A model-space surface in its IGES parameterization. Analytic surfaces (IGES 190 to 198) take u and v in degrees
|
|
103
|
+
* where the specification measures angles; `plane` with no x has no parameterization (IGES 108).
|
|
104
|
+
*/
|
|
105
|
+
export type Surf = {
|
|
106
|
+
readonly kind: 'plane';
|
|
107
|
+
readonly o: V3;
|
|
108
|
+
readonly n: V3;
|
|
109
|
+
readonly x?: V3;
|
|
110
|
+
readonly y?: V3;
|
|
111
|
+
} | {
|
|
112
|
+
readonly kind: 'cylinder' | 'cone' | 'sphere' | 'torus';
|
|
113
|
+
readonly o: V3;
|
|
114
|
+
readonly x: V3;
|
|
115
|
+
readonly y: V3;
|
|
116
|
+
readonly z: V3;
|
|
117
|
+
/** Radius (major radius for a torus). */
|
|
118
|
+
readonly r: number;
|
|
119
|
+
/** Minor radius of a torus; half angle in radians of a cone. */
|
|
120
|
+
readonly r2: number;
|
|
121
|
+
} | {
|
|
122
|
+
readonly kind: 'nurbs';
|
|
123
|
+
readonly s: NurbsSurface;
|
|
124
|
+
readonly dom: readonly number[];
|
|
125
|
+
} | {
|
|
126
|
+
readonly kind: 'revolution';
|
|
127
|
+
readonly a: V3;
|
|
128
|
+
readonly d: V3;
|
|
129
|
+
readonly curve: Curve3;
|
|
130
|
+
readonly sa: number;
|
|
131
|
+
readonly ta: number;
|
|
132
|
+
} | {
|
|
133
|
+
readonly kind: 'extrusion';
|
|
134
|
+
readonly curve: Curve3;
|
|
135
|
+
readonly v: V3;
|
|
136
|
+
} | {
|
|
137
|
+
readonly kind: 'offset';
|
|
138
|
+
readonly base: Surf;
|
|
139
|
+
readonly d: number;
|
|
140
|
+
};
|
|
141
|
+
/** The parameter rectangle [u0, u1, v0, v1] (infinite where the surface is unbounded). */
|
|
142
|
+
export declare function surfDomain(s: Surf): number[];
|
|
143
|
+
/** S(u, v) in model space; undefined for a plane with no parameterization. */
|
|
144
|
+
export declare function surfPoint(s: Surf, u: number, v: number): V3 | undefined;
|
|
145
|
+
/** The unit normal Su x Sv at (u, v), from central differences (the given normal for an unparameterized plane). */
|
|
146
|
+
export declare function surfNormal(s: Surf, u: number, v: number): V3 | undefined;
|
|
147
|
+
/** The surface under an affine map. */
|
|
148
|
+
export declare function transformSurf(s: Surf, m: Xf): Surf;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { type Curve3, type NurbsSurface } from './geometry.js';
|
|
2
|
+
/**
|
|
3
|
+
* A conic arc (IGES 104) from A x^2 + B xy + C y^2 + D x + E y + F = 0 in the plane z = zt, from start to end: an
|
|
4
|
+
* ellipse as a conic (counterclockwise), a parabola or hyperbola as rational quadratic Bezier pieces (each piece's
|
|
5
|
+
* middle weight from the point where the line from its chord's middle to its tangents' meeting point crosses the conic).
|
|
6
|
+
* Undefined for a degenerate conic.
|
|
7
|
+
*/
|
|
8
|
+
export declare function conicArc(q: readonly number[], zt: number, start: readonly number[], end: readonly number[], form: number): Curve3 | undefined;
|
|
9
|
+
/** A parametric spline curve (IGES 112): its cubic segments as Bezier pieces, so exactly its curve and parameter. */
|
|
10
|
+
export declare function polynomialCurve(breaks: readonly number[], coefficients: readonly number[][]): Curve3 | undefined;
|
|
11
|
+
/**
|
|
12
|
+
* A parametric spline surface (IGES 114, section 4.15 and Appendix B.5) as one bicubic B-spline surface, exactly its
|
|
13
|
+
* surface and parameters. Patch (i, j) holds per coordinate the 16 coefficients A, B, C, D, E, F, G, H, K, L, M, N, P,
|
|
14
|
+
* Q, R, S of s^a t^b in the order (a, b) = (0, 0), (1, 0), (2, 0), (3, 0), (0, 1), ..., (3, 3) (s = u - TU(i),
|
|
15
|
+
* t = v - TV(j)), X then Y then Z. Each patch becomes a bicubic Bezier patch over its rectangle; the patches meet on
|
|
16
|
+
* knots of multiplicity 3, so the net is (3 M + 1) by (3 N + 1). Neighbouring patches must agree on their shared edge
|
|
17
|
+
* (the specification's surface is continuous): `gap` is the largest distance between the control points two patches
|
|
18
|
+
* give the same place, which the caller checks against its tolerance; the net takes their mean.
|
|
19
|
+
*/
|
|
20
|
+
export declare function polynomialSurface(tu: readonly number[], tv: readonly number[], patch: (i: number, j: number) => readonly number[]): {
|
|
21
|
+
surface: NurbsSurface;
|
|
22
|
+
gap: number;
|
|
23
|
+
} | undefined;
|
|
24
|
+
/**
|
|
25
|
+
* A ruled surface (IGES 118) between two rails as a B-spline surface, u along the rails and v from rail 1 (v = 0) to
|
|
26
|
+
* rail 2. Exact when both rails' B-splines keep their parameter's meaning (form 1 with rails that are not conics, or
|
|
27
|
+
* both conics of the same sweep; form 0 with two lines or two circles of the same sweep); otherwise both rails are
|
|
28
|
+
* sampled at the same relative parameter (or arc length, form 0) and joined by Hermite cubics.
|
|
29
|
+
*/
|
|
30
|
+
export declare function ruledSurface(c1: Curve3, c2: Curve3, flip: boolean, arcLength: boolean): NurbsSurface;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type IGESGlobal } from './file.js';
|
|
2
|
+
/** What {@link igesToSTEP} produces. */
|
|
3
|
+
export interface IGESConversion {
|
|
4
|
+
/** An AP214 STEP file in millimetres: one product whose shape holds every solid and surface model. */
|
|
5
|
+
readonly step: string;
|
|
6
|
+
readonly global: IGESGlobal;
|
|
7
|
+
/** Millimetres per IGES model unit (the units flag over the model space scale). */
|
|
8
|
+
readonly unit: number;
|
|
9
|
+
/** Solids (186, closed 514), open shells (514) and faces (all of them, trimmed surfaces included) converted. */
|
|
10
|
+
readonly counts: {
|
|
11
|
+
readonly solids: number;
|
|
12
|
+
readonly shells: number;
|
|
13
|
+
readonly faces: number;
|
|
14
|
+
};
|
|
15
|
+
/** What was left out and why (unsupported entities, faces whose geometry could not be built). */
|
|
16
|
+
readonly warnings: readonly string[];
|
|
17
|
+
}
|
|
18
|
+
/** Converts an IGES file to STEP for the kernel. Throws a TypeError for a malformed file or one with no surfaces. */
|
|
19
|
+
export declare function igesToSTEP(input: string | ArrayBuffer | ArrayBufferView): IGESConversion;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { STEPFile, type STEPHeader } from './step/file.js';
|
|
2
|
+
import { type STEPStructure, type STEPStructureOptions } from './step/structure.js';
|
|
3
|
+
import { type BodyMesh, type TessellationOptions } from './mesh/tessellate.js';
|
|
4
|
+
export { validateSTEP } from './mesh/validate.js';
|
|
5
|
+
export type { STEPMeasured, STEPValidationCheck, ValidationOptions } from './mesh/validate.js';
|
|
6
|
+
export { satToSTEP } from './sat/read.js';
|
|
7
|
+
export type { SATConversion } from './sat/read.js';
|
|
8
|
+
export { readXT } from './xt/read.js';
|
|
9
|
+
export type { XTFile, XTNode, XTValue } from './xt/read.js';
|
|
10
|
+
export { xtToSTEP } from './xt/step.js';
|
|
11
|
+
export type { XTConversion, XTOptions } from './xt/step.js';
|
|
12
|
+
export { igesToSTEP } from './iges/step.js';
|
|
13
|
+
export type { IGESConversion } from './iges/step.js';
|
|
14
|
+
export { isIGES, readIGES } from './iges/file.js';
|
|
15
|
+
export type { IGESEntity, IGESFile, IGESGlobal, IGESValue } from './iges/file.js';
|
|
16
|
+
import type { JTModel } from './jt/read.js';
|
|
17
|
+
export { STEPFile, Ref, Enum, Typed, DERIVED, stepText } from './step/file.js';
|
|
18
|
+
export type { STEPEntity, STEPHeader, STEPValue } from './step/file.js';
|
|
19
|
+
export { readStructure } from './step/structure.js';
|
|
20
|
+
export type { STEPBody, STEPColor, STEPInstance, STEPOccurrence, STEPPoint, STEPProduct, STEPStructure, STEPStructureOptions, STEPValidationProperty, } from './step/structure.js';
|
|
21
|
+
export { Tessellator } from './mesh/tessellate.js';
|
|
22
|
+
export type { BodyMesh, BodyMeshFace, TessellationOptions } from './mesh/tessellate.js';
|
|
23
|
+
/** Options of {@link parseSTEP}. */
|
|
24
|
+
export type STEPOptions = STEPStructureOptions;
|
|
25
|
+
/** A parsed STEP file: its header, structure and entity table. */
|
|
26
|
+
export interface STEPModel extends STEPStructure {
|
|
27
|
+
readonly header: STEPHeader;
|
|
28
|
+
/** Every entity instance, parsed on demand (for the geometry stages and for inspection). */
|
|
29
|
+
readonly file: STEPFile;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Reads a STEP file (ISO 10303-21; AP203, AP214 or AP242) into its products, assembly tree, B-rep bodies, length units
|
|
33
|
+
* and colours, without evaluating geometry. Text or bytes (read as ISO 8859-1, the standard's character set). Throws a
|
|
34
|
+
* TypeError that names the line for a malformed file.
|
|
35
|
+
* @example
|
|
36
|
+
* const model = parseSTEP(await (await fetch('/part.step')).arrayBuffer());
|
|
37
|
+
* for (const instance of model.instances) console.log(model.products[instance.product]?.name, model.bodies[instance.body].faces.length);
|
|
38
|
+
*/
|
|
39
|
+
export declare function parseSTEP(input: string | ArrayBuffer | ArrayBufferView, options?: STEPOptions): STEPModel;
|
|
40
|
+
/**
|
|
41
|
+
* Tessellates every body of a parsed STEP file from its exact geometry: one mesh per body (place it with each of the
|
|
42
|
+
* body's `instances`), with exact surface normals, hard B-rep edges and a run of triangles per face. Faces the kernel
|
|
43
|
+
* cannot evaluate are listed in each mesh's `failures`. Throws a RangeError for an option out of range.
|
|
44
|
+
* @example
|
|
45
|
+
* const model = parseSTEP(bytes);
|
|
46
|
+
* const meshes = tessellateSTEP(model, { relativeDeflection: 0.001, angle: 0.5 });
|
|
47
|
+
* for (const instance of model.instances) draw(meshes[instance.body], instance.matrix);
|
|
48
|
+
*/
|
|
49
|
+
export declare function tessellateSTEP(model: STEPModel, options?: TessellationOptions): BodyMesh[];
|
|
50
|
+
/**
|
|
51
|
+
* Reads an ACIS SAT file (as AutoCAD, Inventor, SpaceClaim and others write it, or a DXF 3DSOLID's SAT data) through
|
|
52
|
+
* {@link satToSTEP}, so it meshes with {@link tessellateSTEP} like a STEP file. What the conversion left out comes first
|
|
53
|
+
* in `warnings`. Throws a TypeError for a file it cannot read.
|
|
54
|
+
*/
|
|
55
|
+
export declare function parseSAT(input: string | ArrayBuffer | ArrayBufferView, options?: STEPOptions): STEPModel;
|
|
56
|
+
/**
|
|
57
|
+
* Reads a Parasolid transmit file (.x_t text or .x_b neutral binary, as NX, Solid Edge, SolidWorks, Onshape and others
|
|
58
|
+
* write it) through {@link xtToSTEP}, so it meshes with {@link tessellateSTEP} like a STEP file. What the conversion
|
|
59
|
+
* left out comes first in `warnings`. Throws a TypeError for a file it cannot read.
|
|
60
|
+
*/
|
|
61
|
+
export declare function parseXT(input: string | ArrayBuffer | ArrayBufferView, options?: STEPOptions): STEPModel;
|
|
62
|
+
/**
|
|
63
|
+
* Reads an IGES 5.3 file (fixed ASCII format, as most CAD tools export .igs/.iges) through {@link igesToSTEP}, so it
|
|
64
|
+
* meshes with {@link tessellateSTEP} like a STEP file: manifold solid B-rep objects become solids, trimmed and bounded
|
|
65
|
+
* surfaces the faces of a surface model, in millimetres. What the conversion left out comes first in `warnings`.
|
|
66
|
+
* Throws a TypeError for a file it cannot read, or one with no surfaces or solids.
|
|
67
|
+
* @example
|
|
68
|
+
* const model = parseIGES(await (await fetch('/part.igs')).arrayBuffer());
|
|
69
|
+
* const meshes = tessellateSTEP(model);
|
|
70
|
+
*/
|
|
71
|
+
export declare function parseIGES(input: string | ArrayBuffer | ArrayBufferView, options?: STEPOptions): STEPModel;
|
|
72
|
+
export { parseJT } from './jt/read.js';
|
|
73
|
+
export type { JTInstance, JTModel, JTOptions, JTPart, JTShape } from './jt/read.js';
|
|
74
|
+
export type { JTAttribute, JTLateLoaded, JTNode, JTNodeKind, JTPropertyValue, JTSceneGraph, JTShapeKind, } from './jt/lsg.js';
|
|
75
|
+
/**
|
|
76
|
+
* Tessellates the exact B-rep of every part of a parsed JT file (see {@link tessellateSTEP}): per part, one mesh per
|
|
77
|
+
* body of its `brep`, or undefined for a part without one. Place each with the part's instances, then the body's own
|
|
78
|
+
* instances within its `brep`. Throws a RangeError for an option out of range.
|
|
79
|
+
* @example
|
|
80
|
+
* const model = parseJT(bytes);
|
|
81
|
+
* const meshes = tessellateJT(model);
|
|
82
|
+
* for (const instance of model.instances) {
|
|
83
|
+
* const brep = model.parts[instance.part].brep;
|
|
84
|
+
* for (const placed of brep?.instances ?? []) draw(meshes[instance.part]![placed.body], instance.matrix, placed.matrix);
|
|
85
|
+
* }
|
|
86
|
+
*/
|
|
87
|
+
export declare function tessellateJT(model: JTModel, options?: TessellationOptions): (BodyMesh[] | undefined)[];
|
|
88
|
+
/** The modeler (B-rep topology, primitives, Booleans, fillets and chamfers, STEP export): see model/index.ts. */
|
|
89
|
+
export * as model from './model/index.js';
|
|
90
|
+
export { orient3d } from './geometry/exact.js';
|