@snaptrude/plugin-core 0.9.16 → 0.9.18-edgesetbacks-20261021.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 (221) hide show
  1. package/AGENTS.md +231 -231
  2. package/CHANGELOG.md +408 -402
  3. package/CLAUDE.md +11 -11
  4. package/api-manifest.json +1510 -701
  5. package/dist/api/analysis/daylight.d.ts +5 -5
  6. package/dist/api/analysis/solar.d.ts +2 -2
  7. package/dist/api/core/camera/index.d.ts +29 -0
  8. package/dist/api/core/camera/index.d.ts.map +1 -1
  9. package/dist/api/core/geom/create/index.d.ts +7 -1
  10. package/dist/api/core/geom/create/index.d.ts.map +1 -1
  11. package/dist/api/core/geom/update/contour.d.ts +8 -2
  12. package/dist/api/core/geom/update/contour.d.ts.map +1 -1
  13. package/dist/api/core/storeys/index.d.ts +5 -2
  14. package/dist/api/core/storeys/index.d.ts.map +1 -1
  15. package/dist/api/core/zoom/index.d.ts +13 -0
  16. package/dist/api/core/zoom/index.d.ts.map +1 -1
  17. package/dist/api/design/bim.d.ts +299 -0
  18. package/dist/api/design/bim.d.ts.map +1 -0
  19. package/dist/api/design/boolean/index.d.ts +2 -0
  20. package/dist/api/design/boolean/index.d.ts.map +1 -1
  21. package/dist/api/design/catalog.d.ts +320 -0
  22. package/dist/api/design/catalog.d.ts.map +1 -0
  23. package/dist/api/design/create/bulk-items.d.ts +65 -25
  24. package/dist/api/design/create/bulk-items.d.ts.map +1 -1
  25. package/dist/api/design/create/index.d.ts +299 -100
  26. package/dist/api/design/create/index.d.ts.map +1 -1
  27. package/dist/api/design/create/opening-fields.d.ts +13 -12
  28. package/dist/api/design/create/opening-fields.d.ts.map +1 -1
  29. package/dist/api/design/delete/index.d.ts +1 -0
  30. package/dist/api/design/delete/index.d.ts.map +1 -1
  31. package/dist/api/design/doors/index.d.ts +18 -24
  32. package/dist/api/design/doors/index.d.ts.map +1 -1
  33. package/dist/api/design/family.d.ts +813 -35
  34. package/dist/api/design/family.d.ts.map +1 -1
  35. package/dist/api/design/index.d.ts +16 -0
  36. package/dist/api/design/index.d.ts.map +1 -1
  37. package/dist/api/design/networks.d.ts +1703 -0
  38. package/dist/api/design/networks.d.ts.map +1 -0
  39. package/dist/api/design/query/grids.d.ts +2 -2
  40. package/dist/api/design/query/index.d.ts +42 -32
  41. package/dist/api/design/query/index.d.ts.map +1 -1
  42. package/dist/api/design/selection/index.d.ts +10 -10
  43. package/dist/api/design/types/index.d.ts +40 -24
  44. package/dist/api/design/types/index.d.ts.map +1 -1
  45. package/dist/api/design/update/index.d.ts +111 -6
  46. package/dist/api/design/update/index.d.ts.map +1 -1
  47. package/dist/api/design/windows/index.d.ts +8 -8
  48. package/dist/api/design/windows/index.d.ts.map +1 -1
  49. package/dist/api/entity/buildableEnvelope.d.ts +84 -2
  50. package/dist/api/entity/buildableEnvelope.d.ts.map +1 -1
  51. package/dist/api/presentation/aiInspiration.d.ts +10 -10
  52. package/dist/api/presentation/annotate.d.ts +38 -22
  53. package/dist/api/presentation/annotate.d.ts.map +1 -1
  54. package/dist/api/presentation/drawingContract.d.ts +32 -0
  55. package/dist/api/presentation/drawingContract.d.ts.map +1 -0
  56. package/dist/api/presentation/drawings.d.ts +3523 -0
  57. package/dist/api/presentation/drawings.d.ts.map +1 -0
  58. package/dist/api/presentation/export.d.ts +23 -5
  59. package/dist/api/presentation/export.d.ts.map +1 -1
  60. package/dist/api/presentation/index.d.ts +41 -12
  61. package/dist/api/presentation/index.d.ts.map +1 -1
  62. package/dist/api/presentation/placedViews.d.ts +106 -6
  63. package/dist/api/presentation/placedViews.d.ts.map +1 -1
  64. package/dist/api/presentation/sections.d.ts +461 -0
  65. package/dist/api/presentation/sections.d.ts.map +1 -0
  66. package/dist/api/presentation/shapes.d.ts +2 -2
  67. package/dist/api/presentation/sheets.d.ts +175 -19
  68. package/dist/api/presentation/sheets.d.ts.map +1 -1
  69. package/dist/api/presentation/viewPresets.d.ts +222 -0
  70. package/dist/api/presentation/viewPresets.d.ts.map +1 -0
  71. package/dist/api/presentation/views.d.ts +141 -8
  72. package/dist/api/presentation/views.d.ts.map +1 -1
  73. package/dist/api/presentation/walkthroughs.d.ts +6 -6
  74. package/dist/errors/codes.d.ts +3 -1
  75. package/dist/errors/codes.d.ts.map +1 -1
  76. package/dist/index.cjs +3883 -2385
  77. package/dist/index.cjs.map +1 -1
  78. package/dist/index.js +3744 -2385
  79. package/dist/index.js.map +1 -1
  80. package/package.json +1 -1
  81. package/scripts/check-dist-fresh.mjs +22 -22
  82. package/scripts/generate-manifest.mjs +243 -238
  83. package/scripts/generate-manifest.test.mjs +303 -303
  84. package/src/api/analysis/daylight.ts +470 -470
  85. package/src/api/analysis/heatmaps.ts +683 -683
  86. package/src/api/analysis/illuminance.ts +155 -155
  87. package/src/api/analysis/index.ts +61 -61
  88. package/src/api/analysis/shadows.ts +183 -183
  89. package/src/api/analysis/solar.ts +237 -237
  90. package/src/api/analysis/sunlightHours.ts +211 -211
  91. package/src/api/analysis/sunpath.ts +83 -83
  92. package/src/api/analysis/weather.ts +179 -179
  93. package/src/api/core/buildings.ts +485 -485
  94. package/src/api/core/camera/index.ts +696 -667
  95. package/src/api/core/comment/index.ts +376 -376
  96. package/src/api/core/geom/create/index.ts +2139 -2133
  97. package/src/api/core/geom/delete/index.ts +84 -84
  98. package/src/api/core/geom/index.ts +35 -35
  99. package/src/api/core/geom/query/arc.ts +169 -169
  100. package/src/api/core/geom/query/brep.ts +621 -621
  101. package/src/api/core/geom/query/circle.ts +404 -404
  102. package/src/api/core/geom/query/contour.ts +540 -540
  103. package/src/api/core/geom/query/curve.ts +1102 -1102
  104. package/src/api/core/geom/query/edge.ts +130 -130
  105. package/src/api/core/geom/query/face.ts +508 -508
  106. package/src/api/core/geom/query/halfedge.ts +210 -210
  107. package/src/api/core/geom/query/index.ts +63 -63
  108. package/src/api/core/geom/query/profile.ts +473 -473
  109. package/src/api/core/geom/query/vertex.ts +205 -205
  110. package/src/api/core/geom/update/contour.ts +323 -317
  111. package/src/api/core/geom/update/curve.ts +209 -209
  112. package/src/api/core/geom/update/index.ts +29 -29
  113. package/src/api/core/geom/update/profile.ts +379 -379
  114. package/src/api/core/groups.ts +521 -521
  115. package/src/api/core/handles/index.ts +234 -234
  116. package/src/api/core/history/index.ts +84 -84
  117. package/src/api/core/index.ts +99 -99
  118. package/src/api/core/io/export/index.ts +126 -126
  119. package/src/api/core/io/import/index.ts +504 -504
  120. package/src/api/core/io/index.ts +42 -42
  121. package/src/api/core/io/job/index.ts +140 -140
  122. package/src/api/core/io/query/index.ts +71 -71
  123. package/src/api/core/io/terrain/index.ts +360 -360
  124. package/src/api/core/io/underlay/index.ts +705 -705
  125. package/src/api/core/layers.ts +540 -540
  126. package/src/api/core/math/index.ts +20 -20
  127. package/src/api/core/math/quat.ts +172 -172
  128. package/src/api/core/math/vec3.ts +179 -179
  129. package/src/api/core/mode/index.ts +108 -108
  130. package/src/api/core/project/index.ts +479 -479
  131. package/src/api/core/proposals/index.ts +570 -570
  132. package/src/api/core/storeys/index.ts +311 -308
  133. package/src/api/core/storeys/layers.ts +339 -339
  134. package/src/api/core/tags.ts +911 -911
  135. package/src/api/core/units/index.ts +164 -164
  136. package/src/api/core/user.ts +46 -46
  137. package/src/api/core/zoom/index.ts +64 -51
  138. package/src/api/design/bim.ts +210 -0
  139. package/src/api/design/boolean/index.ts +181 -179
  140. package/src/api/design/catalog.ts +203 -0
  141. package/src/api/design/create/bulk-items.ts +294 -254
  142. package/src/api/design/create/grids.ts +137 -137
  143. package/src/api/design/create/index.ts +2178 -1980
  144. package/src/api/design/create/opening-fields.ts +40 -37
  145. package/src/api/design/delete/index.ts +75 -74
  146. package/src/api/design/dimensions.ts +453 -453
  147. package/src/api/design/doors/index.ts +516 -500
  148. package/src/api/design/edit/index.ts +54 -54
  149. package/src/api/design/erase/index.ts +151 -151
  150. package/src/api/design/family.ts +1342 -704
  151. package/src/api/design/furniture/index.ts +319 -319
  152. package/src/api/design/grids.ts +237 -237
  153. package/src/api/design/index.ts +304 -274
  154. package/src/api/design/lock.ts +69 -69
  155. package/src/api/design/materials/index.ts +608 -608
  156. package/src/api/design/networks.ts +607 -0
  157. package/src/api/design/query/geometry/index.ts +319 -319
  158. package/src/api/design/query/grids.ts +197 -197
  159. package/src/api/design/query/index.ts +1236 -1226
  160. package/src/api/design/query/referenceLines.ts +52 -52
  161. package/src/api/design/query/spaces.ts +275 -275
  162. package/src/api/design/selection/index.ts +273 -273
  163. package/src/api/design/shared.ts +40 -40
  164. package/src/api/design/transform/index.ts +254 -254
  165. package/src/api/design/types/index.ts +163 -156
  166. package/src/api/design/update/index.ts +1096 -983
  167. package/src/api/design/visibility.ts +143 -143
  168. package/src/api/design/windows/index.ts +351 -333
  169. package/src/api/entity/buildableEnvelope.ts +397 -322
  170. package/src/api/entity/index.ts +30 -30
  171. package/src/api/entity/referenceLine.ts +235 -235
  172. package/src/api/entity/space.ts +612 -612
  173. package/src/api/entity/story.ts +517 -517
  174. package/src/api/index.ts +47 -47
  175. package/src/api/presentation/aiInspiration.ts +1116 -1116
  176. package/src/api/presentation/annotate.ts +417 -385
  177. package/src/api/presentation/camera.ts +289 -289
  178. package/src/api/presentation/diagrams.ts +194 -194
  179. package/src/api/presentation/drawingContract.ts +70 -0
  180. package/src/api/presentation/drawings.ts +1179 -0
  181. package/src/api/presentation/export.ts +134 -108
  182. package/src/api/presentation/import.ts +159 -159
  183. package/src/api/presentation/index.ts +160 -126
  184. package/src/api/presentation/placedViews.ts +1211 -1120
  185. package/src/api/presentation/sections.ts +420 -0
  186. package/src/api/presentation/shapes.ts +274 -274
  187. package/src/api/presentation/sheets.ts +746 -585
  188. package/src/api/presentation/slideshow.ts +134 -134
  189. package/src/api/presentation/tables.ts +84 -84
  190. package/src/api/presentation/viewPresets.ts +241 -0
  191. package/src/api/presentation/views.ts +742 -673
  192. package/src/api/presentation/walkthroughs.ts +1201 -1201
  193. package/src/api/program/adjacency.ts +164 -164
  194. package/src/api/program/areas.ts +408 -408
  195. package/src/api/program/classification.ts +138 -138
  196. package/src/api/program/cores.ts +83 -83
  197. package/src/api/program/departments.ts +517 -517
  198. package/src/api/program/index.ts +73 -73
  199. package/src/api/program/labels.ts +332 -332
  200. package/src/api/program/layout.ts +422 -422
  201. package/src/api/program/metadata.ts +364 -364
  202. package/src/api/program/metrics.ts +120 -120
  203. package/src/api/program/site.ts +748 -748
  204. package/src/api/program/spreadsheet.ts +2698 -2698
  205. package/src/api/workspace/index.ts +612 -612
  206. package/src/errors/codes.ts +143 -136
  207. package/src/errors/envelope.ts +75 -75
  208. package/src/errors/index.ts +21 -21
  209. package/src/errors/plugin-error.ts +134 -134
  210. package/src/handles.ts +297 -297
  211. package/src/host-utils.ts +67 -67
  212. package/src/index.ts +7 -7
  213. package/src/massParameters.ops.ts +246 -246
  214. package/src/massParameters.ts +427 -427
  215. package/src/types.ts +16 -16
  216. package/test/drawingContract.test.mjs +288 -0
  217. package/test/errors.test.mjs +185 -184
  218. package/test/massParameters.test.mjs +952 -952
  219. package/test/presentationViewSettings.test.mjs +85 -0
  220. package/tsconfig.json +22 -22
  221. package/tsup.config.ts +12 -12
@@ -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>