@snaptrude/plugin-core 0.9.16 → 0.9.18-networks-20261016.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (215) hide show
  1. package/AGENTS.md +231 -231
  2. package/CHANGELOG.md +408 -402
  3. package/CLAUDE.md +11 -11
  4. package/dist/api/analysis/daylight.d.ts +5 -5
  5. package/dist/api/analysis/solar.d.ts +2 -2
  6. package/dist/api/core/camera/index.d.ts +29 -0
  7. package/dist/api/core/camera/index.d.ts.map +1 -1
  8. package/dist/api/core/geom/create/index.d.ts +7 -1
  9. package/dist/api/core/geom/create/index.d.ts.map +1 -1
  10. package/dist/api/core/geom/update/contour.d.ts +8 -2
  11. package/dist/api/core/geom/update/contour.d.ts.map +1 -1
  12. package/dist/api/core/zoom/index.d.ts +13 -0
  13. package/dist/api/core/zoom/index.d.ts.map +1 -1
  14. package/dist/api/design/bim.d.ts +209 -0
  15. package/dist/api/design/bim.d.ts.map +1 -0
  16. package/dist/api/design/boolean/index.d.ts +2 -0
  17. package/dist/api/design/boolean/index.d.ts.map +1 -1
  18. package/dist/api/design/catalog.d.ts +320 -0
  19. package/dist/api/design/catalog.d.ts.map +1 -0
  20. package/dist/api/design/create/bulk-items.d.ts +65 -25
  21. package/dist/api/design/create/bulk-items.d.ts.map +1 -1
  22. package/dist/api/design/create/index.d.ts +272 -99
  23. package/dist/api/design/create/index.d.ts.map +1 -1
  24. package/dist/api/design/create/opening-fields.d.ts +13 -12
  25. package/dist/api/design/create/opening-fields.d.ts.map +1 -1
  26. package/dist/api/design/delete/index.d.ts +1 -0
  27. package/dist/api/design/delete/index.d.ts.map +1 -1
  28. package/dist/api/design/doors/index.d.ts +18 -24
  29. package/dist/api/design/doors/index.d.ts.map +1 -1
  30. package/dist/api/design/family.d.ts +797 -27
  31. package/dist/api/design/family.d.ts.map +1 -1
  32. package/dist/api/design/index.d.ts +16 -0
  33. package/dist/api/design/index.d.ts.map +1 -1
  34. package/dist/api/design/networks.d.ts +1763 -0
  35. package/dist/api/design/networks.d.ts.map +1 -0
  36. package/dist/api/design/query/index.d.ts +42 -32
  37. package/dist/api/design/query/index.d.ts.map +1 -1
  38. package/dist/api/design/selection/index.d.ts +10 -10
  39. package/dist/api/design/types/index.d.ts +40 -24
  40. package/dist/api/design/types/index.d.ts.map +1 -1
  41. package/dist/api/design/update/index.d.ts +43 -3
  42. package/dist/api/design/update/index.d.ts.map +1 -1
  43. package/dist/api/design/windows/index.d.ts +8 -8
  44. package/dist/api/design/windows/index.d.ts.map +1 -1
  45. package/dist/api/presentation/aiInspiration.d.ts +10 -10
  46. package/dist/api/presentation/annotate.d.ts +38 -22
  47. package/dist/api/presentation/annotate.d.ts.map +1 -1
  48. package/dist/api/presentation/drawingContract.d.ts +32 -0
  49. package/dist/api/presentation/drawingContract.d.ts.map +1 -0
  50. package/dist/api/presentation/drawings.d.ts +3523 -0
  51. package/dist/api/presentation/drawings.d.ts.map +1 -0
  52. package/dist/api/presentation/export.d.ts +23 -5
  53. package/dist/api/presentation/export.d.ts.map +1 -1
  54. package/dist/api/presentation/index.d.ts +41 -12
  55. package/dist/api/presentation/index.d.ts.map +1 -1
  56. package/dist/api/presentation/placedViews.d.ts +106 -6
  57. package/dist/api/presentation/placedViews.d.ts.map +1 -1
  58. package/dist/api/presentation/sections.d.ts +461 -0
  59. package/dist/api/presentation/sections.d.ts.map +1 -0
  60. package/dist/api/presentation/shapes.d.ts +2 -2
  61. package/dist/api/presentation/sheets.d.ts +175 -19
  62. package/dist/api/presentation/sheets.d.ts.map +1 -1
  63. package/dist/api/presentation/viewPresets.d.ts +222 -0
  64. package/dist/api/presentation/viewPresets.d.ts.map +1 -0
  65. package/dist/api/presentation/views.d.ts +103 -5
  66. package/dist/api/presentation/views.d.ts.map +1 -1
  67. package/dist/api/presentation/walkthroughs.d.ts +6 -6
  68. package/dist/errors/codes.d.ts +3 -1
  69. package/dist/errors/codes.d.ts.map +1 -1
  70. package/dist/index.cjs +3788 -2328
  71. package/dist/index.cjs.map +1 -1
  72. package/dist/index.js +3650 -2328
  73. package/dist/index.js.map +1 -1
  74. package/package.json +42 -42
  75. package/scripts/check-dist-fresh.mjs +22 -22
  76. package/scripts/generate-manifest.mjs +243 -238
  77. package/scripts/generate-manifest.test.mjs +303 -303
  78. package/src/api/analysis/daylight.ts +470 -470
  79. package/src/api/analysis/heatmaps.ts +683 -683
  80. package/src/api/analysis/illuminance.ts +155 -155
  81. package/src/api/analysis/index.ts +61 -61
  82. package/src/api/analysis/shadows.ts +183 -183
  83. package/src/api/analysis/solar.ts +237 -237
  84. package/src/api/analysis/sunlightHours.ts +211 -211
  85. package/src/api/analysis/sunpath.ts +83 -83
  86. package/src/api/analysis/weather.ts +179 -179
  87. package/src/api/core/buildings.ts +485 -485
  88. package/src/api/core/camera/index.ts +696 -667
  89. package/src/api/core/comment/index.ts +376 -376
  90. package/src/api/core/geom/create/index.ts +2139 -2133
  91. package/src/api/core/geom/delete/index.ts +84 -84
  92. package/src/api/core/geom/index.ts +35 -35
  93. package/src/api/core/geom/query/arc.ts +169 -169
  94. package/src/api/core/geom/query/brep.ts +621 -621
  95. package/src/api/core/geom/query/circle.ts +404 -404
  96. package/src/api/core/geom/query/contour.ts +540 -540
  97. package/src/api/core/geom/query/curve.ts +1102 -1102
  98. package/src/api/core/geom/query/edge.ts +130 -130
  99. package/src/api/core/geom/query/face.ts +508 -508
  100. package/src/api/core/geom/query/halfedge.ts +210 -210
  101. package/src/api/core/geom/query/index.ts +63 -63
  102. package/src/api/core/geom/query/profile.ts +473 -473
  103. package/src/api/core/geom/query/vertex.ts +205 -205
  104. package/src/api/core/geom/update/contour.ts +323 -317
  105. package/src/api/core/geom/update/curve.ts +209 -209
  106. package/src/api/core/geom/update/index.ts +29 -29
  107. package/src/api/core/geom/update/profile.ts +379 -379
  108. package/src/api/core/groups.ts +521 -521
  109. package/src/api/core/handles/index.ts +234 -234
  110. package/src/api/core/history/index.ts +84 -84
  111. package/src/api/core/index.ts +99 -99
  112. package/src/api/core/io/export/index.ts +126 -126
  113. package/src/api/core/io/import/index.ts +504 -504
  114. package/src/api/core/io/index.ts +42 -42
  115. package/src/api/core/io/job/index.ts +140 -140
  116. package/src/api/core/io/query/index.ts +71 -71
  117. package/src/api/core/io/terrain/index.ts +360 -360
  118. package/src/api/core/io/underlay/index.ts +705 -705
  119. package/src/api/core/layers.ts +540 -540
  120. package/src/api/core/math/index.ts +20 -20
  121. package/src/api/core/math/quat.ts +172 -172
  122. package/src/api/core/math/vec3.ts +179 -179
  123. package/src/api/core/mode/index.ts +108 -108
  124. package/src/api/core/project/index.ts +479 -479
  125. package/src/api/core/proposals/index.ts +570 -570
  126. package/src/api/core/storeys/index.ts +308 -308
  127. package/src/api/core/storeys/layers.ts +339 -339
  128. package/src/api/core/tags.ts +911 -911
  129. package/src/api/core/units/index.ts +164 -164
  130. package/src/api/core/user.ts +46 -46
  131. package/src/api/core/zoom/index.ts +64 -51
  132. package/src/api/design/bim.ts +121 -0
  133. package/src/api/design/boolean/index.ts +181 -179
  134. package/src/api/design/catalog.ts +203 -0
  135. package/src/api/design/create/bulk-items.ts +294 -254
  136. package/src/api/design/create/grids.ts +137 -137
  137. package/src/api/design/create/index.ts +2148 -1980
  138. package/src/api/design/create/opening-fields.ts +40 -37
  139. package/src/api/design/delete/index.ts +75 -74
  140. package/src/api/design/dimensions.ts +453 -453
  141. package/src/api/design/doors/index.ts +516 -500
  142. package/src/api/design/edit/index.ts +54 -54
  143. package/src/api/design/erase/index.ts +151 -151
  144. package/src/api/design/family.ts +1334 -704
  145. package/src/api/design/furniture/index.ts +319 -319
  146. package/src/api/design/grids.ts +237 -237
  147. package/src/api/design/index.ts +304 -274
  148. package/src/api/design/lock.ts +69 -69
  149. package/src/api/design/materials/index.ts +608 -608
  150. package/src/api/design/networks.ts +667 -0
  151. package/src/api/design/query/geometry/index.ts +319 -319
  152. package/src/api/design/query/grids.ts +197 -197
  153. package/src/api/design/query/index.ts +1236 -1226
  154. package/src/api/design/query/referenceLines.ts +52 -52
  155. package/src/api/design/query/spaces.ts +275 -275
  156. package/src/api/design/selection/index.ts +273 -273
  157. package/src/api/design/shared.ts +40 -40
  158. package/src/api/design/transform/index.ts +254 -254
  159. package/src/api/design/types/index.ts +163 -156
  160. package/src/api/design/update/index.ts +1024 -983
  161. package/src/api/design/visibility.ts +143 -143
  162. package/src/api/design/windows/index.ts +351 -333
  163. package/src/api/entity/buildableEnvelope.ts +322 -322
  164. package/src/api/entity/index.ts +30 -30
  165. package/src/api/entity/referenceLine.ts +235 -235
  166. package/src/api/entity/space.ts +612 -612
  167. package/src/api/entity/story.ts +517 -517
  168. package/src/api/index.ts +47 -47
  169. package/src/api/presentation/aiInspiration.ts +1116 -1116
  170. package/src/api/presentation/annotate.ts +417 -385
  171. package/src/api/presentation/camera.ts +289 -289
  172. package/src/api/presentation/diagrams.ts +194 -194
  173. package/src/api/presentation/drawingContract.ts +70 -0
  174. package/src/api/presentation/drawings.ts +1179 -0
  175. package/src/api/presentation/export.ts +134 -108
  176. package/src/api/presentation/import.ts +159 -159
  177. package/src/api/presentation/index.ts +160 -126
  178. package/src/api/presentation/placedViews.ts +1211 -1120
  179. package/src/api/presentation/sections.ts +420 -0
  180. package/src/api/presentation/shapes.ts +274 -274
  181. package/src/api/presentation/sheets.ts +746 -585
  182. package/src/api/presentation/slideshow.ts +134 -134
  183. package/src/api/presentation/tables.ts +84 -84
  184. package/src/api/presentation/viewPresets.ts +241 -0
  185. package/src/api/presentation/views.ts +713 -673
  186. package/src/api/presentation/walkthroughs.ts +1201 -1201
  187. package/src/api/program/adjacency.ts +164 -164
  188. package/src/api/program/areas.ts +408 -408
  189. package/src/api/program/classification.ts +138 -138
  190. package/src/api/program/cores.ts +83 -83
  191. package/src/api/program/departments.ts +517 -517
  192. package/src/api/program/index.ts +73 -73
  193. package/src/api/program/labels.ts +332 -332
  194. package/src/api/program/layout.ts +422 -422
  195. package/src/api/program/metadata.ts +364 -364
  196. package/src/api/program/metrics.ts +120 -120
  197. package/src/api/program/site.ts +748 -748
  198. package/src/api/program/spreadsheet.ts +2698 -2698
  199. package/src/api/workspace/index.ts +612 -612
  200. package/src/errors/codes.ts +143 -136
  201. package/src/errors/envelope.ts +75 -75
  202. package/src/errors/index.ts +21 -21
  203. package/src/errors/plugin-error.ts +134 -134
  204. package/src/handles.ts +297 -297
  205. package/src/host-utils.ts +67 -67
  206. package/src/index.ts +7 -7
  207. package/src/massParameters.ops.ts +246 -246
  208. package/src/massParameters.ts +427 -427
  209. package/src/types.ts +16 -16
  210. package/test/drawingContract.test.mjs +288 -0
  211. package/test/errors.test.mjs +185 -184
  212. package/test/massParameters.test.mjs +952 -952
  213. package/tsconfig.json +22 -22
  214. package/tsup.config.ts +12 -12
  215. package/api-manifest.json +0 -9618
