@snaptrude/plugin-core 0.9.16 → 0.9.18-voids-20261016.1
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.full.json +10406 -0
- package/api-manifest.json +827 -51
- 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 +29 -0
- package/dist/api/core/camera/index.d.ts.map +1 -1
- package/dist/api/core/geom/create/index.d.ts +7 -1
- package/dist/api/core/geom/create/index.d.ts.map +1 -1
- package/dist/api/core/geom/update/contour.d.ts +8 -2
- package/dist/api/core/geom/update/contour.d.ts.map +1 -1
- package/dist/api/core/zoom/index.d.ts +13 -0
- package/dist/api/core/zoom/index.d.ts.map +1 -1
- package/dist/api/design/bim.d.ts +209 -0
- package/dist/api/design/bim.d.ts.map +1 -0
- package/dist/api/design/boolean/index.d.ts +2 -0
- package/dist/api/design/boolean/index.d.ts.map +1 -1
- package/dist/api/design/catalog.d.ts +320 -0
- package/dist/api/design/catalog.d.ts.map +1 -0
- package/dist/api/design/create/bulk-items.d.ts +65 -25
- package/dist/api/design/create/bulk-items.d.ts.map +1 -1
- package/dist/api/design/create/index.d.ts +272 -99
- package/dist/api/design/create/index.d.ts.map +1 -1
- package/dist/api/design/create/opening-fields.d.ts +13 -12
- package/dist/api/design/create/opening-fields.d.ts.map +1 -1
- package/dist/api/design/delete/index.d.ts +1 -0
- package/dist/api/design/delete/index.d.ts.map +1 -1
- package/dist/api/design/doors/index.d.ts +18 -24
- package/dist/api/design/doors/index.d.ts.map +1 -1
- package/dist/api/design/family.d.ts +797 -27
- package/dist/api/design/family.d.ts.map +1 -1
- package/dist/api/design/index.d.ts +16 -0
- package/dist/api/design/index.d.ts.map +1 -1
- package/dist/api/design/networks.d.ts +1703 -0
- package/dist/api/design/networks.d.ts.map +1 -0
- package/dist/api/design/query/index.d.ts +42 -32
- package/dist/api/design/query/index.d.ts.map +1 -1
- package/dist/api/design/selection/index.d.ts +10 -10
- package/dist/api/design/types/index.d.ts +40 -24
- package/dist/api/design/types/index.d.ts.map +1 -1
- package/dist/api/design/update/index.d.ts +43 -3
- 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 +38 -22
- package/dist/api/presentation/annotate.d.ts.map +1 -1
- package/dist/api/presentation/drawingContract.d.ts +32 -0
- package/dist/api/presentation/drawingContract.d.ts.map +1 -0
- package/dist/api/presentation/drawings.d.ts +3523 -0
- package/dist/api/presentation/drawings.d.ts.map +1 -0
- package/dist/api/presentation/export.d.ts +23 -5
- package/dist/api/presentation/export.d.ts.map +1 -1
- package/dist/api/presentation/index.d.ts +41 -12
- package/dist/api/presentation/index.d.ts.map +1 -1
- package/dist/api/presentation/placedViews.d.ts +106 -6
- 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 +175 -19
- package/dist/api/presentation/sheets.d.ts.map +1 -1
- package/dist/api/presentation/viewPresets.d.ts +222 -0
- package/dist/api/presentation/viewPresets.d.ts.map +1 -0
- package/dist/api/presentation/views.d.ts +103 -5
- package/dist/api/presentation/views.d.ts.map +1 -1
- package/dist/api/presentation/walkthroughs.d.ts +6 -6
- package/dist/errors/codes.d.ts +3 -1
- package/dist/errors/codes.d.ts.map +1 -1
- package/dist/index.cjs +3749 -2328
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +3616 -2328
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/scripts/generate-manifest.mjs +5 -0
- package/src/api/core/camera/index.ts +29 -0
- package/src/api/core/geom/create/index.ts +7 -1
- package/src/api/core/geom/update/contour.ts +8 -2
- package/src/api/core/zoom/index.ts +13 -0
- package/src/api/design/bim.ts +121 -0
- package/src/api/design/boolean/index.ts +2 -0
- package/src/api/design/catalog.ts +203 -0
- package/src/api/design/create/bulk-items.ts +57 -17
- package/src/api/design/create/index.ts +288 -120
- package/src/api/design/create/opening-fields.ts +15 -12
- package/src/api/design/delete/index.ts +1 -0
- package/src/api/design/doors/index.ts +58 -42
- package/src/api/design/family.ts +662 -32
- package/src/api/design/index.ts +34 -4
- package/src/api/design/networks.ts +607 -0
- package/src/api/design/query/index.ts +12 -2
- package/src/api/design/types/index.ts +31 -24
- package/src/api/design/update/index.ts +44 -3
- package/src/api/design/windows/index.ts +40 -22
- package/src/api/presentation/annotate.ts +90 -58
- package/src/api/presentation/drawingContract.ts +70 -0
- package/src/api/presentation/drawings.ts +1179 -0
- package/src/api/presentation/export.ts +32 -6
- package/src/api/presentation/index.ts +48 -14
- package/src/api/presentation/placedViews.ts +119 -28
- package/src/api/presentation/sections.ts +420 -0
- package/src/api/presentation/sheets.ts +181 -20
- package/src/api/presentation/viewPresets.ts +241 -0
- package/src/api/presentation/views.ts +46 -6
- package/src/errors/codes.ts +7 -0
- package/test/drawingContract.test.mjs +288 -0
- package/test/errors.test.mjs +1 -0
package/src/api/design/family.ts
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import * as z from "zod"
|
|
2
2
|
import { PluginApiReturn } from "../../types"
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
BrepHandle,
|
|
5
|
+
ComponentHandle,
|
|
6
|
+
Vec3Components,
|
|
7
|
+
Vec3Handle,
|
|
8
|
+
} from "../../handles"
|
|
9
|
+
import { NetworkFamilyContract } from "./networks"
|
|
4
10
|
|
|
5
11
|
/**
|
|
6
12
|
* `snaptrude.design.family.*` — author NATIVE parametric families from a JSON spec.
|
|
@@ -12,19 +18,52 @@ import { BrepHandle, ComponentHandle, Vec3Components } from "../../handles"
|
|
|
12
18
|
* compiles that into a live parametric definition the user can place, flex and
|
|
13
19
|
* save to their library.
|
|
14
20
|
*
|
|
15
|
-
* ##
|
|
21
|
+
* ## Generic component workflow
|
|
16
22
|
*
|
|
17
23
|
* ```
|
|
18
|
-
* getReference() read the spec DSL once — grammar, ops, expressions,
|
|
19
|
-
*
|
|
24
|
+
* getReference() read the spec DSL once — grammar, ops, expressions, examples
|
|
25
|
+
* getExamples() worked example families by discipline; getExamples({ id }) for one
|
|
26
|
+
* prepare({ bundle }) validate + compile; nothing committed, nothing in the viewport
|
|
20
27
|
* flex({ values }) re-run at new values; returns the geometry delta
|
|
21
28
|
* place({ position }) put it in the model — saves the family as the first instance drops
|
|
22
29
|
* 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
|
|
23
31
|
* create({ teamId }) share with a team; a save with nothing placed also drops one instance
|
|
24
32
|
* ```
|
|
25
33
|
*
|
|
26
34
|
* `place` saves the prepared family to the user's personal library, so it
|
|
27
|
-
* survives reload with no extra step; finish
|
|
35
|
+
* survives reload with no extra step; finish a NEW generic component on
|
|
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`.
|
|
28
67
|
*
|
|
29
68
|
* ## Read getReference() first
|
|
30
69
|
*
|
|
@@ -72,6 +111,8 @@ export abstract class PluginDesignFamilyApi {
|
|
|
72
111
|
* Read this before authoring a family for the first time in a session. The
|
|
73
112
|
* DSL is a closed language — a guessed op or function is a rejected spec.
|
|
74
113
|
*
|
|
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.
|
|
75
116
|
* @returns The reference text
|
|
76
117
|
*
|
|
77
118
|
* @examplePrompt How do I write a parametric family spec?
|
|
@@ -82,7 +123,61 @@ export abstract class PluginDesignFamilyApi {
|
|
|
82
123
|
* const { reference } = await snaptrude.design.family.getReference()
|
|
83
124
|
* ```
|
|
84
125
|
*/
|
|
85
|
-
public abstract getReference(
|
|
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>
|
|
86
181
|
|
|
87
182
|
/**
|
|
88
183
|
* Validate, compile and preview a family spec. Nothing is committed to the
|
|
@@ -124,7 +219,8 @@ export abstract class PluginDesignFamilyApi {
|
|
|
124
219
|
* buckets are the host's own diff of what the geometry did — flexing a
|
|
125
220
|
* driving parameter and reporting them demonstrates the family is parametric.
|
|
126
221
|
*
|
|
127
|
-
* @param args The parameter values to change
|
|
222
|
+
* @param args The parameter values to change. Omit values (or pass an empty
|
|
223
|
+
* record) to report or photograph the current draft without rebuilding it.
|
|
128
224
|
* @returns The new build plus the geometry delta
|
|
129
225
|
*
|
|
130
226
|
* @examplePrompt Change it to 6 bays
|
|
@@ -137,25 +233,49 @@ export abstract class PluginDesignFamilyApi {
|
|
|
137
233
|
* ```
|
|
138
234
|
*/
|
|
139
235
|
public abstract flex(
|
|
140
|
-
args
|
|
236
|
+
args?: PluginDesignFamilyFlexArgs,
|
|
141
237
|
): PluginApiReturn<PluginFamilyFlexResult>
|
|
142
238
|
|
|
143
239
|
/**
|
|
144
|
-
*
|
|
240
|
+
* A family's spec bundle: the prepared draft's, or — to CHANGE a saved
|
|
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.
|
|
145
255
|
*
|
|
146
|
-
* @
|
|
256
|
+
* @param args Optional: which saved family to open
|
|
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
|
|
147
261
|
*
|
|
148
262
|
* # Example
|
|
149
263
|
* ```ts
|
|
150
|
-
* const
|
|
264
|
+
* const draft = await snaptrude.design.family.get()
|
|
265
|
+
* const family = await snaptrude.design.family.get({ component })
|
|
266
|
+
* // family.editing → { familyId, version, name, library }
|
|
151
267
|
* ```
|
|
152
268
|
*/
|
|
153
|
-
public abstract get(
|
|
269
|
+
public abstract get(
|
|
270
|
+
args?: PluginDesignFamilyGetArgs | string,
|
|
271
|
+
): PluginApiReturn<PluginFamilyGetResult | null>
|
|
154
272
|
|
|
155
273
|
/**
|
|
156
|
-
* Every parametric family
|
|
274
|
+
* Every available parametric family, merging the session registry and catalog.
|
|
157
275
|
*
|
|
158
|
-
* @
|
|
276
|
+
* @param args Opt into compact lines for generic discovery. The default stays
|
|
277
|
+
* object-shaped so existing callers retain version, openingKind and subType.
|
|
278
|
+
* @returns Summary objects, or `id | label | category | kind` lines when compact.
|
|
159
279
|
*
|
|
160
280
|
* @examplePrompt What families are available?
|
|
161
281
|
*
|
|
@@ -164,7 +284,35 @@ export abstract class PluginDesignFamilyApi {
|
|
|
164
284
|
* const families = await snaptrude.design.family.list()
|
|
165
285
|
* ```
|
|
166
286
|
*/
|
|
167
|
-
public abstract list(
|
|
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>
|
|
168
316
|
|
|
169
317
|
/**
|
|
170
318
|
* Put a family into the model — either the prepared draft or any family from
|
|
@@ -188,6 +336,13 @@ export abstract class PluginDesignFamilyApi {
|
|
|
188
336
|
* To COPY a placed component, place its family again at the new position with
|
|
189
337
|
* the same `values` — there is no separate copy call.
|
|
190
338
|
*
|
|
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
|
+
*
|
|
191
346
|
* @param args Which family, where, and at what parameter values
|
|
192
347
|
* @returns What was placed; `component` is present only in positioned mode
|
|
193
348
|
*
|
|
@@ -207,6 +362,9 @@ export abstract class PluginDesignFamilyApi {
|
|
|
207
362
|
*
|
|
208
363
|
* // interactive — the user clicks
|
|
209
364
|
* 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 } })
|
|
210
368
|
* ```
|
|
211
369
|
*/
|
|
212
370
|
public abstract place(
|
|
@@ -249,6 +407,34 @@ export abstract class PluginDesignFamilyApi {
|
|
|
249
407
|
* that does not is accepted and stored (it round-trips to Revit) but nothing
|
|
250
408
|
* visible happens — say so rather than claiming a change the user cannot see.
|
|
251
409
|
*
|
|
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
|
+
*
|
|
252
438
|
* `length` values are Snaptrude units: the same 254 mm unit as the kernel's
|
|
253
439
|
* internal (`"babylon"`) unit — convert the user's number with
|
|
254
440
|
* `core.units.convert` first; a bare `400` is 400 SU, not 400 mm. Kernel part
|
|
@@ -263,6 +449,15 @@ export abstract class PluginDesignFamilyApi {
|
|
|
263
449
|
* # Example
|
|
264
450
|
* ```ts
|
|
265
451
|
* 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
|
+
* })
|
|
266
461
|
* ```
|
|
267
462
|
*/
|
|
268
463
|
public abstract setParameters(
|
|
@@ -272,12 +467,24 @@ export abstract class PluginDesignFamilyApi {
|
|
|
272
467
|
/**
|
|
273
468
|
* Save the prepared bundle to the library — the user's personal library
|
|
274
469
|
* unless `teamId` is given. {@linkcode PluginDesignFamilyApi.place} already
|
|
275
|
-
* saves
|
|
276
|
-
*
|
|
277
|
-
*
|
|
470
|
+
* saves generic components. Hosted doors/windows save without placement;
|
|
471
|
+
* they need a wall and position through `design.create.door` / `design.create.window`.
|
|
472
|
+
* For a non-hosted family with no placed instance, saving also drops one
|
|
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.
|
|
278
485
|
*
|
|
279
486
|
* @param args Optional library name and team scope
|
|
280
|
-
* @returns The catalogued definition's id and version
|
|
487
|
+
* @returns The catalogued definition's id and version, and what the user chose
|
|
281
488
|
*
|
|
282
489
|
* @examplePrompt Save this as a family called Vertical Louvre
|
|
283
490
|
* @examplePrompt Add it to my library
|
|
@@ -314,14 +521,56 @@ export abstract class PluginDesignFamilyApi {
|
|
|
314
521
|
* ```
|
|
315
522
|
*/
|
|
316
523
|
public abstract delete(
|
|
317
|
-
args?: PluginDesignFamilyDeleteArgs,
|
|
524
|
+
args?: PluginDesignFamilyDeleteArgs | string,
|
|
318
525
|
): PluginApiReturn<PluginFamilyDeleteResult>
|
|
319
526
|
}
|
|
320
527
|
|
|
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
|
+
|
|
321
554
|
// ---------------------------------------------------------------------------
|
|
322
555
|
// Result types
|
|
323
556
|
// ---------------------------------------------------------------------------
|
|
324
557
|
|
|
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
|
+
|
|
325
574
|
/** The family-spec DSL reference returned by `getReference`. */
|
|
326
575
|
export interface PluginFamilyReference {
|
|
327
576
|
/** Grammar, op table, expression whitelist, repair contract, worked example. */
|
|
@@ -340,6 +589,34 @@ export interface PluginFamilyReference {
|
|
|
340
589
|
export interface PluginFamilyBundle {
|
|
341
590
|
root: Record<string, unknown>
|
|
342
591
|
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
|
|
343
620
|
}
|
|
344
621
|
|
|
345
622
|
/** Axis-aligned extents of a built family. Snaptrude units (1 SU = 254 mm), +Y up. */
|
|
@@ -387,6 +664,10 @@ export interface PluginFamilyDiagnostic {
|
|
|
387
664
|
| "depth"
|
|
388
665
|
| "bad-dimension"
|
|
389
666
|
| "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"
|
|
390
671
|
message: string
|
|
391
672
|
hint?: string
|
|
392
673
|
}
|
|
@@ -471,6 +752,13 @@ export interface PluginFamilySummary {
|
|
|
471
752
|
version: number
|
|
472
753
|
label: string
|
|
473
754
|
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"
|
|
474
762
|
/** Number of rows on the family's parameter sheet. */
|
|
475
763
|
parameters: number
|
|
476
764
|
/**
|
|
@@ -487,6 +775,49 @@ export interface PluginFamilySummary {
|
|
|
487
775
|
kind: "native" | "revit"
|
|
488
776
|
}
|
|
489
777
|
|
|
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
|
+
|
|
490
821
|
/** What `place` reports. */
|
|
491
822
|
export interface PluginFamilyPlaceResult {
|
|
492
823
|
ok: boolean
|
|
@@ -515,6 +846,104 @@ export interface PluginFamilyInstanceParameters {
|
|
|
515
846
|
parts?: PluginFamilyPart[]
|
|
516
847
|
/** Present when `getParameters` was asked for a `snapshot`. */
|
|
517
848
|
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
|
|
518
947
|
}
|
|
519
948
|
|
|
520
949
|
/** What `create` reports. */
|
|
@@ -527,6 +956,26 @@ export interface PluginFamilyCreateResult {
|
|
|
527
956
|
placed?: boolean
|
|
528
957
|
/** Host guidance for the caller, e.g. that an instance was placed at the view centre. */
|
|
529
958
|
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[]
|
|
530
979
|
error?: string
|
|
531
980
|
}
|
|
532
981
|
|
|
@@ -555,6 +1004,7 @@ export interface PluginFamilyDeleteResult {
|
|
|
555
1004
|
export const PluginFamilyBundleSchema = z.object({
|
|
556
1005
|
root: z.record(z.string(), z.unknown()),
|
|
557
1006
|
deps: z.record(z.string(), z.record(z.string(), z.unknown())).optional(),
|
|
1007
|
+
network: NetworkFamilyContract.optional(),
|
|
558
1008
|
})
|
|
559
1009
|
|
|
560
1010
|
/**
|
|
@@ -576,16 +1026,71 @@ export const PluginFamilyBundleSchema = z.object({
|
|
|
576
1026
|
* the viewport is not moved — and comes back as a PNG data URL in the result's
|
|
577
1027
|
* `snapshot.image`. Through the agent's `run_worker`, return the result and the
|
|
578
1028
|
* 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.
|
|
579
1038
|
*/
|
|
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
|
+
|
|
580
1076
|
export const PluginFamilySnapshotOption = z.union([
|
|
581
1077
|
z.boolean(),
|
|
582
1078
|
z.object({
|
|
583
1079
|
views: z.array(z.enum(["iso", "front", "right", "top"])).optional(),
|
|
584
1080
|
/** Pixels per tile (square), 64–2048; default 512. */
|
|
585
1081
|
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(),
|
|
586
1089
|
}),
|
|
587
1090
|
])
|
|
588
|
-
export type PluginFamilySnapshotOption = z.infer<
|
|
1091
|
+
export type PluginFamilySnapshotOption = z.infer<
|
|
1092
|
+
typeof PluginFamilySnapshotOption
|
|
1093
|
+
>
|
|
589
1094
|
|
|
590
1095
|
/** The picture block on prepare / flex / getParameters results when `snapshot` was asked for. */
|
|
591
1096
|
export interface PluginFamilySnapshot {
|
|
@@ -593,9 +1098,18 @@ export interface PluginFamilySnapshot {
|
|
|
593
1098
|
/** PNG data URL of the composed sheet. */
|
|
594
1099
|
image?: string
|
|
595
1100
|
views?: ("iso" | "front" | "right" | "top")[]
|
|
596
|
-
/** [width, height, depth] in
|
|
1101
|
+
/** [width, height, depth] in SU. For a close-up list, this remains the whole family's size. */
|
|
597
1102
|
size?: [number, number, number]
|
|
598
1103
|
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
|
+
}>
|
|
599
1113
|
/** Set when the picture could not be taken (e.g. the legacy renderer); the call itself still succeeded. */
|
|
600
1114
|
error?: string
|
|
601
1115
|
}
|
|
@@ -605,21 +1119,105 @@ export const PluginDesignFamilyPrepareArgs = z.object({
|
|
|
605
1119
|
spec: PluginFamilyBundleSchema.optional(),
|
|
606
1120
|
snapshot: PluginFamilySnapshotOption.optional(),
|
|
607
1121
|
})
|
|
608
|
-
export type PluginDesignFamilyPrepareArgs = z.infer<
|
|
1122
|
+
export type PluginDesignFamilyPrepareArgs = z.infer<
|
|
1123
|
+
typeof PluginDesignFamilyPrepareArgs
|
|
1124
|
+
>
|
|
609
1125
|
|
|
610
1126
|
/**
|
|
611
1127
|
* Arguments for {@linkcode PluginDesignFamilyApi.flex}.
|
|
612
1128
|
*
|
|
613
1129
|
* | Property | Type | Description |
|
|
614
1130
|
* |---|---|---|
|
|
615
|
-
* | `values` | `Record<string, number \| string>` |
|
|
1131
|
+
* | `values` | `Record<string, number \| string>` | Optional sparse changes; omission does not rebuild |
|
|
616
1132
|
* | `snapshot` | {@linkcode PluginFamilySnapshotOption} | Also return a picture of the flexed family |
|
|
617
1133
|
*/
|
|
618
1134
|
export const PluginDesignFamilyFlexArgs = z.object({
|
|
619
|
-
values: z.record(z.string(), z.union([z.number(), z.string()])),
|
|
1135
|
+
values: z.record(z.string(), z.union([z.number(), z.string()])).optional(),
|
|
620
1136
|
snapshot: PluginFamilySnapshotOption.optional(),
|
|
621
1137
|
})
|
|
622
|
-
export type PluginDesignFamilyFlexArgs = z.infer<
|
|
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
|
+
}
|
|
623
1221
|
|
|
624
1222
|
/**
|
|
625
1223
|
* Arguments for {@linkcode PluginDesignFamilyApi.create}.
|
|
@@ -633,7 +1231,9 @@ export const PluginDesignFamilyCreateArgs = z.object({
|
|
|
633
1231
|
name: z.string().optional(),
|
|
634
1232
|
teamId: z.string().optional(),
|
|
635
1233
|
})
|
|
636
|
-
export type PluginDesignFamilyCreateArgs = z.infer<
|
|
1234
|
+
export type PluginDesignFamilyCreateArgs = z.infer<
|
|
1235
|
+
typeof PluginDesignFamilyCreateArgs
|
|
1236
|
+
>
|
|
637
1237
|
|
|
638
1238
|
/**
|
|
639
1239
|
* Arguments for {@linkcode PluginDesignFamilyApi.delete}.
|
|
@@ -647,7 +1247,9 @@ export const PluginDesignFamilyDeleteArgs = z.object({
|
|
|
647
1247
|
id: z.string().optional(),
|
|
648
1248
|
instances: z.boolean().optional(),
|
|
649
1249
|
})
|
|
650
|
-
export type PluginDesignFamilyDeleteArgs = z.infer<
|
|
1250
|
+
export type PluginDesignFamilyDeleteArgs = z.infer<
|
|
1251
|
+
typeof PluginDesignFamilyDeleteArgs
|
|
1252
|
+
>
|
|
651
1253
|
|
|
652
1254
|
/**
|
|
653
1255
|
* Arguments for {@linkcode PluginDesignFamilyApi.place}.
|
|
@@ -656,7 +1258,7 @@ export type PluginDesignFamilyDeleteArgs = z.infer<typeof PluginDesignFamilyDele
|
|
|
656
1258
|
* |---|---|---|
|
|
657
1259
|
* | `id` | `string` | Family to place, from {@linkcode PluginDesignFamilyApi.list}. Omit to place the prepared draft |
|
|
658
1260
|
* | `version` | `number` | Exact version; defaults to the newest known |
|
|
659
|
-
* | `position` | `{ x, y, z }` | Place
|
|
1261
|
+
* | `position` | `Vec3Handle` or `{ x, y, z }` | Place here in SU. Prefer a vec3 handle; coordinates remain for existing callers. Omit to arm the cursor |
|
|
660
1262
|
* | `rotation` | `number` | Yaw in degrees about +Y. Only with `position` |
|
|
661
1263
|
* | `values` | `Record<string, number \| string>` | Parameter values for THIS instance |
|
|
662
1264
|
* | `storey` | `number` | Storey to place on; defaults to the active one |
|
|
@@ -664,12 +1266,16 @@ export type PluginDesignFamilyDeleteArgs = z.infer<typeof PluginDesignFamilyDele
|
|
|
664
1266
|
export const PluginDesignFamilyPlaceArgs = z.object({
|
|
665
1267
|
id: z.string().optional(),
|
|
666
1268
|
version: z.number().int().positive().optional(),
|
|
667
|
-
position: Vec3Components.optional(),
|
|
1269
|
+
position: z.union([Vec3Handle, Vec3Components]).optional(),
|
|
668
1270
|
rotation: z.number().optional(),
|
|
669
1271
|
values: z.record(z.string(), z.union([z.number(), z.string()])).optional(),
|
|
670
1272
|
storey: z.number().int().optional(),
|
|
1273
|
+
/** Hosted families: wall or family host. Values apply before fit checks and cutting. */
|
|
1274
|
+
host: ComponentHandle.optional(),
|
|
671
1275
|
})
|
|
672
|
-
export type PluginDesignFamilyPlaceArgs = z.infer<
|
|
1276
|
+
export type PluginDesignFamilyPlaceArgs = z.infer<
|
|
1277
|
+
typeof PluginDesignFamilyPlaceArgs
|
|
1278
|
+
>
|
|
673
1279
|
|
|
674
1280
|
/**
|
|
675
1281
|
* Arguments for {@linkcode PluginDesignFamilyApi.getParameters}.
|
|
@@ -697,7 +1303,31 @@ export type PluginDesignFamilyGetParametersArgs = z.infer<
|
|
|
697
1303
|
*/
|
|
698
1304
|
export const PluginDesignFamilySetParametersArgs = z.object({
|
|
699
1305
|
component: ComponentHandle,
|
|
700
|
-
values: z
|
|
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(),
|
|
701
1331
|
})
|
|
702
1332
|
export type PluginDesignFamilySetParametersArgs = z.infer<
|
|
703
1333
|
typeof PluginDesignFamilySetParametersArgs
|