@snaptrude/plugin-core 0.9.16-networks-20261012.1 → 0.9.17
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/CHANGELOG.md +6 -0
- package/api-manifest.json +9711 -0
- package/dist/api/analysis/daylight.d.ts +5 -5
- package/dist/api/analysis/solar.d.ts +2 -2
- package/dist/api/core/camera/index.d.ts +0 -29
- package/dist/api/core/camera/index.d.ts.map +1 -1
- package/dist/api/core/zoom/index.d.ts +0 -13
- package/dist/api/core/zoom/index.d.ts.map +1 -1
- package/dist/api/design/create/bulk-items.d.ts +21 -40
- package/dist/api/design/create/bulk-items.d.ts.map +1 -1
- package/dist/api/design/create/index.d.ts +97 -120
- package/dist/api/design/create/index.d.ts.map +1 -1
- package/dist/api/design/create/opening-fields.d.ts +12 -13
- package/dist/api/design/create/opening-fields.d.ts.map +1 -1
- package/dist/api/design/doors/index.d.ts +24 -18
- package/dist/api/design/doors/index.d.ts.map +1 -1
- package/dist/api/design/family.d.ts +27 -797
- package/dist/api/design/family.d.ts.map +1 -1
- package/dist/api/design/index.d.ts +0 -16
- package/dist/api/design/index.d.ts.map +1 -1
- package/dist/api/design/query/index.d.ts +30 -30
- package/dist/api/design/selection/index.d.ts +10 -10
- package/dist/api/design/types/index.d.ts +24 -40
- package/dist/api/design/types/index.d.ts.map +1 -1
- package/dist/api/design/update/index.d.ts +3 -40
- package/dist/api/design/update/index.d.ts.map +1 -1
- package/dist/api/design/windows/index.d.ts +8 -8
- package/dist/api/design/windows/index.d.ts.map +1 -1
- package/dist/api/presentation/aiInspiration.d.ts +10 -10
- package/dist/api/presentation/annotate.d.ts +22 -38
- package/dist/api/presentation/annotate.d.ts.map +1 -1
- package/dist/api/presentation/export.d.ts +5 -23
- package/dist/api/presentation/export.d.ts.map +1 -1
- package/dist/api/presentation/index.d.ts +21 -32
- package/dist/api/presentation/index.d.ts.map +1 -1
- package/dist/api/presentation/placedViews.d.ts +6 -106
- package/dist/api/presentation/placedViews.d.ts.map +1 -1
- package/dist/api/presentation/sections.d.ts +461 -0
- package/dist/api/presentation/sections.d.ts.map +1 -0
- package/dist/api/presentation/shapes.d.ts +2 -2
- package/dist/api/presentation/sheets.d.ts +19 -175
- package/dist/api/presentation/sheets.d.ts.map +1 -1
- package/dist/api/presentation/views.d.ts +5 -103
- package/dist/api/presentation/views.d.ts.map +1 -1
- package/dist/api/presentation/walkthroughs.d.ts +6 -6
- package/dist/index.cjs +2434 -3619
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +2421 -3501
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/scripts/generate-manifest.mjs +0 -5
- package/src/api/core/camera/index.ts +0 -29
- package/src/api/core/zoom/index.ts +0 -13
- package/src/api/design/create/bulk-items.ts +16 -23
- package/src/api/design/create/index.ts +119 -129
- package/src/api/design/create/opening-fields.ts +12 -15
- package/src/api/design/doors/index.ts +42 -58
- package/src/api/design/family.ts +32 -662
- package/src/api/design/index.ts +4 -34
- package/src/api/design/types/index.ts +24 -31
- package/src/api/design/update/index.ts +3 -41
- package/src/api/design/windows/index.ts +22 -40
- package/src/api/presentation/annotate.ts +58 -90
- package/src/api/presentation/export.ts +6 -32
- package/src/api/presentation/index.ts +23 -39
- package/src/api/presentation/placedViews.ts +28 -119
- package/src/api/presentation/sections.ts +420 -0
- package/src/api/presentation/sheets.ts +20 -181
- package/src/api/presentation/views.ts +6 -46
- package/dist/api/design/bim.d.ts +0 -209
- package/dist/api/design/bim.d.ts.map +0 -1
- package/dist/api/design/catalog.d.ts +0 -320
- package/dist/api/design/catalog.d.ts.map +0 -1
- package/dist/api/design/networks.d.ts +0 -1703
- package/dist/api/design/networks.d.ts.map +0 -1
- package/dist/api/presentation/drawingContract.d.ts +0 -32
- package/dist/api/presentation/drawingContract.d.ts.map +0 -1
- package/dist/api/presentation/drawings.d.ts +0 -3523
- package/dist/api/presentation/drawings.d.ts.map +0 -1
- package/dist/api/presentation/viewPresets.d.ts +0 -222
- package/dist/api/presentation/viewPresets.d.ts.map +0 -1
- package/src/api/design/bim.ts +0 -121
- package/src/api/design/catalog.ts +0 -203
- package/src/api/design/networks.ts +0 -607
- package/src/api/presentation/drawingContract.ts +0 -70
- package/src/api/presentation/drawings.ts +0 -1179
- package/src/api/presentation/viewPresets.ts +0 -241
- package/test/drawingContract.test.mjs +0 -288
package/src/api/design/family.ts
CHANGED
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
import * as z from "zod"
|
|
2
2
|
import { PluginApiReturn } from "../../types"
|
|
3
|
-
import {
|
|
4
|
-
BrepHandle,
|
|
5
|
-
ComponentHandle,
|
|
6
|
-
Vec3Components,
|
|
7
|
-
Vec3Handle,
|
|
8
|
-
} from "../../handles"
|
|
9
|
-
import { NetworkFamilyContract } from "./networks"
|
|
3
|
+
import { BrepHandle, ComponentHandle, Vec3Components } from "../../handles"
|
|
10
4
|
|
|
11
5
|
/**
|
|
12
6
|
* `snaptrude.design.family.*` — author NATIVE parametric families from a JSON spec.
|
|
@@ -18,52 +12,19 @@ import { NetworkFamilyContract } from "./networks"
|
|
|
18
12
|
* compiles that into a live parametric definition the user can place, flex and
|
|
19
13
|
* save to their library.
|
|
20
14
|
*
|
|
21
|
-
* ##
|
|
15
|
+
* ## Workflow
|
|
22
16
|
*
|
|
23
17
|
* ```
|
|
24
|
-
* getReference() read the spec DSL once — grammar, ops, expressions,
|
|
25
|
-
*
|
|
26
|
-
* prepare({ bundle }) validate + compile; nothing committed, nothing in the viewport
|
|
18
|
+
* getReference() read the spec DSL once — grammar, ops, expressions, example
|
|
19
|
+
* prepare({ bundle }) validate + compile + show a live ghost; nothing committed
|
|
27
20
|
* flex({ values }) re-run at new values; returns the geometry delta
|
|
28
21
|
* place({ position }) put it in the model — saves the family as the first instance drops
|
|
29
22
|
* place() save the family, then arm placement — the USER clicks to drop it
|
|
30
|
-
* create() save an EDIT of a saved family — the app asks the user
|
|
31
23
|
* create({ teamId }) share with a team; a save with nothing placed also drops one instance
|
|
32
24
|
* ```
|
|
33
25
|
*
|
|
34
26
|
* `place` saves the prepared family to the user's personal library, so it
|
|
35
|
-
* survives reload with no extra step; finish
|
|
36
|
-
* `place`, not on `create` (`create` ends only an edit of a saved family, below).
|
|
37
|
-
*
|
|
38
|
-
* Architectural types use `create({ name })` to save the prepared recipe.
|
|
39
|
-
* Saving does not assign a family to a native host.
|
|
40
|
-
* Read `design.catalog` and pass the saved `{ id, version }` reference to the
|
|
41
|
-
* native `design.create` method with its contour, wall profile, or straight axis.
|
|
42
|
-
* Standalone placement does not create a native host. Selecting a Draw type
|
|
43
|
-
* does not register an API type. Native creator values use mm, while this
|
|
44
|
-
* generic family API uses SU. Read `family_authoring` for the full workflow.
|
|
45
|
-
*
|
|
46
|
-
* ## Door and window templates
|
|
47
|
-
*
|
|
48
|
-
* Start with `getTemplate({ kind: "door" | "window", subType? })`, edit the
|
|
49
|
-
* recipe's style while keeping its contract, then `prepare` → `flex` → `create`.
|
|
50
|
-
* Place the saved family with
|
|
51
|
-
* `design.create.door(familyId, hostWall, position, { version, values, hinge }, facing)`
|
|
52
|
-
* or `design.create.window` with the same positional signature. Positions,
|
|
53
|
-
* hinge and facing are vec3 handles; values use the authored parameter keys.
|
|
54
|
-
* Templates produce ParametricComponents, not separate OpeningComponents. Read
|
|
55
|
-
* and edit their instances through `getParameters` / `setParameters`.
|
|
56
|
-
* The contract maps opening dimensions to parameter keys; do not assume the
|
|
57
|
-
* recipe names its width parameter `width`. Generic family lengths use SU.
|
|
58
|
-
* Hosted door/window `create({ name })` saves without placing a standalone
|
|
59
|
-
* sample. Supply the host and position in a subsequent placement.
|
|
60
|
-
*
|
|
61
|
-
* ## Changing a saved family
|
|
62
|
-
*
|
|
63
|
-
* Open it with `get({ id })` or `get({ component })`, edit with `prepare` /
|
|
64
|
-
* `flex`, then `create()`. The app — not the agent — asks the user whether to
|
|
65
|
-
* update that family (this project's placed copies move to the new version) or
|
|
66
|
-
* save a new family. Do not ask this yourself; report the returned `decision`.
|
|
27
|
+
* survives reload with no extra step; finish on `place`, not on `create`.
|
|
67
28
|
*
|
|
68
29
|
* ## Read getReference() first
|
|
69
30
|
*
|
|
@@ -111,8 +72,6 @@ export abstract class PluginDesignFamilyApi {
|
|
|
111
72
|
* Read this before authoring a family for the first time in a session. The
|
|
112
73
|
* DSL is a closed language — a guessed op or function is a rejected spec.
|
|
113
74
|
*
|
|
114
|
-
* @param args Optional section, or its bare name. Omit for the core reference.
|
|
115
|
-
* Fetch architectural, networks or relations only when the family needs them.
|
|
116
75
|
* @returns The reference text
|
|
117
76
|
*
|
|
118
77
|
* @examplePrompt How do I write a parametric family spec?
|
|
@@ -123,61 +82,7 @@ export abstract class PluginDesignFamilyApi {
|
|
|
123
82
|
* const { reference } = await snaptrude.design.family.getReference()
|
|
124
83
|
* ```
|
|
125
84
|
*/
|
|
126
|
-
public abstract getReference(
|
|
127
|
-
args?: PluginDesignFamilyGetReferenceArgs | PluginFamilyReferenceSection,
|
|
128
|
-
): PluginApiReturn<PluginFamilyReference>
|
|
129
|
-
|
|
130
|
-
/**
|
|
131
|
-
* Worked example families to learn from: real, tested bundles by discipline
|
|
132
|
-
* (architecture, structure, MEP, furniture). With no `id`, returns the
|
|
133
|
-
* catalogue — each example's id, label, discipline and the patterns it
|
|
134
|
-
* teaches — filtered by `discipline` / `tag` when given. With an `id`,
|
|
135
|
-
* returns that example's full bundle. Fetch the one closest to the task
|
|
136
|
-
* before authoring and borrow its patterns; examples are patterns to
|
|
137
|
-
* combine, not templates to copy whole.
|
|
138
|
-
*
|
|
139
|
-
* @param args - `{ id }` for one bundle, or `{ discipline?, tag? }` to list
|
|
140
|
-
* @returns The catalogue, or one example with its bundle
|
|
141
|
-
*
|
|
142
|
-
* @examplePrompt Show me an example of a structural family
|
|
143
|
-
* @examplePrompt How is a hosted door family written?
|
|
144
|
-
*
|
|
145
|
-
* # Example
|
|
146
|
-
* ```ts
|
|
147
|
-
* const list = await snaptrude.design.family.getExamples({ discipline: "mep" })
|
|
148
|
-
* const ex = await snaptrude.design.family.getExamples({ id: list[0].id })
|
|
149
|
-
* ```
|
|
150
|
-
*/
|
|
151
|
-
public abstract getExamples(
|
|
152
|
-
args?: PluginDesignFamilyGetExamplesArgs | string,
|
|
153
|
-
): PluginApiReturn<PluginFamilyExampleSummary[] | PluginFamilyExample>
|
|
154
|
-
|
|
155
|
-
/**
|
|
156
|
-
* Get a validated starter recipe for a door or window, with an opening
|
|
157
|
-
* contract, host wall-thickness binding and role-named parts. Edit profiles,
|
|
158
|
-
* panels, glazing, hardware and materials while preserving the contract.
|
|
159
|
-
* Use `prepare` / `flex` to check the recipe, then `create` to save it and
|
|
160
|
-
* `design.create.door(familyId, hostWall, position, { version, values }, facing)`
|
|
161
|
-
* (or `window`) to place it. Edit the resulting ParametricComponent through
|
|
162
|
-
* `getParameters` / `setParameters`, not a separate opening API.
|
|
163
|
-
*
|
|
164
|
-
* `subType` defaults to `singleDoor` / `fixedWindow`. An unsupported subType
|
|
165
|
-
* returns the kind's default template, a note in `guidance`, and `available`
|
|
166
|
-
* templates. Start from the closest recipe and set `root.subType` to your token.
|
|
167
|
-
*
|
|
168
|
-
* @param args The opening kind and optional subtype token
|
|
169
|
-
* @returns The bundle, parameter-key contract, subtype, guidance and available templates
|
|
170
|
-
* @example
|
|
171
|
-
* const { bundle, contract } = await snaptrude.design.family.getTemplate({
|
|
172
|
-
* kind: "door", subType: "doubleDoor",
|
|
173
|
-
* })
|
|
174
|
-
* // Flex the authored width key, not an assumed parameter name (lengths in SU).
|
|
175
|
-
* await snaptrude.design.family.prepare({ bundle })
|
|
176
|
-
* await snaptrude.design.family.flex({ values: { [contract.width]: 4 } })
|
|
177
|
-
*/
|
|
178
|
-
public abstract getTemplate(
|
|
179
|
-
args: PluginDesignFamilyGetTemplateArgs,
|
|
180
|
-
): PluginApiReturn<PluginFamilyTemplateResult>
|
|
85
|
+
public abstract getReference(): PluginApiReturn<PluginFamilyReference>
|
|
181
86
|
|
|
182
87
|
/**
|
|
183
88
|
* Validate, compile and preview a family spec. Nothing is committed to the
|
|
@@ -219,8 +124,7 @@ export abstract class PluginDesignFamilyApi {
|
|
|
219
124
|
* buckets are the host's own diff of what the geometry did — flexing a
|
|
220
125
|
* driving parameter and reporting them demonstrates the family is parametric.
|
|
221
126
|
*
|
|
222
|
-
* @param args The parameter values to change
|
|
223
|
-
* record) to report or photograph the current draft without rebuilding it.
|
|
127
|
+
* @param args The parameter values to change
|
|
224
128
|
* @returns The new build plus the geometry delta
|
|
225
129
|
*
|
|
226
130
|
* @examplePrompt Change it to 6 bays
|
|
@@ -233,49 +137,25 @@ export abstract class PluginDesignFamilyApi {
|
|
|
233
137
|
* ```
|
|
234
138
|
*/
|
|
235
139
|
public abstract flex(
|
|
236
|
-
args
|
|
140
|
+
args: PluginDesignFamilyFlexArgs,
|
|
237
141
|
): PluginApiReturn<PluginFamilyFlexResult>
|
|
238
142
|
|
|
239
143
|
/**
|
|
240
|
-
*
|
|
241
|
-
* family — that family's recipe, opened as the new draft.
|
|
242
|
-
*
|
|
243
|
-
* - No arguments: the prepared draft, or `null` when nothing is prepared.
|
|
244
|
-
* - `{ id, version? }`: open a saved family from the library (newest version
|
|
245
|
-
* when `version` is omitted).
|
|
246
|
-
* - `{ component }`: open the family (at its version) of that placed copy.
|
|
247
|
-
*
|
|
248
|
-
* Opening makes the recipe the current draft and returns `editing` — which
|
|
249
|
-
* saved family it is. Edit it with `prepare` / `flex`, then call `create`.
|
|
250
|
-
* On that save the APP shows the user its own window asking whether to
|
|
251
|
-
* update the family (every placed copy in this project moves to the new
|
|
252
|
-
* version) or save it as a new family — "new family" is the default. Never
|
|
253
|
-
* ask the user this yourself, and never promise either outcome: report what
|
|
254
|
-
* `create` returns.
|
|
144
|
+
* The prepared family's spec bundle, or `null` when nothing is prepared.
|
|
255
145
|
*
|
|
256
|
-
* @
|
|
257
|
-
* @returns The bundle (plus `editing` when it edits a saved family), or `null`
|
|
258
|
-
*
|
|
259
|
-
* @examplePrompt Make the chairs I placed 50 mm wider
|
|
260
|
-
* @examplePrompt Change the Louvre Screen family so its blades are deeper
|
|
146
|
+
* @returns The draft bundle, or `null`
|
|
261
147
|
*
|
|
262
148
|
* # Example
|
|
263
149
|
* ```ts
|
|
264
|
-
* const
|
|
265
|
-
* const family = await snaptrude.design.family.get({ component })
|
|
266
|
-
* // family.editing → { familyId, version, name, library }
|
|
150
|
+
* const bundle = await snaptrude.design.family.get()
|
|
267
151
|
* ```
|
|
268
152
|
*/
|
|
269
|
-
public abstract get(
|
|
270
|
-
args?: PluginDesignFamilyGetArgs | string,
|
|
271
|
-
): PluginApiReturn<PluginFamilyGetResult | null>
|
|
153
|
+
public abstract get(): PluginApiReturn<PluginFamilyBundle | null>
|
|
272
154
|
|
|
273
155
|
/**
|
|
274
|
-
* Every
|
|
156
|
+
* Every parametric family registered in this session — native and imported.
|
|
275
157
|
*
|
|
276
|
-
* @
|
|
277
|
-
* object-shaped so existing callers retain version, openingKind and subType.
|
|
278
|
-
* @returns Summary objects, or `id | label | category | kind` lines when compact.
|
|
158
|
+
* @returns One summary per family
|
|
279
159
|
*
|
|
280
160
|
* @examplePrompt What families are available?
|
|
281
161
|
*
|
|
@@ -284,35 +164,7 @@ export abstract class PluginDesignFamilyApi {
|
|
|
284
164
|
* const families = await snaptrude.design.family.list()
|
|
285
165
|
* ```
|
|
286
166
|
*/
|
|
287
|
-
public abstract list(
|
|
288
|
-
args: PluginDesignFamilyListArgs & { compact: true },
|
|
289
|
-
): PluginApiReturn<string[]>
|
|
290
|
-
public abstract list(
|
|
291
|
-
args?: PluginDesignFamilyListArgs & { compact?: false },
|
|
292
|
-
): PluginApiReturn<PluginFamilySummary[]>
|
|
293
|
-
public abstract list(
|
|
294
|
-
args?: PluginDesignFamilyListArgs,
|
|
295
|
-
): PluginApiReturn<PluginFamilySummary[] | string[]>
|
|
296
|
-
|
|
297
|
-
/**
|
|
298
|
-
* Read one saved catalog definition without opening a draft or placing geometry.
|
|
299
|
-
* Both id and version are required. The catalog checks access on every read.
|
|
300
|
-
* Length defaults and bounds are in mm, ready for network graph overrides;
|
|
301
|
-
* angle parameters retain degrees, identified by each parameter's unit.
|
|
302
|
-
* existing getParameters/place/setParameters continue to use Snaptrude units.
|
|
303
|
-
* Defaults include current catalog overrides, which can change without a new version.
|
|
304
|
-
* No scene, registry, history, or persistence state is changed.
|
|
305
|
-
* Missing/inaccessible pins and invalid recipes fail; no latest-version fallback.
|
|
306
|
-
* This metadata does not certify connectors or engineering compatibility.
|
|
307
|
-
*
|
|
308
|
-
* @param args Exact saved catalog id and version, from list()
|
|
309
|
-
* @returns Compact parameter metadata, not geometry or the recipe bundle
|
|
310
|
-
* @example
|
|
311
|
-
* const definition = await snaptrude.design.family.getDefinition({ id, version })
|
|
312
|
-
*/
|
|
313
|
-
public abstract getDefinition(
|
|
314
|
-
args: PluginDesignFamilyGetDefinitionArgs,
|
|
315
|
-
): PluginApiReturn<PluginFamilyDefinition>
|
|
167
|
+
public abstract list(): PluginApiReturn<PluginFamilySummary[]>
|
|
316
168
|
|
|
317
169
|
/**
|
|
318
170
|
* Put a family into the model — either the prepared draft or any family from
|
|
@@ -336,13 +188,6 @@ export abstract class PluginDesignFamilyApi {
|
|
|
336
188
|
* To COPY a placed component, place its family again at the new position with
|
|
337
189
|
* the same `values` — there is no separate copy call.
|
|
338
190
|
*
|
|
339
|
-
* HOSTED families (doors, windows — anything with an `opening`, a `host`
|
|
340
|
-
* block, or a void with `cuts: "host"`) take `host`: a wall or a placed
|
|
341
|
-
* family. The family is set into the host's face nearest `position` (the
|
|
342
|
-
* host's middle when omitted), and the host is cut — a system wall by the
|
|
343
|
-
* wall cutter, a family by its own recipe. Host-bound parameters then follow
|
|
344
|
-
* the host (a door's wall thickness follows the wall).
|
|
345
|
-
*
|
|
346
191
|
* @param args Which family, where, and at what parameter values
|
|
347
192
|
* @returns What was placed; `component` is present only in positioned mode
|
|
348
193
|
*
|
|
@@ -362,9 +207,6 @@ export abstract class PluginDesignFamilyApi {
|
|
|
362
207
|
*
|
|
363
208
|
* // interactive — the user clicks
|
|
364
209
|
* await snaptrude.design.family.place()
|
|
365
|
-
*
|
|
366
|
-
* // hosted — a door in a wall, near a point along it
|
|
367
|
-
* await snaptrude.design.family.place({ id: doorId, host: wall, position: { x: 3, y: 0, z: 0 } })
|
|
368
210
|
* ```
|
|
369
211
|
*/
|
|
370
212
|
public abstract place(
|
|
@@ -407,34 +249,6 @@ export abstract class PluginDesignFamilyApi {
|
|
|
407
249
|
* that does not is accepted and stored (it round-trips to Revit) but nothing
|
|
408
250
|
* visible happens — say so rather than claiming a change the user cannot see.
|
|
409
251
|
*
|
|
410
|
-
* NESTED children: `children: { "<path>": { key: value } }` sets a nested
|
|
411
|
-
* child's own values (every copy of it). A value its parent sets is sent up
|
|
412
|
-
* to what it follows when that is a plain relationship; otherwise it is
|
|
413
|
-
* refused with what to change instead (see `refused`).
|
|
414
|
-
*
|
|
415
|
-
* LINKS: `links: { key: { from, expr } }` makes this family's `key` follow
|
|
416
|
-
* another placed object — `from` is a family (it reports its parameters and
|
|
417
|
-
* outputs) or a wall (it reports thickness, length, height); `expr` is an
|
|
418
|
-
* expression over those reports. `null` removes a link. Links that would
|
|
419
|
-
* make objects follow each other in a loop are refused. Values accept unit
|
|
420
|
-
* literals ("600mm").
|
|
421
|
-
*
|
|
422
|
-
* RELATIONS: `relations: { add: [...], remove: ["r1"] }` sets how the family
|
|
423
|
-
* sits against other placed objects or cuts its host:
|
|
424
|
-
* - `attach` — `{ kind: "attach", side: "base" | "top", to: <object> | { level, face? }, offset? }`:
|
|
425
|
-
* sits on a surface, or its top reaches one (reports `reach`, `gap`, `surface`).
|
|
426
|
-
* - `join` — `{ kind: "join", end, to: <family>, toEnd, bindOther? }`: its end moves onto
|
|
427
|
-
* the other's end (reports `angle`, `absAngle`, `mitre`).
|
|
428
|
-
* - `span` — `{ kind: "span", from, to, at? }`: pinned between two objects, running along
|
|
429
|
-
* its +X (reports `distance`, `run`, `rise`, `slope`, `from.*`, `to.*`).
|
|
430
|
-
* - `path` — `{ kind: "path", from? | points, closed? }`: follows a wall's centreline, a
|
|
431
|
-
* family's run or given points (reports `length`; the recipe reads the path).
|
|
432
|
-
* - `cut` — `{ kind: "cut", to: "host" }`: applies recipe voids to the current host.
|
|
433
|
-
* Removing it closes the opening without detaching or deleting the family.
|
|
434
|
-
* Door/window placement adds it. Hosting alone does not cut. No parameter binds.
|
|
435
|
-
* Placement relations take `bind: { <param>: "<expression over its reports>" }`; bound
|
|
436
|
-
* parameters are read-only. A relation with an existing `id` replaces it.
|
|
437
|
-
*
|
|
438
252
|
* `length` values are Snaptrude units: the same 254 mm unit as the kernel's
|
|
439
253
|
* internal (`"babylon"`) unit — convert the user's number with
|
|
440
254
|
* `core.units.convert` first; a bare `400` is 400 SU, not 400 mm. Kernel part
|
|
@@ -449,15 +263,6 @@ export abstract class PluginDesignFamilyApi {
|
|
|
449
263
|
* # Example
|
|
450
264
|
* ```ts
|
|
451
265
|
* await snaptrude.design.family.setParameters({ component, values: { seats: 8 } })
|
|
452
|
-
* await snaptrude.design.family.setParameters({ component, children: { chair: { width: "380mm" } } })
|
|
453
|
-
* await snaptrude.design.family.setParameters({
|
|
454
|
-
* component: railing,
|
|
455
|
-
* links: { steps: { from: stair, expr: "steps" }, side: { from: stair, expr: "width - 40mm" } },
|
|
456
|
-
* })
|
|
457
|
-
* await snaptrude.design.family.setParameters({
|
|
458
|
-
* component: post,
|
|
459
|
-
* relations: { add: [{ kind: "attach", side: "top", to: slab, bind: { height: "reach" } }] },
|
|
460
|
-
* })
|
|
461
266
|
* ```
|
|
462
267
|
*/
|
|
463
268
|
public abstract setParameters(
|
|
@@ -467,24 +272,12 @@ export abstract class PluginDesignFamilyApi {
|
|
|
467
272
|
/**
|
|
468
273
|
* Save the prepared bundle to the library — the user's personal library
|
|
469
274
|
* unless `teamId` is given. {@linkcode PluginDesignFamilyApi.place} already
|
|
470
|
-
* saves
|
|
471
|
-
*
|
|
472
|
-
*
|
|
473
|
-
* standalone sample at the current view centre on the active storey
|
|
474
|
-
* (`placed: true`). This includes architectural families: the sample does
|
|
475
|
-
* not assign a family to a native host.
|
|
476
|
-
*
|
|
477
|
-
* When the draft edits a saved family (opened with `get({ id })` /
|
|
478
|
-
* `get({ component })`), or its name is already taken in that library, the
|
|
479
|
-
* APP asks the user in its own window whether to save a new version of that
|
|
480
|
-
* family — every placed copy in this project moves to it, and families
|
|
481
|
-
* nesting it may be offered theirs — or a new family ("new family" is the
|
|
482
|
-
* default). The agent never asks this itself and cannot answer the window.
|
|
483
|
-
* `decision` reports what the user chose; `"cancelled"` means nothing was
|
|
484
|
-
* saved (`ok: false`) and nothing will auto-save until `create` is called again.
|
|
275
|
+
* saves, so `create` is for sharing with a team. When nothing of the family is
|
|
276
|
+
* in the model yet, one instance is also dropped at the centre of the current
|
|
277
|
+
* view on the active storey (`placed: true`), so a save is never invisible.
|
|
485
278
|
*
|
|
486
279
|
* @param args Optional library name and team scope
|
|
487
|
-
* @returns The catalogued definition's id and version
|
|
280
|
+
* @returns The catalogued definition's id and version
|
|
488
281
|
*
|
|
489
282
|
* @examplePrompt Save this as a family called Vertical Louvre
|
|
490
283
|
* @examplePrompt Add it to my library
|
|
@@ -521,56 +314,14 @@ export abstract class PluginDesignFamilyApi {
|
|
|
521
314
|
* ```
|
|
522
315
|
*/
|
|
523
316
|
public abstract delete(
|
|
524
|
-
args?: PluginDesignFamilyDeleteArgs
|
|
317
|
+
args?: PluginDesignFamilyDeleteArgs,
|
|
525
318
|
): PluginApiReturn<PluginFamilyDeleteResult>
|
|
526
319
|
}
|
|
527
320
|
|
|
528
|
-
/** Optional reference sections keep unrelated grammar out of the core response. */
|
|
529
|
-
export const PluginFamilyReferenceSection = z.enum([
|
|
530
|
-
"architectural",
|
|
531
|
-
"networks",
|
|
532
|
-
"relations",
|
|
533
|
-
])
|
|
534
|
-
export type PluginFamilyReferenceSection = z.infer<
|
|
535
|
-
typeof PluginFamilyReferenceSection
|
|
536
|
-
>
|
|
537
|
-
|
|
538
|
-
/** Omit section for the core grammar, workflow and example catalogue. */
|
|
539
|
-
export const PluginDesignFamilyGetReferenceArgs = z.object({
|
|
540
|
-
section: PluginFamilyReferenceSection.optional(),
|
|
541
|
-
})
|
|
542
|
-
export type PluginDesignFamilyGetReferenceArgs = z.infer<
|
|
543
|
-
typeof PluginDesignFamilyGetReferenceArgs
|
|
544
|
-
>
|
|
545
|
-
|
|
546
|
-
/** Compact output is opt-in: existing object consumers must retain their metadata. */
|
|
547
|
-
export const PluginDesignFamilyListArgs = z.object({
|
|
548
|
-
compact: z.boolean().optional(),
|
|
549
|
-
})
|
|
550
|
-
export type PluginDesignFamilyListArgs = z.infer<
|
|
551
|
-
typeof PluginDesignFamilyListArgs
|
|
552
|
-
>
|
|
553
|
-
|
|
554
321
|
// ---------------------------------------------------------------------------
|
|
555
322
|
// Result types
|
|
556
323
|
// ---------------------------------------------------------------------------
|
|
557
324
|
|
|
558
|
-
/** One worked example in the catalogue returned by `getExamples`. */
|
|
559
|
-
export interface PluginFamilyExampleSummary {
|
|
560
|
-
id: string
|
|
561
|
-
label: string
|
|
562
|
-
discipline: "architecture" | "structure" | "mep" | "furniture"
|
|
563
|
-
/** The patterns it demonstrates, e.g. "nesting", "slot", "path", "union", "trim". */
|
|
564
|
-
teaches: string[]
|
|
565
|
-
/** Size of the bundle as compact JSON, kilobytes — what fetching it costs. */
|
|
566
|
-
sizeKB: number
|
|
567
|
-
}
|
|
568
|
-
|
|
569
|
-
/** One worked example with its full bundle, from `getExamples({ id })`. */
|
|
570
|
-
export interface PluginFamilyExample extends PluginFamilyExampleSummary {
|
|
571
|
-
bundle: PluginFamilyBundle
|
|
572
|
-
}
|
|
573
|
-
|
|
574
325
|
/** The family-spec DSL reference returned by `getReference`. */
|
|
575
326
|
export interface PluginFamilyReference {
|
|
576
327
|
/** Grammar, op table, expression whitelist, repair contract, worked example. */
|
|
@@ -589,34 +340,6 @@ export interface PluginFamilyReference {
|
|
|
589
340
|
export interface PluginFamilyBundle {
|
|
590
341
|
root: Record<string, unknown>
|
|
591
342
|
deps?: Record<string, Record<string, unknown>>
|
|
592
|
-
/** Connector metadata saved with the recipe; network placement evaluates these expressions. */
|
|
593
|
-
network?: NetworkFamilyContract
|
|
594
|
-
}
|
|
595
|
-
|
|
596
|
-
/** Which saved family a draft edits. */
|
|
597
|
-
export interface PluginFamilyEditing {
|
|
598
|
-
/** Library id of the family being edited. */
|
|
599
|
-
familyId: string
|
|
600
|
-
/** The version that was opened. */
|
|
601
|
-
version: number
|
|
602
|
-
/** Its library name — an update saves under this name. */
|
|
603
|
-
name: string
|
|
604
|
-
/** "your library", or the team library's name. */
|
|
605
|
-
library: string
|
|
606
|
-
}
|
|
607
|
-
|
|
608
|
-
/** What `get` returns: the bundle, plus `editing` when the draft edits a saved family. */
|
|
609
|
-
export interface PluginFamilyGetResult extends PluginFamilyBundle {
|
|
610
|
-
editing?: PluginFamilyEditing
|
|
611
|
-
}
|
|
612
|
-
|
|
613
|
-
/** A family at a version, as `create` reports parents it did or did not update. */
|
|
614
|
-
export interface PluginFamilyVersionRef {
|
|
615
|
-
id: string
|
|
616
|
-
name: string
|
|
617
|
-
version: number
|
|
618
|
-
/** Set when the user chose to update it but the update failed. */
|
|
619
|
-
error?: string
|
|
620
343
|
}
|
|
621
344
|
|
|
622
345
|
/** Axis-aligned extents of a built family. Snaptrude units (1 SU = 254 mm), +Y up. */
|
|
@@ -664,10 +387,6 @@ export interface PluginFamilyDiagnostic {
|
|
|
664
387
|
| "depth"
|
|
665
388
|
| "bad-dimension"
|
|
666
389
|
| "proportion"
|
|
667
|
-
/** A part the geometry kernel could not build exactly; drawn approximately. */
|
|
668
|
-
| "kernel-fallback"
|
|
669
|
-
/** A part whose hole loop crosses its outline. */
|
|
670
|
-
| "profile-hole"
|
|
671
390
|
message: string
|
|
672
391
|
hint?: string
|
|
673
392
|
}
|
|
@@ -752,13 +471,6 @@ export interface PluginFamilySummary {
|
|
|
752
471
|
version: number
|
|
753
472
|
label: string
|
|
754
473
|
category?: string
|
|
755
|
-
/** The category's type token (`root.subType`), e.g. singleDoor or casementDouble. */
|
|
756
|
-
subType?: string
|
|
757
|
-
/**
|
|
758
|
-
* Opening contract kind, distinct from provenance (`kind`). Place with the
|
|
759
|
-
* positional `design.create.door` / `window` API and edit via family parameters.
|
|
760
|
-
*/
|
|
761
|
-
openingKind?: "door" | "window"
|
|
762
474
|
/** Number of rows on the family's parameter sheet. */
|
|
763
475
|
parameters: number
|
|
764
476
|
/**
|
|
@@ -775,49 +487,6 @@ export interface PluginFamilySummary {
|
|
|
775
487
|
kind: "native" | "revit"
|
|
776
488
|
}
|
|
777
489
|
|
|
778
|
-
/** Exact catalog pin. Unsaved session definitions are not catalog inventory. */
|
|
779
|
-
export const PluginDesignFamilyGetDefinitionArgs = z.object({
|
|
780
|
-
id: z.string().min(1),
|
|
781
|
-
version: z.number().int().positive(),
|
|
782
|
-
})
|
|
783
|
-
export type PluginDesignFamilyGetDefinitionArgs = z.infer<
|
|
784
|
-
typeof PluginDesignFamilyGetDefinitionArgs
|
|
785
|
-
>
|
|
786
|
-
|
|
787
|
-
/** Saved-family metadata. Physical lengths use mm; angle entries retain degrees. */
|
|
788
|
-
export const PluginFamilyDefinitionParameter = z.object({
|
|
789
|
-
key: z.string(),
|
|
790
|
-
label: z.string(),
|
|
791
|
-
type: z.enum(["length", "integer", "enum", "text", "boolean"]),
|
|
792
|
-
/** Angles use the legacy length type. Check unit before interpreting numeric values. */
|
|
793
|
-
unit: z.enum(["mm", "degrees"]).optional(),
|
|
794
|
-
default: z.union([z.number().finite(), z.string()]),
|
|
795
|
-
min: z.number().finite().optional(),
|
|
796
|
-
max: z.number().finite().optional(),
|
|
797
|
-
options: z.array(z.string()).optional(),
|
|
798
|
-
drivesGeometry: z.boolean(),
|
|
799
|
-
readOnly: z.boolean(),
|
|
800
|
-
formulaDriven: z.boolean(),
|
|
801
|
-
/** False means shared/type: placement cannot change it for one instance. */
|
|
802
|
-
isInstance: z.boolean(),
|
|
803
|
-
})
|
|
804
|
-
export type PluginFamilyDefinitionParameter = z.infer<
|
|
805
|
-
typeof PluginFamilyDefinitionParameter
|
|
806
|
-
>
|
|
807
|
-
|
|
808
|
-
/** Read-only catalog inventory. Boolean defaults retain the family DSL's Yes/No strings. */
|
|
809
|
-
export const PluginFamilyDefinition = z.object({
|
|
810
|
-
id: z.string(),
|
|
811
|
-
version: z.number().int().positive(),
|
|
812
|
-
label: z.string(),
|
|
813
|
-
category: z.string().optional(),
|
|
814
|
-
lengthUnit: z.literal("mm"),
|
|
815
|
-
parameters: z.array(PluginFamilyDefinitionParameter),
|
|
816
|
-
/** Pinned connector metadata. Absence means this family cannot build a topology network. */
|
|
817
|
-
network: NetworkFamilyContract.optional(),
|
|
818
|
-
})
|
|
819
|
-
export type PluginFamilyDefinition = z.infer<typeof PluginFamilyDefinition>
|
|
820
|
-
|
|
821
490
|
/** What `place` reports. */
|
|
822
491
|
export interface PluginFamilyPlaceResult {
|
|
823
492
|
ok: boolean
|
|
@@ -846,104 +515,6 @@ export interface PluginFamilyInstanceParameters {
|
|
|
846
515
|
parts?: PluginFamilyPart[]
|
|
847
516
|
/** Present when `getParameters` was asked for a `snapshot`. */
|
|
848
517
|
snapshot?: PluginFamilySnapshot
|
|
849
|
-
/** The family's `outputs`, as last built. */
|
|
850
|
-
reports?: Record<string, number | string>
|
|
851
|
-
/** Every declared nested child, as last built. */
|
|
852
|
-
children?: PluginFamilyNestedChild[]
|
|
853
|
-
/** Parameters that follow another object (links) or the host. */
|
|
854
|
-
follows?: PluginFamilyFollow[]
|
|
855
|
-
/** Where a hosted family sits: a system wall, or a family by id. */
|
|
856
|
-
host?: ({ kind: "wall" } | { kind: "family"; id: string }) & {
|
|
857
|
-
/** True when the host no longer has room for it: it is out of the model until it fits again. */
|
|
858
|
-
parked?: boolean
|
|
859
|
-
}
|
|
860
|
-
/** Guests hosted in THIS family that no longer fit it (parked); they return when they fit. */
|
|
861
|
-
parkedGuests?: { id: string; family: string }[]
|
|
862
|
-
/** How it sits against other placed objects (attach, join, span, path), with current reports. */
|
|
863
|
-
relations?: PluginFamilyRelation[]
|
|
864
|
-
/** setParameters only: the edits refused, each with what to change instead. */
|
|
865
|
-
refused?: string[]
|
|
866
|
-
}
|
|
867
|
-
|
|
868
|
-
/** A nested child of a placed family. */
|
|
869
|
-
export interface PluginFamilyNestedChild {
|
|
870
|
-
/** "chair", or "chair/cushion" for a child of a child — the key for `children` edits. */
|
|
871
|
-
path: string
|
|
872
|
-
label: string
|
|
873
|
-
/** The family it is now (a slot's current pick). */
|
|
874
|
-
family: string
|
|
875
|
-
familyLabel: string
|
|
876
|
-
/** How many copies the parent places. */
|
|
877
|
-
copies: number
|
|
878
|
-
slot?: { expr: string; options: string[] }
|
|
879
|
-
values: Record<string, number | string>
|
|
880
|
-
/** Values the parent sets, with the expression it sets them by. */
|
|
881
|
-
setBy: Record<string, string | undefined>
|
|
882
|
-
reports: Record<string, number | string>
|
|
883
|
-
}
|
|
884
|
-
|
|
885
|
-
/** A placed relation as stored, plus what it measures now. */
|
|
886
|
-
export type PluginFamilyRelation = PluginFamilyRelationInput & {
|
|
887
|
-
id: string
|
|
888
|
-
/** "Attached to", "Joins", "Spans between", "Along a path", "Cuts host". */
|
|
889
|
-
label: string
|
|
890
|
-
summary: string
|
|
891
|
-
/** False when a target is gone: the family stayed where it was. */
|
|
892
|
-
live: boolean
|
|
893
|
-
reports: Record<string, number | string>
|
|
894
|
-
}
|
|
895
|
-
|
|
896
|
-
/** One relation to add (`relations.add`). Targets are handles, except a cut's symbolic "host". */
|
|
897
|
-
export type PluginFamilyRelationInput = {
|
|
898
|
-
/** Replaces the relation with this id; a new one gets "r1", "r2"… */
|
|
899
|
-
id?: string
|
|
900
|
-
/** This family's parameter → an expression over the relation's reports and own parameters. */
|
|
901
|
-
bind?: Record<string, string>
|
|
902
|
-
} & (
|
|
903
|
-
| {
|
|
904
|
-
kind: "attach"
|
|
905
|
-
side: "base" | "top"
|
|
906
|
-
to: ComponentHandle | { level: number; face?: "base" | "top" }
|
|
907
|
-
offset?: number
|
|
908
|
-
}
|
|
909
|
-
| {
|
|
910
|
-
kind: "join"
|
|
911
|
-
end: "start" | "end"
|
|
912
|
-
to: ComponentHandle
|
|
913
|
-
toEnd: "start" | "end"
|
|
914
|
-
/** The other family's parameters, over the same reports. */
|
|
915
|
-
bindOther?: Record<string, string>
|
|
916
|
-
}
|
|
917
|
-
| {
|
|
918
|
-
kind: "span"
|
|
919
|
-
from: ComponentHandle
|
|
920
|
-
to: ComponentHandle
|
|
921
|
-
at?: "top" | "centre" | "base"
|
|
922
|
-
}
|
|
923
|
-
| {
|
|
924
|
-
kind: "path"
|
|
925
|
-
from?: ComponentHandle
|
|
926
|
-
points?: [number, number, number][]
|
|
927
|
-
closed?: boolean
|
|
928
|
-
}
|
|
929
|
-
| {
|
|
930
|
-
/** Apply recipe voids to the existing host without adding another host ID. */
|
|
931
|
-
kind: "cut"
|
|
932
|
-
to: "host"
|
|
933
|
-
bind?: never
|
|
934
|
-
}
|
|
935
|
-
)
|
|
936
|
-
|
|
937
|
-
/** One parameter that follows something else. */
|
|
938
|
-
export interface PluginFamilyFollow {
|
|
939
|
-
key: string
|
|
940
|
-
/** "relation": set by a placed relation — `from` is the relation's id. */
|
|
941
|
-
kind: "link" | "host" | "relation"
|
|
942
|
-
/** The source's id. */
|
|
943
|
-
from: string
|
|
944
|
-
fromLabel: string
|
|
945
|
-
/** The expression over the source's reports (for a host: the report name). */
|
|
946
|
-
expr: string
|
|
947
518
|
}
|
|
948
519
|
|
|
949
520
|
/** What `create` reports. */
|
|
@@ -956,26 +527,6 @@ export interface PluginFamilyCreateResult {
|
|
|
956
527
|
placed?: boolean
|
|
957
528
|
/** Host guidance for the caller, e.g. that an instance was placed at the view centre. */
|
|
958
529
|
hint?: string
|
|
959
|
-
/**
|
|
960
|
-
* What the user chose in the app's window: `"version"` (a new version of
|
|
961
|
-
* the saved family), `"new"` (a new family), `"cancelled"` (nothing saved).
|
|
962
|
-
* `"saved"` = no question was needed.
|
|
963
|
-
*/
|
|
964
|
-
decision?: "version" | "new" | "cancelled" | "saved"
|
|
965
|
-
/** The library name it was saved under. */
|
|
966
|
-
name?: string
|
|
967
|
-
/** Placed copies in this project moved to the new version (the family's and updated parents'). */
|
|
968
|
-
movedCopies?: number
|
|
969
|
-
/** What the moved copies lost because the new version no longer has it. */
|
|
970
|
-
dropped?: {
|
|
971
|
-
values: Array<{ copy: string; key: string }>
|
|
972
|
-
childValues: Array<{ copy: string; path: string }>
|
|
973
|
-
follows: Array<{ copy: string; key: string; kind: "link" | "relation" }>
|
|
974
|
-
}
|
|
975
|
-
/** Families nesting this one that the user chose to update, at their new versions. */
|
|
976
|
-
parentsUpdated?: PluginFamilyVersionRef[]
|
|
977
|
-
/** Families nesting this one that keep their version. */
|
|
978
|
-
parentsKept?: PluginFamilyVersionRef[]
|
|
979
530
|
error?: string
|
|
980
531
|
}
|
|
981
532
|
|
|
@@ -1004,7 +555,6 @@ export interface PluginFamilyDeleteResult {
|
|
|
1004
555
|
export const PluginFamilyBundleSchema = z.object({
|
|
1005
556
|
root: z.record(z.string(), z.unknown()),
|
|
1006
557
|
deps: z.record(z.string(), z.record(z.string(), z.unknown())).optional(),
|
|
1007
|
-
network: NetworkFamilyContract.optional(),
|
|
1008
558
|
})
|
|
1009
559
|
|
|
1010
560
|
/**
|
|
@@ -1026,71 +576,16 @@ export const PluginFamilyBundleSchema = z.object({
|
|
|
1026
576
|
* the viewport is not moved — and comes back as a PNG data URL in the result's
|
|
1027
577
|
* `snapshot.image`. Through the agent's `run_worker`, return the result and the
|
|
1028
578
|
* image reaches the model as an image.
|
|
1029
|
-
*
|
|
1030
|
-
* `focus` makes it a close-up: `{ parts: ["seat", "back", "slat@*"] }` frames
|
|
1031
|
-
* the joint where those groups meet (`*` matches any run of characters;
|
|
1032
|
-
* nested names are `a/b`), or their full bounds if they do not meet. A margin
|
|
1033
|
-
* of a quarter of their size (at least 50 mm) surrounds the joint.
|
|
1034
|
-
* `{ box: { min, max } }` frames a region in family space
|
|
1035
|
-
* (Snaptrude units, +Y up). Every other part is still drawn; the dimension line
|
|
1036
|
-
* then gives the framed region and the result says `closeUp: true`. A part
|
|
1037
|
-
* name that matches nothing fails the snapshot with a list of real names.
|
|
1038
579
|
*/
|
|
1039
|
-
export const PluginFamilySnapshotFocus = z.union([
|
|
1040
|
-
z.object({ parts: z.array(z.string().min(1)).min(1) }),
|
|
1041
|
-
z.object({
|
|
1042
|
-
box: z
|
|
1043
|
-
.object({
|
|
1044
|
-
min: z.tuple([
|
|
1045
|
-
z.number().finite(),
|
|
1046
|
-
z.number().finite(),
|
|
1047
|
-
z.number().finite(),
|
|
1048
|
-
]),
|
|
1049
|
-
max: z.tuple([
|
|
1050
|
-
z.number().finite(),
|
|
1051
|
-
z.number().finite(),
|
|
1052
|
-
z.number().finite(),
|
|
1053
|
-
]),
|
|
1054
|
-
})
|
|
1055
|
-
.refine(
|
|
1056
|
-
({ min, max }) => min.every((value, axis) => value <= max[axis]),
|
|
1057
|
-
{
|
|
1058
|
-
message: "Each minimum must be at or below its maximum",
|
|
1059
|
-
},
|
|
1060
|
-
),
|
|
1061
|
-
}),
|
|
1062
|
-
])
|
|
1063
|
-
export type PluginFamilySnapshotFocus = z.infer<
|
|
1064
|
-
typeof PluginFamilySnapshotFocus
|
|
1065
|
-
>
|
|
1066
|
-
|
|
1067
|
-
/** One close-up tile; omission of view uses the sheet's first view. */
|
|
1068
|
-
export const PluginFamilySnapshotCloseUp = z.intersection(
|
|
1069
|
-
PluginFamilySnapshotFocus,
|
|
1070
|
-
z.object({ view: z.enum(["iso", "front", "right", "top"]).optional() }),
|
|
1071
|
-
)
|
|
1072
|
-
export type PluginFamilySnapshotCloseUp = z.infer<
|
|
1073
|
-
typeof PluginFamilySnapshotCloseUp
|
|
1074
|
-
>
|
|
1075
|
-
|
|
1076
580
|
export const PluginFamilySnapshotOption = z.union([
|
|
1077
581
|
z.boolean(),
|
|
1078
582
|
z.object({
|
|
1079
583
|
views: z.array(z.enum(["iso", "front", "right", "top"])).optional(),
|
|
1080
584
|
/** Pixels per tile (square), 64–2048; default 512. */
|
|
1081
585
|
tileSize: z.number().optional(),
|
|
1082
|
-
/** One focus across views, or 1–6 independent close-up tiles in one image. */
|
|
1083
|
-
focus: z
|
|
1084
|
-
.union([
|
|
1085
|
-
PluginFamilySnapshotFocus,
|
|
1086
|
-
z.array(PluginFamilySnapshotCloseUp).min(1).max(6),
|
|
1087
|
-
])
|
|
1088
|
-
.optional(),
|
|
1089
586
|
}),
|
|
1090
587
|
])
|
|
1091
|
-
export type PluginFamilySnapshotOption = z.infer<
|
|
1092
|
-
typeof PluginFamilySnapshotOption
|
|
1093
|
-
>
|
|
588
|
+
export type PluginFamilySnapshotOption = z.infer<typeof PluginFamilySnapshotOption>
|
|
1094
589
|
|
|
1095
590
|
/** The picture block on prepare / flex / getParameters results when `snapshot` was asked for. */
|
|
1096
591
|
export interface PluginFamilySnapshot {
|
|
@@ -1098,18 +593,9 @@ export interface PluginFamilySnapshot {
|
|
|
1098
593
|
/** PNG data URL of the composed sheet. */
|
|
1099
594
|
image?: string
|
|
1100
595
|
views?: ("iso" | "front" | "right" | "top")[]
|
|
1101
|
-
/** [width, height, depth] in
|
|
596
|
+
/** [width, height, depth] in Snaptrude units. */
|
|
1102
597
|
size?: [number, number, number]
|
|
1103
598
|
ms?: number
|
|
1104
|
-
/** True when the sheet is a close-up (`focus`), not the whole family. */
|
|
1105
|
-
closeUp?: boolean
|
|
1106
|
-
/** Per-tile results for a focus list. One invalid target does not discard other tiles. */
|
|
1107
|
-
closeUps?: Array<{
|
|
1108
|
-
view: "iso" | "front" | "right" | "top"
|
|
1109
|
-
label: string
|
|
1110
|
-
size?: [number, number, number]
|
|
1111
|
-
error?: string
|
|
1112
|
-
}>
|
|
1113
599
|
/** Set when the picture could not be taken (e.g. the legacy renderer); the call itself still succeeded. */
|
|
1114
600
|
error?: string
|
|
1115
601
|
}
|
|
@@ -1119,105 +605,21 @@ export const PluginDesignFamilyPrepareArgs = z.object({
|
|
|
1119
605
|
spec: PluginFamilyBundleSchema.optional(),
|
|
1120
606
|
snapshot: PluginFamilySnapshotOption.optional(),
|
|
1121
607
|
})
|
|
1122
|
-
export type PluginDesignFamilyPrepareArgs = z.infer<
|
|
1123
|
-
typeof PluginDesignFamilyPrepareArgs
|
|
1124
|
-
>
|
|
608
|
+
export type PluginDesignFamilyPrepareArgs = z.infer<typeof PluginDesignFamilyPrepareArgs>
|
|
1125
609
|
|
|
1126
610
|
/**
|
|
1127
611
|
* Arguments for {@linkcode PluginDesignFamilyApi.flex}.
|
|
1128
612
|
*
|
|
1129
613
|
* | Property | Type | Description |
|
|
1130
614
|
* |---|---|---|
|
|
1131
|
-
* | `values` | `Record<string, number \| string>` |
|
|
615
|
+
* | `values` | `Record<string, number \| string>` | Parameter values to change (partial) |
|
|
1132
616
|
* | `snapshot` | {@linkcode PluginFamilySnapshotOption} | Also return a picture of the flexed family |
|
|
1133
617
|
*/
|
|
1134
618
|
export const PluginDesignFamilyFlexArgs = z.object({
|
|
1135
|
-
values: z.record(z.string(), z.union([z.number(), z.string()]))
|
|
619
|
+
values: z.record(z.string(), z.union([z.number(), z.string()])),
|
|
1136
620
|
snapshot: PluginFamilySnapshotOption.optional(),
|
|
1137
621
|
})
|
|
1138
|
-
export type PluginDesignFamilyFlexArgs = z.infer<
|
|
1139
|
-
typeof PluginDesignFamilyFlexArgs
|
|
1140
|
-
>
|
|
1141
|
-
|
|
1142
|
-
/**
|
|
1143
|
-
* Arguments for {@linkcode PluginDesignFamilyApi.get}. All optional — no
|
|
1144
|
-
* arguments returns the prepared draft.
|
|
1145
|
-
*
|
|
1146
|
-
* | Property | Type | Description |
|
|
1147
|
-
* |---|---|---|
|
|
1148
|
-
* | `id` | `string` | A saved family to open for editing, from {@linkcode PluginDesignFamilyApi.list} |
|
|
1149
|
-
* | `version` | `number` | Exact version to open; defaults to the newest |
|
|
1150
|
-
* | `component` | {@linkcode ComponentHandle} | Open the family of this placed copy, at its version |
|
|
1151
|
-
*/
|
|
1152
|
-
export const PluginDesignFamilyGetArgs = z.object({
|
|
1153
|
-
id: z.string().optional(),
|
|
1154
|
-
version: z.number().int().positive().optional(),
|
|
1155
|
-
component: ComponentHandle.optional(),
|
|
1156
|
-
})
|
|
1157
|
-
export type PluginDesignFamilyGetArgs = z.infer<
|
|
1158
|
-
typeof PluginDesignFamilyGetArgs
|
|
1159
|
-
>
|
|
1160
|
-
|
|
1161
|
-
/**
|
|
1162
|
-
* Arguments for {@linkcode PluginDesignFamilyApi.getExamples}.
|
|
1163
|
-
*
|
|
1164
|
-
* | Property | Type | Description |
|
|
1165
|
-
* |---|---|---|
|
|
1166
|
-
* | `id` | `string` | One example's id — returns its bundle |
|
|
1167
|
-
* | `discipline` | `string` | List only this discipline: architecture, structure, mep, furniture |
|
|
1168
|
-
* | `tag` | `string` | List only examples teaching this pattern (e.g. "path", "union") |
|
|
1169
|
-
*/
|
|
1170
|
-
export const PluginDesignFamilyGetExamplesArgs = z.object({
|
|
1171
|
-
id: z.string().optional(),
|
|
1172
|
-
discipline: z
|
|
1173
|
-
.enum(["architecture", "structure", "mep", "furniture"])
|
|
1174
|
-
.optional(),
|
|
1175
|
-
tag: z.string().optional(),
|
|
1176
|
-
})
|
|
1177
|
-
export type PluginDesignFamilyGetExamplesArgs = z.infer<
|
|
1178
|
-
typeof PluginDesignFamilyGetExamplesArgs
|
|
1179
|
-
>
|
|
1180
|
-
|
|
1181
|
-
/**
|
|
1182
|
-
* Arguments for {@linkcode PluginDesignFamilyApi.getTemplate}.
|
|
1183
|
-
* `kind` selects the opening contract. `subType` is a nonempty type token;
|
|
1184
|
-
* omission selects singleDoor / fixedWindow. Unsupported tokens return the
|
|
1185
|
-
* default template with guidance rather than preventing custom subtype authoring.
|
|
1186
|
-
*/
|
|
1187
|
-
export const PluginDesignFamilyGetTemplateArgs = z.object({
|
|
1188
|
-
kind: z.enum(["door", "window"]),
|
|
1189
|
-
subType: z.string().min(1).optional(),
|
|
1190
|
-
})
|
|
1191
|
-
export type PluginDesignFamilyGetTemplateArgs = z.infer<
|
|
1192
|
-
typeof PluginDesignFamilyGetTemplateArgs
|
|
1193
|
-
>
|
|
1194
|
-
|
|
1195
|
-
/**
|
|
1196
|
-
* Maps opening dimensions to authored length parameter KEYS, not values.
|
|
1197
|
-
* Width and height describe the wall hole; sill measures from the wall base
|
|
1198
|
-
* to the hole bottom (windows). Wall thickness follows the host wall.
|
|
1199
|
-
* The recipe and family parameter APIs use Snaptrude units (1 SU = 254 mm).
|
|
1200
|
-
*/
|
|
1201
|
-
export interface PluginFamilyOpeningContract {
|
|
1202
|
-
kind: "door" | "window"
|
|
1203
|
-
width: string
|
|
1204
|
-
height: string
|
|
1205
|
-
sill?: string
|
|
1206
|
-
wallThickness?: string
|
|
1207
|
-
}
|
|
1208
|
-
|
|
1209
|
-
/** Starter recipe metadata returned by `getTemplate`; instances are ParametricComponents. */
|
|
1210
|
-
export interface PluginFamilyTemplateResult {
|
|
1211
|
-
/** Validated recipe bundle: edit its style while preserving the contract. */
|
|
1212
|
-
bundle: PluginFamilyBundle
|
|
1213
|
-
contract: PluginFamilyOpeningContract
|
|
1214
|
-
/** Actual template subtype, including when an unsupported token used the default. */
|
|
1215
|
-
subType: string
|
|
1216
|
-
/** Authoring rules and any note about an unsupported requested subtype. */
|
|
1217
|
-
guidance: string[]
|
|
1218
|
-
/** Available starter templates for the requested kind. */
|
|
1219
|
-
available: Array<{ subType: string; label: string; teaches: string[] }>
|
|
1220
|
-
}
|
|
622
|
+
export type PluginDesignFamilyFlexArgs = z.infer<typeof PluginDesignFamilyFlexArgs>
|
|
1221
623
|
|
|
1222
624
|
/**
|
|
1223
625
|
* Arguments for {@linkcode PluginDesignFamilyApi.create}.
|
|
@@ -1231,9 +633,7 @@ export const PluginDesignFamilyCreateArgs = z.object({
|
|
|
1231
633
|
name: z.string().optional(),
|
|
1232
634
|
teamId: z.string().optional(),
|
|
1233
635
|
})
|
|
1234
|
-
export type PluginDesignFamilyCreateArgs = z.infer<
|
|
1235
|
-
typeof PluginDesignFamilyCreateArgs
|
|
1236
|
-
>
|
|
636
|
+
export type PluginDesignFamilyCreateArgs = z.infer<typeof PluginDesignFamilyCreateArgs>
|
|
1237
637
|
|
|
1238
638
|
/**
|
|
1239
639
|
* Arguments for {@linkcode PluginDesignFamilyApi.delete}.
|
|
@@ -1247,9 +647,7 @@ export const PluginDesignFamilyDeleteArgs = z.object({
|
|
|
1247
647
|
id: z.string().optional(),
|
|
1248
648
|
instances: z.boolean().optional(),
|
|
1249
649
|
})
|
|
1250
|
-
export type PluginDesignFamilyDeleteArgs = z.infer<
|
|
1251
|
-
typeof PluginDesignFamilyDeleteArgs
|
|
1252
|
-
>
|
|
650
|
+
export type PluginDesignFamilyDeleteArgs = z.infer<typeof PluginDesignFamilyDeleteArgs>
|
|
1253
651
|
|
|
1254
652
|
/**
|
|
1255
653
|
* Arguments for {@linkcode PluginDesignFamilyApi.place}.
|
|
@@ -1258,7 +656,7 @@ export type PluginDesignFamilyDeleteArgs = z.infer<
|
|
|
1258
656
|
* |---|---|---|
|
|
1259
657
|
* | `id` | `string` | Family to place, from {@linkcode PluginDesignFamilyApi.list}. Omit to place the prepared draft |
|
|
1260
658
|
* | `version` | `number` | Exact version; defaults to the newest known |
|
|
1261
|
-
* | `position` | `
|
|
659
|
+
* | `position` | `{ x, y, z }` | Place HERE, without user interaction. Omit to arm the cursor instead |
|
|
1262
660
|
* | `rotation` | `number` | Yaw in degrees about +Y. Only with `position` |
|
|
1263
661
|
* | `values` | `Record<string, number \| string>` | Parameter values for THIS instance |
|
|
1264
662
|
* | `storey` | `number` | Storey to place on; defaults to the active one |
|
|
@@ -1266,16 +664,12 @@ export type PluginDesignFamilyDeleteArgs = z.infer<
|
|
|
1266
664
|
export const PluginDesignFamilyPlaceArgs = z.object({
|
|
1267
665
|
id: z.string().optional(),
|
|
1268
666
|
version: z.number().int().positive().optional(),
|
|
1269
|
-
position:
|
|
667
|
+
position: Vec3Components.optional(),
|
|
1270
668
|
rotation: z.number().optional(),
|
|
1271
669
|
values: z.record(z.string(), z.union([z.number(), z.string()])).optional(),
|
|
1272
670
|
storey: z.number().int().optional(),
|
|
1273
|
-
/** Hosted families: wall or family host. Values apply before fit checks and cutting. */
|
|
1274
|
-
host: ComponentHandle.optional(),
|
|
1275
671
|
})
|
|
1276
|
-
export type PluginDesignFamilyPlaceArgs = z.infer<
|
|
1277
|
-
typeof PluginDesignFamilyPlaceArgs
|
|
1278
|
-
>
|
|
672
|
+
export type PluginDesignFamilyPlaceArgs = z.infer<typeof PluginDesignFamilyPlaceArgs>
|
|
1279
673
|
|
|
1280
674
|
/**
|
|
1281
675
|
* Arguments for {@linkcode PluginDesignFamilyApi.getParameters}.
|
|
@@ -1303,31 +697,7 @@ export type PluginDesignFamilyGetParametersArgs = z.infer<
|
|
|
1303
697
|
*/
|
|
1304
698
|
export const PluginDesignFamilySetParametersArgs = z.object({
|
|
1305
699
|
component: ComponentHandle,
|
|
1306
|
-
values: z
|
|
1307
|
-
.record(z.string(), z.union([z.number(), z.string()]))
|
|
1308
|
-
.optional()
|
|
1309
|
-
.default({}),
|
|
1310
|
-
/** Nested children's own values: { "<path>": { key: value } }. */
|
|
1311
|
-
children: z
|
|
1312
|
-
.record(z.string(), z.record(z.string(), z.union([z.number(), z.string()])))
|
|
1313
|
-
.optional(),
|
|
1314
|
-
/** Links: { key: { from, expr } | null }. */
|
|
1315
|
-
links: z
|
|
1316
|
-
.record(
|
|
1317
|
-
z.string(),
|
|
1318
|
-
z.union([
|
|
1319
|
-
z.object({ from: ComponentHandle, expr: z.string() }),
|
|
1320
|
-
z.null(),
|
|
1321
|
-
]),
|
|
1322
|
-
)
|
|
1323
|
-
.optional(),
|
|
1324
|
-
/** Placed relations: { add?: [{ kind, … }], remove?: ["r1"] } — checked by the host. */
|
|
1325
|
-
relations: z
|
|
1326
|
-
.object({
|
|
1327
|
-
add: z.array(z.record(z.string(), z.unknown())).optional(),
|
|
1328
|
-
remove: z.array(z.string()).optional(),
|
|
1329
|
-
})
|
|
1330
|
-
.optional(),
|
|
700
|
+
values: z.record(z.string(), z.union([z.number(), z.string()])),
|
|
1331
701
|
})
|
|
1332
702
|
export type PluginDesignFamilySetParametersArgs = z.infer<
|
|
1333
703
|
typeof PluginDesignFamilySetParametersArgs
|