@snaptrude/plugin-core 0.0.0-dev-20260708130115 → 0.0.0-dev-20260827135706
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 +152 -1
- package/api-manifest.json +3620 -276
- package/dist/api/analysis/daylight.d.ts +603 -0
- package/dist/api/analysis/daylight.d.ts.map +1 -0
- package/dist/api/analysis/heatmaps.d.ts +658 -0
- package/dist/api/analysis/heatmaps.d.ts.map +1 -0
- package/dist/api/analysis/illuminance.d.ts +145 -0
- package/dist/api/analysis/illuminance.d.ts.map +1 -0
- package/dist/api/analysis/index.d.ts +59 -0
- package/dist/api/analysis/index.d.ts.map +1 -0
- package/dist/api/analysis/shadows.d.ts +165 -0
- package/dist/api/analysis/shadows.d.ts.map +1 -0
- package/dist/api/analysis/solar.d.ts +249 -0
- package/dist/api/analysis/solar.d.ts.map +1 -0
- package/dist/api/analysis/sunlightHours.d.ts +208 -0
- package/dist/api/analysis/sunlightHours.d.ts.map +1 -0
- package/dist/api/analysis/sunpath.d.ts +80 -0
- package/dist/api/analysis/sunpath.d.ts.map +1 -0
- package/dist/api/analysis/weather.d.ts +193 -0
- package/dist/api/analysis/weather.d.ts.map +1 -0
- package/dist/api/core/camera/index.d.ts +261 -0
- package/dist/api/core/camera/index.d.ts.map +1 -0
- package/dist/api/core/comment/index.d.ts +105 -2
- package/dist/api/core/comment/index.d.ts.map +1 -1
- package/dist/api/core/geom/create/index.d.ts +840 -14
- package/dist/api/core/geom/create/index.d.ts.map +1 -1
- package/dist/api/core/geom/delete/index.d.ts +8 -2
- package/dist/api/core/geom/delete/index.d.ts.map +1 -1
- package/dist/api/core/geom/query/arc.d.ts +5 -5
- package/dist/api/core/geom/query/brep.d.ts +130 -18
- package/dist/api/core/geom/query/brep.d.ts.map +1 -1
- package/dist/api/core/geom/query/circle.d.ts +18 -18
- package/dist/api/core/geom/query/contour.d.ts +20 -20
- package/dist/api/core/geom/query/curve.d.ts +49 -49
- package/dist/api/core/geom/query/edge.d.ts +5 -5
- package/dist/api/core/geom/query/face.d.ts +16 -16
- package/dist/api/core/geom/query/halfedge.d.ts +8 -8
- package/dist/api/core/geom/query/profile.d.ts +19 -19
- package/dist/api/core/geom/query/vertex.d.ts +8 -8
- package/dist/api/core/geom/update/contour.d.ts +14 -14
- package/dist/api/core/geom/update/curve.d.ts +7 -7
- package/dist/api/core/geom/update/profile.d.ts +16 -16
- package/dist/api/core/handles/index.d.ts +210 -0
- package/dist/api/core/handles/index.d.ts.map +1 -0
- package/dist/api/core/index.d.ts +34 -0
- package/dist/api/core/index.d.ts.map +1 -1
- package/dist/api/core/io/export/index.d.ts +134 -0
- package/dist/api/core/io/export/index.d.ts.map +1 -0
- package/dist/api/core/io/import/index.d.ts +453 -0
- package/dist/api/core/io/import/index.d.ts.map +1 -0
- package/dist/api/core/io/index.d.ts +40 -0
- package/dist/api/core/io/index.d.ts.map +1 -0
- package/dist/api/core/io/job/index.d.ts +139 -0
- package/dist/api/core/io/job/index.d.ts.map +1 -0
- package/dist/api/core/io/query/index.d.ts +74 -0
- package/dist/api/core/io/query/index.d.ts.map +1 -0
- package/dist/api/core/io/terrain/index.d.ts +341 -0
- package/dist/api/core/io/terrain/index.d.ts.map +1 -0
- package/dist/api/core/io/underlay/index.d.ts +805 -0
- package/dist/api/core/io/underlay/index.d.ts.map +1 -0
- package/dist/api/core/layers.d.ts +7 -7
- package/dist/api/core/mode/index.d.ts +99 -0
- package/dist/api/core/mode/index.d.ts.map +1 -0
- package/dist/api/core/project/index.d.ts +68 -1
- package/dist/api/core/project/index.d.ts.map +1 -1
- package/dist/api/core/proposals/index.d.ts +531 -0
- package/dist/api/core/proposals/index.d.ts.map +1 -0
- package/dist/api/core/storeys/index.d.ts +265 -0
- package/dist/api/core/storeys/index.d.ts.map +1 -0
- package/dist/api/core/tags.d.ts +24 -0
- package/dist/api/core/tags.d.ts.map +1 -1
- package/dist/api/core/user.d.ts +44 -0
- package/dist/api/core/user.d.ts.map +1 -0
- package/dist/api/core/zoom/index.d.ts +4 -0
- package/dist/api/core/zoom/index.d.ts.map +1 -1
- package/dist/api/design/boolean/index.d.ts +4 -4
- package/dist/api/design/create/index.d.ts +568 -45
- package/dist/api/design/create/index.d.ts.map +1 -1
- package/dist/api/design/delete/index.d.ts +3 -0
- package/dist/api/design/delete/index.d.ts.map +1 -1
- package/dist/api/design/doors/index.d.ts +195 -0
- package/dist/api/design/doors/index.d.ts.map +1 -1
- package/dist/api/design/edit/index.d.ts +1 -1
- package/dist/api/design/erase/index.d.ts +2 -2
- package/dist/api/design/family.d.ts +349 -0
- package/dist/api/design/family.d.ts.map +1 -0
- package/dist/api/design/furniture/index.d.ts +181 -8
- package/dist/api/design/furniture/index.d.ts.map +1 -1
- package/dist/api/design/index.d.ts +98 -0
- package/dist/api/design/index.d.ts.map +1 -1
- package/dist/api/design/lock.d.ts +26 -0
- package/dist/api/design/lock.d.ts.map +1 -1
- package/dist/api/design/materials/index.d.ts +270 -16
- package/dist/api/design/materials/index.d.ts.map +1 -1
- package/dist/api/design/query/geometry/index.d.ts +112 -0
- package/dist/api/design/query/geometry/index.d.ts.map +1 -1
- package/dist/api/design/query/index.d.ts +282 -11
- package/dist/api/design/query/index.d.ts.map +1 -1
- package/dist/api/design/query/referenceLines.d.ts +45 -0
- package/dist/api/design/query/referenceLines.d.ts.map +1 -0
- package/dist/api/design/query/spaces.d.ts +181 -8
- package/dist/api/design/query/spaces.d.ts.map +1 -1
- package/dist/api/design/selection/index.d.ts +144 -0
- package/dist/api/design/selection/index.d.ts.map +1 -1
- package/dist/api/design/transform/index.d.ts +172 -10
- package/dist/api/design/transform/index.d.ts.map +1 -1
- package/dist/api/design/types/index.d.ts +181 -0
- package/dist/api/design/types/index.d.ts.map +1 -0
- package/dist/api/design/update/index.d.ts +553 -2
- package/dist/api/design/update/index.d.ts.map +1 -1
- package/dist/api/design/visibility.d.ts +126 -0
- package/dist/api/design/visibility.d.ts.map +1 -0
- package/dist/api/design/windows/index.d.ts +113 -2
- package/dist/api/design/windows/index.d.ts.map +1 -1
- package/dist/api/entity/buildableEnvelope.d.ts +4 -0
- package/dist/api/entity/buildableEnvelope.d.ts.map +1 -1
- package/dist/api/entity/referenceLine.d.ts +10 -2
- package/dist/api/entity/referenceLine.d.ts.map +1 -1
- package/dist/api/entity/space.d.ts +21 -21
- package/dist/api/entity/story.d.ts +242 -15
- package/dist/api/entity/story.d.ts.map +1 -1
- package/dist/api/index.d.ts +10 -0
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/presentation/aiInspiration.d.ts +25 -25
- package/dist/api/presentation/annotate.d.ts +467 -0
- package/dist/api/presentation/annotate.d.ts.map +1 -0
- package/dist/api/presentation/diagrams.d.ts +111 -8
- package/dist/api/presentation/diagrams.d.ts.map +1 -1
- package/dist/api/presentation/export.d.ts +108 -0
- package/dist/api/presentation/export.d.ts.map +1 -0
- package/dist/api/presentation/import.d.ts +55 -4
- package/dist/api/presentation/import.d.ts.map +1 -1
- package/dist/api/presentation/index.d.ts +58 -1
- package/dist/api/presentation/index.d.ts.map +1 -1
- package/dist/api/presentation/placedViews.d.ts +1139 -0
- package/dist/api/presentation/placedViews.d.ts.map +1 -0
- package/dist/api/presentation/shapes.d.ts +481 -0
- package/dist/api/presentation/shapes.d.ts.map +1 -0
- package/dist/api/presentation/sheets.d.ts +452 -13
- package/dist/api/presentation/sheets.d.ts.map +1 -1
- package/dist/api/presentation/slideshow.d.ts +125 -0
- package/dist/api/presentation/slideshow.d.ts.map +1 -0
- package/dist/api/presentation/tables.d.ts +81 -0
- package/dist/api/presentation/tables.d.ts.map +1 -0
- package/dist/api/presentation/views.d.ts +367 -7
- package/dist/api/presentation/views.d.ts.map +1 -1
- package/dist/api/program/areas.d.ts +102 -12
- package/dist/api/program/areas.d.ts.map +1 -1
- package/dist/api/program/cores.d.ts +3 -99
- package/dist/api/program/cores.d.ts.map +1 -1
- package/dist/api/program/index.d.ts +7 -15
- package/dist/api/program/index.d.ts.map +1 -1
- package/dist/api/program/layout.d.ts +346 -11
- package/dist/api/program/layout.d.ts.map +1 -1
- package/dist/api/program/site.d.ts +469 -13
- package/dist/api/program/site.d.ts.map +1 -1
- package/dist/api/program/spreadsheet.d.ts +365 -41
- package/dist/api/program/spreadsheet.d.ts.map +1 -1
- package/dist/api/workspace/index.d.ts +505 -0
- package/dist/api/workspace/index.d.ts.map +1 -0
- package/dist/errors/codes.d.ts +34 -0
- package/dist/errors/codes.d.ts.map +1 -0
- package/dist/errors/envelope.d.ts +56 -0
- package/dist/errors/envelope.d.ts.map +1 -0
- package/dist/errors/index.d.ts +6 -0
- package/dist/errors/index.d.ts.map +1 -0
- package/dist/errors/plugin-error.d.ts +69 -0
- package/dist/errors/plugin-error.d.ts.map +1 -0
- package/dist/handles.d.ts +97 -25
- package/dist/handles.d.ts.map +1 -1
- package/dist/host-utils.d.ts +4 -0
- package/dist/host-utils.d.ts.map +1 -1
- package/dist/index.cjs +4582 -1422
- 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 +4171 -1411
- package/dist/index.js.map +1 -1
- package/package.json +4 -2
- package/scripts/generate-manifest.mjs +45 -0
- package/scripts/generate-manifest.test.mjs +103 -4
- package/src/api/analysis/daylight.ts +470 -0
- package/src/api/analysis/heatmaps.ts +683 -0
- package/src/api/analysis/illuminance.ts +155 -0
- package/src/api/analysis/index.ts +61 -0
- package/src/api/analysis/shadows.ts +183 -0
- package/src/api/analysis/solar.ts +237 -0
- package/src/api/analysis/sunlightHours.ts +211 -0
- package/src/api/analysis/sunpath.ts +83 -0
- package/src/api/analysis/weather.ts +179 -0
- package/src/api/core/camera/index.ts +268 -0
- package/src/api/core/comment/index.ts +120 -2
- package/src/api/core/geom/create/index.ts +912 -1
- package/src/api/core/geom/delete/index.ts +6 -0
- package/src/api/core/geom/query/brep.ts +119 -0
- package/src/api/core/handles/index.ts +233 -0
- package/src/api/core/index.ts +34 -0
- package/src/api/core/io/export/index.ts +126 -0
- package/src/api/core/io/import/index.ts +496 -0
- package/src/api/core/io/index.ts +42 -0
- package/src/api/core/io/job/index.ts +140 -0
- package/src/api/core/io/query/index.ts +71 -0
- package/src/api/core/io/terrain/index.ts +360 -0
- package/src/api/core/io/underlay/index.ts +705 -0
- package/src/api/core/mode/index.ts +96 -0
- package/src/api/core/project/index.ts +62 -1
- package/src/api/core/proposals/index.ts +569 -0
- package/src/api/core/storeys/index.ts +294 -0
- package/src/api/core/tags.ts +27 -0
- package/src/api/core/user.ts +46 -0
- package/src/api/core/zoom/index.ts +4 -0
- package/src/api/design/create/index.ts +670 -30
- package/src/api/design/delete/index.ts +3 -0
- package/src/api/design/doors/index.ts +208 -0
- package/src/api/design/erase/index.ts +1 -1
- package/src/api/design/family.ts +388 -0
- package/src/api/design/furniture/index.ts +197 -8
- package/src/api/design/index.ts +102 -0
- package/src/api/design/lock.ts +27 -0
- package/src/api/design/materials/index.ts +334 -27
- package/src/api/design/query/geometry/index.ts +125 -3
- package/src/api/design/query/index.ts +217 -7
- package/src/api/design/query/referenceLines.ts +52 -0
- package/src/api/design/query/spaces.ts +143 -0
- package/src/api/design/selection/index.ts +129 -0
- package/src/api/design/transform/index.ts +170 -9
- package/src/api/design/types/index.ts +156 -0
- package/src/api/design/update/index.ts +631 -3
- package/src/api/design/visibility.ts +143 -0
- package/src/api/design/windows/index.ts +128 -2
- package/src/api/entity/buildableEnvelope.ts +4 -0
- package/src/api/entity/referenceLine.ts +8 -0
- package/src/api/entity/story.ts +259 -15
- package/src/api/index.ts +10 -0
- package/src/api/presentation/annotate.ts +385 -0
- package/src/api/presentation/diagrams.ts +118 -8
- package/src/api/presentation/export.ts +108 -0
- package/src/api/presentation/import.ts +51 -4
- package/src/api/presentation/index.ts +66 -1
- package/src/api/presentation/placedViews.ts +1120 -0
- package/src/api/presentation/shapes.ts +274 -0
- package/src/api/presentation/sheets.ts +400 -13
- package/src/api/presentation/slideshow.ts +134 -0
- package/src/api/presentation/tables.ts +84 -0
- package/src/api/presentation/views.ts +376 -8
- package/src/api/program/areas.ts +88 -15
- package/src/api/program/cores.ts +3 -91
- package/src/api/program/index.ts +7 -15
- package/src/api/program/layout.ts +365 -11
- package/src/api/program/site.ts +435 -13
- package/src/api/program/spreadsheet.ts +376 -35
- package/src/api/workspace/index.ts +563 -0
- package/src/errors/codes.ts +136 -0
- package/src/errors/envelope.ts +75 -0
- package/src/errors/index.ts +21 -0
- package/src/errors/plugin-error.ts +134 -0
- package/src/handles.ts +123 -13
- package/src/host-utils.ts +4 -0
- package/src/index.ts +1 -0
- package/test/errors.test.mjs +184 -0
- package/tsconfig.json +7 -2
|
@@ -7,31 +7,75 @@ import { ComponentHandle, MaterialHandle } from "../../../handles";
|
|
|
7
7
|
* Materials are {@linkcode MaterialHandle}s (entity-style, name-addressed). Reads return
|
|
8
8
|
* a {@linkcode MaterialHandle}/{@linkcode PluginMaterialInfo}; `apply`/`reset` mutate the
|
|
9
9
|
* scene (undoable via `save`, default `true`). `create` mints a material from a
|
|
10
|
-
* {@linkcode PluginMaterialSpec} (idempotent by name).
|
|
10
|
+
* {@linkcode PluginMaterialSpec} (idempotent by name). `list` reads the materials loaded
|
|
11
|
+
* in the project; `listPresets` reads the browsable preset/library catalog (handle-less
|
|
12
|
+
* {@linkcode PluginPresetMaterial} records that become materials via `create`/`apply`).
|
|
11
13
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
+
* Per-face assignment — {@linkcode PluginDesignMaterialsApi.applyToFaces} /
|
|
15
|
+
* {@linkcode PluginDesignMaterialsApi.resetFaces} plus per-face reads
|
|
16
|
+
* ({@linkcode PluginDesignMaterialsApi.getByFace} / {@linkcode PluginDesignMaterialsApi.listByFace})
|
|
17
|
+
* — targets **BREP faces by durable face index** and is **BREP-only** (furniture,
|
|
18
|
+
* doors/windows, and Revit imports are rejected) and **visual-only** in v1 (the
|
|
19
|
+
* per-face finish is not carried into BIM schedules / cost layers). A face index
|
|
20
|
+
* is durable only while the component's BREP topology (face count/order) is unchanged.
|
|
21
|
+
*
|
|
22
|
+
* `copy` (needs an undo wrapper) lands in a later pass.
|
|
14
23
|
*/
|
|
15
24
|
export declare abstract class PluginDesignMaterialsApi {
|
|
16
25
|
constructor();
|
|
17
26
|
/**
|
|
18
|
-
* List the project
|
|
19
|
-
*
|
|
27
|
+
* List the materials loaded in the project — every named material in the live
|
|
28
|
+
* scene (applied finishes, plugin-created materials, and type defaults in use).
|
|
29
|
+
* For the browsable preset/library catalog (finishes not yet in the project),
|
|
30
|
+
* use {@linkcode PluginDesignMaterialsApi.listPresets}.
|
|
31
|
+
*
|
|
20
32
|
* @returns The materials as {@linkcode MaterialHandle}`[]`
|
|
21
33
|
*
|
|
22
34
|
* @examplePrompt List all the materials in this project
|
|
23
35
|
* @examplePrompt What materials do I have available to apply?
|
|
24
|
-
* @examplePrompt Show me the preset materials library
|
|
25
36
|
* @examplePrompt Which finishes exist in this model?
|
|
26
37
|
* @examplePrompt Get every material in the project palette
|
|
27
38
|
*
|
|
28
39
|
* # Example
|
|
29
40
|
* ```ts
|
|
30
|
-
* const
|
|
31
|
-
* console.log(
|
|
41
|
+
* const materials = await snaptrude.design.materials.list()
|
|
42
|
+
* console.log(materials.length, "materials in the project")
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
abstract list(): PluginApiReturn<MaterialHandle[]>;
|
|
46
|
+
/**
|
|
47
|
+
* List the preset material library — the catalog the app's material browser
|
|
48
|
+
* shows (the built-in finishes plus the workspace's uploaded materials),
|
|
49
|
+
* fetched from the material library service. Library entries are **not**
|
|
50
|
+
* scene materials and carry no {@linkcode MaterialHandle}; each is a named
|
|
51
|
+
* texture record. To use one, feed it to
|
|
52
|
+
* {@linkcode PluginDesignMaterialsApi.create} /
|
|
53
|
+
* {@linkcode PluginDesignMaterialsApi.apply} as a
|
|
54
|
+
* {@linkcode PluginMaterialSpec}: `{ name, textureUrl, materialType: category }`.
|
|
55
|
+
*
|
|
56
|
+
* @returns The library as {@linkcode PluginPresetMaterial}`[]` (`[]` when the
|
|
57
|
+
* library service is unreachable)
|
|
58
|
+
*
|
|
59
|
+
* @examplePrompt Show me the preset materials library
|
|
60
|
+
* @examplePrompt What wood finishes are available in the material library?
|
|
61
|
+
* @examplePrompt Browse the material catalog and apply a brick texture
|
|
62
|
+
* @examplePrompt Which preset materials can I choose from?
|
|
63
|
+
*
|
|
64
|
+
* # Example
|
|
65
|
+
* ```ts
|
|
66
|
+
* const presets = await snaptrude.design.materials.listPresets()
|
|
67
|
+
* const brick = presets.find((p) => p.category.toLowerCase().includes("brick"))
|
|
68
|
+
* if (brick) {
|
|
69
|
+
* const walls = await snaptrude.design.query.listWalls()
|
|
70
|
+
* await snaptrude.design.materials.apply(walls, {
|
|
71
|
+
* name: brick.name,
|
|
72
|
+
* textureUrl: brick.textureUrl,
|
|
73
|
+
* materialType: brick.category,
|
|
74
|
+
* })
|
|
75
|
+
* }
|
|
32
76
|
* ```
|
|
33
77
|
*/
|
|
34
|
-
abstract
|
|
78
|
+
abstract listPresets(): PluginApiReturn<PluginPresetMaterial[]>;
|
|
35
79
|
/**
|
|
36
80
|
* Read a material's descriptor — its name, color, opacity, and texture
|
|
37
81
|
* (when it has one).
|
|
@@ -52,6 +96,37 @@ export declare abstract class PluginDesignMaterialsApi {
|
|
|
52
96
|
* ```
|
|
53
97
|
*/
|
|
54
98
|
abstract getInfo(material: MaterialHandle): PluginApiReturn<PluginMaterialInfo | null>;
|
|
99
|
+
/**
|
|
100
|
+
* Read the material applied to a component **as a whole** — the eyedropper. For a
|
|
101
|
+
* uniformly-painted component this is that single material; for a per-face-painted
|
|
102
|
+
* component it is the material on the component's base/first face. Use
|
|
103
|
+
* {@linkcode PluginDesignMaterialsApi.getByFace} /
|
|
104
|
+
* {@linkcode PluginDesignMaterialsApi.listByFace} for the per-face breakdown.
|
|
105
|
+
*
|
|
106
|
+
* @param component The component to sample
|
|
107
|
+
* @returns The whole-object material as a {@linkcode PluginComponentMaterial} — its
|
|
108
|
+
* handle (chain it into `apply` / `getInfo`), engine id, name, and whether the
|
|
109
|
+
* component carries its type `default` or an explicitly `applied` finish — or `null`
|
|
110
|
+
* if the component carries no material
|
|
111
|
+
*
|
|
112
|
+
* @examplePrompt What material is on this wall?
|
|
113
|
+
* @examplePrompt Eyedrop the finish of the selected object
|
|
114
|
+
* @examplePrompt Which material does this slab use?
|
|
115
|
+
* @examplePrompt Read the material on this column so I can paint others with it
|
|
116
|
+
* @examplePrompt Is this component painted, and with what?
|
|
117
|
+
*
|
|
118
|
+
* # Example
|
|
119
|
+
* ```ts
|
|
120
|
+
* const [component] = await snaptrude.design.selection.get()
|
|
121
|
+
* const sampled = await snaptrude.design.materials.get(component)
|
|
122
|
+
* if (sampled) {
|
|
123
|
+
* console.log(sampled.name, sampled.source) // e.g. "Brick Red" "applied"
|
|
124
|
+
* const info = await snaptrude.design.materials.getInfo(sampled.material)
|
|
125
|
+
* console.log(info?.colorHex)
|
|
126
|
+
* }
|
|
127
|
+
* ```
|
|
128
|
+
*/
|
|
129
|
+
abstract get(component: ComponentHandle): PluginApiReturn<PluginComponentMaterial | null>;
|
|
55
130
|
/**
|
|
56
131
|
* Apply a material to one or more components — an existing project material by
|
|
57
132
|
* handle, or a new one described inline as a {@linkcode PluginMaterialSpec}.
|
|
@@ -99,6 +174,102 @@ export declare abstract class PluginDesignMaterialsApi {
|
|
|
99
174
|
* ```
|
|
100
175
|
*/
|
|
101
176
|
abstract reset(components: ComponentHandle[], save?: boolean): PluginApiReturn<PluginMaterialResult>;
|
|
177
|
+
/**
|
|
178
|
+
* Paint specific **BREP faces** of a component with a material — an existing
|
|
179
|
+
* project material by handle, or a new one described inline as a
|
|
180
|
+
* {@linkcode PluginMaterialSpec}. Faces are addressed by **durable BREP face
|
|
181
|
+
* index** (their 0-based position in the component's BREP face list).
|
|
182
|
+
* Undoable when `save` is true (the default).
|
|
183
|
+
*
|
|
184
|
+
* Per-face materials are **BREP-only** (walls, floors, slabs, roofs, masses,
|
|
185
|
+
* columns, beams; furniture, doors/windows, and Revit imports are rejected) and
|
|
186
|
+
* **visual-only in v1** — the finish is not carried into BIM schedules / cost
|
|
187
|
+
* layers. A face index is durable only while the BREP topology (face count/order)
|
|
188
|
+
* is unchanged; a face index at or beyond the face count is rejected.
|
|
189
|
+
*
|
|
190
|
+
* @param component The (BREP) component to paint
|
|
191
|
+
* @param faces BREP face indices to paint (nonnegative integers)
|
|
192
|
+
* @param material Material handle, or an inline {@linkcode PluginMaterialSpec}
|
|
193
|
+
* @param save Commit as an undoable command (default `true`)
|
|
194
|
+
* @returns The number of faces painted
|
|
195
|
+
*
|
|
196
|
+
* @examplePrompt Paint the top face of this slab red
|
|
197
|
+
* @examplePrompt Apply the brick material to faces 0 and 2 of this wall
|
|
198
|
+
* @examplePrompt Put a wood finish on just the front face of this column
|
|
199
|
+
* @examplePrompt Colour face 4 of the selected mass with #ff8800
|
|
200
|
+
*
|
|
201
|
+
* # Example
|
|
202
|
+
* ```ts
|
|
203
|
+
* const [wall] = await snaptrude.design.query.listWalls({ storeys: [1] })
|
|
204
|
+
* // faces are addressed by durable 0-based BREP face index
|
|
205
|
+
* const { count } = await snaptrude.design.materials.applyToFaces(wall, [0, 1], { name: "Accent", color: "#b04a3a" })
|
|
206
|
+
* console.log("painted", count, "faces")
|
|
207
|
+
* ```
|
|
208
|
+
*/
|
|
209
|
+
abstract applyToFaces(component: ComponentHandle, faces: number[], material: MaterialHandle | PluginMaterialSpec, save?: boolean): PluginApiReturn<PluginMaterialResult>;
|
|
210
|
+
/**
|
|
211
|
+
* Reset specific BREP faces of a component back to the component/type default,
|
|
212
|
+
* removing any per-face finish. The inverse of
|
|
213
|
+
* {@linkcode PluginDesignMaterialsApi.applyToFaces}; undoable when `save` is true
|
|
214
|
+
* (the default). BREP-only (see `applyToFaces`).
|
|
215
|
+
*
|
|
216
|
+
* @param component The (BREP) component
|
|
217
|
+
* @param faces BREP face indices to reset (nonnegative integers)
|
|
218
|
+
* @param save Commit as an undoable command (default `true`)
|
|
219
|
+
* @returns The number of faces reset
|
|
220
|
+
*
|
|
221
|
+
* @examplePrompt Remove the paint from the top face of this slab
|
|
222
|
+
* @examplePrompt Reset faces 0 and 2 of this wall to their default material
|
|
223
|
+
* @examplePrompt Clear the custom finish on the front face of this column
|
|
224
|
+
*
|
|
225
|
+
* # Example
|
|
226
|
+
* ```ts
|
|
227
|
+
* const [wall] = await snaptrude.design.query.listWalls({ storeys: [1] })
|
|
228
|
+
* const { count } = await snaptrude.design.materials.resetFaces(wall, [0, 1])
|
|
229
|
+
* console.log("reset", count, "faces")
|
|
230
|
+
* ```
|
|
231
|
+
*/
|
|
232
|
+
abstract resetFaces(component: ComponentHandle, faces: number[], save?: boolean): PluginApiReturn<PluginMaterialResult>;
|
|
233
|
+
/**
|
|
234
|
+
* Read the material applied to a single BREP face.
|
|
235
|
+
*
|
|
236
|
+
* @param component The (BREP) component
|
|
237
|
+
* @param face The BREP face index (a nonnegative integer)
|
|
238
|
+
* @returns The face's material as a {@linkcode MaterialHandle}, or `null` if the
|
|
239
|
+
* face carries no explicit per-face material (or the component has no BREP)
|
|
240
|
+
*
|
|
241
|
+
* @examplePrompt What material is on the top face of this slab?
|
|
242
|
+
* @examplePrompt Get the finish applied to face 2 of this wall
|
|
243
|
+
* @examplePrompt Which material is painted on the front face of this column?
|
|
244
|
+
*
|
|
245
|
+
* # Example
|
|
246
|
+
* ```ts
|
|
247
|
+
* const [wall] = await snaptrude.design.query.listWalls()
|
|
248
|
+
* const material = await snaptrude.design.materials.getByFace(wall, 0)
|
|
249
|
+
* if (material) console.log(await snaptrude.design.materials.getInfo(material))
|
|
250
|
+
* ```
|
|
251
|
+
*/
|
|
252
|
+
abstract getByFace(component: ComponentHandle, face: number): PluginApiReturn<MaterialHandle | null>;
|
|
253
|
+
/**
|
|
254
|
+
* List the per-face materials of a component — one entry per BREP face, in face
|
|
255
|
+
* index order. A face carrying no explicit per-face material reports `null`.
|
|
256
|
+
*
|
|
257
|
+
* @param component The (BREP) component
|
|
258
|
+
* @returns The per-face materials as {@linkcode PluginFaceMaterial}`[]` (`[]` for a
|
|
259
|
+
* component with no BREP)
|
|
260
|
+
*
|
|
261
|
+
* @examplePrompt List the material on every face of this wall
|
|
262
|
+
* @examplePrompt Show me which faces of this slab are painted and with what
|
|
263
|
+
* @examplePrompt Break down the per-face finishes of the selected mass
|
|
264
|
+
*
|
|
265
|
+
* # Example
|
|
266
|
+
* ```ts
|
|
267
|
+
* const [wall] = await snaptrude.design.query.listWalls()
|
|
268
|
+
* const faces = await snaptrude.design.materials.listByFace(wall)
|
|
269
|
+
* for (const f of faces) console.log(f.faceIndex, f.material ?? "(default)")
|
|
270
|
+
* ```
|
|
271
|
+
*/
|
|
272
|
+
abstract listByFace(component: ComponentHandle): PluginApiReturn<PluginFaceMaterial[]>;
|
|
102
273
|
/**
|
|
103
274
|
* Create a new material in the project from a spec — a color, texture URL,
|
|
104
275
|
* opacity, and/or name. Idempotent by name: creating with the name of an
|
|
@@ -238,14 +409,56 @@ export declare const PluginMaterialResult: z.ZodObject<{
|
|
|
238
409
|
count: z.ZodNumber;
|
|
239
410
|
}, z.core.$strip>;
|
|
240
411
|
export type PluginMaterialResult = z.infer<typeof PluginMaterialResult>;
|
|
241
|
-
/**
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
412
|
+
/**
|
|
413
|
+
* A single component face's material assignment (value record — not a handle).
|
|
414
|
+
*
|
|
415
|
+
* | Property | Type | Description |
|
|
416
|
+
* |---|---|---|
|
|
417
|
+
* | `faceIndex` | `number` | Durable BREP face index (0-based position in the face list) |
|
|
418
|
+
* | `material` | {@linkcode MaterialHandle} \| `null` | The applied material, or `null` for the default |
|
|
419
|
+
*/
|
|
420
|
+
export declare const PluginFaceMaterial: z.ZodObject<{
|
|
421
|
+
faceIndex: z.ZodNumber;
|
|
422
|
+
material: z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodTransform<MaterialHandle, string>>>;
|
|
247
423
|
}, z.core.$strip>;
|
|
248
|
-
export type
|
|
424
|
+
export type PluginFaceMaterial = z.infer<typeof PluginFaceMaterial>;
|
|
425
|
+
/**
|
|
426
|
+
* The material on a component **as a whole** — the eyedropper read returned by
|
|
427
|
+
* {@linkcode PluginDesignMaterialsApi.get} (value record, plus a reusable handle).
|
|
428
|
+
*
|
|
429
|
+
* | Property | Type | Description |
|
|
430
|
+
* |---|---|---|
|
|
431
|
+
* | `material` | {@linkcode MaterialHandle} | The whole-object material — chain into `apply` / `getInfo` |
|
|
432
|
+
* | `id` | `string` | Engine material id |
|
|
433
|
+
* | `name` | `string` | Material name (== the handle token) |
|
|
434
|
+
* | `source` | `"default" \| "applied"` | Whether it is the component's type default or an explicitly-applied finish |
|
|
435
|
+
*/
|
|
436
|
+
export declare const PluginComponentMaterial: z.ZodObject<{
|
|
437
|
+
material: z.ZodPipe<z.ZodString, z.ZodTransform<MaterialHandle, string>>;
|
|
438
|
+
id: z.ZodString;
|
|
439
|
+
name: z.ZodString;
|
|
440
|
+
source: z.ZodEnum<{
|
|
441
|
+
default: "default";
|
|
442
|
+
applied: "applied";
|
|
443
|
+
}>;
|
|
444
|
+
}, z.core.$strip>;
|
|
445
|
+
export type PluginComponentMaterial = z.infer<typeof PluginComponentMaterial>;
|
|
446
|
+
/**
|
|
447
|
+
* A preset material library entry (value record — NOT a handle), returned by
|
|
448
|
+
* {@linkcode PluginDesignMaterialsApi.listPresets}.
|
|
449
|
+
*
|
|
450
|
+
* | Property | Type | Description |
|
|
451
|
+
* |---|---|---|
|
|
452
|
+
* | `name` | `string` | Display name of the library entry |
|
|
453
|
+
* | `category` | `string` | Library category (camelCase, e.g. `"wood"`, `"colors"`, `"brick"`) |
|
|
454
|
+
* | `textureUrl` | `string` | Texture/swatch image URL — feed to {@linkcode PluginMaterialSpec}`.textureUrl` |
|
|
455
|
+
*/
|
|
456
|
+
export declare const PluginPresetMaterial: z.ZodObject<{
|
|
457
|
+
name: z.ZodString;
|
|
458
|
+
category: z.ZodString;
|
|
459
|
+
textureUrl: z.ZodString;
|
|
460
|
+
}, z.core.$strip>;
|
|
461
|
+
export type PluginPresetMaterial = z.infer<typeof PluginPresetMaterial>;
|
|
249
462
|
/** Arguments for {@linkcode PluginDesignMaterialsApi.getInfo} / `hasTexture`. */
|
|
250
463
|
export declare const PluginDesignMaterialsGetInfoArgs: z.ZodObject<{
|
|
251
464
|
material: z.ZodPipe<z.ZodString, z.ZodTransform<MaterialHandle, string>>;
|
|
@@ -294,4 +507,45 @@ export declare const PluginDesignMaterialsCreateArgs: z.ZodObject<{
|
|
|
294
507
|
}, z.core.$strip>;
|
|
295
508
|
}, z.core.$strip>;
|
|
296
509
|
export type PluginDesignMaterialsCreateArgs = z.infer<typeof PluginDesignMaterialsCreateArgs>;
|
|
510
|
+
/**
|
|
511
|
+
* Arguments for {@linkcode PluginDesignMaterialsApi.applyToFaces}.
|
|
512
|
+
*
|
|
513
|
+
* | Property | Type | Description |
|
|
514
|
+
* |---|---|---|
|
|
515
|
+
* | `component` | {@linkcode ComponentHandle} | The (BREP) component to paint |
|
|
516
|
+
* | `faces` | `number[]` | BREP face indices to paint (nonnegative integers) |
|
|
517
|
+
* | `material` | {@linkcode MaterialHandle} \| {@linkcode PluginMaterialSpec} | Material handle, or an inline spec |
|
|
518
|
+
* | `save` | `boolean` | Commit as an undoable command (default `true`) |
|
|
519
|
+
*/
|
|
520
|
+
export declare const PluginDesignMaterialsApplyToFacesArgs: z.ZodObject<{
|
|
521
|
+
component: z.ZodPipe<z.ZodString, z.ZodTransform<ComponentHandle, string>>;
|
|
522
|
+
faces: z.ZodArray<z.ZodNumber>;
|
|
523
|
+
material: z.ZodUnion<readonly [z.ZodPipe<z.ZodString, z.ZodTransform<MaterialHandle, string>>, z.ZodObject<{
|
|
524
|
+
name: z.ZodOptional<z.ZodString>;
|
|
525
|
+
color: z.ZodOptional<z.ZodString>;
|
|
526
|
+
textureUrl: z.ZodOptional<z.ZodString>;
|
|
527
|
+
alpha: z.ZodOptional<z.ZodNumber>;
|
|
528
|
+
materialType: z.ZodOptional<z.ZodString>;
|
|
529
|
+
}, z.core.$strip>]>;
|
|
530
|
+
save: z.ZodOptional<z.ZodBoolean>;
|
|
531
|
+
}, z.core.$strip>;
|
|
532
|
+
export type PluginDesignMaterialsApplyToFacesArgs = z.infer<typeof PluginDesignMaterialsApplyToFacesArgs>;
|
|
533
|
+
/** Arguments for {@linkcode PluginDesignMaterialsApi.resetFaces}. */
|
|
534
|
+
export declare const PluginDesignMaterialsResetFacesArgs: z.ZodObject<{
|
|
535
|
+
component: z.ZodPipe<z.ZodString, z.ZodTransform<ComponentHandle, string>>;
|
|
536
|
+
faces: z.ZodArray<z.ZodNumber>;
|
|
537
|
+
save: z.ZodOptional<z.ZodBoolean>;
|
|
538
|
+
}, z.core.$strip>;
|
|
539
|
+
export type PluginDesignMaterialsResetFacesArgs = z.infer<typeof PluginDesignMaterialsResetFacesArgs>;
|
|
540
|
+
/** Arguments for {@linkcode PluginDesignMaterialsApi.getByFace}. */
|
|
541
|
+
export declare const PluginDesignMaterialsGetByFaceArgs: z.ZodObject<{
|
|
542
|
+
component: z.ZodPipe<z.ZodString, z.ZodTransform<ComponentHandle, string>>;
|
|
543
|
+
face: z.ZodNumber;
|
|
544
|
+
}, z.core.$strip>;
|
|
545
|
+
export type PluginDesignMaterialsGetByFaceArgs = z.infer<typeof PluginDesignMaterialsGetByFaceArgs>;
|
|
546
|
+
/** Arguments for {@linkcode PluginDesignMaterialsApi.listByFace} (component only). */
|
|
547
|
+
export declare const PluginDesignMaterialsListByFaceArgs: z.ZodObject<{
|
|
548
|
+
component: z.ZodPipe<z.ZodString, z.ZodTransform<ComponentHandle, string>>;
|
|
549
|
+
}, z.core.$strip>;
|
|
550
|
+
export type PluginDesignMaterialsListByFaceArgs = z.infer<typeof PluginDesignMaterialsListByFaceArgs>;
|
|
297
551
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/api/design/materials/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAA;AACxB,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAChD,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAElE
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/api/design/materials/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAA;AACxB,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAChD,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAElE;;;;;;;;;;;;;;;;;;;GAmBG;AACH,8BAAsB,wBAAwB;;IAG5C;;;;;;;;;;;;;;;;;;OAkBG;aACa,IAAI,IAAI,eAAe,CAAC,cAAc,EAAE,CAAC;IAEzD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA+BG;aACa,WAAW,IAAI,eAAe,CAAC,oBAAoB,EAAE,CAAC;IAEtE;;;;;;;;;;;;;;;;;;OAkBG;aACa,OAAO,CACrB,QAAQ,EAAE,cAAc,GACvB,eAAe,CAAC,kBAAkB,GAAG,IAAI,CAAC;IAE7C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6BG;aACa,GAAG,CACjB,SAAS,EAAE,eAAe,GACzB,eAAe,CAAC,uBAAuB,GAAG,IAAI,CAAC;IAElD;;;;;;;;;;;;;;;;;;;;;;;OAuBG;aACa,KAAK,CACnB,OAAO,EAAE,eAAe,EAAE,EAC1B,QAAQ,EAAE,cAAc,GAAG,kBAAkB,EAC7C,IAAI,CAAC,EAAE,OAAO,GACb,eAAe,CAAC,oBAAoB,CAAC;IAExC;;;;;;;;;;;;;;;;;;;;OAoBG;aACa,KAAK,CACnB,UAAU,EAAE,eAAe,EAAE,EAC7B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C,CAAC,KAAK,CAClD,OAAO,8BAA8B,CACtC,CAAA;AAED,gEAAgE;AAChE,eAAO,MAAM,8BAA8B;;;iBAGzC,CAAA;AACF,MAAM,MAAM,8BAA8B,GAAG,CAAC,CAAC,KAAK,CAClD,OAAO,8BAA8B,CACtC,CAAA;AAED,iEAAiE;AACjE,eAAO,MAAM,+BAA+B;;;;;;;;iBAE1C,CAAA;AACF,MAAM,MAAM,+BAA+B,GAAG,CAAC,CAAC,KAAK,CACnD,OAAO,+BAA+B,CACvC,CAAA;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,qCAAqC;;;;;;;;;;;iBAKhD,CAAA;AACF,MAAM,MAAM,qCAAqC,GAAG,CAAC,CAAC,KAAK,CACzD,OAAO,qCAAqC,CAC7C,CAAA;AAED,qEAAqE;AACrE,eAAO,MAAM,mCAAmC;;;;iBAI9C,CAAA;AACF,MAAM,MAAM,mCAAmC,GAAG,CAAC,CAAC,KAAK,CACvD,OAAO,mCAAmC,CAC3C,CAAA;AAED,oEAAoE;AACpE,eAAO,MAAM,kCAAkC;;;iBAG7C,CAAA;AACF,MAAM,MAAM,kCAAkC,GAAG,CAAC,CAAC,KAAK,CACtD,OAAO,kCAAkC,CAC1C,CAAA;AAED,sFAAsF;AACtF,eAAO,MAAM,mCAAmC;;iBACZ,CAAA;AACpC,MAAM,MAAM,mCAAmC,GAAG,CAAC,CAAC,KAAK,CACvD,OAAO,mCAAmC,CAC3C,CAAA"}
|
|
@@ -12,6 +12,9 @@ import { ComponentHandle, BrepHandle, ContourHandle, CurveHandle } from "../../.
|
|
|
12
12
|
* {@linkcode ContourHandle} for its footprint outline;
|
|
13
13
|
* {@linkcode PluginDesignQueryGeometryApi.getCenterline} mints a
|
|
14
14
|
* {@linkcode CurveHandle} for a wall's core curve.
|
|
15
|
+
* {@linkcode PluginDesignQueryGeometryApi.getTriangulatedMeshes} is the
|
|
16
|
+
* handle-free exception: it returns the triangulated render meshes as plain
|
|
17
|
+
* world-space arrays.
|
|
15
18
|
*
|
|
16
19
|
* Returned handles are session-ephemeral and go stale on undo/redo/re-topologize
|
|
17
20
|
* — re-fetch a fresh one after edits.
|
|
@@ -103,6 +106,61 @@ export declare abstract class PluginDesignQueryGeometryApi {
|
|
|
103
106
|
* ```
|
|
104
107
|
*/
|
|
105
108
|
abstract getCenterline(component: ComponentHandle): PluginApiReturn<CurveHandle | null>;
|
|
109
|
+
/**
|
|
110
|
+
* Get the **triangulated render meshes** of scene components as plain,
|
|
111
|
+
* serializable arrays — flat world-space vertex `positions` (`[x0, y0, z0,
|
|
112
|
+
* x1, …]`) and triangle `indices` (three per triangle), one record per
|
|
113
|
+
* requested component.
|
|
114
|
+
*
|
|
115
|
+
* Unlike the other `geometry.*` reads this does NOT mint kernel handles — the
|
|
116
|
+
* raw arrays cross the boundary directly, ready for export, custom analysis,
|
|
117
|
+
* or feeding an external renderer. Positions are **always world-space**
|
|
118
|
+
* (instance/transform baked in; there is no local-coordinates mode) in plan
|
|
119
|
+
* units — no conversion needed. Raw doubles, unrounded.
|
|
120
|
+
*
|
|
121
|
+
* With `includeMaterialIds: true` each record also carries `materialIds`: one
|
|
122
|
+
* entry **per triangle** (`indices.length / 3` entries), the material *name*
|
|
123
|
+
* painted on that triangle, or `null` for unpainted/default faces.
|
|
124
|
+
*
|
|
125
|
+
* With `includeFaceIndices: true` each record also carries `faceIds`: one
|
|
126
|
+
* entry **per triangle** (input order), the B-rep face index owning that
|
|
127
|
+
* triangle (same ids as {@linkcode getBrep} faces), or `null` where there is
|
|
128
|
+
* no provenance. Non-B-rep meshes (Revit imports, generic models, furniture)
|
|
129
|
+
* yield all-`null` rather than an error.
|
|
130
|
+
*
|
|
131
|
+
* A resolvable component with no readable mesh geometry yields
|
|
132
|
+
* `{ id, positions: [], indices: [] }` — nothing is silently omitted.
|
|
133
|
+
*
|
|
134
|
+
* The call is capped at **500 000 triangles total**; over the cap it throws a
|
|
135
|
+
* `VALIDATION` error whose message includes the actual total — split the
|
|
136
|
+
* component list into smaller batches and call again.
|
|
137
|
+
*
|
|
138
|
+
* @param components - The scene components to triangulate
|
|
139
|
+
* @param options - `includeMaterialIds` adds the per-triangle material names;
|
|
140
|
+
* `includeFaceIndices` adds the per-triangle B-rep face indices
|
|
141
|
+
* @returns `{ meshes }` — one {@linkcode PluginTriangulatedMesh} per requested
|
|
142
|
+
* component, in input order
|
|
143
|
+
* @throws `HANDLE_INVALID` if any component handle is gone/forged;
|
|
144
|
+
* `VALIDATION` if the combined mesh exceeds 500 000 triangles
|
|
145
|
+
*
|
|
146
|
+
* @examplePrompt Export the selected masses as a triangle mesh
|
|
147
|
+
* @examplePrompt Get the raw vertices and triangles of this wall in world coordinates
|
|
148
|
+
* @examplePrompt Give me the triangulated geometry of every space with its materials
|
|
149
|
+
* @examplePrompt Compute the surface area of this roof from its triangles
|
|
150
|
+
*
|
|
151
|
+
* @example
|
|
152
|
+
* ```ts
|
|
153
|
+
* const spaces = await snaptrude.design.query.listSpaces()
|
|
154
|
+
* const { meshes } = await snaptrude.design.query.geometry.getTriangulatedMeshes(spaces, {
|
|
155
|
+
* includeMaterialIds: true,
|
|
156
|
+
* })
|
|
157
|
+
* for (const mesh of meshes) {
|
|
158
|
+
* const triangleCount = mesh.indices.length / 3
|
|
159
|
+
* console.log(mesh.id, triangleCount, mesh.materialIds?.[0])
|
|
160
|
+
* }
|
|
161
|
+
* ```
|
|
162
|
+
*/
|
|
163
|
+
abstract getTriangulatedMeshes(components: ComponentHandle[], options?: PluginDesignQueryGeometryGetTriangulatedMeshesArgs["options"]): PluginApiReturn<PluginDesignQueryGeometryGetTriangulatedMeshesResult>;
|
|
106
164
|
}
|
|
107
165
|
/**
|
|
108
166
|
* Arguments for {@linkcode PluginDesignQueryGeometryApi.getBrep}.
|
|
@@ -137,4 +195,58 @@ export declare const PluginDesignQueryGeometryGetCenterlineArgs: z.ZodObject<{
|
|
|
137
195
|
component: z.ZodPipe<z.ZodString, z.ZodTransform<ComponentHandle, string>>;
|
|
138
196
|
}, z.core.$strip>;
|
|
139
197
|
export type PluginDesignQueryGeometryGetCenterlineArgs = z.infer<typeof PluginDesignQueryGeometryGetCenterlineArgs>;
|
|
198
|
+
/**
|
|
199
|
+
* One component's triangulated world-space mesh, as plain serializable arrays
|
|
200
|
+
* (no handles).
|
|
201
|
+
*
|
|
202
|
+
* | Property | Type | Description |
|
|
203
|
+
* |---|---|---|
|
|
204
|
+
* | `id` | `string` | The component's id (its {@linkcode ComponentHandle} token) |
|
|
205
|
+
* | `positions` | `number[]` | Flat world-space vertex coordinates `[x0, y0, z0, x1, …]`, plan units, raw doubles |
|
|
206
|
+
* | `indices` | `number[]` | Triangle vertex indices, three per triangle, into `positions / 3` |
|
|
207
|
+
* | `materialIds` | `(string \| null)[]` _(optional)_ | One entry per triangle: the painted material's name, `null` for unpainted/default faces. Present only when requested via `includeMaterialIds` |
|
|
208
|
+
* | `faceIds` | `(number \| null)[]` _(optional)_ | One entry per triangle: the B-rep face index owning it (same ids as {@linkcode PluginDesignQueryGeometryApi.getBrep} faces), `null` where there is no provenance (non-B-rep mesh). Present only when requested via `includeFaceIndices` |
|
|
209
|
+
*/
|
|
210
|
+
export declare const PluginTriangulatedMesh: z.ZodObject<{
|
|
211
|
+
id: z.ZodString;
|
|
212
|
+
positions: z.ZodArray<z.ZodNumber>;
|
|
213
|
+
indices: z.ZodArray<z.ZodNumber>;
|
|
214
|
+
materialIds: z.ZodOptional<z.ZodArray<z.ZodNullable<z.ZodString>>>;
|
|
215
|
+
faceIds: z.ZodOptional<z.ZodArray<z.ZodNullable<z.ZodNumber>>>;
|
|
216
|
+
}, z.core.$strip>;
|
|
217
|
+
export type PluginTriangulatedMesh = z.infer<typeof PluginTriangulatedMesh>;
|
|
218
|
+
/**
|
|
219
|
+
* Arguments for {@linkcode PluginDesignQueryGeometryApi.getTriangulatedMeshes}.
|
|
220
|
+
*
|
|
221
|
+
* | Property | Type | Description |
|
|
222
|
+
* |---|---|---|
|
|
223
|
+
* | `components` | {@linkcode ComponentHandle}`[]` | The scene components to triangulate |
|
|
224
|
+
* | `options.includeMaterialIds` | `boolean` _(optional)_ | Also return the per-triangle material names |
|
|
225
|
+
* | `options.includeFaceIndices` | `boolean` _(optional)_ | Also return the per-triangle B-rep face indices |
|
|
226
|
+
*/
|
|
227
|
+
export declare const PluginDesignQueryGeometryGetTriangulatedMeshesArgs: z.ZodObject<{
|
|
228
|
+
components: z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<ComponentHandle, string>>>;
|
|
229
|
+
options: z.ZodOptional<z.ZodObject<{
|
|
230
|
+
includeMaterialIds: z.ZodOptional<z.ZodBoolean>;
|
|
231
|
+
includeFaceIndices: z.ZodOptional<z.ZodBoolean>;
|
|
232
|
+
}, z.core.$strip>>;
|
|
233
|
+
}, z.core.$strip>;
|
|
234
|
+
export type PluginDesignQueryGeometryGetTriangulatedMeshesArgs = z.infer<typeof PluginDesignQueryGeometryGetTriangulatedMeshesArgs>;
|
|
235
|
+
/**
|
|
236
|
+
* Result of {@linkcode PluginDesignQueryGeometryApi.getTriangulatedMeshes}.
|
|
237
|
+
*
|
|
238
|
+
* | Property | Type | Description |
|
|
239
|
+
* |---|---|---|
|
|
240
|
+
* | `meshes` | {@linkcode PluginTriangulatedMesh}`[]` | One record per requested component, in input order |
|
|
241
|
+
*/
|
|
242
|
+
export declare const PluginDesignQueryGeometryGetTriangulatedMeshesResult: z.ZodObject<{
|
|
243
|
+
meshes: z.ZodArray<z.ZodObject<{
|
|
244
|
+
id: z.ZodString;
|
|
245
|
+
positions: z.ZodArray<z.ZodNumber>;
|
|
246
|
+
indices: z.ZodArray<z.ZodNumber>;
|
|
247
|
+
materialIds: z.ZodOptional<z.ZodArray<z.ZodNullable<z.ZodString>>>;
|
|
248
|
+
faceIds: z.ZodOptional<z.ZodArray<z.ZodNullable<z.ZodNumber>>>;
|
|
249
|
+
}, z.core.$strip>>;
|
|
250
|
+
}, z.core.$strip>;
|
|
251
|
+
export type PluginDesignQueryGeometryGetTriangulatedMeshesResult = z.infer<typeof PluginDesignQueryGeometryGetTriangulatedMeshesResult>;
|
|
140
252
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/api/design/query/geometry/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAA;AACxB,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,EACL,eAAe,EACf,UAAU,EACV,aAAa,EACb,WAAW,EACZ,MAAM,qBAAqB,CAAA;AAE5B
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/api/design/query/geometry/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAA;AACxB,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,EACL,eAAe,EACf,UAAU,EACV,aAAa,EACb,WAAW,EACZ,MAAM,qBAAqB,CAAA;AAE5B;;;;;;;;;;;;;;;;;GAiBG;AACH,8BAAsB,4BAA4B;;IAGhD;;;;;;;;;;;;;;;;;;;;;OAqBG;aACa,OAAO,CACrB,SAAS,EAAE,eAAe,GACzB,eAAe,CAAC,UAAU,GAAG,IAAI,CAAC;IAErC;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;aACa,gBAAgB,CAC9B,SAAS,EAAE,eAAe,GACzB,eAAe,CAAC,aAAa,GAAG,IAAI,CAAC;IAExC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA+BG;aACa,aAAa,CAC3B,SAAS,EAAE,eAAe,GACzB,eAAe,CAAC,WAAW,GAAG,IAAI,CAAC;IAEtC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAqDG;aACa,qBAAqB,CACnC,UAAU,EAAE,eAAe,EAAE,EAC7B,OAAO,CAAC,EAAE,kDAAkD,CAAC,S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