@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,319 @@
|
|
|
1
|
+
import * as z from "zod"
|
|
2
|
+
import { PluginApiReturn } from "../../../types"
|
|
3
|
+
import { ComponentHandle } from "../../../handles"
|
|
4
|
+
import { PluginDesignChangeResult } from "../lock"
|
|
5
|
+
import { PluginObjectCatalogGroup } from "../doors"
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* `snaptrude.design.furniture` — the placeable furniture **catalog** (a library of
|
|
9
|
+
* source items, NOT scene entities) plus dimension reads/edits of PLACED furniture.
|
|
10
|
+
* Placement lives at `design.create.furniture` (returns a {@linkcode ComponentHandle});
|
|
11
|
+
* generic reads of placed furniture live at `design.query.listFurniture`/`getProperties`.
|
|
12
|
+
*
|
|
13
|
+
* Catalog items are plain value records ({@linkcode PluginFurnitureCatalogItem}) keyed
|
|
14
|
+
* by a library id (team `_id` or general `fullName`) — not handles. Reads are async
|
|
15
|
+
* (network-backed) but carry no `Async` suffix (§6.6).
|
|
16
|
+
*
|
|
17
|
+
* {@linkcode PluginDesignFurnitureApi.getDimensions} / {@linkcode PluginDesignFurnitureApi.setDimensions}
|
|
18
|
+
* target a PLACED furniture {@linkcode ComponentHandle} (not a catalog id) — `length`
|
|
19
|
+
* along the object, `width` across it, `height` up. Values are engine units, matching
|
|
20
|
+
* the length/width/height fields the furniture properties panel shows.
|
|
21
|
+
*/
|
|
22
|
+
export abstract class PluginDesignFurnitureApi {
|
|
23
|
+
constructor() {}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Get the dimensions of a PLACED furniture item — `length` (along the object),
|
|
27
|
+
* `width` (across it) and `height` (vertical), in engine units. Mirrors the
|
|
28
|
+
* Length/Width/Height fields of the furniture properties panel.
|
|
29
|
+
*
|
|
30
|
+
* @param item The placed furniture to query
|
|
31
|
+
* @returns The dimensions, or `null` if the geometry is degenerate
|
|
32
|
+
*
|
|
33
|
+
* @examplePrompt How big is this sofa?
|
|
34
|
+
* @examplePrompt What are the dimensions of the selected furniture?
|
|
35
|
+
* @examplePrompt Measure the length, width and height of this table
|
|
36
|
+
* @examplePrompt Get the size of the chair I just placed
|
|
37
|
+
*
|
|
38
|
+
* # Example
|
|
39
|
+
* ```ts
|
|
40
|
+
* const [item] = await snaptrude.design.query.listFurniture({ isSelected: true })
|
|
41
|
+
* const dims = await snaptrude.design.furniture.getDimensions(item)
|
|
42
|
+
* if (dims) console.log(dims.length, dims.width, dims.height)
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
public abstract getDimensions(
|
|
46
|
+
item: ComponentHandle
|
|
47
|
+
): PluginApiReturn<PluginFurnitureDimensions | null>
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Resize a PLACED furniture item along one or more axes — `length`, `width`
|
|
51
|
+
* and/or `height` (engine units). Omitted axes are left unchanged. Each supplied
|
|
52
|
+
* axis is an undoable command, mirroring editing the furniture properties panel.
|
|
53
|
+
*
|
|
54
|
+
* @param item The placed furniture to resize
|
|
55
|
+
* @param dimensions New `length` / `width` / `height` (each optional, engine units)
|
|
56
|
+
* @returns The affected furniture
|
|
57
|
+
*
|
|
58
|
+
* @examplePrompt Make this table 1.8m long
|
|
59
|
+
* @examplePrompt Resize the selected sofa to 2000 wide
|
|
60
|
+
* @examplePrompt Set this furniture to 800mm tall
|
|
61
|
+
* @examplePrompt Change the desk to 1500 long and 700 deep
|
|
62
|
+
*
|
|
63
|
+
* # Example
|
|
64
|
+
* ```ts
|
|
65
|
+
* const [item] = await snaptrude.design.query.listFurniture({ isSelected: true })
|
|
66
|
+
* const { affected } = await snaptrude.design.furniture.setDimensions(item, {
|
|
67
|
+
* length: 1800,
|
|
68
|
+
* height: 750
|
|
69
|
+
* })
|
|
70
|
+
* ```
|
|
71
|
+
*/
|
|
72
|
+
public abstract setDimensions(
|
|
73
|
+
item: ComponentHandle,
|
|
74
|
+
dimensions: PluginFurnitureDimensionUpdates
|
|
75
|
+
): PluginApiReturn<PluginDesignChangeResult>
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* List the categories (Living, Bedroom, Kitchen, …) that organize the
|
|
79
|
+
* furniture catalog — the picker taxonomy, merged from built-in categories,
|
|
80
|
+
* team types, and backend user types. Pass a value to
|
|
81
|
+
* {@linkcode PluginDesignFurnitureApi.listCatalog}'s `category` filter.
|
|
82
|
+
* @returns The category names (`[]` when empty)
|
|
83
|
+
*
|
|
84
|
+
* @examplePrompt What furniture categories are available?
|
|
85
|
+
* @examplePrompt List the furniture categories
|
|
86
|
+
* @examplePrompt Show me the furniture groups like living and bedroom
|
|
87
|
+
* @examplePrompt Which furniture categories can I filter by?
|
|
88
|
+
*
|
|
89
|
+
* # Example
|
|
90
|
+
* ```ts
|
|
91
|
+
* const categories = await snaptrude.design.furniture.listCategories()
|
|
92
|
+
* const [first] = categories
|
|
93
|
+
* const items = await snaptrude.design.furniture.listCatalog(undefined, first)
|
|
94
|
+
* console.log(first, "→", items.length, "items")
|
|
95
|
+
* ```
|
|
96
|
+
*
|
|
97
|
+
* @deprecated Use `design.furniture.listCatalogGroups` — the same name
|
|
98
|
+
* `design.doors` and `design.windows` use. Still supported.
|
|
99
|
+
*/
|
|
100
|
+
public abstract listCategories(): PluginApiReturn<string[]>
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* List the furniture catalog's groups. Matches
|
|
104
|
+
* {@linkcode PluginDesignDoorsApi.listCatalogGroups} and
|
|
105
|
+
* {@linkcode PluginDesignWindowsApi.listCatalogGroups}, so all three catalog
|
|
106
|
+
* surfaces are named alike.
|
|
107
|
+
*
|
|
108
|
+
* `source` is `"default"` for the built-in picker groups and `"team"` for the
|
|
109
|
+
* sub-types of THIS project's team library — exactly the split
|
|
110
|
+
* {@linkcode PluginDesignFurnitureApi.listCatalog}'s `source` filter uses, so
|
|
111
|
+
* every `"team"` group is guaranteed to match at least one team item here.
|
|
112
|
+
* For furniture the group token and its label are the same string (the
|
|
113
|
+
* category), so `dbType === label`; `design.doors`/`design.windows` have a
|
|
114
|
+
* distinct engine `dbType`.
|
|
115
|
+
*
|
|
116
|
+
* @returns The catalog groups as {@linkcode PluginObjectCatalogGroup}`[]`
|
|
117
|
+
* (`[]` when empty). Pass a group's `dbType` (=== `label`) to
|
|
118
|
+
* {@linkcode PluginDesignFurnitureApi.listCatalog}'s `category` filter to
|
|
119
|
+
* list its items.
|
|
120
|
+
*
|
|
121
|
+
* @examplePrompt What furniture groups are available?
|
|
122
|
+
* @examplePrompt List the furniture categories in this project
|
|
123
|
+
*
|
|
124
|
+
* # Example
|
|
125
|
+
* ```ts
|
|
126
|
+
* const groups = await snaptrude.design.furniture.listCatalogGroups()
|
|
127
|
+
* for (const g of groups) console.log(g.dbType, g.label, g.source)
|
|
128
|
+
* ```
|
|
129
|
+
*/
|
|
130
|
+
public abstract listCatalogGroups(): PluginApiReturn<PluginObjectCatalogGroup[]>
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* List the placeable furniture catalog (team + general libraries),
|
|
134
|
+
* optionally filtered by library `source` and/or `category`.
|
|
135
|
+
* @param source Restrict to one library (optional)
|
|
136
|
+
* @param category Restrict to one category (optional; see {@linkcode PluginDesignFurnitureApi.listCategories})
|
|
137
|
+
* @returns The catalog as {@linkcode PluginFurnitureCatalogItem}`[]` (`[]` when empty)
|
|
138
|
+
*
|
|
139
|
+
* @examplePrompt What furniture can I place in this project?
|
|
140
|
+
* @examplePrompt Show me all the furniture available in the library
|
|
141
|
+
* @examplePrompt List the chairs and tables I can add to the model
|
|
142
|
+
* @examplePrompt Which furniture items are in my team's library?
|
|
143
|
+
* @examplePrompt Show me the bedroom furniture I can place
|
|
144
|
+
*
|
|
145
|
+
* # Example
|
|
146
|
+
* ```ts
|
|
147
|
+
* const bedroom = await snaptrude.design.furniture.listCatalog("team", "bedroom")
|
|
148
|
+
* for (const item of bedroom) console.log(item.id, item.name, item.thumbnailUrl)
|
|
149
|
+
* ```
|
|
150
|
+
*/
|
|
151
|
+
public abstract listCatalog(
|
|
152
|
+
source?: "team" | "general",
|
|
153
|
+
category?: string
|
|
154
|
+
): PluginApiReturn<PluginFurnitureCatalogItem[]>
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Get a single catalog item by its library id.
|
|
158
|
+
* @param id The catalog library id
|
|
159
|
+
* @returns The item, or `null` if no catalog item matches
|
|
160
|
+
*
|
|
161
|
+
* @examplePrompt Get the details of this furniture item from the library
|
|
162
|
+
* @examplePrompt Look up the catalog entry for this chair id
|
|
163
|
+
* @examplePrompt What is the cost of this furniture item?
|
|
164
|
+
* @examplePrompt Show me the family name of the sofa in the catalog
|
|
165
|
+
*
|
|
166
|
+
* # Example
|
|
167
|
+
* ```ts
|
|
168
|
+
* const [entry] = await snaptrude.design.furniture.listCatalog()
|
|
169
|
+
* const item = await snaptrude.design.furniture.getCatalogItem(entry.id)
|
|
170
|
+
* if (item) console.log(item.name, item.source, item.familyName)
|
|
171
|
+
* ```
|
|
172
|
+
*/
|
|
173
|
+
public abstract getCatalogItem(
|
|
174
|
+
id: string
|
|
175
|
+
): PluginApiReturn<PluginFurnitureCatalogItem | null>
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* Test whether a catalog item exists for the given library id.
|
|
179
|
+
* @param id The catalog library id
|
|
180
|
+
* @returns `true` if it exists, otherwise `false`
|
|
181
|
+
*
|
|
182
|
+
* @examplePrompt Is this furniture item still in the library?
|
|
183
|
+
* @examplePrompt Check whether a catalog item with this id exists
|
|
184
|
+
* @examplePrompt Does my team library have this chair?
|
|
185
|
+
* @examplePrompt Verify the sofa is available in the catalog before placing it
|
|
186
|
+
*
|
|
187
|
+
* # Example
|
|
188
|
+
* ```ts
|
|
189
|
+
* const [entry] = await snaptrude.design.furniture.listCatalog()
|
|
190
|
+
* const stillAvailable = await snaptrude.design.furniture.exists(entry.id)
|
|
191
|
+
* console.log(stillAvailable ? "safe to place" : "removed from library")
|
|
192
|
+
* ```
|
|
193
|
+
*/
|
|
194
|
+
public abstract exists(id: string): PluginApiReturn<boolean>
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* A placeable furniture catalog item (value record — not a scene entity/handle).
|
|
199
|
+
*
|
|
200
|
+
* | Property | Type | Description |
|
|
201
|
+
* |---|---|---|
|
|
202
|
+
* | `id` | `string` | Library id (team `_id` or general `fullName`) — pass to `design.create.furniture` |
|
|
203
|
+
* | `name` | `string` | Display name |
|
|
204
|
+
* | `source` | `'team' \| 'general'` | Which library it came from |
|
|
205
|
+
* | `subType` | `string` | Sub-type (optional) |
|
|
206
|
+
* | `category` | `string` | Category the item belongs to (optional) |
|
|
207
|
+
* | `thumbnailUrl` | `string` | Preview thumbnail URL (optional; never the mesh URL) |
|
|
208
|
+
* | `cost` | `number` | Cost (optional; team items) |
|
|
209
|
+
* | `familyName` | `string` | Family name (optional) |
|
|
210
|
+
*/
|
|
211
|
+
export const PluginFurnitureCatalogItem = z.object({
|
|
212
|
+
id: z.string(),
|
|
213
|
+
name: z.string(),
|
|
214
|
+
source: z.enum(["team", "general"]),
|
|
215
|
+
subType: z.string().optional(),
|
|
216
|
+
category: z.string().optional(),
|
|
217
|
+
thumbnailUrl: z.string().optional(),
|
|
218
|
+
cost: z.number().optional(),
|
|
219
|
+
familyName: z.string().optional(),
|
|
220
|
+
})
|
|
221
|
+
export type PluginFurnitureCatalogItem = z.infer<typeof PluginFurnitureCatalogItem>
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* Arguments for {@linkcode PluginDesignFurnitureApi.listCatalog}.
|
|
225
|
+
*
|
|
226
|
+
* | Property | Type | Description |
|
|
227
|
+
* |---|---|---|
|
|
228
|
+
* | `source` | `'team' \| 'general'` | Restrict to one library (optional) |
|
|
229
|
+
* | `category` | `string` | Restrict to one category (optional) |
|
|
230
|
+
*/
|
|
231
|
+
export const PluginDesignFurnitureListCatalogArgs = z.object({
|
|
232
|
+
source: z.enum(["team", "general"]).optional(),
|
|
233
|
+
category: z.string().optional(),
|
|
234
|
+
})
|
|
235
|
+
export type PluginDesignFurnitureListCatalogArgs = z.infer<
|
|
236
|
+
typeof PluginDesignFurnitureListCatalogArgs
|
|
237
|
+
>
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* Arguments for {@linkcode PluginDesignFurnitureApi.getCatalogItem} / {@linkcode PluginDesignFurnitureApi.exists}.
|
|
241
|
+
*
|
|
242
|
+
* | Property | Type | Description |
|
|
243
|
+
* |---|---|---|
|
|
244
|
+
* | `id` | `string` | The catalog library id |
|
|
245
|
+
*/
|
|
246
|
+
export const PluginDesignFurnitureGetCatalogItemArgs = z.object({
|
|
247
|
+
id: z.string(),
|
|
248
|
+
})
|
|
249
|
+
export type PluginDesignFurnitureGetCatalogItemArgs = z.infer<
|
|
250
|
+
typeof PluginDesignFurnitureGetCatalogItemArgs
|
|
251
|
+
>
|
|
252
|
+
|
|
253
|
+
export const PluginDesignFurnitureExistsArgs = PluginDesignFurnitureGetCatalogItemArgs
|
|
254
|
+
export type PluginDesignFurnitureExistsArgs = z.infer<typeof PluginDesignFurnitureExistsArgs>
|
|
255
|
+
|
|
256
|
+
// ---------------------------------------------------------------------------
|
|
257
|
+
// placed-furniture dimensions
|
|
258
|
+
// ---------------------------------------------------------------------------
|
|
259
|
+
|
|
260
|
+
/**
|
|
261
|
+
* A placed furniture item's dimensions (engine units).
|
|
262
|
+
*
|
|
263
|
+
* | Property | Type | Description |
|
|
264
|
+
* |---|---|---|
|
|
265
|
+
* | `length` | `number` | Along the object (panel "Length") |
|
|
266
|
+
* | `width` | `number` | Across the object (panel "Width") |
|
|
267
|
+
* | `height` | `number` | Vertical (panel "Height") |
|
|
268
|
+
*/
|
|
269
|
+
export const PluginFurnitureDimensions = z.object({
|
|
270
|
+
length: z.number(),
|
|
271
|
+
width: z.number(),
|
|
272
|
+
height: z.number(),
|
|
273
|
+
})
|
|
274
|
+
export type PluginFurnitureDimensions = z.infer<typeof PluginFurnitureDimensions>
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* Arguments for {@linkcode PluginDesignFurnitureApi.getDimensions}.
|
|
278
|
+
*
|
|
279
|
+
* | Property | Type | Description |
|
|
280
|
+
* |---|---|---|
|
|
281
|
+
* | `item` | {@linkcode ComponentHandle} | The placed furniture to query |
|
|
282
|
+
*/
|
|
283
|
+
export const PluginDesignFurnitureItemArgs = z.object({
|
|
284
|
+
item: ComponentHandle,
|
|
285
|
+
})
|
|
286
|
+
export type PluginDesignFurnitureItemArgs = z.infer<typeof PluginDesignFurnitureItemArgs>
|
|
287
|
+
|
|
288
|
+
/**
|
|
289
|
+
* A partial dimension patch — each axis is optional; omitted axes are unchanged.
|
|
290
|
+
* Every supplied axis must be a positive engine-unit length.
|
|
291
|
+
*
|
|
292
|
+
* | Property | Type | Description |
|
|
293
|
+
* |---|---|---|
|
|
294
|
+
* | `length` | `number`? | New length along the object (engine units, > 0) |
|
|
295
|
+
* | `width` | `number`? | New width across the object (engine units, > 0) |
|
|
296
|
+
* | `height` | `number`? | New height (engine units, > 0) |
|
|
297
|
+
*/
|
|
298
|
+
export const PluginFurnitureDimensionUpdates = z.object({
|
|
299
|
+
length: z.number().positive().optional(),
|
|
300
|
+
width: z.number().positive().optional(),
|
|
301
|
+
height: z.number().positive().optional(),
|
|
302
|
+
})
|
|
303
|
+
export type PluginFurnitureDimensionUpdates = z.infer<typeof PluginFurnitureDimensionUpdates>
|
|
304
|
+
|
|
305
|
+
/**
|
|
306
|
+
* Arguments for {@linkcode PluginDesignFurnitureApi.setDimensions}.
|
|
307
|
+
*
|
|
308
|
+
* | Property | Type | Description |
|
|
309
|
+
* |---|---|---|
|
|
310
|
+
* | `item` | {@linkcode ComponentHandle} | The placed furniture to resize |
|
|
311
|
+
* | `dimensions` | {@linkcode PluginFurnitureDimensionUpdates} | The axes to change (each optional) |
|
|
312
|
+
*/
|
|
313
|
+
export const PluginDesignFurnitureSetDimensionsArgs = z.object({
|
|
314
|
+
item: ComponentHandle,
|
|
315
|
+
dimensions: PluginFurnitureDimensionUpdates,
|
|
316
|
+
})
|
|
317
|
+
export type PluginDesignFurnitureSetDimensionsArgs = z.infer<
|
|
318
|
+
typeof PluginDesignFurnitureSetDimensionsArgs
|
|
319
|
+
>
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
import * as z from "zod"
|
|
2
|
+
import { PluginApiReturn } from "../../types"
|
|
3
|
+
import { ComponentHandle } from "../../handles"
|
|
4
|
+
import { PluginGridStyleOptions } from "./create/grids"
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Tag policy for structural line removal (mirrors the engine
|
|
8
|
+
* `GridLineTagPolicy` values verbatim): `"rewrite"` renumbers each affected
|
|
9
|
+
* wing's tag sequence after removal; `"preserve"` keeps the surviving lines'
|
|
10
|
+
* tags unchanged.
|
|
11
|
+
*/
|
|
12
|
+
export const PluginGridLineTagPolicy = z.enum(["rewrite", "preserve"])
|
|
13
|
+
export type PluginGridLineTagPolicy = z.infer<typeof PluginGridLineTagPolicy>
|
|
14
|
+
|
|
15
|
+
/** A positional grid-line address — indices into `design.query.grids.get`'s `wings` arrays. */
|
|
16
|
+
export const PluginGridLineAddress = z.object({
|
|
17
|
+
wing: z.number().int().nonnegative(),
|
|
18
|
+
line: z.number().int().nonnegative(),
|
|
19
|
+
})
|
|
20
|
+
export type PluginGridLineAddress = z.infer<typeof PluginGridLineAddress>
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* One per-wing entry of {@linkcode PluginDesignGridsApi.updateWings} —
|
|
24
|
+
* addressed by wing index. `spanMin`/`spanMax` move the family's length
|
|
25
|
+
* handles (Snaptrude units).
|
|
26
|
+
*/
|
|
27
|
+
export const PluginGridWingEntry = z.object({
|
|
28
|
+
wing: z.number().int().nonnegative(),
|
|
29
|
+
spacing: z.number().positive().finite().optional(),
|
|
30
|
+
count: z.number().int().min(1).optional(),
|
|
31
|
+
spanMin: z.number().finite().optional(),
|
|
32
|
+
spanMax: z.number().finite().optional(),
|
|
33
|
+
})
|
|
34
|
+
export type PluginGridWingEntry = z.infer<typeof PluginGridWingEntry>
|
|
35
|
+
|
|
36
|
+
/** Arguments for {@linkcode PluginDesignGridsApi.updateWings}. */
|
|
37
|
+
export const PluginDesignGridsUpdateWingsArgs = z.object({
|
|
38
|
+
grid: ComponentHandle,
|
|
39
|
+
wings: z.array(PluginGridWingEntry).min(1),
|
|
40
|
+
})
|
|
41
|
+
export type PluginDesignGridsUpdateWingsArgs = z.infer<
|
|
42
|
+
typeof PluginDesignGridsUpdateWingsArgs
|
|
43
|
+
>
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* One per-line entry of {@linkcode PluginDesignGridsApi.updateLines} —
|
|
47
|
+
* addressed positionally by `{ wing, line }` indices (invalidated by
|
|
48
|
+
* structural edits; re-query after mutating). `distanceToPrevious` /
|
|
49
|
+
* `distanceToNext` set the typed distance to the adjacent line on that side
|
|
50
|
+
* and are mutually exclusive.
|
|
51
|
+
*
|
|
52
|
+
* `visible` is **hide-only** (`false`), mirroring the product: per-line show
|
|
53
|
+
* does not exist — showing the GROUP (`design.visibility.show`) restores all
|
|
54
|
+
* of its lines, exactly like the native Show All.
|
|
55
|
+
*/
|
|
56
|
+
export const PluginGridLineEntry = z
|
|
57
|
+
.object({
|
|
58
|
+
wing: z.number().int().nonnegative(),
|
|
59
|
+
line: z.number().int().nonnegative(),
|
|
60
|
+
tag: z.string().min(1).optional(),
|
|
61
|
+
distanceToPrevious: z.number().positive().finite().optional(),
|
|
62
|
+
distanceToNext: z.number().positive().finite().optional(),
|
|
63
|
+
props: PluginGridStyleOptions.optional(),
|
|
64
|
+
visible: z.literal(false).optional(),
|
|
65
|
+
})
|
|
66
|
+
.superRefine((entry, ctx) => {
|
|
67
|
+
if (entry.distanceToPrevious !== undefined && entry.distanceToNext !== undefined) {
|
|
68
|
+
ctx.addIssue({
|
|
69
|
+
code: z.ZodIssueCode.custom,
|
|
70
|
+
message:
|
|
71
|
+
"distanceToPrevious and distanceToNext are mutually exclusive on one line entry",
|
|
72
|
+
})
|
|
73
|
+
}
|
|
74
|
+
})
|
|
75
|
+
export type PluginGridLineEntry = z.infer<typeof PluginGridLineEntry>
|
|
76
|
+
|
|
77
|
+
/** Arguments for {@linkcode PluginDesignGridsApi.updateLines}. */
|
|
78
|
+
export const PluginDesignGridsUpdateLinesArgs = z.object({
|
|
79
|
+
grid: ComponentHandle,
|
|
80
|
+
lines: z.array(PluginGridLineEntry).min(1),
|
|
81
|
+
})
|
|
82
|
+
export type PluginDesignGridsUpdateLinesArgs = z.infer<
|
|
83
|
+
typeof PluginDesignGridsUpdateLinesArgs
|
|
84
|
+
>
|
|
85
|
+
|
|
86
|
+
/** Arguments for {@linkcode PluginDesignGridsApi.addLine}. */
|
|
87
|
+
export const PluginDesignGridsAddLineArgs = z.object({
|
|
88
|
+
grid: ComponentHandle,
|
|
89
|
+
wing: z.number().int().nonnegative(),
|
|
90
|
+
position: z.number().finite(),
|
|
91
|
+
})
|
|
92
|
+
export type PluginDesignGridsAddLineArgs = z.infer<typeof PluginDesignGridsAddLineArgs>
|
|
93
|
+
|
|
94
|
+
/** Arguments for {@linkcode PluginDesignGridsApi.removeLines}. */
|
|
95
|
+
export const PluginDesignGridsRemoveLinesArgs = z.object({
|
|
96
|
+
grid: ComponentHandle,
|
|
97
|
+
lines: z.array(PluginGridLineAddress).min(1),
|
|
98
|
+
tagPolicy: PluginGridLineTagPolicy.optional(),
|
|
99
|
+
})
|
|
100
|
+
export type PluginDesignGridsRemoveLinesArgs = z.infer<
|
|
101
|
+
typeof PluginDesignGridsRemoveLinesArgs
|
|
102
|
+
>
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* `design.grids.*` — structural edits on a grid's line structure (the
|
|
106
|
+
* entity-family home for grid-specific operations, like `design.doors`).
|
|
107
|
+
*
|
|
108
|
+
* Lines are addressed positionally as `{ wing, line }` index pairs into the
|
|
109
|
+
* `wings` arrays returned by `design.query.grids.get`. Adding, removing, or
|
|
110
|
+
* re-counting lines re-indexes the wing — re-query after every structural edit.
|
|
111
|
+
*
|
|
112
|
+
* Group-level edits (default styling, angle, storey visibility) live on
|
|
113
|
+
* `design.update.grid`; creation lives on `design.create.grid*`.
|
|
114
|
+
*
|
|
115
|
+
* Accessed via `snaptrude.design.grids`.
|
|
116
|
+
*/
|
|
117
|
+
export abstract class PluginDesignGridsApi {
|
|
118
|
+
constructor() {}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Update one or more **wings** of a grid with sparse per-wing entries —
|
|
122
|
+
* `spacing` (uniform re-space), `count` (grow/truncate + tag renumber),
|
|
123
|
+
* `spanMin`/`spanMax` (family length handles). Every change routes through
|
|
124
|
+
* the exact setters the native panel uses — each changed field commits its
|
|
125
|
+
* own undoable command, identical to editing that field in the panel.
|
|
126
|
+
*
|
|
127
|
+
* A `count` change re-indexes the wing's lines — positional `{ wing, line }`
|
|
128
|
+
* addresses held from before the call are stale afterwards; re-query.
|
|
129
|
+
*
|
|
130
|
+
* @param grid - The grid group
|
|
131
|
+
* @param wings - Sparse {@linkcode PluginGridWingEntry} entries (≥ 1)
|
|
132
|
+
* @returns `true` once applied
|
|
133
|
+
*
|
|
134
|
+
* @examplePrompt Change this grid's spacing to 8 metres
|
|
135
|
+
* @examplePrompt Make this grid 10 by 12 lines
|
|
136
|
+
*
|
|
137
|
+
* # Example
|
|
138
|
+
* ```ts
|
|
139
|
+
* await snaptrude.design.grids.updateWings(grid, [{ wing: 0, spacing: 8, count: 10 }])
|
|
140
|
+
* ```
|
|
141
|
+
*/
|
|
142
|
+
public abstract updateWings(
|
|
143
|
+
grid: ComponentHandle,
|
|
144
|
+
wings: PluginGridWingEntry[],
|
|
145
|
+
): PluginApiReturn<boolean>
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Update one or more **lines** of a grid with sparse per-line entries —
|
|
149
|
+
* `tag`, `distanceToPrevious`/`distanceToNext` (typed distance to the
|
|
150
|
+
* neighbour on that side; mutually exclusive), `props` (per-line style
|
|
151
|
+
* overrides), and `visible: false` (hide). Every change routes through the
|
|
152
|
+
* exact setters the native panel uses — each changed field commits its own
|
|
153
|
+
* undoable command, identical to editing that field in the panel.
|
|
154
|
+
*
|
|
155
|
+
* Visibility mirrors the product exactly: `visible` accepts only `false` —
|
|
156
|
+
* per-line show does not exist. Hiding lines that would leave NO visible
|
|
157
|
+
* line hides the whole GROUP instead (the native last-line rule; those line
|
|
158
|
+
* flags stay untouched). To bring hidden lines back, show the group
|
|
159
|
+
* (`design.visibility.show([grid])`) — it restores ALL of its lines, like
|
|
160
|
+
* the native Show All.
|
|
161
|
+
*
|
|
162
|
+
* @param grid - The grid group
|
|
163
|
+
* @param lines - Sparse {@linkcode PluginGridLineEntry} entries (≥ 1)
|
|
164
|
+
* @returns `true` once applied
|
|
165
|
+
*
|
|
166
|
+
* @examplePrompt Rename grid line 2 to "B"
|
|
167
|
+
* @examplePrompt Move this grid line 4 metres from its neighbour
|
|
168
|
+
* @examplePrompt Hide grid line 3 on this grid
|
|
169
|
+
*
|
|
170
|
+
* # Example
|
|
171
|
+
* ```ts
|
|
172
|
+
* await snaptrude.design.grids.updateLines(grid, [
|
|
173
|
+
* { wing: 0, line: 1, tag: "B", distanceToPrevious: 4 },
|
|
174
|
+
* ])
|
|
175
|
+
* ```
|
|
176
|
+
*/
|
|
177
|
+
public abstract updateLines(
|
|
178
|
+
grid: ComponentHandle,
|
|
179
|
+
lines: PluginGridLineEntry[],
|
|
180
|
+
): PluginApiReturn<boolean>
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* Insert a parallel grid line into a wing at an explicit position along the
|
|
184
|
+
* wing's spacing axis (Snaptrude units, wing-local — line 0's position can
|
|
185
|
+
* be read from its curve). Sibling lines do not shift; the wing's tag
|
|
186
|
+
* sequence is renumbered. Undoable.
|
|
187
|
+
*
|
|
188
|
+
* @param grid - The grid group
|
|
189
|
+
* @param wing - Wing index
|
|
190
|
+
* @param position - Position along the wing's spacing axis (Snaptrude units)
|
|
191
|
+
* @returns `true` once inserted
|
|
192
|
+
* @throws `VALIDATION` on a bad wing index or non-finite position
|
|
193
|
+
*
|
|
194
|
+
* @examplePrompt Add a grid line between lines 2 and 3
|
|
195
|
+
* @examplePrompt Insert an extra grid line 4 metres from line A
|
|
196
|
+
*
|
|
197
|
+
* # Example
|
|
198
|
+
* ```ts
|
|
199
|
+
* await snaptrude.design.grids.addLine(grid, 0, 12.5)
|
|
200
|
+
* ```
|
|
201
|
+
*/
|
|
202
|
+
public abstract addLine(
|
|
203
|
+
grid: ComponentHandle,
|
|
204
|
+
wing: number,
|
|
205
|
+
position: number,
|
|
206
|
+
): PluginApiReturn<boolean>
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* Remove grid lines by positional address, as ONE undoable step. With
|
|
210
|
+
* `tagPolicy: "rewrite"` (default) each affected wing renumbers its tag
|
|
211
|
+
* sequence; `"preserve"` keeps surviving tags unchanged. A wing emptied of
|
|
212
|
+
* lines is dropped from the group.
|
|
213
|
+
*
|
|
214
|
+
* Removing EVERY line of the group is rejected — delete the group instead
|
|
215
|
+
* (`design.delete.entities`).
|
|
216
|
+
*
|
|
217
|
+
* @param grid - The grid group
|
|
218
|
+
* @param lines - Positional addresses to remove (see `design.query.grids.get`)
|
|
219
|
+
* @param tagPolicy - `"rewrite"` (default) or `"preserve"`
|
|
220
|
+
* @returns `true` once removed
|
|
221
|
+
* @throws `VALIDATION` on out-of-range addresses; `OPERATION_FAILED` when the
|
|
222
|
+
* removal would delete the group's last line
|
|
223
|
+
*
|
|
224
|
+
* @examplePrompt Delete grid line B
|
|
225
|
+
* @examplePrompt Remove the last two lines of this grid without renumbering
|
|
226
|
+
*
|
|
227
|
+
* # Example
|
|
228
|
+
* ```ts
|
|
229
|
+
* await snaptrude.design.grids.removeLines(grid, [{ wing: 0, line: 2 }], "preserve")
|
|
230
|
+
* ```
|
|
231
|
+
*/
|
|
232
|
+
public abstract removeLines(
|
|
233
|
+
grid: ComponentHandle,
|
|
234
|
+
lines: PluginGridLineAddress[],
|
|
235
|
+
tagPolicy?: PluginGridLineTagPolicy,
|
|
236
|
+
): PluginApiReturn<boolean>
|
|
237
|
+
}
|