@selvajs/compute 3.1.0-beta.4 → 3.1.0-beta.5
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/dist/chunk-54O6BO24.js +4 -0
- package/dist/chunk-54O6BO24.js.map +1 -0
- package/dist/chunk-7KFBCOZM.cjs +2 -0
- package/dist/chunk-7KFBCOZM.cjs.map +1 -0
- package/dist/chunk-EZRBMUXT.cjs +62 -0
- package/dist/chunk-EZRBMUXT.cjs.map +1 -0
- package/dist/chunk-GF6ZIJWX.cjs +4 -0
- package/dist/chunk-GF6ZIJWX.cjs.map +1 -0
- package/dist/chunk-ORGJSKR4.js +62 -0
- package/dist/chunk-ORGJSKR4.js.map +1 -0
- package/dist/chunk-PJATLYMU.js +2 -0
- package/dist/chunk-PJATLYMU.js.map +1 -0
- package/dist/core.cjs +1 -1
- package/dist/core.d.cts +40 -3
- package/dist/core.d.ts +40 -3
- package/dist/core.js +1 -1
- package/dist/grasshopper.cjs +1 -1
- package/dist/grasshopper.cjs.map +1 -1
- package/dist/grasshopper.d.cts +220 -20
- package/dist/grasshopper.d.ts +220 -20
- package/dist/grasshopper.js +1 -1
- package/dist/{handle-files-9pkEgDIp.d.cts → handle-files-DMnx92gr.d.cts} +46 -10
- package/dist/{handle-files-9pkEgDIp.d.ts → handle-files-DMnx92gr.d.ts} +46 -10
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +1 -1
- package/dist/{types-V7G83j5m.d.cts → types-C9YpTbr3.d.cts} +27 -6
- package/dist/{types-V7G83j5m.d.ts → types-C9YpTbr3.d.ts} +27 -6
- package/dist/{types-DxPi5SEx.d.cts → types-Ci8Z0-hF.d.cts} +60 -17
- package/dist/{types-BBSF_ISX.d.ts → types-DuOh5XqS.d.ts} +60 -17
- package/dist/visualization-C3YOGQTW.js +2 -0
- package/dist/visualization-CERJ6XDX.cjs +2 -0
- package/dist/visualization-CERJ6XDX.cjs.map +1 -0
- package/dist/visualization.cjs +1 -1
- package/dist/visualization.d.cts +62 -8
- package/dist/visualization.d.ts +62 -8
- package/dist/visualization.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-33753HSV.cjs +0 -2
- package/dist/chunk-33753HSV.cjs.map +0 -1
- package/dist/chunk-4JNRO7TX.cjs +0 -62
- package/dist/chunk-4JNRO7TX.cjs.map +0 -1
- package/dist/chunk-6V6SUB4V.js +0 -62
- package/dist/chunk-6V6SUB4V.js.map +0 -1
- package/dist/chunk-D7A3YIYD.cjs +0 -4
- package/dist/chunk-D7A3YIYD.cjs.map +0 -1
- package/dist/chunk-EMXDP7KY.js +0 -4
- package/dist/chunk-EMXDP7KY.js.map +0 -1
- package/dist/chunk-MDFVHHH6.js +0 -2
- package/dist/chunk-MDFVHHH6.js.map +0 -1
- package/dist/visualization-3XYZHAIV.js +0 -2
- package/dist/visualization-DEAMRV7R.cjs +0 -2
- package/dist/visualization-DEAMRV7R.cjs.map +0 -1
- /package/dist/{visualization-3XYZHAIV.js.map → visualization-C3YOGQTW.js.map} +0 -0
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { Logger, camelcaseKeys, enableDebugLogging, fetchRhinoCompute, getLogger, setLogger, toCamelCase } from './core.cjs';
|
|
2
|
-
export { C as ComputeServerStats, E as ErrorCode, a as ErrorCodes, F as FileBaseInfo, b as FileData, P as ProcessedFile, R as RhinoComputeError, d as downloadFileData, e as extractFilesFromComputeResponse } from './handle-files-
|
|
3
|
-
export { C as ComputeConfig, R as RetryPolicy, a as RhinoModelUnit, S as ServerTiming } from './types-
|
|
4
|
-
export { CacheOptions, DataTreeValue, GetValuesOptions, GetValuesResult, GrasshopperClient, GrasshopperResponseProcessor, ParsedContext, SchedulerMode, SolveContext, SolveOptions, SolveResult, SolveScheduler, SolveSchedulerOptions, TreeBuilder, fetchDefinitionIO, fetchParsedDefinitionIO, processInput, processInputs, solveGrasshopperDefinition } from './grasshopper.cjs';
|
|
5
|
-
export { B as BooleanInputType, D as DataItem, a as DataTree, b as DataTreeDefault, c as DataTreePath, d as DefaultValue, F as FileInputType, G as GeometryInputType, e as GrasshopperComputeConfig, f as GrasshopperComputeResponse, g as GrasshopperParsedIO, h as GrasshopperParsedIORaw, i as GrasshopperRequestSchema, I as InnerTreeData, j as InputParam, k as InputParamSchema, N as NumericInputType, O as OutputParamSchema, l as OutputType, T as TextInputType, V as ValueListInputType } from './types-
|
|
2
|
+
export { C as ComputeServerStats, E as ErrorCode, a as ErrorCodes, F as FileBaseInfo, b as FileData, P as ProcessedFile, R as RhinoComputeError, d as downloadFileData, e as extractFilesFromComputeResponse } from './handle-files-DMnx92gr.cjs';
|
|
3
|
+
export { C as ComputeConfig, R as RetryPolicy, a as RhinoModelUnit, S as ServerTiming } from './types-C9YpTbr3.cjs';
|
|
4
|
+
export { CacheOptions, DataTreeValue, DefinitionRef, GetValuesOptions, GetValuesResult, GrasshopperClient, GrasshopperResponseProcessor, ParsedContext, SchedulerMode, SolveContext, SolveDefinition, SolveOptions, SolveResult, SolveScheduler, SolveSchedulerOptions, TreeBuilder, fetchDefinitionIO, fetchParsedDefinitionIO, hashDefinition, hashSolveInput, isDefinitionRef, processInput, processInputs, solveGrasshopperDefinition, stableStringify } from './grasshopper.cjs';
|
|
5
|
+
export { B as BooleanInputType, D as DataItem, a as DataTree, b as DataTreeDefault, c as DataTreePath, d as DefaultValue, F as FileInputType, G as GeometryInputType, e as GrasshopperComputeConfig, f as GrasshopperComputeResponse, g as GrasshopperParsedIO, h as GrasshopperParsedIORaw, i as GrasshopperRequestSchema, I as InnerTreeData, j as InputParam, k as InputParamSchema, N as NumericInputType, O as OutputParamSchema, l as OutputType, T as TextInputType, V as ValueListInputType } from './types-Ci8Z0-hF.cjs';
|
|
6
6
|
import 'three';
|
|
7
7
|
import 'rhino3dm';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { Logger, camelcaseKeys, enableDebugLogging, fetchRhinoCompute, getLogger, setLogger, toCamelCase } from './core.js';
|
|
2
|
-
export { C as ComputeServerStats, E as ErrorCode, a as ErrorCodes, F as FileBaseInfo, b as FileData, P as ProcessedFile, R as RhinoComputeError, d as downloadFileData, e as extractFilesFromComputeResponse } from './handle-files-
|
|
3
|
-
export { C as ComputeConfig, R as RetryPolicy, a as RhinoModelUnit, S as ServerTiming } from './types-
|
|
4
|
-
export { CacheOptions, DataTreeValue, GetValuesOptions, GetValuesResult, GrasshopperClient, GrasshopperResponseProcessor, ParsedContext, SchedulerMode, SolveContext, SolveOptions, SolveResult, SolveScheduler, SolveSchedulerOptions, TreeBuilder, fetchDefinitionIO, fetchParsedDefinitionIO, processInput, processInputs, solveGrasshopperDefinition } from './grasshopper.js';
|
|
5
|
-
export { B as BooleanInputType, D as DataItem, a as DataTree, b as DataTreeDefault, c as DataTreePath, d as DefaultValue, F as FileInputType, G as GeometryInputType, e as GrasshopperComputeConfig, f as GrasshopperComputeResponse, g as GrasshopperParsedIO, h as GrasshopperParsedIORaw, i as GrasshopperRequestSchema, I as InnerTreeData, j as InputParam, k as InputParamSchema, N as NumericInputType, O as OutputParamSchema, l as OutputType, T as TextInputType, V as ValueListInputType } from './types-
|
|
2
|
+
export { C as ComputeServerStats, E as ErrorCode, a as ErrorCodes, F as FileBaseInfo, b as FileData, P as ProcessedFile, R as RhinoComputeError, d as downloadFileData, e as extractFilesFromComputeResponse } from './handle-files-DMnx92gr.js';
|
|
3
|
+
export { C as ComputeConfig, R as RetryPolicy, a as RhinoModelUnit, S as ServerTiming } from './types-C9YpTbr3.js';
|
|
4
|
+
export { CacheOptions, DataTreeValue, DefinitionRef, GetValuesOptions, GetValuesResult, GrasshopperClient, GrasshopperResponseProcessor, ParsedContext, SchedulerMode, SolveContext, SolveDefinition, SolveOptions, SolveResult, SolveScheduler, SolveSchedulerOptions, TreeBuilder, fetchDefinitionIO, fetchParsedDefinitionIO, hashDefinition, hashSolveInput, isDefinitionRef, processInput, processInputs, solveGrasshopperDefinition, stableStringify } from './grasshopper.js';
|
|
5
|
+
export { B as BooleanInputType, D as DataItem, a as DataTree, b as DataTreeDefault, c as DataTreePath, d as DefaultValue, F as FileInputType, G as GeometryInputType, e as GrasshopperComputeConfig, f as GrasshopperComputeResponse, g as GrasshopperParsedIO, h as GrasshopperParsedIORaw, i as GrasshopperRequestSchema, I as InnerTreeData, j as InputParam, k as InputParamSchema, N as NumericInputType, O as OutputParamSchema, l as OutputType, T as TextInputType, V as ValueListInputType } from './types-DuOh5XqS.js';
|
|
6
6
|
import 'three';
|
|
7
7
|
import 'rhino3dm';
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as d,b as g,c as h,d as i,e as j,f as k,g as l,h as n,i as q}from"./chunk-
|
|
1
|
+
import{a as d,b as g,c as h,d as i,e as j,f as k,g as l,h as n,i as q,j as s,k as u,l as v,m as w}from"./chunk-PJATLYMU.js";import{c as o,d as r,e,f,g as m,l as p,n as t,o as x,p as a,s as b,t as c}from"./chunk-54O6BO24.js";export{t as ComputeServerStats,o as ErrorCodes,l as GrasshopperClient,n as GrasshopperResponseProcessor,r as RhinoComputeError,k as SolveScheduler,w as TreeBuilder,a as camelcaseKeys,c as downloadFileData,m as enableDebugLogging,b as extractFilesFromComputeResponse,u as fetchDefinitionIO,v as fetchParsedDefinitionIO,p as fetchRhinoCompute,e as getLogger,j as hashDefinition,i as hashSolveInput,d as isDefinitionRef,q as processInput,s as processInputs,f as setLogger,g as solveGrasshopperDefinition,h as stableStringify,x as toCamelCase};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -6,7 +6,16 @@ type RhinoModelUnit = 'None' | 'Microns' | 'Millimeters' | 'Centimeters' | 'Mete
|
|
|
6
6
|
* Retry policy for transient errors (network, 502, 503, 504, optionally 429).
|
|
7
7
|
*
|
|
8
8
|
* Retries use exponential backoff with jitter, capped at `maxDelayMs`.
|
|
9
|
-
* If the server returns `Retry-After`, that value is honored instead
|
|
9
|
+
* If the server returns `Retry-After`, that value is honored instead — even
|
|
10
|
+
* above `maxDelayMs` (the server's stated window wins), up to an absolute
|
|
11
|
+
* 60s safety cap.
|
|
12
|
+
*
|
|
13
|
+
* Duplicate-POST caveat: every compute request is a POST. A network error can
|
|
14
|
+
* strike after the body was sent but before the response arrived — in that
|
|
15
|
+
* window the server may already have executed the request, and a retry runs it
|
|
16
|
+
* again. Compute solves are deterministic/idempotent so this is normally just
|
|
17
|
+
* wasted work, but callers wrapping non-idempotent endpoints should keep
|
|
18
|
+
* `attempts` at 0 (the default).
|
|
10
19
|
*/
|
|
11
20
|
interface RetryPolicy {
|
|
12
21
|
/** Maximum number of retry attempts after the initial request (default: 0). */
|
|
@@ -53,8 +62,14 @@ interface ComputeConfig {
|
|
|
53
62
|
/** @deprecated Renamed to `suppressBrowserWarning`. */
|
|
54
63
|
suppressClientSideWarning?: boolean;
|
|
55
64
|
/**
|
|
56
|
-
* Per
|
|
57
|
-
* solves where any timeout is the wrong answer). Default: no timeout.
|
|
65
|
+
* Per-**attempt** timeout in milliseconds. Set to `0` to disable (useful for
|
|
66
|
+
* long solves where any timeout is the wrong answer). Default: no timeout.
|
|
67
|
+
*
|
|
68
|
+
* This is NOT a total deadline: the timeout is re-armed for every retry
|
|
69
|
+
* attempt, so with `retry: { attempts: N }` the worst-case wall clock is
|
|
70
|
+
* `(N + 1) × timeoutMs` plus backoff sleeps between attempts. Callers that
|
|
71
|
+
* need a hard overall deadline should pass their own `signal` (e.g. from
|
|
72
|
+
* `AbortSignal.timeout(totalMs)`), which wins over any pending retry.
|
|
58
73
|
*
|
|
59
74
|
* Uses `AbortSignal.timeout` so the timer is not throttled when the tab is hidden.
|
|
60
75
|
*/
|
|
@@ -74,12 +89,18 @@ interface ComputeConfig {
|
|
|
74
89
|
* breakdown when the response carries one (the `/grasshopper` solve endpoint
|
|
75
90
|
* emits `decode;dur=N, solve;dur=N, encode;dur=N` on every response).
|
|
76
91
|
*
|
|
77
|
-
* Fires
|
|
78
|
-
*
|
|
92
|
+
* Fires once per request, before the parsed body is returned — on success
|
|
93
|
+
* and on the HTTP-500 partial-success path (a solve that completed with
|
|
94
|
+
* Grasshopper errors still carries real timings, often the slowest ones).
|
|
95
|
+
* The transport stays response-type-agnostic — this is a side
|
|
79
96
|
* channel for telemetry, it does not change what a call returns. Use it to
|
|
80
97
|
* feed a perf monitor or surface "solve took Nms" without server log access.
|
|
98
|
+
*
|
|
99
|
+
* `requestId` is the same id sent as the `X-Request-ID` header and used in
|
|
100
|
+
* this library's own debug logs — use it to correlate a timing entry with
|
|
101
|
+
* a specific request when multiple solves are in flight concurrently.
|
|
81
102
|
*/
|
|
82
|
-
onServerTiming?: (timing: ServerTiming) => void;
|
|
103
|
+
onServerTiming?: (timing: ServerTiming, requestId: string) => void;
|
|
83
104
|
}
|
|
84
105
|
/**
|
|
85
106
|
* Parsed `Server-Timing` metrics from a Compute response. Durations are in
|
|
@@ -6,7 +6,16 @@ type RhinoModelUnit = 'None' | 'Microns' | 'Millimeters' | 'Centimeters' | 'Mete
|
|
|
6
6
|
* Retry policy for transient errors (network, 502, 503, 504, optionally 429).
|
|
7
7
|
*
|
|
8
8
|
* Retries use exponential backoff with jitter, capped at `maxDelayMs`.
|
|
9
|
-
* If the server returns `Retry-After`, that value is honored instead
|
|
9
|
+
* If the server returns `Retry-After`, that value is honored instead — even
|
|
10
|
+
* above `maxDelayMs` (the server's stated window wins), up to an absolute
|
|
11
|
+
* 60s safety cap.
|
|
12
|
+
*
|
|
13
|
+
* Duplicate-POST caveat: every compute request is a POST. A network error can
|
|
14
|
+
* strike after the body was sent but before the response arrived — in that
|
|
15
|
+
* window the server may already have executed the request, and a retry runs it
|
|
16
|
+
* again. Compute solves are deterministic/idempotent so this is normally just
|
|
17
|
+
* wasted work, but callers wrapping non-idempotent endpoints should keep
|
|
18
|
+
* `attempts` at 0 (the default).
|
|
10
19
|
*/
|
|
11
20
|
interface RetryPolicy {
|
|
12
21
|
/** Maximum number of retry attempts after the initial request (default: 0). */
|
|
@@ -53,8 +62,14 @@ interface ComputeConfig {
|
|
|
53
62
|
/** @deprecated Renamed to `suppressBrowserWarning`. */
|
|
54
63
|
suppressClientSideWarning?: boolean;
|
|
55
64
|
/**
|
|
56
|
-
* Per
|
|
57
|
-
* solves where any timeout is the wrong answer). Default: no timeout.
|
|
65
|
+
* Per-**attempt** timeout in milliseconds. Set to `0` to disable (useful for
|
|
66
|
+
* long solves where any timeout is the wrong answer). Default: no timeout.
|
|
67
|
+
*
|
|
68
|
+
* This is NOT a total deadline: the timeout is re-armed for every retry
|
|
69
|
+
* attempt, so with `retry: { attempts: N }` the worst-case wall clock is
|
|
70
|
+
* `(N + 1) × timeoutMs` plus backoff sleeps between attempts. Callers that
|
|
71
|
+
* need a hard overall deadline should pass their own `signal` (e.g. from
|
|
72
|
+
* `AbortSignal.timeout(totalMs)`), which wins over any pending retry.
|
|
58
73
|
*
|
|
59
74
|
* Uses `AbortSignal.timeout` so the timer is not throttled when the tab is hidden.
|
|
60
75
|
*/
|
|
@@ -74,12 +89,18 @@ interface ComputeConfig {
|
|
|
74
89
|
* breakdown when the response carries one (the `/grasshopper` solve endpoint
|
|
75
90
|
* emits `decode;dur=N, solve;dur=N, encode;dur=N` on every response).
|
|
76
91
|
*
|
|
77
|
-
* Fires
|
|
78
|
-
*
|
|
92
|
+
* Fires once per request, before the parsed body is returned — on success
|
|
93
|
+
* and on the HTTP-500 partial-success path (a solve that completed with
|
|
94
|
+
* Grasshopper errors still carries real timings, often the slowest ones).
|
|
95
|
+
* The transport stays response-type-agnostic — this is a side
|
|
79
96
|
* channel for telemetry, it does not change what a call returns. Use it to
|
|
80
97
|
* feed a perf monitor or surface "solve took Nms" without server log access.
|
|
98
|
+
*
|
|
99
|
+
* `requestId` is the same id sent as the `X-Request-ID` header and used in
|
|
100
|
+
* this library's own debug logs — use it to correlate a timing entry with
|
|
101
|
+
* a specific request when multiple solves are in flight concurrently.
|
|
81
102
|
*/
|
|
82
|
-
onServerTiming?: (timing: ServerTiming) => void;
|
|
103
|
+
onServerTiming?: (timing: ServerTiming, requestId: string) => void;
|
|
83
104
|
}
|
|
84
105
|
/**
|
|
85
106
|
* Parsed `Server-Timing` metrics from a Compute response. Durations are in
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as ComputeConfig, a as RhinoModelUnit } from './types-
|
|
1
|
+
import { C as ComputeConfig, a as RhinoModelUnit } from './types-C9YpTbr3.cjs';
|
|
2
2
|
import { RhinoModule } from 'rhino3dm';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -42,16 +42,39 @@ type InnerTreeData = {
|
|
|
42
42
|
[path in DataTreePath]: DataItem[];
|
|
43
43
|
};
|
|
44
44
|
/**
|
|
45
|
-
* Tree with parameter metadata (used in compute responses)
|
|
45
|
+
* Tree with parameter metadata (used in compute requests and responses).
|
|
46
|
+
*
|
|
47
|
+
* Field casing varies by server branch: stock mcneel compute (8.x/9.x)
|
|
48
|
+
* serializes `Resthopper.IO.DataTree` in PascalCase (`ParamName`/`InnerTree`
|
|
49
|
+
* — the C# class carries no `[JsonProperty]` attributes), while
|
|
50
|
+
* camelCase-serializing forks return `paramName`/`innerTree` instead. This
|
|
51
|
+
* client always *sends* PascalCase (see `DataTree.toCompute()` in
|
|
52
|
+
* `data-tree.ts`), so the PascalCase fields remain the canonical/required
|
|
53
|
+
* shape; the optional camelCase fields exist so responses from camelCase
|
|
54
|
+
* forks are representable without casts. Code that must read trees across
|
|
55
|
+
* both server families should use `readField`/`hasField`
|
|
56
|
+
* (`@/core/utils/read-field`, case-insensitive) rather than direct property
|
|
57
|
+
* access — `warnOnEmptyInnerTrees` in `solve.ts` is the reference example.
|
|
46
58
|
*/
|
|
47
59
|
interface DataTree {
|
|
60
|
+
/** PascalCase — stock mcneel servers, and the request shape this client sends. */
|
|
48
61
|
InnerTree: InnerTreeData;
|
|
62
|
+
/** PascalCase — stock mcneel servers, and the request shape this client sends. */
|
|
49
63
|
ParamName: string;
|
|
64
|
+
/** camelCase — sent instead of `InnerTree` by camelCase server forks. */
|
|
65
|
+
innerTree?: InnerTreeData;
|
|
66
|
+
/** camelCase — sent instead of `ParamName` by camelCase server forks. */
|
|
67
|
+
paramName?: string;
|
|
50
68
|
}
|
|
51
69
|
/**
|
|
52
|
-
* Output types supported from Grasshopper/Rhino Compute
|
|
70
|
+
* Output types supported from Grasshopper/Rhino Compute.
|
|
71
|
+
*
|
|
72
|
+
* The trailing `(string & {})` keeps the union open — servers can return any
|
|
73
|
+
* GOO type name — without collapsing the whole union to `string` the way a
|
|
74
|
+
* bare `| string` does, so the known literals keep driving autocomplete and
|
|
75
|
+
* `Extract<>`-style narrowing.
|
|
53
76
|
*/
|
|
54
|
-
type OutputType = 'System.String' | 'System.Double' | 'System.Int32' | 'System.Boolean' | 'Rhino.Geometry.Point3d' | 'Rhino.Geometry.Line' | 'Rhino.Geometry.Circle' | 'Rhino.Geometry.Arc' | 'Rhino.Geometry.NurbsCurve' | 'Rhino.Geometry.Brep' | 'Rhino.Geometry.Mesh' | 'Rhino.Geometry.Vector3d' | 'Rhino.Geometry.Plane' | 'Rhino.Geometry.Box' | string;
|
|
77
|
+
type OutputType = 'System.String' | 'System.Double' | 'System.Int32' | 'System.Boolean' | 'Rhino.Geometry.Point3d' | 'Rhino.Geometry.Line' | 'Rhino.Geometry.Circle' | 'Rhino.Geometry.Arc' | 'Rhino.Geometry.NurbsCurve' | 'Rhino.Geometry.Brep' | 'Rhino.Geometry.Mesh' | 'Rhino.Geometry.Vector3d' | 'Rhino.Geometry.Plane' | 'Rhino.Geometry.Box' | (string & {});
|
|
55
78
|
/**
|
|
56
79
|
* Union type for all possible default value types
|
|
57
80
|
*/
|
|
@@ -207,11 +230,24 @@ interface GrasshopperRequestSchema extends GrasshopperBaseSchema, GrasshopperDef
|
|
|
207
230
|
/**
|
|
208
231
|
* Response from Grasshopper compute server
|
|
209
232
|
* Includes all schema fields + computed results
|
|
233
|
+
*
|
|
234
|
+
* `pointer` is deliberately excluded (`Omit`): the solve layer (`runSolve` in
|
|
235
|
+
* `solve.ts`) splits the server's echoed `pointer` off as the solve's
|
|
236
|
+
* `cacheKey` and strips it from the returned response, so client-returned
|
|
237
|
+
* responses never carry it.
|
|
238
|
+
*
|
|
239
|
+
* The schema-echo fields (`cachesolve`/`modelunits`/`dataversion`) stay
|
|
240
|
+
* optional as inherited from {@link GrasshopperBaseSchema}: the server echoes
|
|
241
|
+
* them back when set, but nothing client-side enforces their presence — don't
|
|
242
|
+
* rely on them without a fallback.
|
|
210
243
|
*/
|
|
211
|
-
interface GrasshopperComputeResponse extends GrasshopperBaseSchema, GrasshopperDefinitionSource {
|
|
212
|
-
/**
|
|
213
|
-
|
|
214
|
-
|
|
244
|
+
interface GrasshopperComputeResponse extends GrasshopperBaseSchema, Omit<GrasshopperDefinitionSource, 'pointer'> {
|
|
245
|
+
/**
|
|
246
|
+
* Model units the definition was solved in. Every conforming server response
|
|
247
|
+
* carries this (it drives downstream scaling, e.g. the webdisplay parser),
|
|
248
|
+
* but note it is not validated client-side — a non-conforming server or
|
|
249
|
+
* hand-built mock may omit it at runtime.
|
|
250
|
+
*/
|
|
215
251
|
modelunits: RhinoModelUnit;
|
|
216
252
|
/**
|
|
217
253
|
* The server echoes the request's full base64 definition back as `algo`, but the client strips
|
|
@@ -222,8 +258,6 @@ interface GrasshopperComputeResponse extends GrasshopperBaseSchema, GrasshopperD
|
|
|
222
258
|
algo?: string | null;
|
|
223
259
|
/** Filename of the definition (always present in response) */
|
|
224
260
|
filename: string | null;
|
|
225
|
-
/** Data version */
|
|
226
|
-
dataversion: 7 | 8;
|
|
227
261
|
/** Recursion level used */
|
|
228
262
|
recursionlevel?: number;
|
|
229
263
|
/** Output values organized by parameter */
|
|
@@ -367,7 +401,10 @@ interface DisplayItemBase extends DisplayIdentity {
|
|
|
367
401
|
/** Opacity 0–1. Omitted means fully opaque. */
|
|
368
402
|
opacity?: number;
|
|
369
403
|
}
|
|
370
|
-
/**
|
|
404
|
+
/**
|
|
405
|
+
* A world position in Rhino's Z-up frame, in Rhino's `{X,Y,Z}` casing. Used unchanged on parse —
|
|
406
|
+
* the Three scene IS Rhino's Z-up frame, so no rotation is applied (see `../coordinate-transform.ts`).
|
|
407
|
+
*/
|
|
371
408
|
interface DisplayPosition {
|
|
372
409
|
X: number;
|
|
373
410
|
Y: number;
|
|
@@ -390,7 +427,7 @@ interface DisplayCurve extends DisplayItemBase {
|
|
|
390
427
|
/** A single point, shipped raw (no rhino3dm decode), rendered as one vertex of a `THREE.Points`. */
|
|
391
428
|
interface DisplayPoint extends DisplayItemBase {
|
|
392
429
|
kind: 'point';
|
|
393
|
-
/** World position in Rhino Z-up
|
|
430
|
+
/** World position in Rhino Z-up, used directly — the Three scene shares Rhino's Z-up frame. */
|
|
394
431
|
position: DisplayPosition;
|
|
395
432
|
}
|
|
396
433
|
/**
|
|
@@ -421,11 +458,17 @@ interface SerializableMaterial {
|
|
|
421
458
|
* Metadata for a single mesh within a batch.
|
|
422
459
|
*
|
|
423
460
|
* Offsets and counts are expressed in **vertex-count units** (not float components) and
|
|
424
|
-
* **index-count units
|
|
425
|
-
*
|
|
426
|
-
*
|
|
427
|
-
* -
|
|
428
|
-
* -
|
|
461
|
+
* **index-count units** — i.e. element offsets into the decoded typed arrays, which is how
|
|
462
|
+
* consumers address them (`indices.subarray(indexStart, indexStart + indexCount)`). To address
|
|
463
|
+
* the typed-array storage:
|
|
464
|
+
* - vertex component offset = `vertexStart * 3`
|
|
465
|
+
* - vertex component count = `vertexCount * 3`
|
|
466
|
+
* - index element offset = `indexStart`
|
|
467
|
+
* - index count = `indexCount`
|
|
468
|
+
*
|
|
469
|
+
* If you need *byte* offsets, multiply by the element size, which depends on the blob's flags:
|
|
470
|
+
* indices are 2 bytes each for `FLAG_UINT16_INDICES` (wire v2+) blobs and 4 bytes for uint32
|
|
471
|
+
* blobs; vertex components are 2 bytes (int16 quantized) or 4 bytes (`FLAG_FLOAT32`).
|
|
429
472
|
*/
|
|
430
473
|
interface MeshMetadata {
|
|
431
474
|
name: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as ComputeConfig, a as RhinoModelUnit } from './types-
|
|
1
|
+
import { C as ComputeConfig, a as RhinoModelUnit } from './types-C9YpTbr3.js';
|
|
2
2
|
import { RhinoModule } from 'rhino3dm';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -42,16 +42,39 @@ type InnerTreeData = {
|
|
|
42
42
|
[path in DataTreePath]: DataItem[];
|
|
43
43
|
};
|
|
44
44
|
/**
|
|
45
|
-
* Tree with parameter metadata (used in compute responses)
|
|
45
|
+
* Tree with parameter metadata (used in compute requests and responses).
|
|
46
|
+
*
|
|
47
|
+
* Field casing varies by server branch: stock mcneel compute (8.x/9.x)
|
|
48
|
+
* serializes `Resthopper.IO.DataTree` in PascalCase (`ParamName`/`InnerTree`
|
|
49
|
+
* — the C# class carries no `[JsonProperty]` attributes), while
|
|
50
|
+
* camelCase-serializing forks return `paramName`/`innerTree` instead. This
|
|
51
|
+
* client always *sends* PascalCase (see `DataTree.toCompute()` in
|
|
52
|
+
* `data-tree.ts`), so the PascalCase fields remain the canonical/required
|
|
53
|
+
* shape; the optional camelCase fields exist so responses from camelCase
|
|
54
|
+
* forks are representable without casts. Code that must read trees across
|
|
55
|
+
* both server families should use `readField`/`hasField`
|
|
56
|
+
* (`@/core/utils/read-field`, case-insensitive) rather than direct property
|
|
57
|
+
* access — `warnOnEmptyInnerTrees` in `solve.ts` is the reference example.
|
|
46
58
|
*/
|
|
47
59
|
interface DataTree {
|
|
60
|
+
/** PascalCase — stock mcneel servers, and the request shape this client sends. */
|
|
48
61
|
InnerTree: InnerTreeData;
|
|
62
|
+
/** PascalCase — stock mcneel servers, and the request shape this client sends. */
|
|
49
63
|
ParamName: string;
|
|
64
|
+
/** camelCase — sent instead of `InnerTree` by camelCase server forks. */
|
|
65
|
+
innerTree?: InnerTreeData;
|
|
66
|
+
/** camelCase — sent instead of `ParamName` by camelCase server forks. */
|
|
67
|
+
paramName?: string;
|
|
50
68
|
}
|
|
51
69
|
/**
|
|
52
|
-
* Output types supported from Grasshopper/Rhino Compute
|
|
70
|
+
* Output types supported from Grasshopper/Rhino Compute.
|
|
71
|
+
*
|
|
72
|
+
* The trailing `(string & {})` keeps the union open — servers can return any
|
|
73
|
+
* GOO type name — without collapsing the whole union to `string` the way a
|
|
74
|
+
* bare `| string` does, so the known literals keep driving autocomplete and
|
|
75
|
+
* `Extract<>`-style narrowing.
|
|
53
76
|
*/
|
|
54
|
-
type OutputType = 'System.String' | 'System.Double' | 'System.Int32' | 'System.Boolean' | 'Rhino.Geometry.Point3d' | 'Rhino.Geometry.Line' | 'Rhino.Geometry.Circle' | 'Rhino.Geometry.Arc' | 'Rhino.Geometry.NurbsCurve' | 'Rhino.Geometry.Brep' | 'Rhino.Geometry.Mesh' | 'Rhino.Geometry.Vector3d' | 'Rhino.Geometry.Plane' | 'Rhino.Geometry.Box' | string;
|
|
77
|
+
type OutputType = 'System.String' | 'System.Double' | 'System.Int32' | 'System.Boolean' | 'Rhino.Geometry.Point3d' | 'Rhino.Geometry.Line' | 'Rhino.Geometry.Circle' | 'Rhino.Geometry.Arc' | 'Rhino.Geometry.NurbsCurve' | 'Rhino.Geometry.Brep' | 'Rhino.Geometry.Mesh' | 'Rhino.Geometry.Vector3d' | 'Rhino.Geometry.Plane' | 'Rhino.Geometry.Box' | (string & {});
|
|
55
78
|
/**
|
|
56
79
|
* Union type for all possible default value types
|
|
57
80
|
*/
|
|
@@ -207,11 +230,24 @@ interface GrasshopperRequestSchema extends GrasshopperBaseSchema, GrasshopperDef
|
|
|
207
230
|
/**
|
|
208
231
|
* Response from Grasshopper compute server
|
|
209
232
|
* Includes all schema fields + computed results
|
|
233
|
+
*
|
|
234
|
+
* `pointer` is deliberately excluded (`Omit`): the solve layer (`runSolve` in
|
|
235
|
+
* `solve.ts`) splits the server's echoed `pointer` off as the solve's
|
|
236
|
+
* `cacheKey` and strips it from the returned response, so client-returned
|
|
237
|
+
* responses never carry it.
|
|
238
|
+
*
|
|
239
|
+
* The schema-echo fields (`cachesolve`/`modelunits`/`dataversion`) stay
|
|
240
|
+
* optional as inherited from {@link GrasshopperBaseSchema}: the server echoes
|
|
241
|
+
* them back when set, but nothing client-side enforces their presence — don't
|
|
242
|
+
* rely on them without a fallback.
|
|
210
243
|
*/
|
|
211
|
-
interface GrasshopperComputeResponse extends GrasshopperBaseSchema, GrasshopperDefinitionSource {
|
|
212
|
-
/**
|
|
213
|
-
|
|
214
|
-
|
|
244
|
+
interface GrasshopperComputeResponse extends GrasshopperBaseSchema, Omit<GrasshopperDefinitionSource, 'pointer'> {
|
|
245
|
+
/**
|
|
246
|
+
* Model units the definition was solved in. Every conforming server response
|
|
247
|
+
* carries this (it drives downstream scaling, e.g. the webdisplay parser),
|
|
248
|
+
* but note it is not validated client-side — a non-conforming server or
|
|
249
|
+
* hand-built mock may omit it at runtime.
|
|
250
|
+
*/
|
|
215
251
|
modelunits: RhinoModelUnit;
|
|
216
252
|
/**
|
|
217
253
|
* The server echoes the request's full base64 definition back as `algo`, but the client strips
|
|
@@ -222,8 +258,6 @@ interface GrasshopperComputeResponse extends GrasshopperBaseSchema, GrasshopperD
|
|
|
222
258
|
algo?: string | null;
|
|
223
259
|
/** Filename of the definition (always present in response) */
|
|
224
260
|
filename: string | null;
|
|
225
|
-
/** Data version */
|
|
226
|
-
dataversion: 7 | 8;
|
|
227
261
|
/** Recursion level used */
|
|
228
262
|
recursionlevel?: number;
|
|
229
263
|
/** Output values organized by parameter */
|
|
@@ -367,7 +401,10 @@ interface DisplayItemBase extends DisplayIdentity {
|
|
|
367
401
|
/** Opacity 0–1. Omitted means fully opaque. */
|
|
368
402
|
opacity?: number;
|
|
369
403
|
}
|
|
370
|
-
/**
|
|
404
|
+
/**
|
|
405
|
+
* A world position in Rhino's Z-up frame, in Rhino's `{X,Y,Z}` casing. Used unchanged on parse —
|
|
406
|
+
* the Three scene IS Rhino's Z-up frame, so no rotation is applied (see `../coordinate-transform.ts`).
|
|
407
|
+
*/
|
|
371
408
|
interface DisplayPosition {
|
|
372
409
|
X: number;
|
|
373
410
|
Y: number;
|
|
@@ -390,7 +427,7 @@ interface DisplayCurve extends DisplayItemBase {
|
|
|
390
427
|
/** A single point, shipped raw (no rhino3dm decode), rendered as one vertex of a `THREE.Points`. */
|
|
391
428
|
interface DisplayPoint extends DisplayItemBase {
|
|
392
429
|
kind: 'point';
|
|
393
|
-
/** World position in Rhino Z-up
|
|
430
|
+
/** World position in Rhino Z-up, used directly — the Three scene shares Rhino's Z-up frame. */
|
|
394
431
|
position: DisplayPosition;
|
|
395
432
|
}
|
|
396
433
|
/**
|
|
@@ -421,11 +458,17 @@ interface SerializableMaterial {
|
|
|
421
458
|
* Metadata for a single mesh within a batch.
|
|
422
459
|
*
|
|
423
460
|
* Offsets and counts are expressed in **vertex-count units** (not float components) and
|
|
424
|
-
* **index-count units
|
|
425
|
-
*
|
|
426
|
-
*
|
|
427
|
-
* -
|
|
428
|
-
* -
|
|
461
|
+
* **index-count units** — i.e. element offsets into the decoded typed arrays, which is how
|
|
462
|
+
* consumers address them (`indices.subarray(indexStart, indexStart + indexCount)`). To address
|
|
463
|
+
* the typed-array storage:
|
|
464
|
+
* - vertex component offset = `vertexStart * 3`
|
|
465
|
+
* - vertex component count = `vertexCount * 3`
|
|
466
|
+
* - index element offset = `indexStart`
|
|
467
|
+
* - index count = `indexCount`
|
|
468
|
+
*
|
|
469
|
+
* If you need *byte* offsets, multiply by the element size, which depends on the blob's flags:
|
|
470
|
+
* indices are 2 bytes each for `FLAG_UINT16_INDICES` (wire v2+) blobs and 4 bytes for uint32
|
|
471
|
+
* blobs; vertex components are 2 bytes (int16 quantized) or 4 bytes (`FLAG_FLOAT32`).
|
|
429
472
|
*/
|
|
430
473
|
interface MeshMetadata {
|
|
431
474
|
name: string;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{A as j,B as R,C as I,D,E as B,F as G,G as L,H as P,I as u,J as F,K as b,L as N,M as V,a as e,b as r,c as t,d as o,e as a,f as s,g as p,h as i,i as n,j as l,k as m,l as y,m as f,n as d,o as C,p as x,q as h,r as E,s as M,t as _,u as c,v as A,w as g,x as O,y as S,z as T}from"./chunk-ORGJSKR4.js";import"./chunk-54O6BO24.js";export{g as BINARY_MESH_MAGIC,S as BINARY_MESH_VERSION,O as COMPRESSED_MESH_MAGIC,n as EDGE_USERDATA_KIND,I as FLAG_DELTA_ENCODED,j as FLAG_FLOAT32,D as FLAG_HAS_UVS,B as FLAG_HAS_VERTEX_COLORS,R as FLAG_UINT16_INDICES,T as MIN_SUPPORTED_VERSION,e as Materials,N as SCALE_FACTORS,h as TEXTURE_CACHE_MAX_ENTRIES,L as UV_FORMAT_FLOAT32,G as UV_FORMAT_UINT16,l as addEdges,o as applyOffset,M as clearTextureCache,a as computeCombinedBoundingBox,s as createCameraController,p as createGrid,d as createLabelLayer,x as createMeasureTool,f as createRenderPipeline,i as createViewGizmo,V as getThreeMeshesFromComputeResponse,c as initThree,m as isEdgeOverlay,_ as materialAppearanceForStyle,P as parseBinaryMeshBatch,t as parseColor,A as parseDisplayItems,u as parseMeshBatch,b as parseMeshBatchBlob,F as parseMeshBatchObject,y as removeEdges,E as setTextureAnisotropy,C as snapToVertex,r as updateScene};
|
|
2
|
+
//# sourceMappingURL=visualization-C3YOGQTW.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkEZRBMUXTcjs = require('./chunk-EZRBMUXT.cjs');require('./chunk-GF6ZIJWX.cjs');exports.BINARY_MESH_MAGIC = _chunkEZRBMUXTcjs.w; exports.BINARY_MESH_VERSION = _chunkEZRBMUXTcjs.y; exports.COMPRESSED_MESH_MAGIC = _chunkEZRBMUXTcjs.x; exports.EDGE_USERDATA_KIND = _chunkEZRBMUXTcjs.i; exports.FLAG_DELTA_ENCODED = _chunkEZRBMUXTcjs.C; exports.FLAG_FLOAT32 = _chunkEZRBMUXTcjs.A; exports.FLAG_HAS_UVS = _chunkEZRBMUXTcjs.D; exports.FLAG_HAS_VERTEX_COLORS = _chunkEZRBMUXTcjs.E; exports.FLAG_UINT16_INDICES = _chunkEZRBMUXTcjs.B; exports.MIN_SUPPORTED_VERSION = _chunkEZRBMUXTcjs.z; exports.Materials = _chunkEZRBMUXTcjs.a; exports.SCALE_FACTORS = _chunkEZRBMUXTcjs.L; exports.TEXTURE_CACHE_MAX_ENTRIES = _chunkEZRBMUXTcjs.q; exports.UV_FORMAT_FLOAT32 = _chunkEZRBMUXTcjs.G; exports.UV_FORMAT_UINT16 = _chunkEZRBMUXTcjs.F; exports.addEdges = _chunkEZRBMUXTcjs.j; exports.applyOffset = _chunkEZRBMUXTcjs.d; exports.clearTextureCache = _chunkEZRBMUXTcjs.s; exports.computeCombinedBoundingBox = _chunkEZRBMUXTcjs.e; exports.createCameraController = _chunkEZRBMUXTcjs.f; exports.createGrid = _chunkEZRBMUXTcjs.g; exports.createLabelLayer = _chunkEZRBMUXTcjs.n; exports.createMeasureTool = _chunkEZRBMUXTcjs.p; exports.createRenderPipeline = _chunkEZRBMUXTcjs.m; exports.createViewGizmo = _chunkEZRBMUXTcjs.h; exports.getThreeMeshesFromComputeResponse = _chunkEZRBMUXTcjs.M; exports.initThree = _chunkEZRBMUXTcjs.u; exports.isEdgeOverlay = _chunkEZRBMUXTcjs.k; exports.materialAppearanceForStyle = _chunkEZRBMUXTcjs.t; exports.parseBinaryMeshBatch = _chunkEZRBMUXTcjs.H; exports.parseColor = _chunkEZRBMUXTcjs.c; exports.parseDisplayItems = _chunkEZRBMUXTcjs.v; exports.parseMeshBatch = _chunkEZRBMUXTcjs.I; exports.parseMeshBatchBlob = _chunkEZRBMUXTcjs.K; exports.parseMeshBatchObject = _chunkEZRBMUXTcjs.J; exports.removeEdges = _chunkEZRBMUXTcjs.l; exports.setTextureAnisotropy = _chunkEZRBMUXTcjs.r; exports.snapToVertex = _chunkEZRBMUXTcjs.o; exports.updateScene = _chunkEZRBMUXTcjs.b;
|
|
2
|
+
//# sourceMappingURL=visualization-CERJ6XDX.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/selva-compute/selva-compute/dist/visualization-CERJ6XDX.cjs"],"names":[],"mappings":"AAAA,iIAA6S,gCAA6B,82DAAi4B","file":"/home/runner/work/selva-compute/selva-compute/dist/visualization-CERJ6XDX.cjs"}
|
package/dist/visualization.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkEZRBMUXTcjs = require('./chunk-EZRBMUXT.cjs');require('./chunk-GF6ZIJWX.cjs');exports.EDGE_USERDATA_KIND = _chunkEZRBMUXTcjs.i; exports.Materials = _chunkEZRBMUXTcjs.a; exports.SCALE_FACTORS = _chunkEZRBMUXTcjs.L; exports.addEdges = _chunkEZRBMUXTcjs.j; exports.applyOffset = _chunkEZRBMUXTcjs.d; exports.computeCombinedBoundingBox = _chunkEZRBMUXTcjs.e; exports.createCameraController = _chunkEZRBMUXTcjs.f; exports.createGrid = _chunkEZRBMUXTcjs.g; exports.createLabelLayer = _chunkEZRBMUXTcjs.n; exports.createMeasureTool = _chunkEZRBMUXTcjs.p; exports.createRenderPipeline = _chunkEZRBMUXTcjs.m; exports.createViewGizmo = _chunkEZRBMUXTcjs.h; exports.getThreeMeshesFromComputeResponse = _chunkEZRBMUXTcjs.M; exports.initThree = _chunkEZRBMUXTcjs.u; exports.isEdgeOverlay = _chunkEZRBMUXTcjs.k; exports.parseColor = _chunkEZRBMUXTcjs.c; exports.parseDisplayItems = _chunkEZRBMUXTcjs.v; exports.parseMeshBatchBlob = _chunkEZRBMUXTcjs.K; exports.parseMeshBatchObject = _chunkEZRBMUXTcjs.J; exports.removeEdges = _chunkEZRBMUXTcjs.l; exports.snapToVertex = _chunkEZRBMUXTcjs.o; exports.updateScene = _chunkEZRBMUXTcjs.b;
|
|
2
2
|
//# sourceMappingURL=visualization.cjs.map
|
package/dist/visualization.d.cts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import * as THREE from 'three';
|
|
2
2
|
import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
|
|
3
|
-
import { M as MaterialAppearanceOptions, f as GrasshopperComputeResponse, m as MeshExtractionOptions, n as MeshBatchParsingOptions, o as DisplayBatch, p as DisplayItem } from './types-
|
|
4
|
-
export { q as DisplayCurve, r as DisplayIdentity, s as DisplayItemBase, t as DisplayPoint, u as DisplayPosition, v as MeshBatch } from './types-
|
|
3
|
+
import { M as MaterialAppearanceOptions, f as GrasshopperComputeResponse, m as MeshExtractionOptions, n as MeshBatchParsingOptions, o as DisplayBatch, p as DisplayItem } from './types-Ci8Z0-hF.cjs';
|
|
4
|
+
export { q as DisplayCurve, r as DisplayIdentity, s as DisplayItemBase, t as DisplayPoint, u as DisplayPosition, v as MeshBatch } from './types-Ci8Z0-hF.cjs';
|
|
5
5
|
import { CSS2DObject } from 'three/addons/renderers/CSS2DRenderer.js';
|
|
6
6
|
import { LineSegments2 } from 'three/addons/lines/LineSegments2.js';
|
|
7
7
|
import { RhinoModule } from 'rhino3dm';
|
|
8
|
-
import './types-
|
|
8
|
+
import './types-C9YpTbr3.cjs';
|
|
9
9
|
|
|
10
10
|
type CameraConfig = {
|
|
11
11
|
position?: THREE.Vector3;
|
|
@@ -210,12 +210,20 @@ interface CameraController {
|
|
|
210
210
|
* singularity.
|
|
211
211
|
*/
|
|
212
212
|
setViewDirection(direction: THREE.Vector3, animate?: boolean): void;
|
|
213
|
+
/**
|
|
214
|
+
* Frame an arbitrary world-space box (e.g. a double-clicked object) from the current view
|
|
215
|
+
* direction, moving the *active* camera — in 2D mode that means resizing the ortho frustum, not
|
|
216
|
+
* just translating. No-op on an empty box.
|
|
217
|
+
*/
|
|
218
|
+
frameBounds(box: THREE.Box3, animate?: boolean): void;
|
|
213
219
|
/** Enable/disable orbit rotation at runtime (pan/zoom unaffected). */
|
|
214
220
|
setRotateEnabled(enabled: boolean): void;
|
|
215
221
|
/** Whether rotation is currently enabled. */
|
|
216
222
|
isRotateEnabled(): boolean;
|
|
217
223
|
/** Keep the orthographic frustum aspect in sync on canvas resize. Called by the resize loop. */
|
|
218
224
|
updateAspect(width: number, height: number): void;
|
|
225
|
+
/** Cancel any in-flight camera tween. Call on viewer teardown so ticks can't touch disposed controls. */
|
|
226
|
+
dispose(): void;
|
|
219
227
|
}
|
|
220
228
|
interface CameraControllerDeps {
|
|
221
229
|
scene: THREE.Scene;
|
|
@@ -282,14 +290,24 @@ declare function createGrid(options?: GridOptions): Grid;
|
|
|
282
290
|
*
|
|
283
291
|
* Caller responsibilities (mirror ViewHelper's own contract):
|
|
284
292
|
* - call {@link ViewGizmo.render} *after* the main scene render each frame (overlay viewport),
|
|
285
|
-
* - call {@link ViewGizmo.update} each frame (no-op now; kept for API symmetry),
|
|
286
293
|
* - forward pointer clicks to {@link ViewGizmo.handleClick}.
|
|
287
294
|
*/
|
|
288
295
|
interface ViewGizmo {
|
|
289
296
|
render(renderer: THREE.WebGLRenderer): void;
|
|
297
|
+
/**
|
|
298
|
+
* @deprecated No-op, kept only for API stability. This wrapper never uses ViewHelper's
|
|
299
|
+
* click→animate path (see module comment) — view changes snap instantly through the camera
|
|
300
|
+
* controller — so there is never a gizmo animation to advance. Safe to stop calling.
|
|
301
|
+
*/
|
|
290
302
|
update(delta: number): void;
|
|
291
303
|
/** Hit-test a click. Returns true if it hit the gizmo (and a view change started). */
|
|
292
304
|
handleClick(event: MouseEvent): boolean;
|
|
305
|
+
/**
|
|
306
|
+
* @deprecated Always `false`, kept only for API stability. Gizmo clicks snap the view
|
|
307
|
+
* instantly rather than animating (deliberately — ViewHelper's built-in animation assumes a
|
|
308
|
+
* Y-up world and rolls the view in this Z-up scene), so there is no animation window to gate
|
|
309
|
+
* input on.
|
|
310
|
+
*/
|
|
293
311
|
readonly isAnimating: boolean;
|
|
294
312
|
/** Show/hide the gizmo at runtime. Hidden = not rendered and not click-hittable. */
|
|
295
313
|
setVisible(visible: boolean): void;
|
|
@@ -392,6 +410,14 @@ interface MeasureDeps {
|
|
|
392
410
|
canvas: HTMLCanvasElement;
|
|
393
411
|
scene: THREE.Scene;
|
|
394
412
|
getActiveCamera: () => THREE.Camera;
|
|
413
|
+
/**
|
|
414
|
+
* The current orbit target (e.g. `controls.target`). Used to scale the line/point pick
|
|
415
|
+
* threshold with the view: the tolerance is a fraction of the camera→target distance, so it
|
|
416
|
+
* stays roughly constant on screen wherever the user has framed the model. Optional for
|
|
417
|
+
* backward compatibility — without it the perspective fallback is the camera's distance to the
|
|
418
|
+
* world origin, which misjudges the threshold for off-origin content. Thread it in when you can.
|
|
419
|
+
*/
|
|
420
|
+
getViewTarget?: () => THREE.Vector3;
|
|
395
421
|
labelLayer: LabelLayer;
|
|
396
422
|
options?: MeasureOptions;
|
|
397
423
|
}
|
|
@@ -500,6 +526,13 @@ declare const PLASTIC_MATERIAL: THREE.MeshPhysicalMaterial;
|
|
|
500
526
|
declare const GLASS_MATERIAL: THREE.MeshPhysicalMaterial;
|
|
501
527
|
declare const RUBBER_MATERIAL: THREE.MeshPhysicalMaterial;
|
|
502
528
|
declare const WOOD_MATERIAL: THREE.MeshPhysicalMaterial;
|
|
529
|
+
/**
|
|
530
|
+
* The module-scope singleton materials above, as a set. Scene-clearing code must NOT dispose a
|
|
531
|
+
* material in this set: they are shared across meshes and across solves, and `dispose()` on a
|
|
532
|
+
* still-referenced material forces a shader program rebuild on its next use (and would free any
|
|
533
|
+
* textures they gain later while other objects still use them).
|
|
534
|
+
*/
|
|
535
|
+
declare const SHARED_MATERIALS: ReadonlySet<THREE.Material>;
|
|
503
536
|
|
|
504
537
|
declare const threeMaterials_CONCRETE_MATERIAL: typeof CONCRETE_MATERIAL;
|
|
505
538
|
declare const threeMaterials_EMISSIVE_MATERIAL: typeof EMISSIVE_MATERIAL;
|
|
@@ -507,9 +540,10 @@ declare const threeMaterials_GLASS_MATERIAL: typeof GLASS_MATERIAL;
|
|
|
507
540
|
declare const threeMaterials_METAL_MATERIAL: typeof METAL_MATERIAL;
|
|
508
541
|
declare const threeMaterials_PLASTIC_MATERIAL: typeof PLASTIC_MATERIAL;
|
|
509
542
|
declare const threeMaterials_RUBBER_MATERIAL: typeof RUBBER_MATERIAL;
|
|
543
|
+
declare const threeMaterials_SHARED_MATERIALS: typeof SHARED_MATERIALS;
|
|
510
544
|
declare const threeMaterials_WOOD_MATERIAL: typeof WOOD_MATERIAL;
|
|
511
545
|
declare namespace threeMaterials {
|
|
512
|
-
export { threeMaterials_CONCRETE_MATERIAL as CONCRETE_MATERIAL, threeMaterials_EMISSIVE_MATERIAL as EMISSIVE_MATERIAL, threeMaterials_GLASS_MATERIAL as GLASS_MATERIAL, threeMaterials_METAL_MATERIAL as METAL_MATERIAL, threeMaterials_PLASTIC_MATERIAL as PLASTIC_MATERIAL, threeMaterials_RUBBER_MATERIAL as RUBBER_MATERIAL, threeMaterials_WOOD_MATERIAL as WOOD_MATERIAL };
|
|
546
|
+
export { threeMaterials_CONCRETE_MATERIAL as CONCRETE_MATERIAL, threeMaterials_EMISSIVE_MATERIAL as EMISSIVE_MATERIAL, threeMaterials_GLASS_MATERIAL as GLASS_MATERIAL, threeMaterials_METAL_MATERIAL as METAL_MATERIAL, threeMaterials_PLASTIC_MATERIAL as PLASTIC_MATERIAL, threeMaterials_RUBBER_MATERIAL as RUBBER_MATERIAL, threeMaterials_SHARED_MATERIALS as SHARED_MATERIALS, threeMaterials_WOOD_MATERIAL as WOOD_MATERIAL };
|
|
513
547
|
}
|
|
514
548
|
|
|
515
549
|
/**
|
|
@@ -588,6 +622,12 @@ interface RenderPipelineOptions {
|
|
|
588
622
|
}
|
|
589
623
|
declare function createRenderPipeline(renderer: THREE.WebGLRenderer, scene: THREE.Scene, camera: THREE.Camera, width: number, height: number, options: RenderPipelineOptions): RenderPipeline;
|
|
590
624
|
|
|
625
|
+
/**
|
|
626
|
+
* Metres per model unit, keyed by Rhino `UnitSystem` name (the `modelunits` string on the compute
|
|
627
|
+
* response). Imperial factors are the exact international definitions (1 in = 0.0254 m,
|
|
628
|
+
* 1 ft = 0.3048 m, 1 mi = 1609.344 m). Units not in this table scale 1 and log a one-time warning
|
|
629
|
+
* — see {@link getScaleFactor}.
|
|
630
|
+
*/
|
|
591
631
|
declare const SCALE_FACTORS: Record<string, number>;
|
|
592
632
|
/**
|
|
593
633
|
* Extracts and processes display meshes from a ComputePointerResponse using the Grasshopper WebDisplay component.
|
|
@@ -595,7 +635,9 @@ declare const SCALE_FACTORS: Record<string, number>;
|
|
|
595
635
|
* This is the primary entry point for extracting mesh geometry from Grasshopper compute responses.
|
|
596
636
|
* It handles all aspects of mesh processing: decompression, coordinate transformation, scaling, and positioning.
|
|
597
637
|
*
|
|
598
|
-
* **Note:**
|
|
638
|
+
* **Note:** The entire pipeline (base64 decode, inflate, dequantization, mesh construction) runs
|
|
639
|
+
* synchronously on the calling thread — large batches will block the UI for their duration. The
|
|
640
|
+
* function is `async` only so its shape can stay stable if parsing moves off-thread later.
|
|
599
641
|
*
|
|
600
642
|
* @param data - The ComputePointerResponse containing Grasshopper output trees.
|
|
601
643
|
* @param options - Configuration for mesh extraction and parsing behavior. All options are optional with sensible defaults.
|
|
@@ -606,7 +648,7 @@ declare const SCALE_FACTORS: Record<string, number>;
|
|
|
606
648
|
* - Only works with the WebDisplay component of GHHeadless.
|
|
607
649
|
* - Requires changes to Rhino.Compute (see https://github.com/TheVessen/compute.rhino3d).
|
|
608
650
|
* - Provides a performant way to display mesh data in Three.js.
|
|
609
|
-
* -
|
|
651
|
+
* - All decoding is synchronous on the main thread; there is no Web Worker offload today.
|
|
610
652
|
* - Supports mesh metadata (names, user data) if provided in the compute response.
|
|
611
653
|
*
|
|
612
654
|
* @internal Internal helper: high-level extraction remains public via visualization module, but this
|
|
@@ -651,9 +693,14 @@ interface ParseTelemetry {
|
|
|
651
693
|
* over the blob. The function stays `async` so callers don't have to change shape if we move
|
|
652
694
|
* parsing into a worker later.
|
|
653
695
|
*
|
|
696
|
+
* A batch with no `compressedData` (genuinely empty/absent geometry) resolves to `[]`. A corrupt,
|
|
697
|
+
* truncated, or unsupported blob throws so callers get a signal instead of a silent empty scene —
|
|
698
|
+
* `getThreeMeshesFromComputeResponse` documents (and now delivers) exactly that rethrow.
|
|
699
|
+
*
|
|
654
700
|
* @param batch - DisplayBatch object
|
|
655
701
|
* @param options - Rendering options
|
|
656
702
|
* @returns Promise resolving to array of Three.js mesh objects
|
|
703
|
+
* @throws {RhinoComputeError} On a corrupt/truncated/unsupported mesh blob or malformed group metadata.
|
|
657
704
|
*/
|
|
658
705
|
declare function parseMeshBatchObject(batch: DisplayBatch, options?: MeshBatchParsingOptions,
|
|
659
706
|
/** @internal Timings threaded from an outer entry point; not a caller option. */
|
|
@@ -669,13 +716,20 @@ telemetry?: ParseTelemetry): Promise<THREE.Mesh[]>;
|
|
|
669
716
|
* @param blob - Raw blob bytes from a binary WebSocket frame.
|
|
670
717
|
* @param options - Rendering options.
|
|
671
718
|
* @returns Promise resolving to array of Three.js mesh objects.
|
|
719
|
+
* @throws {RhinoComputeError} On a corrupt/truncated/unsupported mesh blob or malformed group metadata.
|
|
672
720
|
*/
|
|
673
721
|
declare function parseMeshBatchBlob(blob: ArrayBuffer | Uint8Array, options?: MeshBatchParsingOptions): Promise<THREE.Mesh[]>;
|
|
674
722
|
|
|
675
723
|
interface DisplayItemParseOptions {
|
|
676
724
|
/** rhino3dm instance for decoding curve JSON. Omit to skip curves (points still render). */
|
|
677
725
|
rhino?: RhinoModule;
|
|
678
|
-
/**
|
|
726
|
+
/**
|
|
727
|
+
* No-op. Historically toggled the Rhino Z-up → Three Y-up rotation, but the pipeline now keeps
|
|
728
|
+
* one coordinate frame end to end ({@link rhinoToThree} is the identity), so this flag no longer
|
|
729
|
+
* changes the result. Do NOT pre-rotate your own geometry to compensate — none is applied.
|
|
730
|
+
*
|
|
731
|
+
* @deprecated Retained only so existing call sites compile unchanged; has no effect.
|
|
732
|
+
*/
|
|
679
733
|
applyTransforms?: boolean;
|
|
680
734
|
}
|
|
681
735
|
/**
|