@snaptrude/plugin-core 0.3.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +130 -48
- package/CHANGELOG.md +111 -0
- package/api-manifest.full.json +3999 -0
- package/api-manifest.json +3845 -0
- package/dist/api/core/buildings.d.ts +427 -0
- package/dist/api/core/buildings.d.ts.map +1 -0
- package/dist/api/core/comment/index.d.ts +230 -0
- package/dist/api/core/comment/index.d.ts.map +1 -0
- package/dist/api/core/geom/create/index.d.ts +247 -0
- package/dist/api/core/geom/create/index.d.ts.map +1 -0
- package/dist/api/core/geom/delete/index.d.ts +72 -0
- package/dist/api/core/geom/delete/index.d.ts.map +1 -0
- package/dist/api/core/geom/index.d.ts +24 -23
- package/dist/api/core/geom/index.d.ts.map +1 -1
- package/dist/api/core/geom/query/arc.d.ts +169 -0
- package/dist/api/core/geom/query/arc.d.ts.map +1 -0
- package/dist/api/core/geom/query/brep.d.ts +402 -0
- package/dist/api/core/geom/query/brep.d.ts.map +1 -0
- package/dist/api/core/geom/query/circle.d.ts +378 -0
- package/dist/api/core/geom/query/circle.d.ts.map +1 -0
- package/dist/api/core/geom/query/contour.d.ts +450 -0
- package/dist/api/core/geom/query/contour.d.ts.map +1 -0
- package/dist/api/core/geom/query/curve.d.ts +918 -0
- package/dist/api/core/geom/query/curve.d.ts.map +1 -0
- package/dist/api/core/geom/query/edge.d.ts +128 -0
- package/dist/api/core/geom/query/edge.d.ts.map +1 -0
- package/dist/api/core/geom/query/face.d.ts +363 -0
- package/dist/api/core/geom/query/face.d.ts.map +1 -0
- package/dist/api/core/geom/query/halfedge.d.ts +206 -0
- package/dist/api/core/geom/query/halfedge.d.ts.map +1 -0
- package/dist/api/core/geom/query/index.d.ts +61 -0
- package/dist/api/core/geom/query/index.d.ts.map +1 -0
- package/dist/api/core/geom/query/profile.d.ts +410 -0
- package/dist/api/core/geom/query/profile.d.ts.map +1 -0
- package/dist/api/core/geom/query/vertex.d.ts +187 -0
- package/dist/api/core/geom/query/vertex.d.ts.map +1 -0
- package/dist/api/core/geom/update/contour.d.ts +272 -0
- package/dist/api/core/geom/update/contour.d.ts.map +1 -0
- package/dist/api/core/geom/update/curve.d.ts +180 -0
- package/dist/api/core/geom/update/curve.d.ts.map +1 -0
- package/dist/api/core/geom/update/index.d.ts +27 -0
- package/dist/api/core/geom/update/index.d.ts.map +1 -0
- package/dist/api/core/geom/update/profile.d.ts +329 -0
- package/dist/api/core/geom/update/profile.d.ts.map +1 -0
- package/dist/api/core/groups.d.ts +485 -0
- package/dist/api/core/groups.d.ts.map +1 -0
- package/dist/api/core/history/index.d.ts +78 -0
- package/dist/api/core/history/index.d.ts.map +1 -0
- package/dist/api/core/index.d.ts +46 -1
- package/dist/api/core/index.d.ts.map +1 -1
- package/dist/api/core/layers.d.ts +402 -0
- package/dist/api/core/layers.d.ts.map +1 -0
- package/dist/api/core/math/quat.d.ts +111 -128
- package/dist/api/core/math/quat.d.ts.map +1 -1
- package/dist/api/core/math/vec3.d.ts +120 -102
- package/dist/api/core/math/vec3.d.ts.map +1 -1
- package/dist/api/core/project/index.d.ts +399 -0
- package/dist/api/core/project/index.d.ts.map +1 -0
- package/dist/api/core/tags.d.ts +755 -0
- package/dist/api/core/tags.d.ts.map +1 -0
- package/dist/api/core/units/index.d.ts +175 -0
- package/dist/api/core/units/index.d.ts.map +1 -0
- package/dist/api/core/zoom/index.d.ts +45 -0
- package/dist/api/core/zoom/index.d.ts.map +1 -0
- package/dist/api/design/boolean/index.d.ts +168 -0
- package/dist/api/design/boolean/index.d.ts.map +1 -0
- package/dist/api/design/create/index.d.ts +828 -0
- package/dist/api/design/create/index.d.ts.map +1 -0
- package/dist/api/design/delete/index.d.ts +63 -0
- package/dist/api/design/delete/index.d.ts.map +1 -0
- package/dist/api/design/doors/index.d.ts +268 -0
- package/dist/api/design/doors/index.d.ts.map +1 -0
- package/dist/api/design/edit/index.d.ts +49 -0
- package/dist/api/design/edit/index.d.ts.map +1 -0
- package/dist/api/design/erase/index.d.ts +160 -0
- package/dist/api/design/erase/index.d.ts.map +1 -0
- package/dist/api/design/furniture/index.d.ts +123 -0
- package/dist/api/design/furniture/index.d.ts.map +1 -0
- package/dist/api/design/index.d.ts +153 -0
- package/dist/api/design/index.d.ts.map +1 -0
- package/dist/api/design/lock.d.ts +41 -0
- package/dist/api/design/lock.d.ts.map +1 -0
- package/dist/api/design/materials/index.d.ts +297 -0
- package/dist/api/design/materials/index.d.ts.map +1 -0
- package/dist/api/design/query/geometry/index.d.ts +140 -0
- package/dist/api/design/query/geometry/index.d.ts.map +1 -0
- package/dist/api/design/query/index.d.ts +1011 -0
- package/dist/api/design/query/index.d.ts.map +1 -0
- package/dist/api/design/query/spaces.d.ts +221 -0
- package/dist/api/design/query/spaces.d.ts.map +1 -0
- package/dist/api/design/selection/index.d.ts +138 -0
- package/dist/api/design/selection/index.d.ts.map +1 -0
- package/dist/api/design/shared.d.ts +38 -0
- package/dist/api/design/shared.d.ts.map +1 -0
- package/dist/api/design/transform/index.d.ts +87 -0
- package/dist/api/design/transform/index.d.ts.map +1 -0
- package/dist/api/design/update/index.d.ts +178 -0
- package/dist/api/design/update/index.d.ts.map +1 -0
- package/dist/api/design/windows/index.d.ts +189 -0
- package/dist/api/design/windows/index.d.ts.map +1 -0
- package/dist/api/entity/buildableEnvelope.d.ts +261 -0
- package/dist/api/entity/buildableEnvelope.d.ts.map +1 -0
- package/dist/api/entity/department.d.ts +0 -98
- package/dist/api/entity/department.d.ts.map +1 -1
- package/dist/api/entity/index.d.ts +9 -9
- package/dist/api/entity/index.d.ts.map +1 -1
- package/dist/api/entity/referenceLine.d.ts +49 -106
- package/dist/api/entity/referenceLine.d.ts.map +1 -1
- package/dist/api/entity/space.d.ts +482 -249
- package/dist/api/entity/space.d.ts.map +1 -1
- package/dist/api/entity/story.d.ts +49 -39
- package/dist/api/entity/story.d.ts.map +1 -1
- package/dist/api/index.d.ts +17 -12
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/presentation/aiInspiration.d.ts +440 -0
- package/dist/api/presentation/aiInspiration.d.ts.map +1 -0
- package/dist/api/presentation/diagrams.d.ts +81 -0
- package/dist/api/presentation/diagrams.d.ts.map +1 -0
- package/dist/api/presentation/import.d.ts +113 -0
- package/dist/api/presentation/import.d.ts.map +1 -0
- package/dist/api/presentation/index.d.ts +46 -0
- package/dist/api/presentation/index.d.ts.map +1 -0
- package/dist/api/presentation/sheets.d.ts +176 -0
- package/dist/api/presentation/sheets.d.ts.map +1 -0
- package/dist/api/presentation/views.d.ts +296 -0
- package/dist/api/presentation/views.d.ts.map +1 -0
- package/dist/api/program/adjacency.d.ts +155 -0
- package/dist/api/program/adjacency.d.ts.map +1 -0
- package/dist/api/program/areas.d.ts +360 -0
- package/dist/api/program/areas.d.ts.map +1 -0
- package/dist/api/program/classification.d.ts +135 -0
- package/dist/api/program/classification.d.ts.map +1 -0
- package/dist/api/program/cores.d.ts +174 -0
- package/dist/api/program/cores.d.ts.map +1 -0
- package/dist/api/program/departments.d.ts +431 -0
- package/dist/api/program/departments.d.ts.map +1 -0
- package/dist/api/program/index.d.ts +69 -0
- package/dist/api/program/index.d.ts.map +1 -0
- package/dist/api/program/layout.d.ts +63 -0
- package/dist/api/program/layout.d.ts.map +1 -0
- package/dist/api/program/metrics.d.ts +108 -0
- package/dist/api/program/metrics.d.ts.map +1 -0
- package/dist/api/program/site.d.ts +367 -0
- package/dist/api/program/site.d.ts.map +1 -0
- package/dist/api/program/spreadsheet.d.ts +2041 -0
- package/dist/api/program/spreadsheet.d.ts.map +1 -0
- package/dist/handles.d.ts +138 -0
- package/dist/handles.d.ts.map +1 -0
- package/dist/host-utils.d.ts +7 -5
- package/dist/host-utils.d.ts.map +1 -1
- package/dist/index.cjs +4001 -904
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3392 -870
- package/dist/index.js.map +1 -1
- package/package.json +6 -2
- package/scripts/generate-manifest.mjs +193 -0
- package/scripts/generate-manifest.test.mjs +193 -0
- package/src/api/core/buildings.ts +485 -0
- package/src/api/core/comment/index.ts +258 -0
- package/src/api/core/geom/create/index.ts +293 -0
- package/src/api/core/geom/delete/index.ts +78 -0
- package/src/api/core/geom/index.ts +24 -23
- package/src/api/core/geom/query/arc.ts +169 -0
- package/src/api/core/geom/query/brep.ts +444 -0
- package/src/api/core/geom/query/circle.ts +404 -0
- package/src/api/core/geom/query/contour.ts +540 -0
- package/src/api/core/geom/query/curve.ts +1078 -0
- package/src/api/core/geom/query/edge.ts +130 -0
- package/src/api/core/geom/query/face.ts +403 -0
- package/src/api/core/geom/query/halfedge.ts +210 -0
- package/src/api/core/geom/query/index.ts +63 -0
- package/src/api/core/geom/query/profile.ts +473 -0
- package/src/api/core/geom/query/vertex.ts +205 -0
- package/src/api/core/geom/update/contour.ts +315 -0
- package/src/api/core/geom/update/curve.ts +209 -0
- package/src/api/core/geom/update/index.ts +29 -0
- package/src/api/core/geom/update/profile.ts +377 -0
- package/src/api/core/groups.ts +521 -0
- package/src/api/core/history/index.ts +84 -0
- package/src/api/core/index.ts +46 -1
- package/src/api/core/layers.ts +333 -0
- package/src/api/core/math/quat.ts +112 -235
- package/src/api/core/math/vec3.ts +124 -159
- package/src/api/core/project/index.ts +418 -0
- package/src/api/core/tags.ts +808 -0
- package/src/api/core/units/index.ts +164 -0
- package/src/api/core/zoom/index.ts +47 -0
- package/src/api/design/boolean/index.ts +179 -0
- package/src/api/design/create/index.ts +886 -0
- package/src/api/design/delete/index.ts +67 -0
- package/src/api/design/doors/index.ts +285 -0
- package/src/api/design/edit/index.ts +54 -0
- package/src/api/design/erase/index.ts +151 -0
- package/src/api/design/furniture/index.ts +130 -0
- package/src/api/design/index.ts +162 -0
- package/src/api/design/lock.ts +42 -0
- package/src/api/design/materials/index.ts +301 -0
- package/src/api/design/query/geometry/index.ts +166 -0
- package/src/api/design/query/index.ts +937 -0
- package/src/api/design/query/spaces.ts +132 -0
- package/src/api/design/selection/index.ts +144 -0
- package/src/api/design/shared.ts +40 -0
- package/src/api/design/transform/index.ts +93 -0
- package/src/api/design/update/index.ts +117 -0
- package/src/api/design/windows/index.ts +207 -0
- package/src/api/entity/buildableEnvelope.ts +318 -0
- package/src/api/entity/department.ts +0 -113
- package/src/api/entity/index.ts +9 -9
- package/src/api/entity/referenceLine.ts +50 -38
- package/src/api/entity/space.ts +285 -226
- package/src/api/entity/story.ts +53 -42
- package/src/api/index.ts +17 -12
- package/src/api/presentation/aiInspiration.ts +362 -0
- package/src/api/presentation/diagrams.ts +84 -0
- package/src/api/presentation/import.ts +112 -0
- package/src/api/presentation/index.ts +48 -0
- package/src/api/presentation/sheets.ts +198 -0
- package/src/api/presentation/views.ts +303 -0
- package/src/api/program/adjacency.ts +164 -0
- package/src/api/program/areas.ts +335 -0
- package/src/api/program/classification.ts +138 -0
- package/src/api/program/cores.ts +171 -0
- package/src/api/program/departments.ts +465 -0
- package/src/api/program/index.ts +71 -0
- package/src/api/program/layout.ts +68 -0
- package/src/api/program/metrics.ts +120 -0
- package/src/api/program/site.ts +326 -0
- package/src/api/program/spreadsheet.ts +2075 -0
- package/src/handles.ts +148 -0
- package/src/host-utils.ts +10 -6
- package/src/index.ts +1 -0
- package/dist/api/core/geom/arc.d.ts +0 -81
- package/dist/api/core/geom/arc.d.ts.map +0 -1
- package/dist/api/core/geom/curve.d.ts +0 -70
- package/dist/api/core/geom/curve.d.ts.map +0 -1
- package/dist/api/core/geom/line.d.ts +0 -56
- package/dist/api/core/geom/line.d.ts.map +0 -1
- package/dist/api/core/geom/profile.d.ts +0 -121
- package/dist/api/core/geom/profile.d.ts.map +0 -1
- package/dist/api/tools/copy.d.ts +0 -59
- package/dist/api/tools/copy.d.ts.map +0 -1
- package/dist/api/tools/index.d.ts +0 -33
- package/dist/api/tools/index.d.ts.map +0 -1
- package/dist/api/tools/material.d.ts +0 -51
- package/dist/api/tools/material.d.ts.map +0 -1
- package/dist/api/tools/offset.d.ts +0 -43
- package/dist/api/tools/offset.d.ts.map +0 -1
- package/dist/api/tools/selection.d.ts +0 -48
- package/dist/api/tools/selection.d.ts.map +0 -1
- package/dist/api/tools/transform.d.ts +0 -114
- package/dist/api/tools/transform.d.ts.map +0 -1
- package/dist/api/units/index.d.ts +0 -163
- package/dist/api/units/index.d.ts.map +0 -1
- package/src/api/core/geom/arc.ts +0 -70
- package/src/api/core/geom/curve.ts +0 -41
- package/src/api/core/geom/line.ts +0 -53
- package/src/api/core/geom/profile.ts +0 -94
- package/src/api/tools/copy.ts +0 -55
- package/src/api/tools/index.ts +0 -39
- package/src/api/tools/material.ts +0 -49
- package/src/api/tools/offset.ts +0 -43
- package/src/api/tools/selection.ts +0 -51
- package/src/api/tools/transform.ts +0 -117
- package/src/api/units/index.ts +0 -163
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import * as z from "zod";
|
|
2
|
+
import { PluginApiReturn } from "../../../types";
|
|
3
|
+
/**
|
|
4
|
+
* `snaptrude.design.furniture` — the placeable furniture **catalog** (a library of
|
|
5
|
+
* source items, NOT scene entities). Placement lives at `design.create.furniture`
|
|
6
|
+
* (returns a {@linkcode ComponentHandle}); reads of placed furniture live at
|
|
7
|
+
* `design.query.listFurniture`/`getProperties`.
|
|
8
|
+
*
|
|
9
|
+
* Catalog items are plain value records ({@linkcode PluginFurnitureCatalogItem}) keyed
|
|
10
|
+
* by a library id (team `_id` or general `fullName`) — not handles. Reads are async
|
|
11
|
+
* (network-backed) but carry no `Async` suffix (§6.6).
|
|
12
|
+
*/
|
|
13
|
+
export declare abstract class PluginDesignFurnitureApi {
|
|
14
|
+
constructor();
|
|
15
|
+
/**
|
|
16
|
+
* List the placeable furniture catalog (team + general libraries).
|
|
17
|
+
* @param source Restrict to one library (optional)
|
|
18
|
+
* @returns The catalog as {@linkcode PluginFurnitureCatalogItem}`[]` (`[]` when empty)
|
|
19
|
+
*
|
|
20
|
+
* @examplePrompt What furniture can I place in this project?
|
|
21
|
+
* @examplePrompt Show me all the furniture available in the library
|
|
22
|
+
* @examplePrompt List the chairs and tables I can add to the model
|
|
23
|
+
* @examplePrompt Which furniture items are in my team's library?
|
|
24
|
+
* @examplePrompt Browse the furniture catalog
|
|
25
|
+
*
|
|
26
|
+
* # Example
|
|
27
|
+
* ```ts
|
|
28
|
+
* const teamItems = await snaptrude.design.furniture.listCatalog("team")
|
|
29
|
+
* for (const item of teamItems) console.log(item.id, item.name, item.cost)
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
abstract listCatalog(source?: "team" | "general"): PluginApiReturn<PluginFurnitureCatalogItem[]>;
|
|
33
|
+
/**
|
|
34
|
+
* Get a single catalog item by its library id.
|
|
35
|
+
* @param id The catalog library id
|
|
36
|
+
* @returns The item, or `null` if no catalog item matches
|
|
37
|
+
*
|
|
38
|
+
* @examplePrompt Get the details of this furniture item from the library
|
|
39
|
+
* @examplePrompt Look up the catalog entry for this chair id
|
|
40
|
+
* @examplePrompt What is the cost of this furniture item?
|
|
41
|
+
* @examplePrompt Show me the family name of the sofa in the catalog
|
|
42
|
+
*
|
|
43
|
+
* # Example
|
|
44
|
+
* ```ts
|
|
45
|
+
* const [entry] = await snaptrude.design.furniture.listCatalog()
|
|
46
|
+
* const item = await snaptrude.design.furniture.getCatalogItem(entry.id)
|
|
47
|
+
* if (item) console.log(item.name, item.source, item.familyName)
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
50
|
+
abstract getCatalogItem(id: string): PluginApiReturn<PluginFurnitureCatalogItem | null>;
|
|
51
|
+
/**
|
|
52
|
+
* Test whether a catalog item exists for the given library id.
|
|
53
|
+
* @param id The catalog library id
|
|
54
|
+
* @returns `true` if it exists, otherwise `false`
|
|
55
|
+
*
|
|
56
|
+
* @examplePrompt Is this furniture item still in the library?
|
|
57
|
+
* @examplePrompt Check whether a catalog item with this id exists
|
|
58
|
+
* @examplePrompt Does my team library have this chair?
|
|
59
|
+
* @examplePrompt Verify the sofa is available in the catalog before placing it
|
|
60
|
+
*
|
|
61
|
+
* # Example
|
|
62
|
+
* ```ts
|
|
63
|
+
* const [entry] = await snaptrude.design.furniture.listCatalog()
|
|
64
|
+
* const stillAvailable = await snaptrude.design.furniture.exists(entry.id)
|
|
65
|
+
* console.log(stillAvailable ? "safe to place" : "removed from library")
|
|
66
|
+
* ```
|
|
67
|
+
*/
|
|
68
|
+
abstract exists(id: string): PluginApiReturn<boolean>;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* A placeable furniture catalog item (value record — not a scene entity/handle).
|
|
72
|
+
*
|
|
73
|
+
* | Property | Type | Description |
|
|
74
|
+
* |---|---|---|
|
|
75
|
+
* | `id` | `string` | Library id (team `_id` or general `fullName`) — pass to `design.create.furniture` |
|
|
76
|
+
* | `name` | `string` | Display name |
|
|
77
|
+
* | `source` | `'team' \| 'general'` | Which library it came from |
|
|
78
|
+
* | `subType` | `string` | Sub-type (optional) |
|
|
79
|
+
* | `cost` | `number` | Cost (optional; team items) |
|
|
80
|
+
* | `familyName` | `string` | Family name (optional) |
|
|
81
|
+
*/
|
|
82
|
+
export declare const PluginFurnitureCatalogItem: z.ZodObject<{
|
|
83
|
+
id: z.ZodString;
|
|
84
|
+
name: z.ZodString;
|
|
85
|
+
source: z.ZodEnum<{
|
|
86
|
+
team: "team";
|
|
87
|
+
general: "general";
|
|
88
|
+
}>;
|
|
89
|
+
subType: z.ZodOptional<z.ZodString>;
|
|
90
|
+
cost: z.ZodOptional<z.ZodNumber>;
|
|
91
|
+
familyName: z.ZodOptional<z.ZodString>;
|
|
92
|
+
}, z.core.$strip>;
|
|
93
|
+
export type PluginFurnitureCatalogItem = z.infer<typeof PluginFurnitureCatalogItem>;
|
|
94
|
+
/**
|
|
95
|
+
* Arguments for {@linkcode PluginDesignFurnitureApi.listCatalog}.
|
|
96
|
+
*
|
|
97
|
+
* | Property | Type | Description |
|
|
98
|
+
* |---|---|---|
|
|
99
|
+
* | `source` | `'team' \| 'general'` | Restrict to one library (optional) |
|
|
100
|
+
*/
|
|
101
|
+
export declare const PluginDesignFurnitureListCatalogArgs: z.ZodObject<{
|
|
102
|
+
source: z.ZodOptional<z.ZodEnum<{
|
|
103
|
+
team: "team";
|
|
104
|
+
general: "general";
|
|
105
|
+
}>>;
|
|
106
|
+
}, z.core.$strip>;
|
|
107
|
+
export type PluginDesignFurnitureListCatalogArgs = z.infer<typeof PluginDesignFurnitureListCatalogArgs>;
|
|
108
|
+
/**
|
|
109
|
+
* Arguments for {@linkcode PluginDesignFurnitureApi.getCatalogItem} / {@linkcode PluginDesignFurnitureApi.exists}.
|
|
110
|
+
*
|
|
111
|
+
* | Property | Type | Description |
|
|
112
|
+
* |---|---|---|
|
|
113
|
+
* | `id` | `string` | The catalog library id |
|
|
114
|
+
*/
|
|
115
|
+
export declare const PluginDesignFurnitureGetCatalogItemArgs: z.ZodObject<{
|
|
116
|
+
id: z.ZodString;
|
|
117
|
+
}, z.core.$strip>;
|
|
118
|
+
export type PluginDesignFurnitureGetCatalogItemArgs = z.infer<typeof PluginDesignFurnitureGetCatalogItemArgs>;
|
|
119
|
+
export declare const PluginDesignFurnitureExistsArgs: z.ZodObject<{
|
|
120
|
+
id: z.ZodString;
|
|
121
|
+
}, z.core.$strip>;
|
|
122
|
+
export type PluginDesignFurnitureExistsArgs = z.infer<typeof PluginDesignFurnitureExistsArgs>;
|
|
123
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/api/design/furniture/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAA;AACxB,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAEhD;;;;;;;;;GASG;AACH,8BAAsB,wBAAwB;;IAG5C;;;;;;;;;;;;;;;;OAgBG;aACa,WAAW,CACzB,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,GAC1B,eAAe,CAAC,0BAA0B,EAAE,CAAC;IAEhD;;;;;;;;;;;;;;;;OAgBG;aACa,cAAc,CAC5B,EAAE,EAAE,MAAM,GACT,eAAe,CAAC,0BAA0B,GAAG,IAAI,CAAC;IAErD;;;;;;;;;;;;;;;;OAgBG;aACa,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,eAAe,CAAC,OAAO,CAAC;CAC7D;AAED;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,0BAA0B;;;;;;;;;;iBAOrC,CAAA;AACF,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAA;AAEnF;;;;;;GAMG;AACH,eAAO,MAAM,oCAAoC;;;;;iBAE/C,CAAA;AACF,MAAM,MAAM,oCAAoC,GAAG,CAAC,CAAC,KAAK,CACxD,OAAO,oCAAoC,CAC5C,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,uCAAuC;;iBAElD,CAAA;AACF,MAAM,MAAM,uCAAuC,GAAG,CAAC,CAAC,KAAK,CAC3D,OAAO,uCAAuC,CAC/C,CAAA;AAED,eAAO,MAAM,+BAA+B;;iBAA0C,CAAA;AACtF,MAAM,MAAM,+BAA+B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,+BAA+B,CAAC,CAAA"}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { PluginApiReturn } from "../../types";
|
|
2
|
+
import { ComponentHandle } from "../../handles";
|
|
3
|
+
import { PluginDesignCreateApi } from "./create";
|
|
4
|
+
import { PluginDesignQueryApi } from "./query";
|
|
5
|
+
import { PluginDesignSelectionApi } from "./selection";
|
|
6
|
+
import { PluginDesignDoorsApi } from "./doors";
|
|
7
|
+
import { PluginDesignWindowsApi } from "./windows";
|
|
8
|
+
import { PluginDesignFurnitureApi } from "./furniture";
|
|
9
|
+
import { PluginDesignMaterialsApi } from "./materials";
|
|
10
|
+
import { PluginDesignEraseApi } from "./erase";
|
|
11
|
+
import { PluginDesignDeleteApi } from "./delete";
|
|
12
|
+
import { PluginDesignBooleanApi } from "./boolean";
|
|
13
|
+
import { PluginDesignTransformApi } from "./transform";
|
|
14
|
+
import { PluginDesignEditApi } from "./edit";
|
|
15
|
+
import { PluginDesignUpdateApi } from "./update";
|
|
16
|
+
import { PluginDesignChangeResult } from "./lock";
|
|
17
|
+
/**
|
|
18
|
+
* `snaptrude.design.*` — author, query & edit BIM geometry.
|
|
19
|
+
*
|
|
20
|
+
* - {@linkcode PluginDesignApi.create} — new BIM entities
|
|
21
|
+
* - {@linkcode PluginDesignApi.query} — read entities + their geometry
|
|
22
|
+
* - {@linkcode PluginDesignApi.selection} — read/mutate the scene selection
|
|
23
|
+
* - {@linkcode PluginDesignApi.doors} / {@linkcode PluginDesignApi.windows} — fenestration reads + edits
|
|
24
|
+
* - {@linkcode PluginDesignApi.furniture} — furniture catalog reads
|
|
25
|
+
* - {@linkcode PluginDesignApi.materials} — material library + assignment
|
|
26
|
+
* - {@linkcode PluginDesignApi.boolean} — CSG boolean ops (union / subtract / intersect)
|
|
27
|
+
* - {@linkcode PluginDesignApi.erase} — plan-level adjacency-edge erase (NOT hard delete)
|
|
28
|
+
* - {@linkcode PluginDesignApi.delete} — hard entity removal
|
|
29
|
+
* - {@linkcode PluginDesignApi.lock} / {@linkcode PluginDesignApi.unlock} / {@linkcode PluginDesignApi.isLocked} / {@linkcode PluginDesignApi.listLocked} — lock state (top-level design verbs, §2A.1)
|
|
30
|
+
*
|
|
31
|
+
* Transform and edit operation namespaces land here in later waves.
|
|
32
|
+
*/
|
|
33
|
+
export declare abstract class PluginDesignApi {
|
|
34
|
+
/** Author new scene-committed BIM entities. See {@linkcode PluginDesignCreateApi}. */
|
|
35
|
+
abstract create: PluginDesignCreateApi;
|
|
36
|
+
/** Read scene entities and their geometry. See {@linkcode PluginDesignQueryApi}. */
|
|
37
|
+
abstract query: PluginDesignQueryApi;
|
|
38
|
+
/** Read/mutate the current selection. See {@linkcode PluginDesignSelectionApi}. */
|
|
39
|
+
abstract selection: PluginDesignSelectionApi;
|
|
40
|
+
/** Door-specific reads + edits. See {@linkcode PluginDesignDoorsApi}. */
|
|
41
|
+
abstract doors: PluginDesignDoorsApi;
|
|
42
|
+
/** Window-specific reads. See {@linkcode PluginDesignWindowsApi}. */
|
|
43
|
+
abstract windows: PluginDesignWindowsApi;
|
|
44
|
+
/** Furniture catalog reads. See {@linkcode PluginDesignFurnitureApi}. */
|
|
45
|
+
abstract furniture: PluginDesignFurnitureApi;
|
|
46
|
+
/** Material library + assignment. See {@linkcode PluginDesignMaterialsApi}. */
|
|
47
|
+
abstract materials: PluginDesignMaterialsApi;
|
|
48
|
+
/** Plan-level adjacency-edge erase (NOT hard delete). See {@linkcode PluginDesignEraseApi}. */
|
|
49
|
+
abstract erase: PluginDesignEraseApi;
|
|
50
|
+
/** Hard entity removal. See {@linkcode PluginDesignDeleteApi}. */
|
|
51
|
+
abstract delete: PluginDesignDeleteApi;
|
|
52
|
+
/** CSG boolean ops (union / subtract / intersect). See {@linkcode PluginDesignBooleanApi}. */
|
|
53
|
+
abstract boolean: PluginDesignBooleanApi;
|
|
54
|
+
/** Rigid transforms — move / rotate. See {@linkcode PluginDesignTransformApi}. */
|
|
55
|
+
abstract transform: PluginDesignTransformApi;
|
|
56
|
+
/** Non-create geometry edits — offset-split. See {@linkcode PluginDesignEditApi}. */
|
|
57
|
+
abstract edit: PluginDesignEditApi;
|
|
58
|
+
/** Update existing entities — properties + geometry. See {@linkcode PluginDesignUpdateApi}. */
|
|
59
|
+
abstract update: PluginDesignUpdateApi;
|
|
60
|
+
/**
|
|
61
|
+
* Lock entities so they cannot be edited. Undoable. Cascades to void/door/window
|
|
62
|
+
* children, stacked-wall companions, and terrain neighborhood; skips
|
|
63
|
+
* active-group members.
|
|
64
|
+
* @param components Entities to lock
|
|
65
|
+
* @returns The affected entities (post-cascade)
|
|
66
|
+
*
|
|
67
|
+
* @examplePrompt Lock the selected walls so they can't be edited
|
|
68
|
+
* @examplePrompt Freeze these masses so nobody moves them by accident
|
|
69
|
+
* @examplePrompt Lock everything on the ground floor
|
|
70
|
+
* @examplePrompt Protect this room from further changes
|
|
71
|
+
*
|
|
72
|
+
* # Example
|
|
73
|
+
* ```ts
|
|
74
|
+
* // Lock every wall on the ground storey
|
|
75
|
+
* const walls = await snaptrude.design.query.listWalls({ storeys: [1] })
|
|
76
|
+
* const { affected } = await snaptrude.design.lock(walls)
|
|
77
|
+
* // affected is post-cascade: hosted doors/windows are included
|
|
78
|
+
* ```
|
|
79
|
+
*/
|
|
80
|
+
abstract lock(components: ComponentHandle[]): PluginApiReturn<PluginDesignChangeResult>;
|
|
81
|
+
/**
|
|
82
|
+
* Unlock previously locked entities so they can be edited again. Undoable.
|
|
83
|
+
* Paired with {@linkcode PluginDesignApi.lock}.
|
|
84
|
+
* @param components Entities to unlock
|
|
85
|
+
* @returns The affected entities
|
|
86
|
+
*
|
|
87
|
+
* @examplePrompt Unlock the selected objects
|
|
88
|
+
* @examplePrompt Make this locked wall editable again
|
|
89
|
+
* @examplePrompt Unfreeze the masses I locked earlier
|
|
90
|
+
* @examplePrompt Remove the lock from these doors
|
|
91
|
+
*
|
|
92
|
+
* # Example
|
|
93
|
+
* ```ts
|
|
94
|
+
* // Unlock everything that is explicitly locked
|
|
95
|
+
* const locked = await snaptrude.design.listLocked()
|
|
96
|
+
* const { affected } = await snaptrude.design.unlock(locked)
|
|
97
|
+
* ```
|
|
98
|
+
*/
|
|
99
|
+
abstract unlock(components: ComponentHandle[]): PluginApiReturn<PluginDesignChangeResult>;
|
|
100
|
+
/**
|
|
101
|
+
* Test whether an entity is locked (folds group + bucket lock unless `includeInherited: false`).
|
|
102
|
+
* @param component The entity to test
|
|
103
|
+
* @param includeInherited Fold group + bucket lock (default `true`); `false` reads the own flag only
|
|
104
|
+
* @returns `true` if locked, otherwise `false`
|
|
105
|
+
*
|
|
106
|
+
* @examplePrompt Is this wall locked?
|
|
107
|
+
* @examplePrompt Check whether the selected mass is locked or editable
|
|
108
|
+
* @examplePrompt Why can't I move this object? Check if it is locked
|
|
109
|
+
* @examplePrompt Tell me if this room is locked, counting locks inherited from its group
|
|
110
|
+
*
|
|
111
|
+
* # Example
|
|
112
|
+
* ```ts
|
|
113
|
+
* const [wall] = await snaptrude.design.query.listWalls()
|
|
114
|
+
* const locked = await snaptrude.design.isLocked(wall)
|
|
115
|
+
* // Own flag only — ignore locks inherited from the group / bucket
|
|
116
|
+
* const ownLock = await snaptrude.design.isLocked(wall, false)
|
|
117
|
+
* ```
|
|
118
|
+
*/
|
|
119
|
+
abstract isLocked(component: ComponentHandle, includeInherited?: boolean): PluginApiReturn<boolean>;
|
|
120
|
+
/**
|
|
121
|
+
* List the explicitly-locked entities (excludes purely group/bucket-inherited locks).
|
|
122
|
+
* @returns The locked entities as {@linkcode ComponentHandle}`[]`
|
|
123
|
+
*
|
|
124
|
+
* @examplePrompt Which objects in the model are locked?
|
|
125
|
+
* @examplePrompt List all the locked entities in this project
|
|
126
|
+
* @examplePrompt Show everything that has been locked
|
|
127
|
+
* @examplePrompt Are there any locked walls or masses in the scene?
|
|
128
|
+
*
|
|
129
|
+
* # Example
|
|
130
|
+
* ```ts
|
|
131
|
+
* const locked = await snaptrude.design.listLocked()
|
|
132
|
+
* console.log(locked.length, "explicitly locked entities")
|
|
133
|
+
* ```
|
|
134
|
+
*/
|
|
135
|
+
abstract listLocked(): PluginApiReturn<ComponentHandle[]>;
|
|
136
|
+
constructor();
|
|
137
|
+
}
|
|
138
|
+
export * from "./create";
|
|
139
|
+
export * from "./query";
|
|
140
|
+
export * from "./selection";
|
|
141
|
+
export * from "./doors";
|
|
142
|
+
export * from "./windows";
|
|
143
|
+
export * from "./furniture";
|
|
144
|
+
export * from "./materials";
|
|
145
|
+
export * from "./lock";
|
|
146
|
+
export * from "./erase";
|
|
147
|
+
export * from "./delete";
|
|
148
|
+
export * from "./shared";
|
|
149
|
+
export * from "./boolean";
|
|
150
|
+
export * from "./transform";
|
|
151
|
+
export * from "./edit";
|
|
152
|
+
export * from "./update";
|
|
153
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/api/design/index.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import * as z from "zod";
|
|
2
|
+
import { ComponentHandle } from "../../handles";
|
|
3
|
+
/**
|
|
4
|
+
* Shared result for scene-state change mutations (lock/unlock, selection, visibility)
|
|
5
|
+
* — echoes the handles actually affected (post-cascade for lock). Errors throw
|
|
6
|
+
* (RPC rejects); there is no `Result<>` monad in the SDK (consistent with
|
|
7
|
+
* `design.create.*` returning a handle directly).
|
|
8
|
+
*/
|
|
9
|
+
export declare const PluginDesignChangeResult: z.ZodObject<{
|
|
10
|
+
affected: z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<ComponentHandle, string>>>;
|
|
11
|
+
}, z.core.$strip>;
|
|
12
|
+
export type PluginDesignChangeResult = z.infer<typeof PluginDesignChangeResult>;
|
|
13
|
+
/**
|
|
14
|
+
* Arguments for {@linkcode PluginDesignApi.lock} / {@linkcode PluginDesignApi.unlock}.
|
|
15
|
+
*
|
|
16
|
+
* | Property | Type | Description |
|
|
17
|
+
* |---|---|---|
|
|
18
|
+
* | `components` | {@linkcode ComponentHandle}`[]` | Entities to lock / unlock |
|
|
19
|
+
*/
|
|
20
|
+
export declare const PluginDesignLockArgs: z.ZodObject<{
|
|
21
|
+
components: z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<ComponentHandle, string>>>;
|
|
22
|
+
}, z.core.$strip>;
|
|
23
|
+
export type PluginDesignLockArgs = z.infer<typeof PluginDesignLockArgs>;
|
|
24
|
+
export declare const PluginDesignUnlockArgs: z.ZodObject<{
|
|
25
|
+
components: z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<ComponentHandle, string>>>;
|
|
26
|
+
}, z.core.$strip>;
|
|
27
|
+
export type PluginDesignUnlockArgs = z.infer<typeof PluginDesignUnlockArgs>;
|
|
28
|
+
/**
|
|
29
|
+
* Arguments for {@linkcode PluginDesignApi.isLocked}.
|
|
30
|
+
*
|
|
31
|
+
* | Property | Type | Description |
|
|
32
|
+
* |---|---|---|
|
|
33
|
+
* | `component` | {@linkcode ComponentHandle} | The entity to test |
|
|
34
|
+
* | `includeInherited` | `boolean` | Fold group + bucket lock (default `true`); `false` reads the own flag only |
|
|
35
|
+
*/
|
|
36
|
+
export declare const PluginDesignIsLockedArgs: z.ZodObject<{
|
|
37
|
+
component: z.ZodPipe<z.ZodString, z.ZodTransform<ComponentHandle, string>>;
|
|
38
|
+
includeInherited: z.ZodOptional<z.ZodBoolean>;
|
|
39
|
+
}, z.core.$strip>;
|
|
40
|
+
export type PluginDesignIsLockedArgs = z.infer<typeof PluginDesignIsLockedArgs>;
|
|
41
|
+
//# sourceMappingURL=lock.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lock.d.ts","sourceRoot":"","sources":["../../../src/api/design/lock.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAA;AACxB,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAE/C;;;;;GAKG;AACH,eAAO,MAAM,wBAAwB;;iBAEnC,CAAA;AACF,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAA;AAE/E;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB;;iBAE/B,CAAA;AACF,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAA;AAEvE,eAAO,MAAM,sBAAsB;;iBAAuB,CAAA;AAC1D,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAA;AAE3E;;;;;;;GAOG;AACH,eAAO,MAAM,wBAAwB;;;iBAGnC,CAAA;AACF,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAA"}
|
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
import * as z from "zod";
|
|
2
|
+
import { PluginApiReturn } from "../../../types";
|
|
3
|
+
import { ComponentHandle, MaterialHandle } from "../../../handles";
|
|
4
|
+
/**
|
|
5
|
+
* `snaptrude.design.materials` — the project material library + material assignment.
|
|
6
|
+
*
|
|
7
|
+
* Materials are {@linkcode MaterialHandle}s (entity-style, name-addressed). Reads return
|
|
8
|
+
* a {@linkcode MaterialHandle}/{@linkcode PluginMaterialInfo}; `apply`/`reset` mutate the
|
|
9
|
+
* scene (undoable via `save`, default `true`). `create` mints a material from a
|
|
10
|
+
* {@linkcode PluginMaterialSpec} (idempotent by name).
|
|
11
|
+
*
|
|
12
|
+
* Face-targeted apply, per-face reads (`listByFace`), and `copy` (needs an undo
|
|
13
|
+
* wrapper) land in a later pass.
|
|
14
|
+
*/
|
|
15
|
+
export declare abstract class PluginDesignMaterialsApi {
|
|
16
|
+
constructor();
|
|
17
|
+
/**
|
|
18
|
+
* List the project materials.
|
|
19
|
+
* @param scope Which library to list (optional)
|
|
20
|
+
* @returns The materials as {@linkcode MaterialHandle}`[]`
|
|
21
|
+
*
|
|
22
|
+
* @examplePrompt List all the materials in this project
|
|
23
|
+
* @examplePrompt What materials do I have available to apply?
|
|
24
|
+
* @examplePrompt Show me the preset materials library
|
|
25
|
+
* @examplePrompt Which finishes exist in this model?
|
|
26
|
+
* @examplePrompt Get every material in the project palette
|
|
27
|
+
*
|
|
28
|
+
* # Example
|
|
29
|
+
* ```ts
|
|
30
|
+
* const presets = await snaptrude.design.materials.list("preset")
|
|
31
|
+
* console.log(presets.length, "preset materials")
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
abstract list(scope?: "project" | "preset"): PluginApiReturn<MaterialHandle[]>;
|
|
35
|
+
/**
|
|
36
|
+
* Read a material's descriptor — its name, color, opacity, and texture
|
|
37
|
+
* (when it has one).
|
|
38
|
+
*
|
|
39
|
+
* @param material The material to read
|
|
40
|
+
* @returns The {@linkcode PluginMaterialInfo}, or `null` if the material is gone
|
|
41
|
+
*
|
|
42
|
+
* @examplePrompt What colour is the Brick material?
|
|
43
|
+
* @examplePrompt Show me the details of this material
|
|
44
|
+
* @examplePrompt Get the opacity of the glass finish
|
|
45
|
+
* @examplePrompt Which texture image does the wood material use?
|
|
46
|
+
*
|
|
47
|
+
* # Example
|
|
48
|
+
* ```ts
|
|
49
|
+
* const [material] = await snaptrude.design.materials.list()
|
|
50
|
+
* const info = await snaptrude.design.materials.getInfo(material)
|
|
51
|
+
* if (info) console.log(info.name, info.colorHex, info.alpha)
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
54
|
+
abstract getInfo(material: MaterialHandle): PluginApiReturn<PluginMaterialInfo | null>;
|
|
55
|
+
/**
|
|
56
|
+
* Apply a material to one or more components — an existing project material by
|
|
57
|
+
* handle, or a new one described inline as a {@linkcode PluginMaterialSpec}.
|
|
58
|
+
* Undoable when `save` is true (the default).
|
|
59
|
+
*
|
|
60
|
+
* @param targets Components to paint
|
|
61
|
+
* @param material Material handle, or an inline {@linkcode PluginMaterialSpec}
|
|
62
|
+
* @param save Commit as an undoable command (default `true`)
|
|
63
|
+
* @returns The number of targets the material was applied to
|
|
64
|
+
*
|
|
65
|
+
* @examplePrompt Paint the selected walls red
|
|
66
|
+
* @examplePrompt Apply the brick material to these walls
|
|
67
|
+
* @examplePrompt Put a wood finish on the floor
|
|
68
|
+
* @examplePrompt Change the colour of this room's walls to #ff8800
|
|
69
|
+
* @examplePrompt Add a concrete texture to the facade
|
|
70
|
+
*
|
|
71
|
+
* # Example
|
|
72
|
+
* ```ts
|
|
73
|
+
* const walls = await snaptrude.design.query.listWalls({ storeys: [1] })
|
|
74
|
+
* // inline spec — creates (or reuses by name) a project material, then applies it
|
|
75
|
+
* const { count } = await snaptrude.design.materials.apply(walls, { name: "Accent Red", color: "#b04a3a" })
|
|
76
|
+
* console.log("painted", count, "walls")
|
|
77
|
+
* ```
|
|
78
|
+
*/
|
|
79
|
+
abstract apply(targets: ComponentHandle[], material: MaterialHandle | PluginMaterialSpec, save?: boolean): PluginApiReturn<PluginMaterialResult>;
|
|
80
|
+
/**
|
|
81
|
+
* Reset one or more components back to the default material for their type,
|
|
82
|
+
* removing any applied finish. The inverse of `apply`; undoable when `save`
|
|
83
|
+
* is true (the default).
|
|
84
|
+
*
|
|
85
|
+
* @param components Components to reset
|
|
86
|
+
* @param save Commit as an undoable command (default `true`)
|
|
87
|
+
* @returns The number of components reset
|
|
88
|
+
*
|
|
89
|
+
* @examplePrompt Remove the paint from these walls
|
|
90
|
+
* @examplePrompt Reset the selected objects to their default material
|
|
91
|
+
* @examplePrompt Clear the custom finish on the floor
|
|
92
|
+
* @examplePrompt Restore the original colour of this roof
|
|
93
|
+
*
|
|
94
|
+
* # Example
|
|
95
|
+
* ```ts
|
|
96
|
+
* const selected = await snaptrude.design.selection.get()
|
|
97
|
+
* const { count } = await snaptrude.design.materials.reset(selected)
|
|
98
|
+
* console.log("reset", count, "components to their default material")
|
|
99
|
+
* ```
|
|
100
|
+
*/
|
|
101
|
+
abstract reset(components: ComponentHandle[], save?: boolean): PluginApiReturn<PluginMaterialResult>;
|
|
102
|
+
/**
|
|
103
|
+
* Create a new material in the project from a spec — a color, texture URL,
|
|
104
|
+
* opacity, and/or name. Idempotent by name: creating with the name of an
|
|
105
|
+
* existing material returns that material instead of duplicating it.
|
|
106
|
+
*
|
|
107
|
+
* @param spec The material construction spec
|
|
108
|
+
* @returns The new material as a {@linkcode MaterialHandle}
|
|
109
|
+
*
|
|
110
|
+
* @examplePrompt Create a new red material called Accent
|
|
111
|
+
* @examplePrompt Make a material from this texture image URL
|
|
112
|
+
* @examplePrompt Add a semi-transparent glass material to the project
|
|
113
|
+
* @examplePrompt Define a dark grey concrete finish I can reuse
|
|
114
|
+
*
|
|
115
|
+
* # Example
|
|
116
|
+
* ```ts
|
|
117
|
+
* const glass = await snaptrude.design.materials.create({ name: "Frosted Glass", color: "#cfe4e8", alpha: 0.4 })
|
|
118
|
+
* const walls = await snaptrude.design.query.listWalls({ storeys: [1] })
|
|
119
|
+
* await snaptrude.design.materials.apply(walls, glass)
|
|
120
|
+
* ```
|
|
121
|
+
*/
|
|
122
|
+
abstract create(spec: PluginMaterialSpec): PluginApiReturn<MaterialHandle>;
|
|
123
|
+
/**
|
|
124
|
+
* Get the default material for a component's type.
|
|
125
|
+
* @param component The component to look up
|
|
126
|
+
* @returns The default material as a {@linkcode MaterialHandle}, or `null`
|
|
127
|
+
*
|
|
128
|
+
* @examplePrompt What is the default material for walls?
|
|
129
|
+
* @examplePrompt Get the standard material this floor type uses
|
|
130
|
+
* @examplePrompt Which material would this roof have out of the box?
|
|
131
|
+
* @examplePrompt Find the default finish for the selected column
|
|
132
|
+
*
|
|
133
|
+
* # Example
|
|
134
|
+
* ```ts
|
|
135
|
+
* const [wall] = await snaptrude.design.query.listWalls()
|
|
136
|
+
* const defaultMaterial = await snaptrude.design.materials.getDefault(wall)
|
|
137
|
+
* if (defaultMaterial) console.log(await snaptrude.design.materials.getInfo(defaultMaterial))
|
|
138
|
+
* ```
|
|
139
|
+
*/
|
|
140
|
+
abstract getDefault(component: ComponentHandle): PluginApiReturn<MaterialHandle | null>;
|
|
141
|
+
/**
|
|
142
|
+
* Test whether a component carries its (type) default material.
|
|
143
|
+
* @param component The component to test
|
|
144
|
+
* @returns `true` if default, otherwise `false`
|
|
145
|
+
*
|
|
146
|
+
* @examplePrompt Is this wall still using its default material?
|
|
147
|
+
* @examplePrompt Has the material on this floor been changed?
|
|
148
|
+
* @examplePrompt Check if the selected object still has its original finish
|
|
149
|
+
* @examplePrompt Tell me whether this roof has been painted or is still standard
|
|
150
|
+
*
|
|
151
|
+
* # Example
|
|
152
|
+
* ```ts
|
|
153
|
+
* const [wall] = await snaptrude.design.query.listWalls()
|
|
154
|
+
* const untouched = await snaptrude.design.materials.isDefault(wall)
|
|
155
|
+
* console.log(untouched ? "still default" : "has been painted")
|
|
156
|
+
* ```
|
|
157
|
+
*/
|
|
158
|
+
abstract isDefault(component: ComponentHandle): PluginApiReturn<boolean>;
|
|
159
|
+
/**
|
|
160
|
+
* Test whether a component has a single (uniform) material across all faces.
|
|
161
|
+
* @param component The component to test
|
|
162
|
+
* @returns `true` if uniform, otherwise `false`
|
|
163
|
+
*
|
|
164
|
+
* @examplePrompt Does this wall have the same material on every face?
|
|
165
|
+
* @examplePrompt Is the floor finished uniformly or face by face?
|
|
166
|
+
* @examplePrompt Check if this column is a single material all over
|
|
167
|
+
* @examplePrompt Are any faces of the selected object painted differently?
|
|
168
|
+
*
|
|
169
|
+
* # Example
|
|
170
|
+
* ```ts
|
|
171
|
+
* const [selected] = await snaptrude.design.selection.get()
|
|
172
|
+
* const uniform = await snaptrude.design.materials.isUniform(selected)
|
|
173
|
+
* console.log(uniform ? "one material all over" : "painted per face")
|
|
174
|
+
* ```
|
|
175
|
+
*/
|
|
176
|
+
abstract isUniform(component: ComponentHandle): PluginApiReturn<boolean>;
|
|
177
|
+
/**
|
|
178
|
+
* Test whether a material has a texture.
|
|
179
|
+
* @param material The material to test
|
|
180
|
+
* @returns `true` if it has a diffuse texture, otherwise `false`
|
|
181
|
+
*
|
|
182
|
+
* @examplePrompt Does this material have a texture image?
|
|
183
|
+
* @examplePrompt Is the brick material textured or just a flat colour?
|
|
184
|
+
* @examplePrompt Check whether the wood finish uses an image map
|
|
185
|
+
* @examplePrompt Tell me if this material is image-based or a plain colour
|
|
186
|
+
*
|
|
187
|
+
* # Example
|
|
188
|
+
* ```ts
|
|
189
|
+
* const [material] = await snaptrude.design.materials.list()
|
|
190
|
+
* const textured = await snaptrude.design.materials.hasTexture(material)
|
|
191
|
+
* console.log(textured ? "image-based" : "flat colour")
|
|
192
|
+
* ```
|
|
193
|
+
*/
|
|
194
|
+
abstract hasTexture(material: MaterialHandle): PluginApiReturn<boolean>;
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* A material's descriptor.
|
|
198
|
+
*
|
|
199
|
+
* | Property | Type | Description |
|
|
200
|
+
* |---|---|---|
|
|
201
|
+
* | `name` | `string` | Material name (== the handle token) |
|
|
202
|
+
* | `id` | `string` | Engine material id |
|
|
203
|
+
* | `colorHex` | `string` | Diffuse color as `#rrggbb` |
|
|
204
|
+
* | `alpha` | `number` | Opacity `0..1` |
|
|
205
|
+
* | `materialType` | `string` | Material type tag (optional) |
|
|
206
|
+
* | `textureUrl` | `string` | Diffuse texture URL (optional) |
|
|
207
|
+
*/
|
|
208
|
+
export declare const PluginMaterialInfo: z.ZodObject<{
|
|
209
|
+
name: z.ZodString;
|
|
210
|
+
id: z.ZodString;
|
|
211
|
+
colorHex: z.ZodString;
|
|
212
|
+
alpha: z.ZodNumber;
|
|
213
|
+
materialType: z.ZodOptional<z.ZodString>;
|
|
214
|
+
textureUrl: z.ZodOptional<z.ZodString>;
|
|
215
|
+
}, z.core.$strip>;
|
|
216
|
+
export type PluginMaterialInfo = z.infer<typeof PluginMaterialInfo>;
|
|
217
|
+
/**
|
|
218
|
+
* A material construction spec (input DTO — NOT a handle).
|
|
219
|
+
*
|
|
220
|
+
* | Property | Type | Description |
|
|
221
|
+
* |---|---|---|
|
|
222
|
+
* | `name` | `string` | Name (optional; generated if omitted) |
|
|
223
|
+
* | `color` | `string` | Diffuse color `#rrggbb` (optional) |
|
|
224
|
+
* | `textureUrl` | `string` | Diffuse texture URL (optional; wins over color) |
|
|
225
|
+
* | `alpha` | `number` | Opacity `0..1` (optional) |
|
|
226
|
+
* | `materialType` | `string` | Material type tag (optional) |
|
|
227
|
+
*/
|
|
228
|
+
export declare const PluginMaterialSpec: z.ZodObject<{
|
|
229
|
+
name: z.ZodOptional<z.ZodString>;
|
|
230
|
+
color: z.ZodOptional<z.ZodString>;
|
|
231
|
+
textureUrl: z.ZodOptional<z.ZodString>;
|
|
232
|
+
alpha: z.ZodOptional<z.ZodNumber>;
|
|
233
|
+
materialType: z.ZodOptional<z.ZodString>;
|
|
234
|
+
}, z.core.$strip>;
|
|
235
|
+
export type PluginMaterialSpec = z.infer<typeof PluginMaterialSpec>;
|
|
236
|
+
/** Result of a material mutation — the count of targets affected. */
|
|
237
|
+
export declare const PluginMaterialResult: z.ZodObject<{
|
|
238
|
+
count: z.ZodNumber;
|
|
239
|
+
}, z.core.$strip>;
|
|
240
|
+
export type PluginMaterialResult = z.infer<typeof PluginMaterialResult>;
|
|
241
|
+
/** Arguments for {@linkcode PluginDesignMaterialsApi.list}. */
|
|
242
|
+
export declare const PluginDesignMaterialsListArgs: z.ZodObject<{
|
|
243
|
+
scope: z.ZodOptional<z.ZodEnum<{
|
|
244
|
+
preset: "preset";
|
|
245
|
+
project: "project";
|
|
246
|
+
}>>;
|
|
247
|
+
}, z.core.$strip>;
|
|
248
|
+
export type PluginDesignMaterialsListArgs = z.infer<typeof PluginDesignMaterialsListArgs>;
|
|
249
|
+
/** Arguments for {@linkcode PluginDesignMaterialsApi.getInfo} / `hasTexture`. */
|
|
250
|
+
export declare const PluginDesignMaterialsGetInfoArgs: z.ZodObject<{
|
|
251
|
+
material: z.ZodPipe<z.ZodString, z.ZodTransform<MaterialHandle, string>>;
|
|
252
|
+
}, z.core.$strip>;
|
|
253
|
+
export type PluginDesignMaterialsGetInfoArgs = z.infer<typeof PluginDesignMaterialsGetInfoArgs>;
|
|
254
|
+
/** Arguments for component-scoped predicates (`getDefault`/`isDefault`/`isUniform`). */
|
|
255
|
+
export declare const PluginDesignMaterialsComponentArgs: z.ZodObject<{
|
|
256
|
+
component: z.ZodPipe<z.ZodString, z.ZodTransform<ComponentHandle, string>>;
|
|
257
|
+
}, z.core.$strip>;
|
|
258
|
+
export type PluginDesignMaterialsComponentArgs = z.infer<typeof PluginDesignMaterialsComponentArgs>;
|
|
259
|
+
/**
|
|
260
|
+
* Arguments for {@linkcode PluginDesignMaterialsApi.apply}.
|
|
261
|
+
*
|
|
262
|
+
* | Property | Type | Description |
|
|
263
|
+
* |---|---|---|
|
|
264
|
+
* | `targets` | {@linkcode ComponentHandle}`[]` | Components to paint |
|
|
265
|
+
* | `material` | {@linkcode MaterialHandle} \| {@linkcode PluginMaterialSpec} | Material handle, or an inline spec |
|
|
266
|
+
* | `save` | `boolean` | Commit as an undoable command (default `true`) |
|
|
267
|
+
*/
|
|
268
|
+
export declare const PluginDesignMaterialsApplyArgs: z.ZodObject<{
|
|
269
|
+
targets: z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<ComponentHandle, string>>>;
|
|
270
|
+
material: z.ZodUnion<readonly [z.ZodPipe<z.ZodString, z.ZodTransform<MaterialHandle, string>>, z.ZodObject<{
|
|
271
|
+
name: z.ZodOptional<z.ZodString>;
|
|
272
|
+
color: z.ZodOptional<z.ZodString>;
|
|
273
|
+
textureUrl: z.ZodOptional<z.ZodString>;
|
|
274
|
+
alpha: z.ZodOptional<z.ZodNumber>;
|
|
275
|
+
materialType: z.ZodOptional<z.ZodString>;
|
|
276
|
+
}, z.core.$strip>]>;
|
|
277
|
+
save: z.ZodOptional<z.ZodBoolean>;
|
|
278
|
+
}, z.core.$strip>;
|
|
279
|
+
export type PluginDesignMaterialsApplyArgs = z.infer<typeof PluginDesignMaterialsApplyArgs>;
|
|
280
|
+
/** Arguments for {@linkcode PluginDesignMaterialsApi.reset}. */
|
|
281
|
+
export declare const PluginDesignMaterialsResetArgs: z.ZodObject<{
|
|
282
|
+
components: z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<ComponentHandle, string>>>;
|
|
283
|
+
save: z.ZodOptional<z.ZodBoolean>;
|
|
284
|
+
}, z.core.$strip>;
|
|
285
|
+
export type PluginDesignMaterialsResetArgs = z.infer<typeof PluginDesignMaterialsResetArgs>;
|
|
286
|
+
/** Arguments for {@linkcode PluginDesignMaterialsApi.create}. */
|
|
287
|
+
export declare const PluginDesignMaterialsCreateArgs: z.ZodObject<{
|
|
288
|
+
spec: z.ZodObject<{
|
|
289
|
+
name: z.ZodOptional<z.ZodString>;
|
|
290
|
+
color: z.ZodOptional<z.ZodString>;
|
|
291
|
+
textureUrl: z.ZodOptional<z.ZodString>;
|
|
292
|
+
alpha: z.ZodOptional<z.ZodNumber>;
|
|
293
|
+
materialType: z.ZodOptional<z.ZodString>;
|
|
294
|
+
}, z.core.$strip>;
|
|
295
|
+
}, z.core.$strip>;
|
|
296
|
+
export type PluginDesignMaterialsCreateArgs = z.infer<typeof PluginDesignMaterialsCreateArgs>;
|
|
297
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/api/design/materials/index.ts"],"names":[],"mappings":"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"}
|