@snaptrude/plugin-core 0.11.0-rc.1 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +4 -0
- package/CHANGELOG.md +176 -14
- package/api-manifest.json +872 -49
- package/dist/api/analysis/daylight.d.ts +5 -5
- package/dist/api/analysis/solar.d.ts +2 -2
- package/dist/api/core/camera/index.d.ts +447 -0
- package/dist/api/core/camera/index.d.ts.map +1 -1
- package/dist/api/core/geom/create/index.d.ts +942 -101
- package/dist/api/core/geom/create/index.d.ts.map +1 -1
- package/dist/api/core/geom/query/brep.d.ts +59 -2
- package/dist/api/core/geom/query/brep.d.ts.map +1 -1
- package/dist/api/core/geom/query/curve.d.ts +59 -35
- package/dist/api/core/geom/query/curve.d.ts.map +1 -1
- package/dist/api/core/geom/query/edge.d.ts +2 -2
- package/dist/api/core/geom/query/face.d.ts +105 -0
- package/dist/api/core/geom/query/face.d.ts.map +1 -1
- package/dist/api/core/geom/update/contour.d.ts +10 -2
- package/dist/api/core/geom/update/contour.d.ts.map +1 -1
- package/dist/api/core/geom/update/curve.d.ts +5 -5
- package/dist/api/core/geom/update/profile.d.ts +3 -1
- package/dist/api/core/geom/update/profile.d.ts.map +1 -1
- package/dist/api/core/handles/index.d.ts +4 -2
- package/dist/api/core/handles/index.d.ts.map +1 -1
- package/dist/api/core/index.d.ts +4 -4
- package/dist/api/core/index.d.ts.map +1 -1
- package/dist/api/core/io/import/index.d.ts +3 -1
- package/dist/api/core/io/import/index.d.ts.map +1 -1
- package/dist/api/core/layers.d.ts +377 -255
- package/dist/api/core/layers.d.ts.map +1 -1
- package/dist/api/core/mode/index.d.ts +19 -7
- package/dist/api/core/mode/index.d.ts.map +1 -1
- package/dist/api/core/proposals/index.d.ts +4 -3
- package/dist/api/core/proposals/index.d.ts.map +1 -1
- package/dist/api/core/storeys/index.d.ts +17 -2
- package/dist/api/core/storeys/index.d.ts.map +1 -1
- package/dist/api/core/storeys/layers.d.ts +408 -0
- package/dist/api/core/storeys/layers.d.ts.map +1 -0
- package/dist/api/core/tags.d.ts +84 -3
- package/dist/api/core/tags.d.ts.map +1 -1
- package/dist/api/core/zoom/index.d.ts +13 -0
- package/dist/api/core/zoom/index.d.ts.map +1 -1
- package/dist/api/design/bim.d.ts +299 -0
- package/dist/api/design/bim.d.ts.map +1 -0
- package/dist/api/design/boolean/index.d.ts +2 -0
- package/dist/api/design/boolean/index.d.ts.map +1 -1
- package/dist/api/design/catalog.d.ts +320 -0
- package/dist/api/design/catalog.d.ts.map +1 -0
- package/dist/api/design/create/bulk-items.d.ts +269 -0
- package/dist/api/design/create/bulk-items.d.ts.map +1 -0
- package/dist/api/design/create/grids.d.ts +132 -0
- package/dist/api/design/create/grids.d.ts.map +1 -0
- package/dist/api/design/create/index.d.ts +753 -102
- package/dist/api/design/create/index.d.ts.map +1 -1
- package/dist/api/design/create/opening-fields.d.ts +38 -0
- package/dist/api/design/create/opening-fields.d.ts.map +1 -0
- package/dist/api/design/delete/index.d.ts +7 -20
- package/dist/api/design/delete/index.d.ts.map +1 -1
- package/dist/api/design/dimensions.d.ts +427 -0
- package/dist/api/design/dimensions.d.ts.map +1 -0
- package/dist/api/design/doors/index.d.ts +24 -23
- package/dist/api/design/doors/index.d.ts.map +1 -1
- package/dist/api/design/family.d.ts +1446 -0
- package/dist/api/design/family.d.ts.map +1 -0
- package/dist/api/design/grids.d.ts +237 -0
- package/dist/api/design/grids.d.ts.map +1 -0
- package/dist/api/design/index.d.ts +30 -0
- package/dist/api/design/index.d.ts.map +1 -1
- package/dist/api/design/networks.d.ts +1703 -0
- package/dist/api/design/networks.d.ts.map +1 -0
- package/dist/api/design/query/geometry/index.d.ts +33 -5
- package/dist/api/design/query/geometry/index.d.ts.map +1 -1
- package/dist/api/design/query/grids.d.ts +287 -0
- package/dist/api/design/query/grids.d.ts.map +1 -0
- package/dist/api/design/query/index.d.ts +143 -36
- package/dist/api/design/query/index.d.ts.map +1 -1
- package/dist/api/design/query/spaces.d.ts +5 -66
- package/dist/api/design/query/spaces.d.ts.map +1 -1
- package/dist/api/design/selection/index.d.ts +12 -12
- package/dist/api/design/types/index.d.ts +40 -24
- package/dist/api/design/types/index.d.ts.map +1 -1
- package/dist/api/design/update/index.d.ts +412 -8
- package/dist/api/design/update/index.d.ts.map +1 -1
- package/dist/api/design/windows/index.d.ts +8 -8
- package/dist/api/design/windows/index.d.ts.map +1 -1
- package/dist/api/entity/buildableEnvelope.d.ts +84 -2
- package/dist/api/entity/buildableEnvelope.d.ts.map +1 -1
- package/dist/api/entity/referenceLine.d.ts +13 -1
- package/dist/api/entity/referenceLine.d.ts.map +1 -1
- package/dist/api/entity/space.d.ts +12 -15
- package/dist/api/entity/space.d.ts.map +1 -1
- package/dist/api/entity/story.d.ts +4 -4
- package/dist/api/presentation/aiInspiration.d.ts +24 -24
- package/dist/api/presentation/annotate.d.ts +38 -22
- package/dist/api/presentation/annotate.d.ts.map +1 -1
- package/dist/api/presentation/camera.d.ts +265 -0
- package/dist/api/presentation/camera.d.ts.map +1 -0
- package/dist/api/presentation/drawingContract.d.ts +32 -0
- package/dist/api/presentation/drawingContract.d.ts.map +1 -0
- package/dist/api/presentation/drawings.d.ts +3523 -0
- package/dist/api/presentation/drawings.d.ts.map +1 -0
- package/dist/api/presentation/export.d.ts +23 -5
- package/dist/api/presentation/export.d.ts.map +1 -1
- package/dist/api/presentation/graphics.d.ts +419 -0
- package/dist/api/presentation/graphics.d.ts.map +1 -0
- package/dist/api/presentation/index.d.ts +66 -12
- package/dist/api/presentation/index.d.ts.map +1 -1
- package/dist/api/presentation/placedViews.d.ts +117 -51
- package/dist/api/presentation/placedViews.d.ts.map +1 -1
- package/dist/api/presentation/sections.d.ts +461 -0
- package/dist/api/presentation/sections.d.ts.map +1 -0
- package/dist/api/presentation/shapes.d.ts +2 -2
- package/dist/api/presentation/sheets.d.ts +175 -37
- package/dist/api/presentation/sheets.d.ts.map +1 -1
- package/dist/api/presentation/standards.d.ts +590 -0
- package/dist/api/presentation/standards.d.ts.map +1 -0
- package/dist/api/presentation/viewPresets.d.ts +222 -0
- package/dist/api/presentation/viewPresets.d.ts.map +1 -0
- package/dist/api/presentation/views.d.ts +144 -9
- package/dist/api/presentation/views.d.ts.map +1 -1
- package/dist/api/presentation/walkthroughs.d.ts +1350 -0
- package/dist/api/presentation/walkthroughs.d.ts.map +1 -0
- package/dist/api/program/departments.d.ts +58 -2
- package/dist/api/program/departments.d.ts.map +1 -1
- package/dist/api/program/index.d.ts +16 -6
- package/dist/api/program/index.d.ts.map +1 -1
- package/dist/api/program/labels.d.ts +355 -0
- package/dist/api/program/labels.d.ts.map +1 -0
- package/dist/api/program/metadata.d.ts +328 -0
- package/dist/api/program/metadata.d.ts.map +1 -0
- package/dist/api/program/site.d.ts +4 -4
- package/dist/api/program/spreadsheet.d.ts +267 -4
- package/dist/api/program/spreadsheet.d.ts.map +1 -1
- package/dist/api/workspace/index.d.ts +49 -2
- package/dist/api/workspace/index.d.ts.map +1 -1
- package/dist/errors/codes.d.ts +5 -8
- package/dist/errors/codes.d.ts.map +1 -1
- package/dist/handles.d.ts +32 -3
- package/dist/handles.d.ts.map +1 -1
- package/dist/index.cjs +6534 -2865
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6118 -2857
- package/dist/index.js.map +1 -1
- package/dist/massParameters.d.ts +287 -0
- package/dist/massParameters.d.ts.map +1 -0
- package/dist/massParameters.ops.d.ts +138 -0
- package/dist/massParameters.ops.d.ts.map +1 -0
- package/package.json +2 -1
- package/scripts/check-dist-fresh.mjs +22 -0
- package/scripts/generate-manifest.mjs +5 -0
- package/scripts/generate-manifest.test.mjs +14 -3
- package/src/api/core/camera/index.ts +429 -1
- package/src/api/core/geom/create/index.ts +1037 -102
- package/src/api/core/geom/query/brep.ts +60 -2
- package/src/api/core/geom/query/curve.ts +26 -2
- package/src/api/core/geom/query/edge.ts +2 -2
- package/src/api/core/geom/query/face.ts +109 -4
- package/src/api/core/geom/update/contour.ts +10 -2
- package/src/api/core/geom/update/profile.ts +2 -0
- package/src/api/core/handles/index.ts +3 -2
- package/src/api/core/index.ts +4 -4
- package/src/api/core/io/import/index.ts +11 -3
- package/src/api/core/layers.ts +380 -173
- package/src/api/core/mode/index.ts +19 -7
- package/src/api/core/proposals/index.ts +4 -3
- package/src/api/core/storeys/index.ts +19 -2
- package/src/api/core/storeys/layers.ts +339 -0
- package/src/api/core/tags.ts +76 -0
- package/src/api/core/zoom/index.ts +13 -0
- package/src/api/design/bim.ts +210 -0
- package/src/api/design/boolean/index.ts +2 -0
- package/src/api/design/catalog.ts +203 -0
- package/src/api/design/create/bulk-items.ts +294 -0
- package/src/api/design/create/grids.ts +137 -0
- package/src/api/design/create/index.ts +824 -141
- package/src/api/design/create/opening-fields.ts +40 -0
- package/src/api/design/delete/index.ts +6 -20
- package/src/api/design/dimensions.ts +453 -0
- package/src/api/design/doors/index.ts +64 -41
- package/src/api/design/family.ts +1342 -0
- package/src/api/design/grids.ts +237 -0
- package/src/api/design/index.ts +49 -4
- package/src/api/design/networks.ts +607 -0
- package/src/api/design/query/geometry/index.ts +35 -4
- package/src/api/design/query/grids.ts +197 -0
- package/src/api/design/query/index.ts +105 -5
- package/src/api/design/query/spaces.ts +0 -68
- package/src/api/design/types/index.ts +31 -24
- package/src/api/design/update/index.ts +398 -4
- package/src/api/design/windows/index.ts +40 -22
- package/src/api/entity/buildableEnvelope.ts +77 -2
- package/src/api/entity/referenceLine.ts +25 -12
- package/src/api/entity/space.ts +0 -2
- package/src/api/presentation/annotate.ts +90 -58
- package/src/api/presentation/camera.ts +289 -0
- package/src/api/presentation/drawingContract.ts +70 -0
- package/src/api/presentation/drawings.ts +1179 -0
- package/src/api/presentation/export.ts +32 -6
- package/src/api/presentation/graphics.ts +324 -0
- package/src/api/presentation/index.ts +73 -14
- package/src/api/presentation/placedViews.ts +120 -57
- package/src/api/presentation/sections.ts +420 -0
- package/src/api/presentation/sheets.ts +182 -37
- package/src/api/presentation/standards.ts +445 -0
- package/src/api/presentation/viewPresets.ts +241 -0
- package/src/api/presentation/views.ts +81 -10
- package/src/api/presentation/walkthroughs.ts +1201 -0
- package/src/api/program/departments.ts +54 -2
- package/src/api/program/index.ts +16 -6
- package/src/api/program/labels.ts +332 -0
- package/src/api/program/metadata.ts +364 -0
- package/src/api/program/spreadsheet.ts +282 -0
- package/src/api/workspace/index.ts +51 -2
- package/src/errors/codes.ts +9 -30
- package/src/handles.ts +42 -3
- package/src/index.ts +2 -0
- package/src/massParameters.ops.ts +246 -0
- package/src/massParameters.ts +427 -0
- package/test/drawingContract.test.mjs +288 -0
- package/test/errors.test.mjs +1 -4
- package/test/massParameters.test.mjs +952 -0
- package/test/paperPensContract.test.mjs +75 -0
- package/test/presentationViewSettings.test.mjs +85 -0
- package/api-manifest.full.json +0 -6928
- package/snaptrude-plugin-core-0.11.0.tgz +0 -0
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as z from "zod"
|
|
2
2
|
import { PluginApiReturn } from "../../types"
|
|
3
|
+
import { PluginStandardDrawingScale } from "./drawingContract"
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* Presentation sheets — the layout sheets a presentation is assembled on.
|
|
@@ -10,9 +11,16 @@ import { PluginApiReturn } from "../../types"
|
|
|
10
11
|
*
|
|
11
12
|
* `list`/`get` are reads; the rest mutate and require Present mode to be open:
|
|
12
13
|
* `create` adds a sheet, `place` drops a saved view onto a sheet as a live
|
|
13
|
-
* linked view shape
|
|
14
|
-
*
|
|
15
|
-
* `
|
|
14
|
+
* linked view shape (fitted to that sheet), `placeDrawing` moves an existing
|
|
15
|
+
* drawing onto a sheet (scaled down to fit by default), `rename` relabels a
|
|
16
|
+
* sheet, `delete` removes one, `reorder` moves one in the sheet order,
|
|
17
|
+
* `setActive` navigates to one, and `updatePlacedView` re-renders placed views
|
|
18
|
+
* to the current model.
|
|
19
|
+
*
|
|
20
|
+
* `presentation.drawings.create` never puts a drawing on a sheet: it makes the
|
|
21
|
+
* drawing beside its source view on the canvas. To put a view on a sheet, call
|
|
22
|
+
* `place(sheetId, viewId)`; to move a drawing you already made, call
|
|
23
|
+
* `placeDrawing(sheetId, drawingId)`.
|
|
16
24
|
*
|
|
17
25
|
* Accessed via `snaptrude.presentation.sheets`.
|
|
18
26
|
*/
|
|
@@ -155,38 +163,75 @@ export abstract class PluginPresentationSheetsApi {
|
|
|
155
163
|
): PluginApiReturn<PluginPresentationSheet>
|
|
156
164
|
|
|
157
165
|
/**
|
|
158
|
-
* Place a saved view onto a sheet.
|
|
166
|
+
* Place a saved view onto a sheet. This is the call that puts a view on a
|
|
167
|
+
* sheet (`presentation.drawings.create` makes a drawing beside its source
|
|
168
|
+
* view, not on a sheet). When `scale` is omitted the view is fitted to the
|
|
169
|
+
* target sheet: a 2D or site-plan view is placed at the largest
|
|
170
|
+
* standard scale at which it fits inside the target sheet's margin, and
|
|
171
|
+
* never at a larger scale than the normal view drop would pick; a 3D view
|
|
172
|
+
* has no scale, so it is shrunk evenly to fit instead. This is the same fit
|
|
173
|
+
* as `placeDrawing`. Omit `position` unless the user asked for a specific
|
|
174
|
+
* place.
|
|
175
|
+
* Without a `position` the drawing goes to the sheet centre when that is
|
|
176
|
+
* free, otherwise to the nearest free spot to the centre inside the margin,
|
|
177
|
+
* beside the drawings already there; when there is no free spot it is
|
|
178
|
+
* centred anyway and the result has `overlaps: true`. With a `position` it
|
|
179
|
+
* is placed as given, and the result has `overlaps: true` when it covers
|
|
180
|
+
* another drawing, but it is not moved. In both cases only other drawings
|
|
181
|
+
* count (placed views and their title blocks and labels): text, images and
|
|
182
|
+
* other shapes on the sheet are ignored. Each call fits one view to the
|
|
183
|
+
* whole sheet, so a second fitted view often has no free spot: when several
|
|
184
|
+
* views should share a sheet, pass a `scale` small enough for all of them;
|
|
185
|
+
* otherwise use `sheets.create` per view. When the result's `overlaps` is
|
|
186
|
+
* true, move the drawing or put it on its own sheet.
|
|
187
|
+
* An explicit `scale` is always kept, even when the drawing (title block
|
|
188
|
+
* included) does not fit inside the sheet's margin at that scale; the result
|
|
189
|
+
* then has `overflows: true`. When it is true, pass a smaller scale (larger
|
|
190
|
+
* denominator), omit `scale` to fit, or use a larger sheet.
|
|
191
|
+
* `scale` must be a standard architectural scale denominator (100 means 1:100)
|
|
192
|
+
* in the project's unit system; any other value is rejected. Metric: 10, 20, 50,
|
|
193
|
+
* 100, 150, 200, 250, 500, 1000. Imperial detail: 12, 16, 24, 32, 48, 64, 96, 128,
|
|
194
|
+
* 192, 384, 768, 1536 (1" = 1' to 1/128" = 1'; 48 is 1/4" = 1', 96 is 1/8" = 1').
|
|
195
|
+
* Imperial site: 120, 240, 360, 480, 600, 1200, 2400, 3600, 4800 (1" = 10' to
|
|
196
|
+
* 1" = 400'). Pick the LARGEST standard scale (smallest denominator) at which the
|
|
197
|
+
* view still fits its frame or sheet and its room labels stay readable: for a
|
|
198
|
+
* building floor plan that is usually 1:50 to 1:200 (1/4" = 1' to 1/16" = 1').
|
|
199
|
+
* Never use a site-sized scale (1:500 and up, 1/64" = 1' (768) and smaller,
|
|
200
|
+
* 1" = 20' (240) and up) for a single building plan unless the user asked for it.
|
|
159
201
|
*
|
|
160
202
|
* Drops the given view onto the sheet through the **native view drop** — the
|
|
161
203
|
* placed shape is a live linked view (the same shape the Present views panel's
|
|
162
204
|
* drag-drop creates), re-rendered from the current model, so
|
|
163
205
|
* {@linkcode PluginPresentationSheetsApi.updatePlacedView} refreshes it later.
|
|
164
|
-
* 2D and site-plan views are placed at an architectural scale: the
|
|
165
|
-
* standard scale by default
|
|
166
|
-
*
|
|
167
|
-
*
|
|
168
|
-
* 250, 500, 1000`; imperial e.g. `48` for 1/4″ = 1′, `96` for 1/8″ = 1′,
|
|
169
|
-
* `120` for 1″ = 10′). 3D views have no scale — passing `scale` for one
|
|
170
|
-
* throws. Requires Present mode to be open.
|
|
206
|
+
* 2D and site-plan views are placed at an architectural scale: the fitted
|
|
207
|
+
* standard scale described above by default, or the explicit `scale` when
|
|
208
|
+
* given (one of the standard values above). 3D views have no scale; passing
|
|
209
|
+
* `scale` for one throws. Requires Present mode to be open.
|
|
171
210
|
*
|
|
172
211
|
* @param sheetId - The id of the sheet to place onto.
|
|
173
212
|
* @param viewId - The id of the saved view to place.
|
|
174
213
|
* @param options - Optional `position` ({@linkcode PluginSheetPosition}) —
|
|
175
|
-
* where to place it (
|
|
176
|
-
* scale value for the project's unit system (2D/site-plan views only;
|
|
177
|
-
*
|
|
178
|
-
* of the placed view (default: the product's Design default).
|
|
214
|
+
* where to place it (when omitted, the sheet centre or the nearest free
|
|
215
|
+
* spot) — and `scale` — a standard scale value for the project's unit system (2D/site-plan views only;
|
|
216
|
+
* fitted to the target sheet when omitted).
|
|
179
217
|
* @returns A {@linkcode PluginPresentationSheetsPlaceResult} with the created
|
|
180
|
-
* `shapeId
|
|
218
|
+
* `shapeId`, the `scale` used (`null` for a 3D view), whether the fit
|
|
219
|
+
* `rescaled` it, whether it `overlaps` another drawing on the sheet, and
|
|
220
|
+
* whether it `overflows` the sheet's margin at an explicit `scale`.
|
|
221
|
+
* (Hosts older than the fit return only `shapeId`.)
|
|
181
222
|
* @throws If Present mode is not open, the sheet/view id is invalid, `scale`
|
|
182
223
|
* is not a standard value for the project's unit system, or `scale` is
|
|
183
|
-
* passed for a 3D view.
|
|
224
|
+
* passed for a 3D view. `PRECONDITION_FAILED` when the view does not fit
|
|
225
|
+
* the sheet even at the smallest standard scale, or the title block alone
|
|
226
|
+
* is larger than the sheet's drawable area (use a larger sheet); no
|
|
227
|
+
* drawing is left on the sheet.
|
|
184
228
|
*
|
|
185
229
|
* @examplePrompt Place the floor plan on Sheet 1
|
|
186
230
|
* @examplePrompt Add this 3D view to the cover sheet
|
|
187
231
|
* @examplePrompt Drop the site plan onto the layout sheet at 100, 200
|
|
188
232
|
* @examplePrompt Put the Ground Floor view on sheet_1 at 1:100 scale
|
|
189
233
|
* @examplePrompt Place the plan on the cover sheet at quarter-inch scale
|
|
234
|
+
* @examplePrompt Add a floor plan drawing of each storey to this sheet
|
|
190
235
|
*
|
|
191
236
|
* # Example
|
|
192
237
|
* ```ts
|
|
@@ -198,13 +243,75 @@ export abstract class PluginPresentationSheetsApi {
|
|
|
198
243
|
public abstract place(
|
|
199
244
|
sheetId: string,
|
|
200
245
|
viewId: string,
|
|
201
|
-
options?: {
|
|
202
|
-
position?: PluginSheetPosition
|
|
203
|
-
scale?: number
|
|
204
|
-
lod?: PluginViewLod
|
|
205
|
-
},
|
|
246
|
+
options?: { position?: PluginSheetPosition; scale?: number },
|
|
206
247
|
): PluginApiReturn<PluginPresentationSheetsPlaceResult>
|
|
207
248
|
|
|
249
|
+
/**
|
|
250
|
+
* Move an existing drawing onto a sheet without copying or regenerating it,
|
|
251
|
+
* scaled down to fit the sheet when it is too big. `presentation.drawings.create`
|
|
252
|
+
* leaves a drawing beside its source view, not on a sheet; this is the call
|
|
253
|
+
* that puts it on one. To place a saved view on a sheet in one call, use
|
|
254
|
+
* `sheets.place(sheetId, viewId)`, which fits it the same way.
|
|
255
|
+
* By default (`fit` true or omitted) a drawing larger than the sheet's
|
|
256
|
+
* drawable area (the sheet inside its margin) is moved to the LARGEST standard
|
|
257
|
+
* architectural scale at which it fits; a drawing that already fits keeps its
|
|
258
|
+
* scale, and a drawing is never scaled up. A 3D drawing has no architectural
|
|
259
|
+
* scale, so it is shrunk uniformly to fit instead. With `fit: false` the scale
|
|
260
|
+
* is kept and a drawing that does not fit is rejected with an error naming the
|
|
261
|
+
* drawing, the sheet and the scale, and saying to call `placeDrawing` without
|
|
262
|
+
* `fit: false` to fit it, or use a larger sheet. When even
|
|
263
|
+
* the smallest standard scale does not fit, the call is rejected with an error
|
|
264
|
+
* suggesting a larger sheet size.
|
|
265
|
+
* Without a `position` the drawing goes to the sheet centre when that is
|
|
266
|
+
* free, otherwise to the nearest free spot to the centre inside the margin,
|
|
267
|
+
* beside the drawings already there; when there is no free spot it is
|
|
268
|
+
* centred anyway and the result has `overlaps: true`. With a `position` it
|
|
269
|
+
* is placed as given, and the result has `overlaps: true` when it covers
|
|
270
|
+
* another drawing, but it is not moved. In both cases only other drawings
|
|
271
|
+
* count (placed views and their title blocks and labels): text, images and
|
|
272
|
+
* other shapes on the sheet are ignored. Each call fits one drawing to the
|
|
273
|
+
* whole sheet, so a second fitted drawing often has no free spot: when
|
|
274
|
+
* several drawings should share a sheet, give them scales small enough for
|
|
275
|
+
* all of them; otherwise use `sheets.create` per drawing.
|
|
276
|
+
* The position is sheet-local. The drawing's
|
|
277
|
+
* stable id remains unchanged; `shapeId` therefore identifies the moved
|
|
278
|
+
* drawing. The result reports the architectural scale the drawing has on the
|
|
279
|
+
* sheet and whether this call changed it; a host that reports it also says
|
|
280
|
+
* whether the drawing `overlaps` another drawing on the sheet (move it or
|
|
281
|
+
* put it on its own sheet when true).
|
|
282
|
+
*
|
|
283
|
+
* @param sheetId - The id of the destination sheet.
|
|
284
|
+
* @param drawingId - The id of an existing drawing deliverable.
|
|
285
|
+
* @param options - Optional sheet-local `position` (when omitted, the sheet centre or the nearest free spot)
|
|
286
|
+
* and `fit` (default `true`: scale a drawing that does not fit down to fit;
|
|
287
|
+
* `false`: keep its scale and reject a drawing that does not fit).
|
|
288
|
+
* @returns A {@linkcode PluginPresentationSheetsPlaceDrawingResult} with the
|
|
289
|
+
* drawing's `shapeId`, the `scale` used (`null` for a 3D drawing),
|
|
290
|
+
* `rescaled`, and optionally `overlaps`.
|
|
291
|
+
* @throws `PRECONDITION_FAILED` if Present mode is closed, the sheet is locked,
|
|
292
|
+
* the drawing does not fit with `fit: false`, or it does not fit even at the
|
|
293
|
+
* smallest standard scale; `HANDLE_INVALID` if either id is invalid or the
|
|
294
|
+
* shape is not a drawing.
|
|
295
|
+
*
|
|
296
|
+
* @examplePrompt Move this drawing onto the cover sheet
|
|
297
|
+
* @examplePrompt Place drawing_1 at the center of sheet_2
|
|
298
|
+
* @examplePrompt Put the level 2 plan drawing on the Level 2 Plan sheet
|
|
299
|
+
* @examplePrompt Add the floor plan drawings to this sheet
|
|
300
|
+
*
|
|
301
|
+
* # Example
|
|
302
|
+
* ```ts
|
|
303
|
+
* const { scale, rescaled } = await snaptrude.presentation.sheets.placeDrawing(
|
|
304
|
+
* sheet.id,
|
|
305
|
+
* drawing.id,
|
|
306
|
+
* )
|
|
307
|
+
* ```
|
|
308
|
+
*/
|
|
309
|
+
public abstract placeDrawing(
|
|
310
|
+
sheetId: string,
|
|
311
|
+
drawingId: string,
|
|
312
|
+
options?: { position?: PluginSheetPosition; fit?: boolean },
|
|
313
|
+
): PluginApiReturn<PluginPresentationSheetsPlaceDrawingResult>
|
|
314
|
+
|
|
208
315
|
/**
|
|
209
316
|
* Rename a layout sheet.
|
|
210
317
|
*
|
|
@@ -413,15 +520,6 @@ export const PluginSheetPosition = z.object({
|
|
|
413
520
|
})
|
|
414
521
|
export type PluginSheetPosition = z.infer<typeof PluginSheetPosition>
|
|
415
522
|
|
|
416
|
-
/**
|
|
417
|
-
* The level of detail a placed view renders at: `"design"` (the Design-mode
|
|
418
|
-
* massing representation) or `"bim"` (the detailed BIM representation).
|
|
419
|
-
* Shared by `sheets.place` and `placedViews.*` (defined here because
|
|
420
|
-
* `placedViews` already imports from this module).
|
|
421
|
-
*/
|
|
422
|
-
export const PluginViewLod = z.enum(["design", "bim"])
|
|
423
|
-
export type PluginViewLod = z.infer<typeof PluginViewLod>
|
|
424
|
-
|
|
425
523
|
/** Result of {@linkcode PluginPresentationSheetsApi.list}. */
|
|
426
524
|
export const PluginPresentationSheetsListResult = z.object({
|
|
427
525
|
sheets: z.array(PluginPresentationSheet),
|
|
@@ -481,35 +579,82 @@ export type PluginPresentationSheetsSetMarginArgs = z.infer<
|
|
|
481
579
|
* |---|---|---|
|
|
482
580
|
* | `sheetId` | `string` | The sheet to place onto |
|
|
483
581
|
* | `viewId` | `string` | The saved view to place |
|
|
484
|
-
* | `position` | {@linkcode PluginSheetPosition}` \| undefined` | Where to place it (sheet centre
|
|
485
|
-
* | `scale` | `number \| undefined` | Standard scale value for the project's unit system (2D/site-plan views only;
|
|
486
|
-
* | `lod` | {@linkcode PluginViewLod}` \| undefined` | LOD of the placed view (default: the product's Design default) |
|
|
582
|
+
* | `position` | {@linkcode PluginSheetPosition}` \| undefined` | Where to place it (when omitted, the sheet centre or the nearest free spot) |
|
|
583
|
+
* | `scale` | `number \| undefined` | Standard scale value for the project's unit system (2D/site-plan views only; when omitted, the largest standard scale that fits inside the target sheet's margin, never larger than the normal view drop's) |
|
|
487
584
|
*/
|
|
488
585
|
export const PluginPresentationSheetsPlaceArgs = z.object({
|
|
489
586
|
sheetId: z.string(),
|
|
490
587
|
viewId: z.string(),
|
|
491
588
|
position: PluginSheetPosition.optional(),
|
|
492
|
-
scale:
|
|
493
|
-
lod: PluginViewLod.optional(),
|
|
589
|
+
scale: PluginStandardDrawingScale.optional(),
|
|
494
590
|
})
|
|
495
591
|
export type PluginPresentationSheetsPlaceArgs = z.infer<
|
|
496
592
|
typeof PluginPresentationSheetsPlaceArgs
|
|
497
593
|
>
|
|
498
594
|
|
|
499
595
|
/**
|
|
500
|
-
*
|
|
596
|
+
* Arguments for {@linkcode PluginPresentationSheetsApi.placeDrawing}.
|
|
597
|
+
*
|
|
598
|
+
* | Property | Type | Description |
|
|
599
|
+
* |---|---|---|
|
|
600
|
+
* | `sheetId` | `string` | The destination sheet |
|
|
601
|
+
* | `drawingId` | `string` | The existing drawing to move |
|
|
602
|
+
* | `position` | {@linkcode PluginSheetPosition}` \| undefined` | Sheet-local position (when omitted, the sheet centre or the nearest free spot) |
|
|
603
|
+
* | `fit` | `boolean \| undefined` | `true` (default) scales a drawing that does not fit down to fit; `false` keeps its scale and rejects a drawing that does not fit |
|
|
604
|
+
*/
|
|
605
|
+
export const PluginPresentationSheetsPlaceDrawingArgs = z.object({
|
|
606
|
+
sheetId: z.string().min(1),
|
|
607
|
+
drawingId: z.string().min(1),
|
|
608
|
+
position: PluginSheetPosition.optional(),
|
|
609
|
+
fit: z.boolean().optional(),
|
|
610
|
+
})
|
|
611
|
+
export type PluginPresentationSheetsPlaceDrawingArgs = z.infer<
|
|
612
|
+
typeof PluginPresentationSheetsPlaceDrawingArgs
|
|
613
|
+
>
|
|
614
|
+
|
|
615
|
+
/**
|
|
616
|
+
* Result of {@linkcode PluginPresentationSheetsApi.place}. The host returns
|
|
617
|
+
* `scale` and `rescaled` (and `overlaps`, `overflows`); they are optional only
|
|
618
|
+
* because hosts that predate the fit report `shapeId` alone.
|
|
501
619
|
*
|
|
502
620
|
* | Property | Type | Description |
|
|
503
621
|
* |---|---|---|
|
|
504
622
|
* | `shapeId` | `string` | Id of the created canvas shape |
|
|
623
|
+
* | `scale` | `number \| null \| undefined` | Architectural scale denominator the view has on the sheet (`null` for a 3D view) |
|
|
624
|
+
* | `rescaled` | `boolean \| undefined` | Whether the fit changed the view's size from the normal view drop's |
|
|
625
|
+
* | `overlaps` | `boolean \| undefined` | Whether the placed drawing overlaps another drawing on the sheet (only drawings count, not text, images or other shapes) |
|
|
626
|
+
* | `overflows` | `boolean \| undefined` | `true` when the drawing, title block included, does not fit inside the sheet's margin at the explicit `scale` passed (the scale is kept); absent otherwise |
|
|
505
627
|
*/
|
|
506
628
|
export const PluginPresentationSheetsPlaceResult = z.object({
|
|
507
629
|
shapeId: z.string(),
|
|
630
|
+
scale: z.number().finite().nullable().optional(),
|
|
631
|
+
rescaled: z.boolean().optional(),
|
|
632
|
+
overlaps: z.boolean().optional(),
|
|
633
|
+
overflows: z.boolean().optional(),
|
|
508
634
|
})
|
|
509
635
|
export type PluginPresentationSheetsPlaceResult = z.infer<
|
|
510
636
|
typeof PluginPresentationSheetsPlaceResult
|
|
511
637
|
>
|
|
512
638
|
|
|
639
|
+
/**
|
|
640
|
+
* Result of {@linkcode PluginPresentationSheetsApi.placeDrawing}.
|
|
641
|
+
*
|
|
642
|
+
* | Property | Type | Description |
|
|
643
|
+
* |---|---|---|
|
|
644
|
+
* | `shapeId` | `string` | Id of the moved drawing (the drawing id, unchanged) |
|
|
645
|
+
* | `scale` | `number \| null` | Architectural scale denominator the drawing has on the sheet (`null` for a 3D drawing) |
|
|
646
|
+
* | `rescaled` | `boolean` | Whether this call changed the drawing's size to fit the sheet |
|
|
647
|
+
* | `overlaps` | `boolean \| undefined` | Whether the drawing overlaps another drawing on the sheet (only drawings count, not text, images or other shapes) |
|
|
648
|
+
*/
|
|
649
|
+
export const PluginPresentationSheetsPlaceDrawingResult =
|
|
650
|
+
PluginPresentationSheetsPlaceResult.omit({ overflows: true }).extend({
|
|
651
|
+
scale: z.number().finite().nullable(),
|
|
652
|
+
rescaled: z.boolean(),
|
|
653
|
+
})
|
|
654
|
+
export type PluginPresentationSheetsPlaceDrawingResult = z.infer<
|
|
655
|
+
typeof PluginPresentationSheetsPlaceDrawingResult
|
|
656
|
+
>
|
|
657
|
+
|
|
513
658
|
/**
|
|
514
659
|
* Arguments for {@linkcode PluginPresentationSheetsApi.rename}.
|
|
515
660
|
*
|