@@ -1,479 +1,479 @@
1
- import * as z from "zod"
2
- import { PluginApiReturn } from "../../../types"
3
- import { PUnitType } from "../units"
4
-
5
- /**
6
- * Project-level settings and info.
7
- *
8
- * Accessed via `snaptrude.core.project`. Exposes
9
- * {@linkcode PluginProjectApi.getInfo} (project identity) and
10
- * {@linkcode PluginProjectApi.settings} (snap + grid controls).
11
- */
12
- export abstract class PluginProjectApi {
13
- constructor() {}
14
-
15
- /**
16
- * Read identity and headline facts about the currently open project — id,
17
- * display name, unit type, storey count, active storey, and site location
18
- * when the project is geo-located.
19
- *
20
- * `activeStorey` and `storeyCount` are both scoped to the ACTIVE BUILDING, so
21
- * they always describe the same building. In a multi-building project
22
- * `storeyCount` is therefore NOT the total across every building — use
23
- * `core.storeys.list()`, which spans all buildings, for that.
24
- *
25
- * @returns A {@linkcode PluginProjectInfo}. `name` is `null` only when the
26
- * project genuinely has no title; `location` is `null` only when the project
27
- * is not geo-located. Neither is used to signal a failure.
28
- * @throws PRECONDITION_FAILED when no project is open.
29
- * @throws OPERATION_FAILED when the project lookup or the site-location read
30
- * fails. A failed read is never reported as `null`.
31
- *
32
- * @examplePrompt What is this project called?
33
- * @examplePrompt Where is this project located?
34
- * @examplePrompt Give me a summary of this project
35
- * @examplePrompt How many storeys does this project have?
36
- *
37
- * # Example
38
- * ```ts
39
- * const info = await snaptrude.core.project.getInfo()
40
- * console.log(info.name, info.units, info.storeyCount)
41
- * ```
42
- */
43
- public abstract getInfo(): PluginApiReturn<PluginProjectInfo>
44
-
45
- /** Project settings — snaps and grid. See {@linkcode PluginProjectSettingsApi}. */
46
- public abstract settings: PluginProjectSettingsApi
47
- }
48
-
49
- /**
50
- * Project settings — tolerance, snaps, and grid.
51
- *
52
- * Accessed via `snaptrude.core.project.settings`.
53
- */
54
- export abstract class PluginProjectSettingsApi {
55
- constructor() {}
56
-
57
- /**
58
- * Get the project tolerance as a numeric magnitude.
59
- *
60
- * The engine stores tolerance as a discrete per-unit precision option; this
61
- * returns its magnitude (decimal precision `"0.00"` → `0.01`; fraction `"1/4"`
62
- * → `0.25`).
63
- *
64
- * @examplePrompt What is the tolerance setting in this project?
65
- * @examplePrompt Check the current dimension precision of the model
66
- * @examplePrompt How precise are the measurements in this project?
67
- * @examplePrompt Show me the project's tolerance value
68
- *
69
- * # Example
70
- * ```ts
71
- * const tolerance = await snaptrude.core.project.settings.getTolerance()
72
- * console.log(tolerance) // e.g. 0.01
73
- * ```
74
- */
75
- public abstract getTolerance(): PluginApiReturn<number>
76
-
77
- /**
78
- * Set the project tolerance. The value snaps to the **nearest allowed**
79
- * per-unit precision option (tolerance is a discrete dropdown, not arbitrary).
80
- *
81
- * @param value - Target tolerance magnitude; snaps to the nearest allowed option.
82
- * @returns `true` once applied; `false` if no tolerance options are available.
83
- *
84
- * @examplePrompt Set the project tolerance to 0.01
85
- * @examplePrompt Change the dimension precision to two decimal places
86
- * @examplePrompt Round dimensions to the nearest quarter inch
87
- * @examplePrompt Make the measurements in this project more precise
88
- *
89
- * # Example
90
- * ```ts
91
- * // snaps to the nearest allowed precision option
92
- * const applied = await snaptrude.core.project.settings.setTolerance(0.01)
93
- * if (!applied) console.log("no tolerance options available")
94
- * ```
95
- */
96
- public abstract setTolerance(value: number): PluginApiReturn<boolean>
97
-
98
- /** Snap controls (dimension / angle / parallel / normal / magnetic). See {@linkcode PluginSnapsApi}. */
99
- public abstract snaps: PluginSnapsApi
100
- /** Grid controls. See {@linkcode PluginGridApi}. */
101
- public abstract grid: PluginGridApi
102
- }
103
-
104
- /**
105
- * Snap controls. Dimension and angle snaps each have a numeric threshold plus an
106
- * on/off toggle; parallel, normal, and magnetic snaps are on/off only.
107
- * (`normal` is the perpendicular snap.)
108
- *
109
- * Accessed via `snaptrude.core.project.settings.snaps`.
110
- */
111
- export abstract class PluginSnapsApi {
112
- constructor() {}
113
-
114
- /**
115
- * Set the dimension-snap threshold — the length increment that drawing and
116
- * editing snap to when dimension snapping is on.
117
- *
118
- * @param value - The snap threshold distance.
119
- *
120
- * @examplePrompt Set the dimension snap to 100mm
121
- * @examplePrompt Change the snap distance to half a metre
122
- * @examplePrompt Make the cursor snap every 6 inches when drawing
123
- * @examplePrompt Adjust the snapping increment for lengths
124
- *
125
- * # Example
126
- * ```ts
127
- * // the threshold only applies while dimension snapping is on
128
- * await snaptrude.core.project.settings.snaps.setDimension(100)
129
- * await snaptrude.core.project.settings.snaps.enableDimension()
130
- * ```
131
- */
132
- public abstract setDimension(value: number): PluginApiReturn<boolean>
133
- /**
134
- * Get the current dimension-snap threshold — the length increment that
135
- * drawing and editing snap to when dimension snapping is on.
136
- *
137
- * @examplePrompt What is the dimension snap distance?
138
- * @examplePrompt Check the current snap increment for drawing
139
- * @examplePrompt How far apart are the length snaps set?
140
- * @examplePrompt Show me the snap spacing value
141
- *
142
- * # Example
143
- * ```ts
144
- * const increment = await snaptrude.core.project.settings.snaps.getDimension()
145
- * console.log(increment)
146
- * ```
147
- */
148
- public abstract getDimension(): PluginApiReturn<number>
149
- /**
150
- * Turn dimension snapping on, so drawing and editing snap to the configured
151
- * length increment.
152
- *
153
- * @examplePrompt Turn on dimension snapping
154
- * @examplePrompt Enable snapping to set lengths while I draw
155
- * @examplePrompt Make my walls snap to round dimensions
156
- * @examplePrompt Switch length snapping back on
157
- *
158
- * # Example
159
- * ```ts
160
- * await snaptrude.core.project.settings.snaps.enableDimension()
161
- * ```
162
- */
163
- public abstract enableDimension(): PluginApiReturn<boolean>
164
- /**
165
- * Turn dimension snapping off, so lengths no longer snap to the configured
166
- * increment while drawing.
167
- *
168
- * @examplePrompt Turn off dimension snapping
169
- * @examplePrompt Stop snapping to fixed lengths when I draw
170
- * @examplePrompt Disable the length snap so I can draw freely
171
- * @examplePrompt I don't want dimensions to snap anymore
172
- *
173
- * # Example
174
- * ```ts
175
- * await snaptrude.core.project.settings.snaps.disableDimension()
176
- * ```
177
- */
178
- public abstract disableDimension(): PluginApiReturn<boolean>
179
-
180
- /**
181
- * Set the angle-snap threshold in degrees — the angular increment that
182
- * drawing snaps to when angle snapping is on.
183
- *
184
- * @param value - The snap threshold in degrees.
185
- *
186
- * @examplePrompt Set the angle snap to 15 degrees
187
- * @examplePrompt Change angle snapping to every 45 degrees
188
- * @examplePrompt Make drawing snap at 30 degree increments
189
- * @examplePrompt Adjust the rotation snap angle
190
- *
191
- * # Example
192
- * ```ts
193
- * // snap drawing to 15-degree increments (applies while angle snapping is on)
194
- * await snaptrude.core.project.settings.snaps.setAngle(15)
195
- * await snaptrude.core.project.settings.snaps.enableAngle()
196
- * ```
197
- */
198
- public abstract setAngle(value: number): PluginApiReturn<boolean>
199
- /**
200
- * Get the current angle-snap threshold in degrees — the angular increment
201
- * that drawing snaps to when angle snapping is on.
202
- *
203
- * @examplePrompt What angle does drawing snap to?
204
- * @examplePrompt Check the current angle snap in degrees
205
- * @examplePrompt Show me the angle snapping increment
206
- * @examplePrompt How many degrees is the angle snap set to?
207
- *
208
- * # Example
209
- * ```ts
210
- * const degrees = await snaptrude.core.project.settings.snaps.getAngle()
211
- * console.log(degrees)
212
- * ```
213
- */
214
- public abstract getAngle(): PluginApiReturn<number>
215
- /**
216
- * Turn angle snapping on, so drawn lines snap to the configured angle
217
- * increment.
218
- *
219
- * @examplePrompt Turn on angle snapping
220
- * @examplePrompt Enable snapping to angles while drawing
221
- * @examplePrompt Make my lines snap to set angles
222
- * @examplePrompt Switch angle snap back on
223
- *
224
- * # Example
225
- * ```ts
226
- * await snaptrude.core.project.settings.snaps.enableAngle()
227
- * ```
228
- */
229
- public abstract enableAngle(): PluginApiReturn<boolean>
230
- /**
231
- * Turn angle snapping off, so lines can be drawn at any angle without
232
- * snapping to fixed increments.
233
- *
234
- * @examplePrompt Turn off angle snapping
235
- * @examplePrompt Stop lines snapping to fixed angles
236
- * @examplePrompt Disable the angle snap so I can draw at any angle
237
- * @examplePrompt Remove angle snapping while sketching
238
- *
239
- * # Example
240
- * ```ts
241
- * await snaptrude.core.project.settings.snaps.disableAngle()
242
- * ```
243
- */
244
- public abstract disableAngle(): PluginApiReturn<boolean>
245
-
246
- /**
247
- * Turn parallel snapping on, so drawing snaps when the cursor lines up
248
- * parallel to existing edges.
249
- *
250
- * @examplePrompt Turn on parallel snapping
251
- * @examplePrompt Enable snapping to parallel lines
252
- * @examplePrompt Help me draw walls parallel to existing ones
253
- * @examplePrompt Snap to parallel edges when drawing
254
- *
255
- * # Example
256
- * ```ts
257
- * await snaptrude.core.project.settings.snaps.enableParallel()
258
- * ```
259
- */
260
- public abstract enableParallel(): PluginApiReturn<boolean>
261
- /**
262
- * Turn parallel snapping off, so drawing no longer snaps to directions
263
- * parallel to existing edges.
264
- *
265
- * @examplePrompt Turn off parallel snapping
266
- * @examplePrompt Stop snapping to parallel edges
267
- * @examplePrompt Disable the parallel snap guide
268
- * @examplePrompt I don't want my lines snapping parallel anymore
269
- *
270
- * # Example
271
- * ```ts
272
- * await snaptrude.core.project.settings.snaps.disableParallel()
273
- * ```
274
- */
275
- public abstract disableParallel(): PluginApiReturn<boolean>
276
-
277
- /**
278
- * Turn normal (perpendicular) snapping on, so drawing snaps when the cursor
279
- * is at a right angle to existing edges.
280
- *
281
- * @examplePrompt Turn on perpendicular snapping
282
- * @examplePrompt Enable the normal snap so lines snap at right angles
283
- * @examplePrompt Snap to perpendicular when I draw walls
284
- * @examplePrompt Help me draw at 90 degrees to existing edges
285
- *
286
- * # Example
287
- * ```ts
288
- * await snaptrude.core.project.settings.snaps.enableNormal()
289
- * ```
290
- */
291
- public abstract enableNormal(): PluginApiReturn<boolean>
292
- /**
293
- * Turn normal (perpendicular) snapping off, so drawing no longer snaps at
294
- * right angles to existing edges.
295
- *
296
- * @examplePrompt Turn off perpendicular snapping
297
- * @examplePrompt Disable the normal snap
298
- * @examplePrompt Stop snapping at right angles to edges
299
- * @examplePrompt Remove the 90 degree snap guide
300
- *
301
- * # Example
302
- * ```ts
303
- * await snaptrude.core.project.settings.snaps.disableNormal()
304
- * ```
305
- */
306
- public abstract disableNormal(): PluginApiReturn<boolean>
307
-
308
- /**
309
- * Turn magnetic snapping on, so the cursor is pulled to nearby geometry
310
- * while drawing.
311
- *
312
- * @examplePrompt Turn on magnetic snapping
313
- * @examplePrompt Enable the magnet snap
314
- * @examplePrompt Make the cursor stick to nearby geometry when drawing
315
- * @examplePrompt Switch magnetic snap back on
316
- *
317
- * # Example
318
- * ```ts
319
- * await snaptrude.core.project.settings.snaps.enableMagnetic()
320
- * ```
321
- */
322
- public abstract enableMagnetic(): PluginApiReturn<boolean>
323
- /**
324
- * Turn magnetic snapping off, so the cursor is no longer pulled to nearby
325
- * geometry while drawing.
326
- *
327
- * @examplePrompt Turn off magnetic snapping
328
- * @examplePrompt Disable the magnet snap
329
- * @examplePrompt Stop the cursor sticking to nearby objects
330
- * @examplePrompt The magnetic snap is annoying, switch it off
331
- *
332
- * # Example
333
- * ```ts
334
- * await snaptrude.core.project.settings.snaps.disableMagnetic()
335
- * ```
336
- */
337
- public abstract disableMagnetic(): PluginApiReturn<boolean>
338
- }
339
-
340
- /**
341
- * Grid controls — the visual snap-to grid.
342
- *
343
- * Accessed via `snaptrude.core.project.settings.grid`.
344
- */
345
- export abstract class PluginGridApi {
346
- constructor() {}
347
-
348
- /**
349
- * Turn the grid on, showing the visual snap-to grid in the canvas.
350
- *
351
- * @examplePrompt Turn on the grid
352
- * @examplePrompt Show the grid in my project
353
- * @examplePrompt Enable the drawing grid
354
- * @examplePrompt Switch the snap grid back on
355
- *
356
- * # Example
357
- * ```ts
358
- * await snaptrude.core.project.settings.grid.enable()
359
- * ```
360
- */
361
- public abstract enable(): PluginApiReturn<boolean>
362
- /**
363
- * Turn the grid off, hiding the visual snap-to grid in the canvas.
364
- *
365
- * @examplePrompt Turn off the grid
366
- * @examplePrompt Hide the grid
367
- * @examplePrompt Disable the background grid in the canvas
368
- * @examplePrompt Remove the drawing grid from view
369
- *
370
- * # Example
371
- * ```ts
372
- * await snaptrude.core.project.settings.grid.disable()
373
- * ```
374
- */
375
- public abstract disable(): PluginApiReturn<boolean>
376
- /**
377
- * Set the grid cell value — the size of each cell in the visual snap-to
378
- * grid.
379
- *
380
- * @param value - The grid cell value.
381
- *
382
- * @examplePrompt Set the grid spacing to 1 metre
383
- * @examplePrompt Change the grid cell size to 500mm
384
- * @examplePrompt Make the grid squares 2 feet wide
385
- * @examplePrompt Adjust the grid size in this project
386
- *
387
- * # Example
388
- * ```ts
389
- * await snaptrude.core.project.settings.grid.setValue(1)
390
- * await snaptrude.core.project.settings.grid.enable()
391
- * ```
392
- */
393
- public abstract setValue(value: number): PluginApiReturn<boolean>
394
- /**
395
- * Get the current grid cell value — the size of each cell in the visual
396
- * snap-to grid.
397
- *
398
- * @examplePrompt What is the grid spacing?
399
- * @examplePrompt Check the current grid cell size
400
- * @examplePrompt How big are the grid squares?
401
- * @examplePrompt Show me the grid size setting
402
- *
403
- * # Example
404
- * ```ts
405
- * const cellSize = await snaptrude.core.project.settings.grid.getValue()
406
- * console.log(cellSize)
407
- * ```
408
- */
409
- public abstract getValue(): PluginApiReturn<number>
410
- }
411
-
412
- /**
413
- * Arguments for the snap-threshold setters
414
- * ({@linkcode PluginSnapsApi.setDimension} / {@linkcode PluginSnapsApi.setAngle}).
415
- *
416
- * | Property | Type | Description |
417
- * |---|---|---|
418
- * | `value` | `number` | The snap threshold (distance, or degrees for angle) |
419
- */
420
- export const PluginSnapValueArgs = z.object({
421
- value: z.number(),
422
- })
423
-
424
- export type PluginSnapValueArgs = z.infer<typeof PluginSnapValueArgs>
425
-
426
- /**
427
- * Arguments for {@linkcode PluginGridApi.setValue}.
428
- *
429
- * | Property | Type | Description |
430
- * |---|---|---|
431
- * | `value` | `number` | The grid cell value |
432
- */
433
- export const PluginGridValueArgs = z.object({
434
- value: z.number(),
435
- })
436
-
437
- export type PluginGridValueArgs = z.infer<typeof PluginGridValueArgs>
438
-
439
- /**
440
- * Arguments for {@linkcode PluginProjectSettingsApi.setTolerance}.
441
- *
442
- * | Property | Type | Description |
443
- * |---|---|---|
444
- * | `value` | `number` | Target tolerance magnitude; snaps to the nearest allowed option |
445
- */
446
- export const PluginToleranceArgs = z.object({
447
- value: z.number(),
448
- })
449
-
450
- export type PluginToleranceArgs = z.infer<typeof PluginToleranceArgs>
451
-
452
- /**
453
- * Identity and headline facts about the currently open project.
454
- *
455
- * `location` is a read-only projection of {@linkcode PluginProgramSiteApi.getLocation}
456
- * — `program.site.*` remains the full site surface (context, weather, polygons).
457
- * It is mirrored here because "what and where is this project" is one question.
458
- *
459
- * | Property | Type | Description |
460
- * |---|---|---|
461
- * | `projectId` | `string` | The open project's id (floorkey) |
462
- * | `name` | `string \| null` | Display name; `null` only when the project has no title (a failed lookup throws) |
463
- * | `units` | {@linkcode PUnitType} | The project's unit type |
464
- * | `activeStorey` | `number` | The active storey value, in the active building |
465
- * | `storeyCount` | `number` | How many storeys the ACTIVE BUILDING has (not the project-wide total — `core.storeys.list()` spans all buildings) |
466
- * | `location` | `{ latitude, longitude } \| null` | Site location; `null` only when not geo-located (a failed read throws) |
467
- */
468
- export const PluginProjectInfo = z.object({
469
- projectId: z.string(),
470
- name: z.string().nullable(),
471
- units: PUnitType,
472
- activeStorey: z.number(),
473
- storeyCount: z.number(),
474
- location: z
475
- .object({ latitude: z.number(), longitude: z.number() })
476
- .nullable(),
477
- })
478
-
479
- export type PluginProjectInfo = z.infer<typeof PluginProjectInfo>
1
+ import * as z from "zod"
2
+ import { PluginApiReturn } from "../../../types"
3
+ import { PUnitType } from "../units"
4
+
5
+ /**
6
+ * Project-level settings and info.
7
+ *
8
+ * Accessed via `snaptrude.core.project`. Exposes
9
+ * {@linkcode PluginProjectApi.getInfo} (project identity) and
10
+ * {@linkcode PluginProjectApi.settings} (snap + grid controls).
11
+ */
12
+ export abstract class PluginProjectApi {
13
+ constructor() {}
14
+
15
+ /**
16
+ * Read identity and headline facts about the currently open project — id,
17
+ * display name, unit type, storey count, active storey, and site location
18
+ * when the project is geo-located.
19
+ *
20
+ * `activeStorey` and `storeyCount` are both scoped to the ACTIVE BUILDING, so
21
+ * they always describe the same building. In a multi-building project
22
+ * `storeyCount` is therefore NOT the total across every building — use
23
+ * `core.storeys.list()`, which spans all buildings, for that.
24
+ *
25
+ * @returns A {@linkcode PluginProjectInfo}. `name` is `null` only when the
26
+ * project genuinely has no title; `location` is `null` only when the project
27
+ * is not geo-located. Neither is used to signal a failure.
28
+ * @throws PRECONDITION_FAILED when no project is open.
29
+ * @throws OPERATION_FAILED when the project lookup or the site-location read
30
+ * fails. A failed read is never reported as `null`.
31
+ *
32
+ * @examplePrompt What is this project called?
33
+ * @examplePrompt Where is this project located?
34
+ * @examplePrompt Give me a summary of this project
35
+ * @examplePrompt How many storeys does this project have?
36
+ *
37
+ * # Example
38
+ * ```ts
39
+ * const info = await snaptrude.core.project.getInfo()
40
+ * console.log(info.name, info.units, info.storeyCount)
41
+ * ```
42
+ */
43
+ public abstract getInfo(): PluginApiReturn<PluginProjectInfo>
44
+
45
+ /** Project settings — snaps and grid. See {@linkcode PluginProjectSettingsApi}. */
46
+ public abstract settings: PluginProjectSettingsApi
47
+ }
48
+
49
+ /**
50
+ * Project settings — tolerance, snaps, and grid.
51
+ *
52
+ * Accessed via `snaptrude.core.project.settings`.
53
+ */
54
+ export abstract class PluginProjectSettingsApi {
55
+ constructor() {}
56
+
57
+ /**
58
+ * Get the project tolerance as a numeric magnitude.
59
+ *
60
+ * The engine stores tolerance as a discrete per-unit precision option; this
61
+ * returns its magnitude (decimal precision `"0.00"` → `0.01`; fraction `"1/4"`
62
+ * → `0.25`).
63
+ *
64
+ * @examplePrompt What is the tolerance setting in this project?
65
+ * @examplePrompt Check the current dimension precision of the model
66
+ * @examplePrompt How precise are the measurements in this project?
67
+ * @examplePrompt Show me the project's tolerance value
68
+ *
69
+ * # Example
70
+ * ```ts
71
+ * const tolerance = await snaptrude.core.project.settings.getTolerance()
72
+ * console.log(tolerance) // e.g. 0.01
73
+ * ```
74
+ */
75
+ public abstract getTolerance(): PluginApiReturn<number>
76
+
77
+ /**
78
+ * Set the project tolerance. The value snaps to the **nearest allowed**
79
+ * per-unit precision option (tolerance is a discrete dropdown, not arbitrary).
80
+ *
81
+ * @param value - Target tolerance magnitude; snaps to the nearest allowed option.
82
+ * @returns `true` once applied; `false` if no tolerance options are available.
83
+ *
84
+ * @examplePrompt Set the project tolerance to 0.01
85
+ * @examplePrompt Change the dimension precision to two decimal places
86
+ * @examplePrompt Round dimensions to the nearest quarter inch
87
+ * @examplePrompt Make the measurements in this project more precise
88
+ *
89
+ * # Example
90
+ * ```ts
91
+ * // snaps to the nearest allowed precision option
92
+ * const applied = await snaptrude.core.project.settings.setTolerance(0.01)
93
+ * if (!applied) console.log("no tolerance options available")
94
+ * ```
95
+ */
96
+ public abstract setTolerance(value: number): PluginApiReturn<boolean>
97
+
98
+ /** Snap controls (dimension / angle / parallel / normal / magnetic). See {@linkcode PluginSnapsApi}. */
99
+ public abstract snaps: PluginSnapsApi
100
+ /** Grid controls. See {@linkcode PluginGridApi}. */
101
+ public abstract grid: PluginGridApi
102
+ }
103
+
104
+ /**
105
+ * Snap controls. Dimension and angle snaps each have a numeric threshold plus an
106
+ * on/off toggle; parallel, normal, and magnetic snaps are on/off only.
107
+ * (`normal` is the perpendicular snap.)
108
+ *
109
+ * Accessed via `snaptrude.core.project.settings.snaps`.
110
+ */
111
+ export abstract class PluginSnapsApi {
112
+ constructor() {}
113
+
114
+ /**
115
+ * Set the dimension-snap threshold — the length increment that drawing and
116
+ * editing snap to when dimension snapping is on.
117
+ *
118
+ * @param value - The snap threshold distance.
119
+ *
120
+ * @examplePrompt Set the dimension snap to 100mm
121
+ * @examplePrompt Change the snap distance to half a metre
122
+ * @examplePrompt Make the cursor snap every 6 inches when drawing
123
+ * @examplePrompt Adjust the snapping increment for lengths
124
+ *
125
+ * # Example
126
+ * ```ts
127
+ * // the threshold only applies while dimension snapping is on
128
+ * await snaptrude.core.project.settings.snaps.setDimension(100)
129
+ * await snaptrude.core.project.settings.snaps.enableDimension()
130
+ * ```
131
+ */
132
+ public abstract setDimension(value: number): PluginApiReturn<boolean>
133
+ /**
134
+ * Get the current dimension-snap threshold — the length increment that
135
+ * drawing and editing snap to when dimension snapping is on.
136
+ *
137
+ * @examplePrompt What is the dimension snap distance?
138
+ * @examplePrompt Check the current snap increment for drawing
139
+ * @examplePrompt How far apart are the length snaps set?
140
+ * @examplePrompt Show me the snap spacing value
141
+ *
142
+ * # Example
143
+ * ```ts
144
+ * const increment = await snaptrude.core.project.settings.snaps.getDimension()
145
+ * console.log(increment)
146
+ * ```
147
+ */
148
+ public abstract getDimension(): PluginApiReturn<number>
149
+ /**
150
+ * Turn dimension snapping on, so drawing and editing snap to the configured
151
+ * length increment.
152
+ *
153
+ * @examplePrompt Turn on dimension snapping
154
+ * @examplePrompt Enable snapping to set lengths while I draw
155
+ * @examplePrompt Make my walls snap to round dimensions
156
+ * @examplePrompt Switch length snapping back on
157
+ *
158
+ * # Example
159
+ * ```ts
160
+ * await snaptrude.core.project.settings.snaps.enableDimension()
161
+ * ```
162
+ */
163
+ public abstract enableDimension(): PluginApiReturn<boolean>
164
+ /**
165
+ * Turn dimension snapping off, so lengths no longer snap to the configured
166
+ * increment while drawing.
167
+ *
168
+ * @examplePrompt Turn off dimension snapping
169
+ * @examplePrompt Stop snapping to fixed lengths when I draw
170
+ * @examplePrompt Disable the length snap so I can draw freely
171
+ * @examplePrompt I don't want dimensions to snap anymore
172
+ *
173
+ * # Example
174
+ * ```ts
175
+ * await snaptrude.core.project.settings.snaps.disableDimension()
176
+ * ```
177
+ */
178
+ public abstract disableDimension(): PluginApiReturn<boolean>
179
+
180
+ /**
181
+ * Set the angle-snap threshold in degrees — the angular increment that
182
+ * drawing snaps to when angle snapping is on.
183
+ *
184
+ * @param value - The snap threshold in degrees.
185
+ *
186
+ * @examplePrompt Set the angle snap to 15 degrees
187
+ * @examplePrompt Change angle snapping to every 45 degrees
188
+ * @examplePrompt Make drawing snap at 30 degree increments
189
+ * @examplePrompt Adjust the rotation snap angle
190
+ *
191
+ * # Example
192
+ * ```ts
193
+ * // snap drawing to 15-degree increments (applies while angle snapping is on)
194
+ * await snaptrude.core.project.settings.snaps.setAngle(15)
195
+ * await snaptrude.core.project.settings.snaps.enableAngle()
196
+ * ```
197
+ */
198
+ public abstract setAngle(value: number): PluginApiReturn<boolean>
199
+ /**
200
+ * Get the current angle-snap threshold in degrees — the angular increment
201
+ * that drawing snaps to when angle snapping is on.
202
+ *
203
+ * @examplePrompt What angle does drawing snap to?
204
+ * @examplePrompt Check the current angle snap in degrees
205
+ * @examplePrompt Show me the angle snapping increment
206
+ * @examplePrompt How many degrees is the angle snap set to?
207
+ *
208
+ * # Example
209
+ * ```ts
210
+ * const degrees = await snaptrude.core.project.settings.snaps.getAngle()
211
+ * console.log(degrees)
212
+ * ```
213
+ */
214
+ public abstract getAngle(): PluginApiReturn<number>
215
+ /**
216
+ * Turn angle snapping on, so drawn lines snap to the configured angle
217
+ * increment.
218
+ *
219
+ * @examplePrompt Turn on angle snapping
220
+ * @examplePrompt Enable snapping to angles while drawing
221
+ * @examplePrompt Make my lines snap to set angles
222
+ * @examplePrompt Switch angle snap back on
223
+ *
224
+ * # Example
225
+ * ```ts
226
+ * await snaptrude.core.project.settings.snaps.enableAngle()
227
+ * ```
228
+ */
229
+ public abstract enableAngle(): PluginApiReturn<boolean>
230
+ /**
231
+ * Turn angle snapping off, so lines can be drawn at any angle without
232
+ * snapping to fixed increments.
233
+ *
234
+ * @examplePrompt Turn off angle snapping
235
+ * @examplePrompt Stop lines snapping to fixed angles
236
+ * @examplePrompt Disable the angle snap so I can draw at any angle
237
+ * @examplePrompt Remove angle snapping while sketching
238
+ *
239
+ * # Example
240
+ * ```ts
241
+ * await snaptrude.core.project.settings.snaps.disableAngle()
242
+ * ```
243
+ */
244
+ public abstract disableAngle(): PluginApiReturn<boolean>
245
+
246
+ /**
247
+ * Turn parallel snapping on, so drawing snaps when the cursor lines up
248
+ * parallel to existing edges.
249
+ *
250
+ * @examplePrompt Turn on parallel snapping
251
+ * @examplePrompt Enable snapping to parallel lines
252
+ * @examplePrompt Help me draw walls parallel to existing ones
253
+ * @examplePrompt Snap to parallel edges when drawing
254
+ *
255
+ * # Example
256
+ * ```ts
257
+ * await snaptrude.core.project.settings.snaps.enableParallel()
258
+ * ```
259
+ */
260
+ public abstract enableParallel(): PluginApiReturn<boolean>
261
+ /**
262
+ * Turn parallel snapping off, so drawing no longer snaps to directions
263
+ * parallel to existing edges.
264
+ *
265
+ * @examplePrompt Turn off parallel snapping
266
+ * @examplePrompt Stop snapping to parallel edges
267
+ * @examplePrompt Disable the parallel snap guide
268
+ * @examplePrompt I don't want my lines snapping parallel anymore
269
+ *
270
+ * # Example
271
+ * ```ts
272
+ * await snaptrude.core.project.settings.snaps.disableParallel()
273
+ * ```
274
+ */
275
+ public abstract disableParallel(): PluginApiReturn<boolean>
276
+
277
+ /**
278
+ * Turn normal (perpendicular) snapping on, so drawing snaps when the cursor
279
+ * is at a right angle to existing edges.
280
+ *
281
+ * @examplePrompt Turn on perpendicular snapping
282
+ * @examplePrompt Enable the normal snap so lines snap at right angles
283
+ * @examplePrompt Snap to perpendicular when I draw walls
284
+ * @examplePrompt Help me draw at 90 degrees to existing edges
285
+ *
286
+ * # Example
287
+ * ```ts
288
+ * await snaptrude.core.project.settings.snaps.enableNormal()
289
+ * ```
290
+ */
291
+ public abstract enableNormal(): PluginApiReturn<boolean>
292
+ /**
293
+ * Turn normal (perpendicular) snapping off, so drawing no longer snaps at
294
+ * right angles to existing edges.
295
+ *
296
+ * @examplePrompt Turn off perpendicular snapping
297
+ * @examplePrompt Disable the normal snap
298
+ * @examplePrompt Stop snapping at right angles to edges
299
+ * @examplePrompt Remove the 90 degree snap guide
300
+ *
301
+ * # Example
302
+ * ```ts
303
+ * await snaptrude.core.project.settings.snaps.disableNormal()
304
+ * ```
305
+ */
306
+ public abstract disableNormal(): PluginApiReturn<boolean>
307
+
308
+ /**
309
+ * Turn magnetic snapping on, so the cursor is pulled to nearby geometry
310
+ * while drawing.
311
+ *
312
+ * @examplePrompt Turn on magnetic snapping
313
+ * @examplePrompt Enable the magnet snap
314
+ * @examplePrompt Make the cursor stick to nearby geometry when drawing
315
+ * @examplePrompt Switch magnetic snap back on
316
+ *
317
+ * # Example
318
+ * ```ts
319
+ * await snaptrude.core.project.settings.snaps.enableMagnetic()
320
+ * ```
321
+ */
322
+ public abstract enableMagnetic(): PluginApiReturn<boolean>
323
+ /**
324
+ * Turn magnetic snapping off, so the cursor is no longer pulled to nearby
325
+ * geometry while drawing.
326
+ *
327
+ * @examplePrompt Turn off magnetic snapping
328
+ * @examplePrompt Disable the magnet snap
329
+ * @examplePrompt Stop the cursor sticking to nearby objects
330
+ * @examplePrompt The magnetic snap is annoying, switch it off
331
+ *
332
+ * # Example
333
+ * ```ts
334
+ * await snaptrude.core.project.settings.snaps.disableMagnetic()
335
+ * ```
336
+ */
337
+ public abstract disableMagnetic(): PluginApiReturn<boolean>
338
+ }
339
+
340
+ /**
341
+ * Grid controls — the visual snap-to grid.
342
+ *
343
+ * Accessed via `snaptrude.core.project.settings.grid`.
344
+ */
345
+ export abstract class PluginGridApi {
346
+ constructor() {}
347
+
348
+ /**
349
+ * Turn the grid on, showing the visual snap-to grid in the canvas.
350
+ *
351
+ * @examplePrompt Turn on the grid
352
+ * @examplePrompt Show the grid in my project
353
+ * @examplePrompt Enable the drawing grid
354
+ * @examplePrompt Switch the snap grid back on
355
+ *
356
+ * # Example
357
+ * ```ts
358
+ * await snaptrude.core.project.settings.grid.enable()
359
+ * ```
360
+ */
361
+ public abstract enable(): PluginApiReturn<boolean>
362
+ /**
363
+ * Turn the grid off, hiding the visual snap-to grid in the canvas.
364
+ *
365
+ * @examplePrompt Turn off the grid
366
+ * @examplePrompt Hide the grid
367
+ * @examplePrompt Disable the background grid in the canvas
368
+ * @examplePrompt Remove the drawing grid from view
369
+ *
370
+ * # Example
371
+ * ```ts
372
+ * await snaptrude.core.project.settings.grid.disable()
373
+ * ```
374
+ */
375
+ public abstract disable(): PluginApiReturn<boolean>
376
+ /**
377
+ * Set the grid cell value — the size of each cell in the visual snap-to
378
+ * grid.
379
+ *
380
+ * @param value - The grid cell value.
381
+ *
382
+ * @examplePrompt Set the grid spacing to 1 metre
383
+ * @examplePrompt Change the grid cell size to 500mm
384
+ * @examplePrompt Make the grid squares 2 feet wide
385
+ * @examplePrompt Adjust the grid size in this project
386
+ *
387
+ * # Example
388
+ * ```ts
389
+ * await snaptrude.core.project.settings.grid.setValue(1)
390
+ * await snaptrude.core.project.settings.grid.enable()
391
+ * ```
392
+ */
393
+ public abstract setValue(value: number): PluginApiReturn<boolean>
394
+ /**
395
+ * Get the current grid cell value — the size of each cell in the visual
396
+ * snap-to grid.
397
+ *
398
+ * @examplePrompt What is the grid spacing?
399
+ * @examplePrompt Check the current grid cell size
400
+ * @examplePrompt How big are the grid squares?
401
+ * @examplePrompt Show me the grid size setting
402
+ *
403
+ * # Example
404
+ * ```ts
405
+ * const cellSize = await snaptrude.core.project.settings.grid.getValue()
406
+ * console.log(cellSize)
407
+ * ```
408
+ */
409
+ public abstract getValue(): PluginApiReturn<number>
410
+ }
411
+
412
+ /**
413
+ * Arguments for the snap-threshold setters
414
+ * ({@linkcode PluginSnapsApi.setDimension} / {@linkcode PluginSnapsApi.setAngle}).
415
+ *
416
+ * | Property | Type | Description |
417
+ * |---|---|---|
418
+ * | `value` | `number` | The snap threshold (distance, or degrees for angle) |
419
+ */
420
+ export const PluginSnapValueArgs = z.object({
421
+ value: z.number(),
422
+ })
423
+
424
+ export type PluginSnapValueArgs = z.infer<typeof PluginSnapValueArgs>
425
+
426
+ /**
427
+ * Arguments for {@linkcode PluginGridApi.setValue}.
428
+ *
429
+ * | Property | Type | Description |
430
+ * |---|---|---|
431
+ * | `value` | `number` | The grid cell value |
432
+ */
433
+ export const PluginGridValueArgs = z.object({
434
+ value: z.number(),
435
+ })
436
+
437
+ export type PluginGridValueArgs = z.infer<typeof PluginGridValueArgs>
438
+
439
+ /**
440
+ * Arguments for {@linkcode PluginProjectSettingsApi.setTolerance}.
441
+ *
442
+ * | Property | Type | Description |
443
+ * |---|---|---|
444
+ * | `value` | `number` | Target tolerance magnitude; snaps to the nearest allowed option |
445
+ */
446
+ export const PluginToleranceArgs = z.object({
447
+ value: z.number(),
448
+ })
449
+
450
+ export type PluginToleranceArgs = z.infer<typeof PluginToleranceArgs>
451
+
452
+ /**
453
+ * Identity and headline facts about the currently open project.
454
+ *
455
+ * `location` is a read-only projection of {@linkcode PluginProgramSiteApi.getLocation}
456
+ * — `program.site.*` remains the full site surface (context, weather, polygons).
457
+ * It is mirrored here because "what and where is this project" is one question.
458
+ *
459
+ * | Property | Type | Description |
460
+ * |---|---|---|
461
+ * | `projectId` | `string` | The open project's id (floorkey) |
462
+ * | `name` | `string \| null` | Display name; `null` only when the project has no title (a failed lookup throws) |
463
+ * | `units` | {@linkcode PUnitType} | The project's unit type |
464
+ * | `activeStorey` | `number` | The active storey value, in the active building |
465
+ * | `storeyCount` | `number` | How many storeys the ACTIVE BUILDING has (not the project-wide total — `core.storeys.list()` spans all buildings) |
466
+ * | `location` | `{ latitude, longitude } \| null` | Site location; `null` only when not geo-located (a failed read throws) |
467
+ */
468
+ export const PluginProjectInfo = z.object({
469
+ projectId: z.string(),
470
+ name: z.string().nullable(),
471
+ units: PUnitType,
472
+ activeStorey: z.number(),
473
+ storeyCount: z.number(),
474
+ location: z
475
+ .object({ latitude: z.number(), longitude: z.number() })
476
+ .nullable(),
477
+ })
478
+
479
+ export type PluginProjectInfo = z.infer<typeof PluginProjectInfo>