@snaptrude/plugin-core 0.0.0-bimsvg-20260928124803
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 +231 -0
- package/CHANGELOG.md +341 -0
- package/CLAUDE.md +11 -0
- package/api-manifest.json +9120 -0
- 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/buildings.d.ts +427 -0
- package/dist/api/core/buildings.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 +333 -0
- package/dist/api/core/comment/index.d.ts.map +1 -0
- package/dist/api/core/geom/create/index.d.ts +1073 -0
- package/dist/api/core/geom/create/index.d.ts.map +1 -0
- package/dist/api/core/geom/delete/index.d.ts +78 -0
- package/dist/api/core/geom/delete/index.d.ts.map +1 -0
- package/dist/api/core/geom/index.d.ts +33 -0
- package/dist/api/core/geom/index.d.ts.map +1 -0
- 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 +514 -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/handles/index.d.ts +210 -0
- package/dist/api/core/handles/index.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 +97 -0
- package/dist/api/core/index.d.ts.map +1 -0
- 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 +455 -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 +402 -0
- package/dist/api/core/layers.d.ts.map +1 -0
- package/dist/api/core/math/index.d.ts +18 -0
- package/dist/api/core/math/index.d.ts.map +1 -0
- package/dist/api/core/math/quat.d.ts +170 -0
- package/dist/api/core/math/quat.d.ts.map +1 -0
- package/dist/api/core/math/vec3.d.ts +174 -0
- package/dist/api/core/math/vec3.d.ts.map +1 -0
- package/dist/api/core/mode/index.d.ts +111 -0
- package/dist/api/core/mode/index.d.ts.map +1 -0
- package/dist/api/core/project/index.d.ts +466 -0
- package/dist/api/core/project/index.d.ts.map +1 -0
- 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 +860 -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/user.d.ts +44 -0
- package/dist/api/core/user.d.ts.map +1 -0
- package/dist/api/core/zoom/index.d.ts +49 -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/bulk-items.d.ts +185 -0
- package/dist/api/design/create/bulk-items.d.ts.map +1 -0
- package/dist/api/design/create/grids.d.ts +132 -0
- package/dist/api/design/create/grids.d.ts.map +1 -0
- package/dist/api/design/create/index.d.ts +1747 -0
- package/dist/api/design/create/index.d.ts.map +1 -0
- package/dist/api/design/create/opening-fields.d.ts +37 -0
- package/dist/api/design/create/opening-fields.d.ts.map +1 -0
- package/dist/api/design/delete/index.d.ts +70 -0
- package/dist/api/design/delete/index.d.ts.map +1 -0
- package/dist/api/design/dimensions.d.ts +427 -0
- package/dist/api/design/dimensions.d.ts.map +1 -0
- package/dist/api/design/doors/index.d.ts +470 -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/family.d.ts +611 -0
- package/dist/api/design/family.d.ts.map +1 -0
- package/dist/api/design/furniture/index.d.ts +296 -0
- package/dist/api/design/furniture/index.d.ts.map +1 -0
- package/dist/api/design/grids.d.ts +237 -0
- package/dist/api/design/grids.d.ts.map +1 -0
- package/dist/api/design/index.d.ts +260 -0
- package/dist/api/design/index.d.ts.map +1 -0
- package/dist/api/design/lock.d.ts +67 -0
- package/dist/api/design/lock.d.ts.map +1 -0
- package/dist/api/design/materials/index.d.ts +551 -0
- package/dist/api/design/materials/index.d.ts.map +1 -0
- package/dist/api/design/query/geometry/index.d.ts +252 -0
- package/dist/api/design/query/geometry/index.d.ts.map +1 -0
- package/dist/api/design/query/grids.d.ts +287 -0
- package/dist/api/design/query/grids.d.ts.map +1 -0
- package/dist/api/design/query/index.d.ts +1318 -0
- package/dist/api/design/query/index.d.ts.map +1 -0
- 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 +394 -0
- package/dist/api/design/query/spaces.d.ts.map +1 -0
- package/dist/api/design/selection/index.d.ts +282 -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 +249 -0
- package/dist/api/design/transform/index.d.ts.map +1 -0
- 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 +803 -0
- package/dist/api/design/update/index.d.ts.map +1 -0
- 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 +300 -0
- package/dist/api/design/windows/index.d.ts.map +1 -0
- package/dist/api/entity/buildableEnvelope.d.ts +265 -0
- package/dist/api/entity/buildableEnvelope.d.ts.map +1 -0
- package/dist/api/entity/department.d.ts +1 -0
- package/dist/api/entity/department.d.ts.map +1 -0
- package/dist/api/entity/index.d.ts +28 -0
- package/dist/api/entity/index.d.ts.map +1 -0
- package/dist/api/entity/referenceLine.d.ts +210 -0
- package/dist/api/entity/referenceLine.d.ts.map +1 -0
- package/dist/api/entity/space.d.ts +846 -0
- package/dist/api/entity/space.d.ts.map +1 -0
- package/dist/api/entity/story.d.ts +476 -0
- package/dist/api/entity/story.d.ts.map +1 -0
- package/dist/api/index.d.ts +45 -0
- package/dist/api/index.d.ts.map +1 -0
- package/dist/api/presentation/aiInspiration.d.ts +2400 -0
- package/dist/api/presentation/aiInspiration.d.ts.map +1 -0
- package/dist/api/presentation/annotate.d.ts +483 -0
- package/dist/api/presentation/annotate.d.ts.map +1 -0
- package/dist/api/presentation/diagrams.d.ts +184 -0
- package/dist/api/presentation/diagrams.d.ts.map +1 -0
- package/dist/api/presentation/drawings.d.ts +2900 -0
- package/dist/api/presentation/drawings.d.ts.map +1 -0
- package/dist/api/presentation/export.d.ts +126 -0
- package/dist/api/presentation/export.d.ts.map +1 -0
- package/dist/api/presentation/import.d.ts +164 -0
- package/dist/api/presentation/import.d.ts.map +1 -0
- package/dist/api/presentation/index.d.ts +114 -0
- package/dist/api/presentation/index.d.ts.map +1 -0
- package/dist/api/presentation/placedViews.d.ts +1232 -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 +643 -0
- package/dist/api/presentation/sheets.d.ts.map +1 -0
- 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/viewPresets.d.ts +70 -0
- package/dist/api/presentation/viewPresets.d.ts.map +1 -0
- package/dist/api/presentation/views.d.ts +741 -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 +450 -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 +78 -0
- package/dist/api/program/cores.d.ts.map +1 -0
- package/dist/api/program/departments.d.ts +487 -0
- package/dist/api/program/departments.d.ts.map +1 -0
- package/dist/api/program/index.d.ts +71 -0
- package/dist/api/program/index.d.ts.map +1 -0
- package/dist/api/program/labels.d.ts +355 -0
- package/dist/api/program/labels.d.ts.map +1 -0
- package/dist/api/program/layout.d.ts +398 -0
- package/dist/api/program/layout.d.ts.map +1 -0
- package/dist/api/program/metadata.d.ts +328 -0
- package/dist/api/program/metadata.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 +823 -0
- package/dist/api/program/site.d.ts.map +1 -0
- package/dist/api/program/spreadsheet.d.ts +2628 -0
- package/dist/api/program/spreadsheet.d.ts.map +1 -0
- package/dist/api/workspace/index.d.ts +552 -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 +229 -0
- package/dist/handles.d.ts.map +1 -0
- package/dist/host-utils.d.ts +47 -0
- package/dist/host-utils.d.ts.map +1 -0
- package/dist/index.cjs +8836 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +7568 -0
- package/dist/index.js.map +1 -0
- package/dist/types.d.ts +16 -0
- package/dist/types.d.ts.map +1 -0
- package/package.json +41 -0
- package/scripts/generate-manifest.mjs +238 -0
- package/scripts/generate-manifest.test.mjs +292 -0
- 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/buildings.ts +485 -0
- package/src/api/core/camera/index.ts +268 -0
- package/src/api/core/comment/index.ts +376 -0
- package/src/api/core/geom/create/index.ts +1204 -0
- package/src/api/core/geom/delete/index.ts +84 -0
- package/src/api/core/geom/index.ts +35 -0
- package/src/api/core/geom/query/arc.ts +169 -0
- package/src/api/core/geom/query/brep.ts +563 -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/handles/index.ts +233 -0
- package/src/api/core/history/index.ts +84 -0
- package/src/api/core/index.ts +99 -0
- package/src/api/core/io/export/index.ts +126 -0
- package/src/api/core/io/import/index.ts +504 -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/layers.ts +333 -0
- package/src/api/core/math/index.ts +20 -0
- package/src/api/core/math/quat.ts +172 -0
- package/src/api/core/math/vec3.ts +179 -0
- package/src/api/core/mode/index.ts +108 -0
- package/src/api/core/project/index.ts +479 -0
- package/src/api/core/proposals/index.ts +569 -0
- package/src/api/core/storeys/index.ts +294 -0
- package/src/api/core/tags.ts +911 -0
- package/src/api/core/units/index.ts +164 -0
- package/src/api/core/user.ts +46 -0
- package/src/api/core/zoom/index.ts +51 -0
- package/src/api/design/boolean/index.ts +179 -0
- package/src/api/design/create/bulk-items.ts +186 -0
- package/src/api/design/create/grids.ts +137 -0
- package/src/api/design/create/index.ts +1954 -0
- package/src/api/design/create/opening-fields.ts +37 -0
- package/src/api/design/delete/index.ts +74 -0
- package/src/api/design/dimensions.ts +453 -0
- package/src/api/design/doors/index.ts +500 -0
- package/src/api/design/edit/index.ts +54 -0
- package/src/api/design/erase/index.ts +151 -0
- package/src/api/design/family.ts +646 -0
- package/src/api/design/furniture/index.ts +319 -0
- package/src/api/design/grids.ts +237 -0
- package/src/api/design/index.ts +274 -0
- package/src/api/design/lock.ts +69 -0
- package/src/api/design/materials/index.ts +608 -0
- package/src/api/design/query/geometry/index.ts +288 -0
- package/src/api/design/query/grids.ts +197 -0
- package/src/api/design/query/index.ts +1176 -0
- package/src/api/design/query/referenceLines.ts +52 -0
- package/src/api/design/query/spaces.ts +275 -0
- package/src/api/design/selection/index.ts +273 -0
- package/src/api/design/shared.ts +40 -0
- package/src/api/design/transform/index.ts +254 -0
- package/src/api/design/types/index.ts +156 -0
- package/src/api/design/update/index.ts +798 -0
- package/src/api/design/visibility.ts +143 -0
- package/src/api/design/windows/index.ts +333 -0
- package/src/api/entity/buildableEnvelope.ts +322 -0
- package/src/api/entity/department.ts +0 -0
- package/src/api/entity/index.ts +30 -0
- package/src/api/entity/referenceLine.ts +235 -0
- package/src/api/entity/space.ts +612 -0
- package/src/api/entity/story.ts +517 -0
- package/src/api/index.ts +47 -0
- package/src/api/presentation/aiInspiration.ts +1116 -0
- package/src/api/presentation/annotate.ts +417 -0
- package/src/api/presentation/diagrams.ts +194 -0
- package/src/api/presentation/drawings.ts +529 -0
- package/src/api/presentation/export.ts +133 -0
- package/src/api/presentation/import.ts +159 -0
- package/src/api/presentation/index.ts +129 -0
- package/src/api/presentation/placedViews.ts +1203 -0
- package/src/api/presentation/shapes.ts +274 -0
- package/src/api/presentation/sheets.ts +616 -0
- package/src/api/presentation/slideshow.ts +134 -0
- package/src/api/presentation/tables.ts +84 -0
- package/src/api/presentation/viewPresets.ts +83 -0
- package/src/api/presentation/views.ts +698 -0
- package/src/api/program/adjacency.ts +164 -0
- package/src/api/program/areas.ts +408 -0
- package/src/api/program/classification.ts +138 -0
- package/src/api/program/cores.ts +83 -0
- package/src/api/program/departments.ts +517 -0
- package/src/api/program/index.ts +73 -0
- package/src/api/program/labels.ts +332 -0
- package/src/api/program/layout.ts +422 -0
- package/src/api/program/metadata.ts +364 -0
- package/src/api/program/metrics.ts +120 -0
- package/src/api/program/site.ts +748 -0
- package/src/api/program/spreadsheet.ts +2698 -0
- package/src/api/workspace/index.ts +612 -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 +282 -0
- package/src/host-utils.ts +68 -0
- package/src/index.ts +5 -0
- package/src/types.ts +16 -0
- package/test/errors.test.mjs +184 -0
- package/tsconfig.json +22 -0
- package/tsup.config.ts +12 -0
|
@@ -0,0 +1,608 @@
|
|
|
1
|
+
import * as z from "zod"
|
|
2
|
+
import { PluginApiReturn } from "../../../types"
|
|
3
|
+
import { ComponentHandle, MaterialHandle } from "../../../handles"
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* `snaptrude.design.materials` — the project material library + material assignment.
|
|
7
|
+
*
|
|
8
|
+
* Materials are {@linkcode MaterialHandle}s (entity-style, name-addressed). Reads return
|
|
9
|
+
* a {@linkcode MaterialHandle}/{@linkcode PluginMaterialInfo}; `apply`/`reset` mutate the
|
|
10
|
+
* scene (undoable via `save`, default `true`). `create` mints a material from a
|
|
11
|
+
* {@linkcode PluginMaterialSpec} (idempotent by name). `list` reads the materials loaded
|
|
12
|
+
* in the project; `listPresets` reads the browsable preset/library catalog (handle-less
|
|
13
|
+
* {@linkcode PluginPresetMaterial} records that become materials via `create`/`apply`).
|
|
14
|
+
*
|
|
15
|
+
* Per-face assignment — {@linkcode PluginDesignMaterialsApi.applyToFaces} /
|
|
16
|
+
* {@linkcode PluginDesignMaterialsApi.resetFaces} plus per-face reads
|
|
17
|
+
* ({@linkcode PluginDesignMaterialsApi.getByFace} / {@linkcode PluginDesignMaterialsApi.listByFace})
|
|
18
|
+
* — targets **BREP faces by durable face index** and is **BREP-only** (furniture,
|
|
19
|
+
* doors/windows, and Revit imports are rejected) and **visual-only** in v1 (the
|
|
20
|
+
* per-face finish is not carried into BIM schedules / cost layers). A face index
|
|
21
|
+
* is durable only while the component's BREP topology (face count/order) is unchanged.
|
|
22
|
+
*
|
|
23
|
+
* `copy` (needs an undo wrapper) lands in a later pass.
|
|
24
|
+
*/
|
|
25
|
+
export abstract class PluginDesignMaterialsApi {
|
|
26
|
+
constructor() {}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* List the materials loaded in the project — every named material in the live
|
|
30
|
+
* scene (applied finishes, plugin-created materials, and type defaults in use).
|
|
31
|
+
* For the browsable preset/library catalog (finishes not yet in the project),
|
|
32
|
+
* use {@linkcode PluginDesignMaterialsApi.listPresets}.
|
|
33
|
+
*
|
|
34
|
+
* @returns The materials as {@linkcode MaterialHandle}`[]`
|
|
35
|
+
*
|
|
36
|
+
* @examplePrompt List all the materials in this project
|
|
37
|
+
* @examplePrompt What materials do I have available to apply?
|
|
38
|
+
* @examplePrompt Which finishes exist in this model?
|
|
39
|
+
* @examplePrompt Get every material in the project palette
|
|
40
|
+
*
|
|
41
|
+
* # Example
|
|
42
|
+
* ```ts
|
|
43
|
+
* const materials = await snaptrude.design.materials.list()
|
|
44
|
+
* console.log(materials.length, "materials in the project")
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
public abstract list(): PluginApiReturn<MaterialHandle[]>
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* List the preset material library — the catalog the app's material browser
|
|
51
|
+
* shows (the built-in finishes plus the workspace's uploaded materials),
|
|
52
|
+
* fetched from the material library service. Library entries are **not**
|
|
53
|
+
* scene materials and carry no {@linkcode MaterialHandle}; each is a named
|
|
54
|
+
* texture record. To use one, feed it to
|
|
55
|
+
* {@linkcode PluginDesignMaterialsApi.create} /
|
|
56
|
+
* {@linkcode PluginDesignMaterialsApi.apply} as a
|
|
57
|
+
* {@linkcode PluginMaterialSpec}: `{ name, textureUrl, materialType: category }`.
|
|
58
|
+
*
|
|
59
|
+
* @returns The library as {@linkcode PluginPresetMaterial}`[]` (`[]` when the
|
|
60
|
+
* library service is unreachable)
|
|
61
|
+
*
|
|
62
|
+
* @examplePrompt Show me the preset materials library
|
|
63
|
+
* @examplePrompt What wood finishes are available in the material library?
|
|
64
|
+
* @examplePrompt Browse the material catalog and apply a brick texture
|
|
65
|
+
* @examplePrompt Which preset materials can I choose from?
|
|
66
|
+
*
|
|
67
|
+
* # Example
|
|
68
|
+
* ```ts
|
|
69
|
+
* const presets = await snaptrude.design.materials.listPresets()
|
|
70
|
+
* const brick = presets.find((p) => p.category.toLowerCase().includes("brick"))
|
|
71
|
+
* if (brick) {
|
|
72
|
+
* const walls = await snaptrude.design.query.listWalls()
|
|
73
|
+
* await snaptrude.design.materials.apply(walls, {
|
|
74
|
+
* name: brick.name,
|
|
75
|
+
* textureUrl: brick.textureUrl,
|
|
76
|
+
* materialType: brick.category,
|
|
77
|
+
* })
|
|
78
|
+
* }
|
|
79
|
+
* ```
|
|
80
|
+
*/
|
|
81
|
+
public abstract listPresets(): PluginApiReturn<PluginPresetMaterial[]>
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Read a material's descriptor — its name, color, opacity, and texture
|
|
85
|
+
* (when it has one).
|
|
86
|
+
*
|
|
87
|
+
* @param material The material to read
|
|
88
|
+
* @returns The {@linkcode PluginMaterialInfo}, or `null` if the material is gone
|
|
89
|
+
*
|
|
90
|
+
* @examplePrompt What colour is the Brick material?
|
|
91
|
+
* @examplePrompt Show me the details of this material
|
|
92
|
+
* @examplePrompt Get the opacity of the glass finish
|
|
93
|
+
* @examplePrompt Which texture image does the wood material use?
|
|
94
|
+
*
|
|
95
|
+
* # Example
|
|
96
|
+
* ```ts
|
|
97
|
+
* const [material] = await snaptrude.design.materials.list()
|
|
98
|
+
* const info = await snaptrude.design.materials.getInfo(material)
|
|
99
|
+
* if (info) console.log(info.name, info.colorHex, info.alpha)
|
|
100
|
+
* ```
|
|
101
|
+
*/
|
|
102
|
+
public abstract getInfo(
|
|
103
|
+
material: MaterialHandle,
|
|
104
|
+
): PluginApiReturn<PluginMaterialInfo | null>
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Read the material applied to a component **as a whole** — the eyedropper. For a
|
|
108
|
+
* uniformly-painted component this is that single material; for a per-face-painted
|
|
109
|
+
* component it is the material on the component's base/first face. Use
|
|
110
|
+
* {@linkcode PluginDesignMaterialsApi.getByFace} /
|
|
111
|
+
* {@linkcode PluginDesignMaterialsApi.listByFace} for the per-face breakdown.
|
|
112
|
+
*
|
|
113
|
+
* @param component The component to sample
|
|
114
|
+
* @returns The whole-object material as a {@linkcode PluginComponentMaterial} — its
|
|
115
|
+
* handle (chain it into `apply` / `getInfo`), engine id, name, and whether the
|
|
116
|
+
* component carries its type `default` or an explicitly `applied` finish — or `null`
|
|
117
|
+
* if the component carries no material
|
|
118
|
+
*
|
|
119
|
+
* @examplePrompt What material is on this wall?
|
|
120
|
+
* @examplePrompt Eyedrop the finish of the selected object
|
|
121
|
+
* @examplePrompt Which material does this slab use?
|
|
122
|
+
* @examplePrompt Read the material on this column so I can paint others with it
|
|
123
|
+
* @examplePrompt Is this component painted, and with what?
|
|
124
|
+
*
|
|
125
|
+
* # Example
|
|
126
|
+
* ```ts
|
|
127
|
+
* const [component] = await snaptrude.design.selection.get()
|
|
128
|
+
* const sampled = await snaptrude.design.materials.get(component)
|
|
129
|
+
* if (sampled) {
|
|
130
|
+
* console.log(sampled.name, sampled.source) // e.g. "Brick Red" "applied"
|
|
131
|
+
* const info = await snaptrude.design.materials.getInfo(sampled.material)
|
|
132
|
+
* console.log(info?.colorHex)
|
|
133
|
+
* }
|
|
134
|
+
* ```
|
|
135
|
+
*/
|
|
136
|
+
public abstract get(
|
|
137
|
+
component: ComponentHandle,
|
|
138
|
+
): PluginApiReturn<PluginComponentMaterial | null>
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Apply a material to one or more components — an existing project material by
|
|
142
|
+
* handle, or a new one described inline as a {@linkcode PluginMaterialSpec}.
|
|
143
|
+
* Undoable when `save` is true (the default).
|
|
144
|
+
*
|
|
145
|
+
* @param targets Components to paint
|
|
146
|
+
* @param material Material handle, or an inline {@linkcode PluginMaterialSpec}
|
|
147
|
+
* @param save Commit as an undoable command (default `true`)
|
|
148
|
+
* @returns The number of targets the material was applied to
|
|
149
|
+
*
|
|
150
|
+
* @examplePrompt Paint the selected walls red
|
|
151
|
+
* @examplePrompt Apply the brick material to these walls
|
|
152
|
+
* @examplePrompt Put a wood finish on the floor
|
|
153
|
+
* @examplePrompt Change the colour of this room's walls to #ff8800
|
|
154
|
+
* @examplePrompt Add a concrete texture to the facade
|
|
155
|
+
*
|
|
156
|
+
* # Example
|
|
157
|
+
* ```ts
|
|
158
|
+
* const walls = await snaptrude.design.query.listWalls({ storeys: [1] })
|
|
159
|
+
* // inline spec — creates (or reuses by name) a project material, then applies it
|
|
160
|
+
* const { count } = await snaptrude.design.materials.apply(walls, { name: "Accent Red", color: "#b04a3a" })
|
|
161
|
+
* console.log("painted", count, "walls")
|
|
162
|
+
* ```
|
|
163
|
+
*/
|
|
164
|
+
public abstract apply(
|
|
165
|
+
targets: ComponentHandle[],
|
|
166
|
+
material: MaterialHandle | PluginMaterialSpec,
|
|
167
|
+
save?: boolean,
|
|
168
|
+
): PluginApiReturn<PluginMaterialResult>
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* Reset one or more components back to the default material for their type,
|
|
172
|
+
* removing any applied finish. The inverse of `apply`; undoable when `save`
|
|
173
|
+
* is true (the default).
|
|
174
|
+
*
|
|
175
|
+
* @param components Components to reset
|
|
176
|
+
* @param save Commit as an undoable command (default `true`)
|
|
177
|
+
* @returns The number of components reset
|
|
178
|
+
*
|
|
179
|
+
* @examplePrompt Remove the paint from these walls
|
|
180
|
+
* @examplePrompt Reset the selected objects to their default material
|
|
181
|
+
* @examplePrompt Clear the custom finish on the floor
|
|
182
|
+
* @examplePrompt Restore the original colour of this roof
|
|
183
|
+
*
|
|
184
|
+
* # Example
|
|
185
|
+
* ```ts
|
|
186
|
+
* const selected = await snaptrude.design.selection.get()
|
|
187
|
+
* const { count } = await snaptrude.design.materials.reset(selected)
|
|
188
|
+
* console.log("reset", count, "components to their default material")
|
|
189
|
+
* ```
|
|
190
|
+
*/
|
|
191
|
+
public abstract reset(
|
|
192
|
+
components: ComponentHandle[],
|
|
193
|
+
save?: boolean,
|
|
194
|
+
): PluginApiReturn<PluginMaterialResult>
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* Paint specific **BREP faces** of a component with a material — an existing
|
|
198
|
+
* project material by handle, or a new one described inline as a
|
|
199
|
+
* {@linkcode PluginMaterialSpec}. Faces are addressed by **durable BREP face
|
|
200
|
+
* index** (their 0-based position in the component's BREP face list).
|
|
201
|
+
* Undoable when `save` is true (the default).
|
|
202
|
+
*
|
|
203
|
+
* Per-face materials are **BREP-only** (walls, floors, slabs, roofs, masses,
|
|
204
|
+
* columns, beams; furniture, doors/windows, and Revit imports are rejected) and
|
|
205
|
+
* **visual-only in v1** — the finish is not carried into BIM schedules / cost
|
|
206
|
+
* layers. A face index is durable only while the BREP topology (face count/order)
|
|
207
|
+
* is unchanged; a face index at or beyond the face count is rejected.
|
|
208
|
+
*
|
|
209
|
+
* @param component The (BREP) component to paint
|
|
210
|
+
* @param faces BREP face indices to paint (nonnegative integers)
|
|
211
|
+
* @param material Material handle, or an inline {@linkcode PluginMaterialSpec}
|
|
212
|
+
* @param save Commit as an undoable command (default `true`)
|
|
213
|
+
* @returns The number of faces painted
|
|
214
|
+
*
|
|
215
|
+
* @examplePrompt Paint the top face of this slab red
|
|
216
|
+
* @examplePrompt Apply the brick material to faces 0 and 2 of this wall
|
|
217
|
+
* @examplePrompt Put a wood finish on just the front face of this column
|
|
218
|
+
* @examplePrompt Colour face 4 of the selected mass with #ff8800
|
|
219
|
+
*
|
|
220
|
+
* # Example
|
|
221
|
+
* ```ts
|
|
222
|
+
* const [wall] = await snaptrude.design.query.listWalls({ storeys: [1] })
|
|
223
|
+
* // faces are addressed by durable 0-based BREP face index
|
|
224
|
+
* const { count } = await snaptrude.design.materials.applyToFaces(wall, [0, 1], { name: "Accent", color: "#b04a3a" })
|
|
225
|
+
* console.log("painted", count, "faces")
|
|
226
|
+
* ```
|
|
227
|
+
*/
|
|
228
|
+
public abstract applyToFaces(
|
|
229
|
+
component: ComponentHandle,
|
|
230
|
+
faces: number[],
|
|
231
|
+
material: MaterialHandle | PluginMaterialSpec,
|
|
232
|
+
save?: boolean,
|
|
233
|
+
): PluginApiReturn<PluginMaterialResult>
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* Reset specific BREP faces of a component back to the component/type default,
|
|
237
|
+
* removing any per-face finish. The inverse of
|
|
238
|
+
* {@linkcode PluginDesignMaterialsApi.applyToFaces}; undoable when `save` is true
|
|
239
|
+
* (the default). BREP-only (see `applyToFaces`).
|
|
240
|
+
*
|
|
241
|
+
* @param component The (BREP) component
|
|
242
|
+
* @param faces BREP face indices to reset (nonnegative integers)
|
|
243
|
+
* @param save Commit as an undoable command (default `true`)
|
|
244
|
+
* @returns The number of faces reset
|
|
245
|
+
*
|
|
246
|
+
* @examplePrompt Remove the paint from the top face of this slab
|
|
247
|
+
* @examplePrompt Reset faces 0 and 2 of this wall to their default material
|
|
248
|
+
* @examplePrompt Clear the custom finish on the front face of this column
|
|
249
|
+
*
|
|
250
|
+
* # Example
|
|
251
|
+
* ```ts
|
|
252
|
+
* const [wall] = await snaptrude.design.query.listWalls({ storeys: [1] })
|
|
253
|
+
* const { count } = await snaptrude.design.materials.resetFaces(wall, [0, 1])
|
|
254
|
+
* console.log("reset", count, "faces")
|
|
255
|
+
* ```
|
|
256
|
+
*/
|
|
257
|
+
public abstract resetFaces(
|
|
258
|
+
component: ComponentHandle,
|
|
259
|
+
faces: number[],
|
|
260
|
+
save?: boolean,
|
|
261
|
+
): PluginApiReturn<PluginMaterialResult>
|
|
262
|
+
|
|
263
|
+
/**
|
|
264
|
+
* Read the material applied to a single BREP face.
|
|
265
|
+
*
|
|
266
|
+
* @param component The (BREP) component
|
|
267
|
+
* @param face The BREP face index (a nonnegative integer)
|
|
268
|
+
* @returns The face's material as a {@linkcode MaterialHandle}, or `null` if the
|
|
269
|
+
* face carries no explicit per-face material (or the component has no BREP)
|
|
270
|
+
*
|
|
271
|
+
* @examplePrompt What material is on the top face of this slab?
|
|
272
|
+
* @examplePrompt Get the finish applied to face 2 of this wall
|
|
273
|
+
* @examplePrompt Which material is painted on the front face of this column?
|
|
274
|
+
*
|
|
275
|
+
* # Example
|
|
276
|
+
* ```ts
|
|
277
|
+
* const [wall] = await snaptrude.design.query.listWalls()
|
|
278
|
+
* const material = await snaptrude.design.materials.getByFace(wall, 0)
|
|
279
|
+
* if (material) console.log(await snaptrude.design.materials.getInfo(material))
|
|
280
|
+
* ```
|
|
281
|
+
*/
|
|
282
|
+
public abstract getByFace(
|
|
283
|
+
component: ComponentHandle,
|
|
284
|
+
face: number,
|
|
285
|
+
): PluginApiReturn<MaterialHandle | null>
|
|
286
|
+
|
|
287
|
+
/**
|
|
288
|
+
* List the per-face materials of a component — one entry per BREP face, in face
|
|
289
|
+
* index order. A face carrying no explicit per-face material reports `null`.
|
|
290
|
+
*
|
|
291
|
+
* @param component The (BREP) component
|
|
292
|
+
* @returns The per-face materials as {@linkcode PluginFaceMaterial}`[]` (`[]` for a
|
|
293
|
+
* component with no BREP)
|
|
294
|
+
*
|
|
295
|
+
* @examplePrompt List the material on every face of this wall
|
|
296
|
+
* @examplePrompt Show me which faces of this slab are painted and with what
|
|
297
|
+
* @examplePrompt Break down the per-face finishes of the selected mass
|
|
298
|
+
*
|
|
299
|
+
* # Example
|
|
300
|
+
* ```ts
|
|
301
|
+
* const [wall] = await snaptrude.design.query.listWalls()
|
|
302
|
+
* const faces = await snaptrude.design.materials.listByFace(wall)
|
|
303
|
+
* for (const f of faces) console.log(f.faceIndex, f.material ?? "(default)")
|
|
304
|
+
* ```
|
|
305
|
+
*/
|
|
306
|
+
public abstract listByFace(
|
|
307
|
+
component: ComponentHandle,
|
|
308
|
+
): PluginApiReturn<PluginFaceMaterial[]>
|
|
309
|
+
|
|
310
|
+
/**
|
|
311
|
+
* Create a new material in the project from a spec — a color, texture URL,
|
|
312
|
+
* opacity, and/or name. Idempotent by name: creating with the name of an
|
|
313
|
+
* existing material returns that material instead of duplicating it.
|
|
314
|
+
*
|
|
315
|
+
* @param spec The material construction spec
|
|
316
|
+
* @returns The new material as a {@linkcode MaterialHandle}
|
|
317
|
+
*
|
|
318
|
+
* @examplePrompt Create a new red material called Accent
|
|
319
|
+
* @examplePrompt Make a material from this texture image URL
|
|
320
|
+
* @examplePrompt Add a semi-transparent glass material to the project
|
|
321
|
+
* @examplePrompt Define a dark grey concrete finish I can reuse
|
|
322
|
+
*
|
|
323
|
+
* # Example
|
|
324
|
+
* ```ts
|
|
325
|
+
* const glass = await snaptrude.design.materials.create({ name: "Frosted Glass", color: "#cfe4e8", alpha: 0.4 })
|
|
326
|
+
* const walls = await snaptrude.design.query.listWalls({ storeys: [1] })
|
|
327
|
+
* await snaptrude.design.materials.apply(walls, glass)
|
|
328
|
+
* ```
|
|
329
|
+
*/
|
|
330
|
+
public abstract create(
|
|
331
|
+
spec: PluginMaterialSpec,
|
|
332
|
+
): PluginApiReturn<MaterialHandle>
|
|
333
|
+
|
|
334
|
+
/**
|
|
335
|
+
* Get the default material for a component's type.
|
|
336
|
+
* @param component The component to look up
|
|
337
|
+
* @returns The default material as a {@linkcode MaterialHandle}, or `null`
|
|
338
|
+
*
|
|
339
|
+
* @examplePrompt What is the default material for walls?
|
|
340
|
+
* @examplePrompt Get the standard material this floor type uses
|
|
341
|
+
* @examplePrompt Which material would this roof have out of the box?
|
|
342
|
+
* @examplePrompt Find the default finish for the selected column
|
|
343
|
+
*
|
|
344
|
+
* # Example
|
|
345
|
+
* ```ts
|
|
346
|
+
* const [wall] = await snaptrude.design.query.listWalls()
|
|
347
|
+
* const defaultMaterial = await snaptrude.design.materials.getDefault(wall)
|
|
348
|
+
* if (defaultMaterial) console.log(await snaptrude.design.materials.getInfo(defaultMaterial))
|
|
349
|
+
* ```
|
|
350
|
+
*/
|
|
351
|
+
public abstract getDefault(
|
|
352
|
+
component: ComponentHandle,
|
|
353
|
+
): PluginApiReturn<MaterialHandle | null>
|
|
354
|
+
|
|
355
|
+
/**
|
|
356
|
+
* Test whether a component carries its (type) default material.
|
|
357
|
+
* @param component The component to test
|
|
358
|
+
* @returns `true` if default, otherwise `false`
|
|
359
|
+
*
|
|
360
|
+
* @examplePrompt Is this wall still using its default material?
|
|
361
|
+
* @examplePrompt Has the material on this floor been changed?
|
|
362
|
+
* @examplePrompt Check if the selected object still has its original finish
|
|
363
|
+
* @examplePrompt Tell me whether this roof has been painted or is still standard
|
|
364
|
+
*
|
|
365
|
+
* # Example
|
|
366
|
+
* ```ts
|
|
367
|
+
* const [wall] = await snaptrude.design.query.listWalls()
|
|
368
|
+
* const untouched = await snaptrude.design.materials.isDefault(wall)
|
|
369
|
+
* console.log(untouched ? "still default" : "has been painted")
|
|
370
|
+
* ```
|
|
371
|
+
*/
|
|
372
|
+
public abstract isDefault(
|
|
373
|
+
component: ComponentHandle,
|
|
374
|
+
): PluginApiReturn<boolean>
|
|
375
|
+
|
|
376
|
+
/**
|
|
377
|
+
* Test whether a component has a single (uniform) material across all faces.
|
|
378
|
+
* @param component The component to test
|
|
379
|
+
* @returns `true` if uniform, otherwise `false`
|
|
380
|
+
*
|
|
381
|
+
* @examplePrompt Does this wall have the same material on every face?
|
|
382
|
+
* @examplePrompt Is the floor finished uniformly or face by face?
|
|
383
|
+
* @examplePrompt Check if this column is a single material all over
|
|
384
|
+
* @examplePrompt Are any faces of the selected object painted differently?
|
|
385
|
+
*
|
|
386
|
+
* # Example
|
|
387
|
+
* ```ts
|
|
388
|
+
* const [selected] = await snaptrude.design.selection.get()
|
|
389
|
+
* const uniform = await snaptrude.design.materials.isUniform(selected)
|
|
390
|
+
* console.log(uniform ? "one material all over" : "painted per face")
|
|
391
|
+
* ```
|
|
392
|
+
*/
|
|
393
|
+
public abstract isUniform(
|
|
394
|
+
component: ComponentHandle,
|
|
395
|
+
): PluginApiReturn<boolean>
|
|
396
|
+
|
|
397
|
+
/**
|
|
398
|
+
* Test whether a material has a texture.
|
|
399
|
+
* @param material The material to test
|
|
400
|
+
* @returns `true` if it has a diffuse texture, otherwise `false`
|
|
401
|
+
*
|
|
402
|
+
* @examplePrompt Does this material have a texture image?
|
|
403
|
+
* @examplePrompt Is the brick material textured or just a flat colour?
|
|
404
|
+
* @examplePrompt Check whether the wood finish uses an image map
|
|
405
|
+
* @examplePrompt Tell me if this material is image-based or a plain colour
|
|
406
|
+
*
|
|
407
|
+
* # Example
|
|
408
|
+
* ```ts
|
|
409
|
+
* const [material] = await snaptrude.design.materials.list()
|
|
410
|
+
* const textured = await snaptrude.design.materials.hasTexture(material)
|
|
411
|
+
* console.log(textured ? "image-based" : "flat colour")
|
|
412
|
+
* ```
|
|
413
|
+
*/
|
|
414
|
+
public abstract hasTexture(material: MaterialHandle): PluginApiReturn<boolean>
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
/**
|
|
418
|
+
* A material's descriptor.
|
|
419
|
+
*
|
|
420
|
+
* | Property | Type | Description |
|
|
421
|
+
* |---|---|---|
|
|
422
|
+
* | `name` | `string` | Material name (== the handle token) |
|
|
423
|
+
* | `id` | `string` | Engine material id |
|
|
424
|
+
* | `colorHex` | `string` | Diffuse color as `#rrggbb` |
|
|
425
|
+
* | `alpha` | `number` | Opacity `0..1` |
|
|
426
|
+
* | `materialType` | `string` | Material type tag (optional) |
|
|
427
|
+
* | `textureUrl` | `string` | Diffuse texture URL (optional) |
|
|
428
|
+
*/
|
|
429
|
+
export const PluginMaterialInfo = z.object({
|
|
430
|
+
name: z.string(),
|
|
431
|
+
id: z.string(),
|
|
432
|
+
colorHex: z.string(),
|
|
433
|
+
alpha: z.number(),
|
|
434
|
+
materialType: z.string().optional(),
|
|
435
|
+
textureUrl: z.string().optional(),
|
|
436
|
+
})
|
|
437
|
+
export type PluginMaterialInfo = z.infer<typeof PluginMaterialInfo>
|
|
438
|
+
|
|
439
|
+
/**
|
|
440
|
+
* A material construction spec (input DTO — NOT a handle).
|
|
441
|
+
*
|
|
442
|
+
* | Property | Type | Description |
|
|
443
|
+
* |---|---|---|
|
|
444
|
+
* | `name` | `string` | Name (optional; generated if omitted) |
|
|
445
|
+
* | `color` | `string` | Diffuse color `#rrggbb` (optional) |
|
|
446
|
+
* | `textureUrl` | `string` | Diffuse texture URL (optional; wins over color) |
|
|
447
|
+
* | `alpha` | `number` | Opacity `0..1` (optional) |
|
|
448
|
+
* | `materialType` | `string` | Material type tag (optional) |
|
|
449
|
+
*/
|
|
450
|
+
export const PluginMaterialSpec = z.object({
|
|
451
|
+
name: z.string().optional(),
|
|
452
|
+
color: z.string().optional(),
|
|
453
|
+
textureUrl: z.string().optional(),
|
|
454
|
+
alpha: z.number().optional(),
|
|
455
|
+
materialType: z.string().optional(),
|
|
456
|
+
})
|
|
457
|
+
export type PluginMaterialSpec = z.infer<typeof PluginMaterialSpec>
|
|
458
|
+
|
|
459
|
+
/** Result of a material mutation — the count of targets affected. */
|
|
460
|
+
export const PluginMaterialResult = z.object({ count: z.number() })
|
|
461
|
+
export type PluginMaterialResult = z.infer<typeof PluginMaterialResult>
|
|
462
|
+
|
|
463
|
+
/**
|
|
464
|
+
* A single component face's material assignment (value record — not a handle).
|
|
465
|
+
*
|
|
466
|
+
* | Property | Type | Description |
|
|
467
|
+
* |---|---|---|
|
|
468
|
+
* | `faceIndex` | `number` | Durable BREP face index (0-based position in the face list) |
|
|
469
|
+
* | `material` | {@linkcode MaterialHandle} \| `null` | The applied material, or `null` for the default |
|
|
470
|
+
*/
|
|
471
|
+
export const PluginFaceMaterial = z.object({
|
|
472
|
+
faceIndex: z.number().int().nonnegative(),
|
|
473
|
+
material: MaterialHandle.nullable(),
|
|
474
|
+
})
|
|
475
|
+
export type PluginFaceMaterial = z.infer<typeof PluginFaceMaterial>
|
|
476
|
+
|
|
477
|
+
/**
|
|
478
|
+
* The material on a component **as a whole** — the eyedropper read returned by
|
|
479
|
+
* {@linkcode PluginDesignMaterialsApi.get} (value record, plus a reusable handle).
|
|
480
|
+
*
|
|
481
|
+
* | Property | Type | Description |
|
|
482
|
+
* |---|---|---|
|
|
483
|
+
* | `material` | {@linkcode MaterialHandle} | The whole-object material — chain into `apply` / `getInfo` |
|
|
484
|
+
* | `id` | `string` | Engine material id |
|
|
485
|
+
* | `name` | `string` | Material name (== the handle token) |
|
|
486
|
+
* | `source` | `"default" \| "applied"` | Whether it is the component's type default or an explicitly-applied finish |
|
|
487
|
+
*/
|
|
488
|
+
export const PluginComponentMaterial = z.object({
|
|
489
|
+
material: MaterialHandle,
|
|
490
|
+
id: z.string(),
|
|
491
|
+
name: z.string(),
|
|
492
|
+
source: z.enum(["default", "applied"]),
|
|
493
|
+
})
|
|
494
|
+
export type PluginComponentMaterial = z.infer<typeof PluginComponentMaterial>
|
|
495
|
+
|
|
496
|
+
/**
|
|
497
|
+
* A preset material library entry (value record — NOT a handle), returned by
|
|
498
|
+
* {@linkcode PluginDesignMaterialsApi.listPresets}.
|
|
499
|
+
*
|
|
500
|
+
* | Property | Type | Description |
|
|
501
|
+
* |---|---|---|
|
|
502
|
+
* | `name` | `string` | Display name of the library entry |
|
|
503
|
+
* | `category` | `string` | Library category (camelCase, e.g. `"wood"`, `"colors"`, `"brick"`) |
|
|
504
|
+
* | `textureUrl` | `string` | Texture/swatch image URL — feed to {@linkcode PluginMaterialSpec}`.textureUrl` |
|
|
505
|
+
*/
|
|
506
|
+
export const PluginPresetMaterial = z.object({
|
|
507
|
+
name: z.string(),
|
|
508
|
+
category: z.string(),
|
|
509
|
+
textureUrl: z.string(),
|
|
510
|
+
})
|
|
511
|
+
export type PluginPresetMaterial = z.infer<typeof PluginPresetMaterial>
|
|
512
|
+
|
|
513
|
+
/** Arguments for {@linkcode PluginDesignMaterialsApi.getInfo} / `hasTexture`. */
|
|
514
|
+
export const PluginDesignMaterialsGetInfoArgs = z.object({
|
|
515
|
+
material: MaterialHandle,
|
|
516
|
+
})
|
|
517
|
+
export type PluginDesignMaterialsGetInfoArgs = z.infer<
|
|
518
|
+
typeof PluginDesignMaterialsGetInfoArgs
|
|
519
|
+
>
|
|
520
|
+
|
|
521
|
+
/** Arguments for component-scoped predicates (`getDefault`/`isDefault`/`isUniform`). */
|
|
522
|
+
export const PluginDesignMaterialsComponentArgs = z.object({
|
|
523
|
+
component: ComponentHandle,
|
|
524
|
+
})
|
|
525
|
+
export type PluginDesignMaterialsComponentArgs = z.infer<
|
|
526
|
+
typeof PluginDesignMaterialsComponentArgs
|
|
527
|
+
>
|
|
528
|
+
|
|
529
|
+
/**
|
|
530
|
+
* Arguments for {@linkcode PluginDesignMaterialsApi.apply}.
|
|
531
|
+
*
|
|
532
|
+
* | Property | Type | Description |
|
|
533
|
+
* |---|---|---|
|
|
534
|
+
* | `targets` | {@linkcode ComponentHandle}`[]` | Components to paint |
|
|
535
|
+
* | `material` | {@linkcode MaterialHandle} \| {@linkcode PluginMaterialSpec} | Material handle, or an inline spec |
|
|
536
|
+
* | `save` | `boolean` | Commit as an undoable command (default `true`) |
|
|
537
|
+
*/
|
|
538
|
+
export const PluginDesignMaterialsApplyArgs = z.object({
|
|
539
|
+
targets: z.array(ComponentHandle),
|
|
540
|
+
material: z.union([MaterialHandle, PluginMaterialSpec]),
|
|
541
|
+
save: z.boolean().optional(),
|
|
542
|
+
})
|
|
543
|
+
export type PluginDesignMaterialsApplyArgs = z.infer<
|
|
544
|
+
typeof PluginDesignMaterialsApplyArgs
|
|
545
|
+
>
|
|
546
|
+
|
|
547
|
+
/** Arguments for {@linkcode PluginDesignMaterialsApi.reset}. */
|
|
548
|
+
export const PluginDesignMaterialsResetArgs = z.object({
|
|
549
|
+
components: z.array(ComponentHandle),
|
|
550
|
+
save: z.boolean().optional(),
|
|
551
|
+
})
|
|
552
|
+
export type PluginDesignMaterialsResetArgs = z.infer<
|
|
553
|
+
typeof PluginDesignMaterialsResetArgs
|
|
554
|
+
>
|
|
555
|
+
|
|
556
|
+
/** Arguments for {@linkcode PluginDesignMaterialsApi.create}. */
|
|
557
|
+
export const PluginDesignMaterialsCreateArgs = z.object({
|
|
558
|
+
spec: PluginMaterialSpec,
|
|
559
|
+
})
|
|
560
|
+
export type PluginDesignMaterialsCreateArgs = z.infer<
|
|
561
|
+
typeof PluginDesignMaterialsCreateArgs
|
|
562
|
+
>
|
|
563
|
+
|
|
564
|
+
/**
|
|
565
|
+
* Arguments for {@linkcode PluginDesignMaterialsApi.applyToFaces}.
|
|
566
|
+
*
|
|
567
|
+
* | Property | Type | Description |
|
|
568
|
+
* |---|---|---|
|
|
569
|
+
* | `component` | {@linkcode ComponentHandle} | The (BREP) component to paint |
|
|
570
|
+
* | `faces` | `number[]` | BREP face indices to paint (nonnegative integers) |
|
|
571
|
+
* | `material` | {@linkcode MaterialHandle} \| {@linkcode PluginMaterialSpec} | Material handle, or an inline spec |
|
|
572
|
+
* | `save` | `boolean` | Commit as an undoable command (default `true`) |
|
|
573
|
+
*/
|
|
574
|
+
export const PluginDesignMaterialsApplyToFacesArgs = z.object({
|
|
575
|
+
component: ComponentHandle,
|
|
576
|
+
faces: z.array(z.number().int().nonnegative()),
|
|
577
|
+
material: z.union([MaterialHandle, PluginMaterialSpec]),
|
|
578
|
+
save: z.boolean().optional(),
|
|
579
|
+
})
|
|
580
|
+
export type PluginDesignMaterialsApplyToFacesArgs = z.infer<
|
|
581
|
+
typeof PluginDesignMaterialsApplyToFacesArgs
|
|
582
|
+
>
|
|
583
|
+
|
|
584
|
+
/** Arguments for {@linkcode PluginDesignMaterialsApi.resetFaces}. */
|
|
585
|
+
export const PluginDesignMaterialsResetFacesArgs = z.object({
|
|
586
|
+
component: ComponentHandle,
|
|
587
|
+
faces: z.array(z.number().int().nonnegative()),
|
|
588
|
+
save: z.boolean().optional(),
|
|
589
|
+
})
|
|
590
|
+
export type PluginDesignMaterialsResetFacesArgs = z.infer<
|
|
591
|
+
typeof PluginDesignMaterialsResetFacesArgs
|
|
592
|
+
>
|
|
593
|
+
|
|
594
|
+
/** Arguments for {@linkcode PluginDesignMaterialsApi.getByFace}. */
|
|
595
|
+
export const PluginDesignMaterialsGetByFaceArgs = z.object({
|
|
596
|
+
component: ComponentHandle,
|
|
597
|
+
face: z.number().int().nonnegative(),
|
|
598
|
+
})
|
|
599
|
+
export type PluginDesignMaterialsGetByFaceArgs = z.infer<
|
|
600
|
+
typeof PluginDesignMaterialsGetByFaceArgs
|
|
601
|
+
>
|
|
602
|
+
|
|
603
|
+
/** Arguments for {@linkcode PluginDesignMaterialsApi.listByFace} (component only). */
|
|
604
|
+
export const PluginDesignMaterialsListByFaceArgs =
|
|
605
|
+
PluginDesignMaterialsComponentArgs
|
|
606
|
+
export type PluginDesignMaterialsListByFaceArgs = z.infer<
|
|
607
|
+
typeof PluginDesignMaterialsListByFaceArgs
|
|
608
|
+
>
|