@snaptrude/plugin-core 0.10.0 → 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 +187 -3
- package/api-manifest.json +929 -25
- 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 +463 -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/project/index.d.ts +68 -1
- package/dist/api/core/project/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 +31 -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 +752 -78
- 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 +5 -0
- 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/furniture/index.d.ts +33 -0
- package/dist/api/design/furniture/index.d.ts.map +1 -1
- 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 -34
- package/dist/api/design/query/index.d.ts.map +1 -1
- package/dist/api/design/query/spaces.d.ts +5 -5
- 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/visibility.d.ts +28 -0
- package/dist/api/design/visibility.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 -12
- 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 +116 -16
- 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 -19
- 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 +3 -1
- 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 +6539 -2804
- 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 +6121 -2801
- 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 +14 -13
- 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 +446 -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/project/index.ts +62 -1
- package/src/api/core/proposals/index.ts +4 -3
- package/src/api/core/storeys/index.ts +34 -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 +823 -114
- package/src/api/design/create/opening-fields.ts +40 -0
- package/src/api/design/delete/index.ts +5 -0
- 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/furniture/index.ts +34 -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 -3
- package/src/api/design/types/index.ts +31 -24
- package/src/api/design/update/index.ts +398 -4
- package/src/api/design/visibility.ts +34 -0
- 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/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 +119 -28
- package/src/api/presentation/sections.ts +420 -0
- package/src/api/presentation/sheets.ts +181 -20
- 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 +7 -0
- 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 -0
- package/test/massParameters.test.mjs +952 -0
- package/test/paperPensContract.test.mjs +75 -0
- package/test/presentationViewSettings.test.mjs +85 -0
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as z from "zod"
|
|
2
2
|
import { PluginApiReturn } from "../../types"
|
|
3
3
|
import { PluginSheetPosition } from "./sheets"
|
|
4
|
+
import { PluginStandardDrawingScale } from "./drawingContract"
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* Placed views — the view shapes already laid out on the Present canvas.
|
|
@@ -141,14 +142,21 @@ export abstract class PluginPresentationPlacedViewsApi {
|
|
|
141
142
|
|
|
142
143
|
/**
|
|
143
144
|
* Set a placed view's architectural scale.
|
|
145
|
+
* `scale` must be a standard architectural scale denominator (100 means 1:100)
|
|
146
|
+
* in the project's unit system; any other value is rejected. Metric: 10, 20, 50,
|
|
147
|
+
* 100, 150, 200, 250, 500, 1000. Imperial detail: 12, 16, 24, 32, 48, 64, 96, 128,
|
|
148
|
+
* 192, 384, 768, 1536 (1" = 1' to 1/128" = 1'; 48 is 1/4" = 1', 96 is 1/8" = 1').
|
|
149
|
+
* Imperial site: 120, 240, 360, 480, 600, 1200, 2400, 3600, 4800 (1" = 10' to
|
|
150
|
+
* 1" = 400'). Pick the LARGEST standard scale (smallest denominator) at which the
|
|
151
|
+
* view still fits its frame or sheet and its room labels stay readable: for a
|
|
152
|
+
* building floor plan that is usually 1:50 to 1:200 (1/4" = 1' to 1/16" = 1').
|
|
153
|
+
* Never use a site-sized scale (1:500 and up, 1/64" = 1' (768) and smaller,
|
|
154
|
+
* 1" = 20' (240) and up) for a single building plan unless the user asked for it.
|
|
144
155
|
*
|
|
145
156
|
* Applies a standard architectural scale — the same write the placed view's
|
|
146
157
|
* Scale dropdown performs. The view (and its labels) is resized about its
|
|
147
|
-
* top-left corner so it prints at the given scale
|
|
148
|
-
*
|
|
149
|
-
* 100, 150, 200, 250, 500, 1000`; imperial e.g. `48` for 1/4″ = 1′, `96`
|
|
150
|
-
* for 1/8″ = 1′, `120` for 1″ = 10′) — the same validation as
|
|
151
|
-
* `sheets.place`. 3D views have no architectural scale — calling this on
|
|
158
|
+
* top-left corner so it prints at the given scale (the same validation as
|
|
159
|
+
* `sheets.place`). 3D views have no architectural scale — calling this on
|
|
152
160
|
* one throws. Requires Present mode to be open.
|
|
153
161
|
*
|
|
154
162
|
* @param shapeId - The placed view shape to set the scale of.
|
|
@@ -741,7 +749,7 @@ export type PluginPresentationPlacedViewsScaleArgs = z.infer<
|
|
|
741
749
|
*/
|
|
742
750
|
export const PluginPresentationPlacedViewsSetScaleArgs = z.object({
|
|
743
751
|
shapeId: z.string(),
|
|
744
|
-
scale:
|
|
752
|
+
scale: PluginStandardDrawingScale,
|
|
745
753
|
})
|
|
746
754
|
export type PluginPresentationPlacedViewsSetScaleArgs = z.infer<
|
|
747
755
|
typeof PluginPresentationPlacedViewsSetScaleArgs
|
|
@@ -794,11 +802,28 @@ export const PluginViewSettingCategory = z.enum([
|
|
|
794
802
|
"Envelope",
|
|
795
803
|
"Facade/Mass",
|
|
796
804
|
"Dimension",
|
|
805
|
+
"Grid",
|
|
806
|
+
"Walls",
|
|
807
|
+
"Columns",
|
|
808
|
+
"Beams",
|
|
809
|
+
"Doors",
|
|
810
|
+
"Windows",
|
|
811
|
+
"Floors",
|
|
812
|
+
"Slabs",
|
|
813
|
+
"Roofs",
|
|
814
|
+
"Ceilings",
|
|
815
|
+
"Staircase",
|
|
816
|
+
"Furniture",
|
|
817
|
+
"Families",
|
|
818
|
+
"Underlay",
|
|
819
|
+
"Overlay",
|
|
797
820
|
"Reference Line",
|
|
798
821
|
"Adjacency Line",
|
|
799
822
|
"Landscape elements",
|
|
800
823
|
])
|
|
801
|
-
export type PluginViewSettingCategory = z.infer<
|
|
824
|
+
export type PluginViewSettingCategory = z.infer<
|
|
825
|
+
typeof PluginViewSettingCategory
|
|
826
|
+
>
|
|
802
827
|
|
|
803
828
|
/** The 7 line dash styles (mirrors the host's LINE_STYLES). */
|
|
804
829
|
export const PluginViewLineStyle = z.enum([
|
|
@@ -824,7 +849,7 @@ export type PluginViewLineStyle = z.infer<typeof PluginViewLineStyle>
|
|
|
824
849
|
* | `lineStyle` | {@linkcode PluginViewLineStyle}? | Dash pattern |
|
|
825
850
|
* | `lineColor` | `string`? | Line color, 6-digit hex (`#` optional) |
|
|
826
851
|
* | `dashLength` | `number`? | Dash-length multiplier (> 0; `1` = default) |
|
|
827
|
-
* | `lineWidth` | `number`? | Single line weight in mm (
|
|
852
|
+
* | `lineWidth` | `number`? | Single line weight in mm (Dimension: 0.05–0.7; otherwise non-negative) |
|
|
828
853
|
* | `cutWidth` | `number`? | Cut-line weight in mm |
|
|
829
854
|
* | `projectionWidth` | `number`? | Projection-line weight in mm |
|
|
830
855
|
* | `treeLineWidth` | `number`? | Tree line weight in mm (Landscape) |
|
|
@@ -857,8 +882,13 @@ export const PluginPlacedViewStylePatch = z
|
|
|
857
882
|
colorMode: z
|
|
858
883
|
.string()
|
|
859
884
|
.refine(
|
|
860
|
-
(v) =>
|
|
861
|
-
|
|
885
|
+
(v) =>
|
|
886
|
+
["department", "texture", "monochrome"].includes(v) ||
|
|
887
|
+
v.startsWith("tag:"),
|
|
888
|
+
{
|
|
889
|
+
message:
|
|
890
|
+
"colorMode must be department, texture, monochrome, or tag:<tagCategoryId>",
|
|
891
|
+
},
|
|
862
892
|
)
|
|
863
893
|
.optional(),
|
|
864
894
|
opacity: z.number().finite().min(0).max(100).optional(),
|
|
@@ -870,13 +900,42 @@ export const PluginPlacedViewStylePatch = z
|
|
|
870
900
|
viewStyle: z.enum(["NONE", "FILLET", "BUBBLE"]).optional(),
|
|
871
901
|
radius: z.number().finite().min(0).optional(),
|
|
872
902
|
inset: z.number().finite().min(0).optional(),
|
|
903
|
+
// Dimension lengths are plotted paper millimetres, independent of drawing scale.
|
|
904
|
+
markerKind: z
|
|
905
|
+
.enum(["architecturalTick", "openArrow", "closedArrow"])
|
|
906
|
+
.optional(),
|
|
907
|
+
markerSize: z.number().finite().min(0.5).max(6).optional(),
|
|
908
|
+
extensionLineVisible: z.boolean().optional(),
|
|
909
|
+
extensionLineStyle: PluginViewLineStyle.optional(),
|
|
910
|
+
extensionGap: z.number().finite().min(0).max(10).optional(),
|
|
911
|
+
extensionOvershoot: z.number().finite().min(0).max(10).optional(),
|
|
912
|
+
textColor: z
|
|
913
|
+
.string()
|
|
914
|
+
.regex(/^(inherit|#[0-9a-fA-F]{6})$/)
|
|
915
|
+
.optional(),
|
|
916
|
+
textGap: z.number().finite().min(0).max(10).optional(),
|
|
917
|
+
textPlacement: z.literal("above").optional(),
|
|
918
|
+
textMask: z.boolean().optional(),
|
|
919
|
+
textMaskColor: z
|
|
920
|
+
.string()
|
|
921
|
+
.regex(/^#[0-9a-fA-F]{6}$/)
|
|
922
|
+
.optional(),
|
|
923
|
+
textMaskPadding: z.number().finite().min(0).max(5).optional(),
|
|
873
924
|
})
|
|
874
925
|
.strict()
|
|
875
|
-
.refine((p) => Object.keys(p).length > 0, {
|
|
876
|
-
|
|
926
|
+
.refine((p) => Object.keys(p).length > 0, {
|
|
927
|
+
message: "patch must set at least one setting",
|
|
928
|
+
})
|
|
929
|
+
export type PluginPlacedViewStylePatch = z.infer<
|
|
930
|
+
typeof PluginPlacedViewStylePatch
|
|
931
|
+
>
|
|
877
932
|
|
|
878
933
|
/** Label types that carry typography in a category's Text tab. */
|
|
879
|
-
export const PluginViewLabelType = z.enum([
|
|
934
|
+
export const PluginViewLabelType = z.enum([
|
|
935
|
+
"objectLabels",
|
|
936
|
+
"department",
|
|
937
|
+
"areas",
|
|
938
|
+
])
|
|
880
939
|
export type PluginViewLabelType = z.infer<typeof PluginViewLabelType>
|
|
881
940
|
|
|
882
941
|
/** Typography patch for one label type. `fontSize` is in px. */
|
|
@@ -885,7 +944,10 @@ const PluginViewFontVariantPatch = z
|
|
|
885
944
|
fontFamily: z.string().min(1).optional(),
|
|
886
945
|
fontWeight: z
|
|
887
946
|
.string()
|
|
888
|
-
.regex(
|
|
947
|
+
.regex(
|
|
948
|
+
/^\d{3}$/,
|
|
949
|
+
'fontWeight must be a numeric string like "400" or "700"',
|
|
950
|
+
)
|
|
889
951
|
.optional(),
|
|
890
952
|
fontStyle: z.enum(["normal", "italic"]).optional(),
|
|
891
953
|
fontSize: z.number().finite().positive().max(200).optional(),
|
|
@@ -910,8 +972,12 @@ export const PluginPlacedViewFontStylesPatch = z
|
|
|
910
972
|
areas: PluginViewFontVariantPatch.optional(),
|
|
911
973
|
})
|
|
912
974
|
.strict()
|
|
913
|
-
.refine((p) => Object.keys(p).length > 0, {
|
|
914
|
-
|
|
975
|
+
.refine((p) => Object.keys(p).length > 0, {
|
|
976
|
+
message: "patch must set at least one field",
|
|
977
|
+
})
|
|
978
|
+
export type PluginPlacedViewFontStylesPatch = z.infer<
|
|
979
|
+
typeof PluginPlacedViewFontStylesPatch
|
|
980
|
+
>
|
|
915
981
|
|
|
916
982
|
/** Resolved font styles for one label type (fontSize in px). */
|
|
917
983
|
export type PluginViewFontVariant = {
|
|
@@ -961,12 +1027,25 @@ export type PluginPlacedViewStylesResult = {
|
|
|
961
1027
|
}
|
|
962
1028
|
|
|
963
1029
|
/** Arguments for {@link PluginPresentationPlacedViewsApi.updateStyles}. */
|
|
964
|
-
export const PluginPlacedViewsUpdateStylesArgs = z
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
1030
|
+
export const PluginPlacedViewsUpdateStylesArgs = z
|
|
1031
|
+
.object({
|
|
1032
|
+
shapeId: z.string().min(1),
|
|
1033
|
+
category: PluginViewSettingCategory,
|
|
1034
|
+
patch: PluginPlacedViewStylePatch,
|
|
1035
|
+
})
|
|
1036
|
+
.refine(
|
|
1037
|
+
({ category, patch }) =>
|
|
1038
|
+
category !== "Dimension" ||
|
|
1039
|
+
patch.lineWidth === undefined ||
|
|
1040
|
+
(patch.lineWidth >= 0.05 && patch.lineWidth <= 0.7),
|
|
1041
|
+
{
|
|
1042
|
+
message: "Dimension lineWidth must be between 0.05 and 0.7 paper mm",
|
|
1043
|
+
path: ["patch", "lineWidth"],
|
|
1044
|
+
},
|
|
1045
|
+
)
|
|
1046
|
+
export type PluginPlacedViewsUpdateStylesArgs = z.infer<
|
|
1047
|
+
typeof PluginPlacedViewsUpdateStylesArgs
|
|
1048
|
+
>
|
|
970
1049
|
|
|
971
1050
|
/** Arguments for {@link PluginPresentationPlacedViewsApi.updateFontStyles}. */
|
|
972
1051
|
export const PluginPlacedViewsUpdateFontStylesArgs = z.object({
|
|
@@ -1011,7 +1090,9 @@ export const PluginPlacedViewsMoveLabelArgs = z.object({
|
|
|
1011
1090
|
labelId: z.string().min(1),
|
|
1012
1091
|
position: PluginSheetPosition,
|
|
1013
1092
|
})
|
|
1014
|
-
export type PluginPlacedViewsMoveLabelArgs = z.infer<
|
|
1093
|
+
export type PluginPlacedViewsMoveLabelArgs = z.infer<
|
|
1094
|
+
typeof PluginPlacedViewsMoveLabelArgs
|
|
1095
|
+
>
|
|
1015
1096
|
|
|
1016
1097
|
/** Arguments for {@link PluginPresentationPlacedViewsApi.setLabelHidden}. */
|
|
1017
1098
|
export const PluginPlacedViewsSetLabelHiddenArgs = z.object({
|
|
@@ -1081,14 +1162,18 @@ export const PluginPlacedViewsMoveShapeArgs = z.object({
|
|
|
1081
1162
|
position: PluginSheetPosition,
|
|
1082
1163
|
sheetId: z.string().optional(),
|
|
1083
1164
|
})
|
|
1084
|
-
export type PluginPlacedViewsMoveShapeArgs = z.infer<
|
|
1165
|
+
export type PluginPlacedViewsMoveShapeArgs = z.infer<
|
|
1166
|
+
typeof PluginPlacedViewsMoveShapeArgs
|
|
1167
|
+
>
|
|
1085
1168
|
|
|
1086
1169
|
/** Arguments for {@link PluginPresentationPlacedViewsApi.resizeShape}. */
|
|
1087
1170
|
export const PluginPlacedViewsResizeShapeArgs = z.object({
|
|
1088
1171
|
shapeId: z.string().min(1),
|
|
1089
1172
|
factor: z.number().finite().min(0.01).max(100),
|
|
1090
1173
|
})
|
|
1091
|
-
export type PluginPlacedViewsResizeShapeArgs = z.infer<
|
|
1174
|
+
export type PluginPlacedViewsResizeShapeArgs = z.infer<
|
|
1175
|
+
typeof PluginPlacedViewsResizeShapeArgs
|
|
1176
|
+
>
|
|
1092
1177
|
|
|
1093
1178
|
/** Arguments for {@link PluginPresentationPlacedViewsApi.rotateShape}. */
|
|
1094
1179
|
export const PluginPresentationPlacedViewsRotateShapeArgs = z.object({
|
|
@@ -1103,18 +1188,24 @@ export type PluginPresentationPlacedViewsRotateShapeArgs = z.infer<
|
|
|
1103
1188
|
export const PluginPlacedViewsDeleteShapesArgs = z.object({
|
|
1104
1189
|
shapeIds: z.array(z.string().min(1)).min(1).max(500),
|
|
1105
1190
|
})
|
|
1106
|
-
export type PluginPlacedViewsDeleteShapesArgs = z.infer<
|
|
1191
|
+
export type PluginPlacedViewsDeleteShapesArgs = z.infer<
|
|
1192
|
+
typeof PluginPlacedViewsDeleteShapesArgs
|
|
1193
|
+
>
|
|
1107
1194
|
|
|
1108
1195
|
/** Arguments for {@link PluginPresentationPlacedViewsApi.setOpacity}. */
|
|
1109
1196
|
export const PluginPlacedViewsSetOpacityArgs = z.object({
|
|
1110
1197
|
shapeId: z.string().min(1),
|
|
1111
1198
|
opacity: z.number().finite().min(0).max(1),
|
|
1112
1199
|
})
|
|
1113
|
-
export type PluginPlacedViewsSetOpacityArgs = z.infer<
|
|
1200
|
+
export type PluginPlacedViewsSetOpacityArgs = z.infer<
|
|
1201
|
+
typeof PluginPlacedViewsSetOpacityArgs
|
|
1202
|
+
>
|
|
1114
1203
|
|
|
1115
1204
|
/** Arguments for {@link PluginPresentationPlacedViewsApi.setMask}. */
|
|
1116
1205
|
export const PluginPlacedViewsSetMaskArgs = z.object({
|
|
1117
1206
|
shapeId: z.string().min(1),
|
|
1118
1207
|
enabled: z.boolean(),
|
|
1119
1208
|
})
|
|
1120
|
-
export type PluginPlacedViewsSetMaskArgs = z.infer<
|
|
1209
|
+
export type PluginPlacedViewsSetMaskArgs = z.infer<
|
|
1210
|
+
typeof PluginPlacedViewsSetMaskArgs
|
|
1211
|
+
>
|
|
@@ -0,0 +1,420 @@
|
|
|
1
|
+
import * as z from "zod"
|
|
2
|
+
import type { PluginApiReturn } from "../../types"
|
|
3
|
+
import { Vec3Components } from "../../handles"
|
|
4
|
+
|
|
5
|
+
/** A point on the plan: world `x` and `z` in babylon units. */
|
|
6
|
+
export const PluginSectionPoint = z
|
|
7
|
+
.object({ x: z.number().finite(), z: z.number().finite() })
|
|
8
|
+
.strict()
|
|
9
|
+
export type PluginSectionPoint = z.infer<typeof PluginSectionPoint>
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* A section: a line drawn on the plan that cuts the model and looks one way
|
|
13
|
+
* along it.
|
|
14
|
+
*
|
|
15
|
+
* | Property | Type | Description |
|
|
16
|
+
* |---|---|---|
|
|
17
|
+
* | `sectionId` | `string` | The section's id |
|
|
18
|
+
* | `name` | `string` | Its name in the Views panel ("Section 1") |
|
|
19
|
+
* | `tagLabel` | `string` | What its heads are marked with on the plan ("A") |
|
|
20
|
+
* | `buildingId` | `string` | The building it belongs to |
|
|
21
|
+
* | `start` | {@linkcode PluginSectionPoint} | First head on the plan |
|
|
22
|
+
* | `end` | {@linkcode PluginSectionPoint} | Second head on the plan |
|
|
23
|
+
* | `isFlipped` | `boolean` | Looks the other way along the line |
|
|
24
|
+
* | `depth` | `number` | How far behind the line the view keeps, babylon units |
|
|
25
|
+
* | `base` | `number` | Bottom of the slice, world Y |
|
|
26
|
+
* | `top` | `number` | Top of the slice, world Y |
|
|
27
|
+
* | `isHidden` | `boolean` | The line is hidden on the plan |
|
|
28
|
+
* | `isLocked` | `boolean` | Geometry edits are refused |
|
|
29
|
+
* | `isActive` | `boolean` | It is the section view open now |
|
|
30
|
+
*/
|
|
31
|
+
export const PluginSection = z.object({
|
|
32
|
+
sectionId: z.string(),
|
|
33
|
+
name: z.string(),
|
|
34
|
+
tagLabel: z.string(),
|
|
35
|
+
buildingId: z.string(),
|
|
36
|
+
start: PluginSectionPoint,
|
|
37
|
+
end: PluginSectionPoint,
|
|
38
|
+
isFlipped: z.boolean(),
|
|
39
|
+
depth: z.number(),
|
|
40
|
+
base: z.number(),
|
|
41
|
+
top: z.number(),
|
|
42
|
+
isHidden: z.boolean(),
|
|
43
|
+
isLocked: z.boolean(),
|
|
44
|
+
isActive: z.boolean(),
|
|
45
|
+
})
|
|
46
|
+
export type PluginSection = z.infer<typeof PluginSection>
|
|
47
|
+
|
|
48
|
+
export const PluginSectionIdArgs = z
|
|
49
|
+
.object({ sectionId: z.string().min(1) })
|
|
50
|
+
.strict()
|
|
51
|
+
export type PluginSectionIdArgs = z.infer<typeof PluginSectionIdArgs>
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Options for {@linkcode PluginPresentationSectionsApi.create}.
|
|
55
|
+
*
|
|
56
|
+
* | Property | Type | Description |
|
|
57
|
+
* |---|---|---|
|
|
58
|
+
* | `name` | `string \| undefined` | Name in the Views panel (default: the next "Section N") |
|
|
59
|
+
* | `tagLabel` | `string \| undefined` | Head mark on the plan (default: the next free mark) |
|
|
60
|
+
* | `depth` | `number \| undefined` | How far behind the line the view keeps (default: to the far side of the model) |
|
|
61
|
+
* | `base` | `number \| undefined` | Bottom of the slice, world Y (default: the building's base) |
|
|
62
|
+
* | `top` | `number \| undefined` | Top of the slice, world Y (default: the building's top) |
|
|
63
|
+
* | `buildingId` | `string \| undefined` | Building it belongs to (default: the active one) |
|
|
64
|
+
* | `isActive` | `boolean \| undefined` | Open the section view once created (default `false`) |
|
|
65
|
+
*/
|
|
66
|
+
export const PluginSectionCreateOptions = z
|
|
67
|
+
.object({
|
|
68
|
+
name: z.string().trim().min(1).optional(),
|
|
69
|
+
tagLabel: z.string().trim().min(1).optional(),
|
|
70
|
+
depth: z.number().finite().positive().optional(),
|
|
71
|
+
base: z.number().finite().optional(),
|
|
72
|
+
top: z.number().finite().optional(),
|
|
73
|
+
buildingId: z.string().min(1).optional(),
|
|
74
|
+
isActive: z.boolean().optional(),
|
|
75
|
+
})
|
|
76
|
+
.strict()
|
|
77
|
+
export type PluginSectionCreateOptions = z.infer<
|
|
78
|
+
typeof PluginSectionCreateOptions
|
|
79
|
+
>
|
|
80
|
+
|
|
81
|
+
export const PluginSectionCreateArgs = z
|
|
82
|
+
.object({
|
|
83
|
+
start: PluginSectionPoint,
|
|
84
|
+
end: PluginSectionPoint,
|
|
85
|
+
options: PluginSectionCreateOptions.optional(),
|
|
86
|
+
})
|
|
87
|
+
.strict()
|
|
88
|
+
export type PluginSectionCreateArgs = z.infer<typeof PluginSectionCreateArgs>
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* The fields to change in {@linkcode PluginPresentationSectionsApi.update};
|
|
92
|
+
* omitted fields keep their value.
|
|
93
|
+
*
|
|
94
|
+
* | Property | Type | Description |
|
|
95
|
+
* |---|---|---|
|
|
96
|
+
* | `name` | `string \| undefined` | Name in the Views panel |
|
|
97
|
+
* | `tagLabel` | `string \| undefined` | Head mark on the plan |
|
|
98
|
+
* | `start` | {@linkcode PluginSectionPoint} `\| undefined` | First head |
|
|
99
|
+
* | `end` | {@linkcode PluginSectionPoint} `\| undefined` | Second head |
|
|
100
|
+
* | `isFlipped` | `boolean \| undefined` | Look the other way; without `depth`, the depth re-spans the model the new way |
|
|
101
|
+
* | `depth` | `number \| undefined` | View depth behind the line, > 0 |
|
|
102
|
+
* | `base` | `number \| undefined` | Bottom of the slice, world Y |
|
|
103
|
+
* | `top` | `number \| undefined` | Top of the slice, world Y; above `base` |
|
|
104
|
+
* | `isHidden` | `boolean \| undefined` | Hide the line on the plan |
|
|
105
|
+
*/
|
|
106
|
+
export const PluginSectionPatch = z
|
|
107
|
+
.object({
|
|
108
|
+
name: z.string().trim().min(1).optional(),
|
|
109
|
+
tagLabel: z.string().trim().min(1).optional(),
|
|
110
|
+
start: PluginSectionPoint.optional(),
|
|
111
|
+
end: PluginSectionPoint.optional(),
|
|
112
|
+
isFlipped: z.boolean().optional(),
|
|
113
|
+
depth: z.number().finite().positive().optional(),
|
|
114
|
+
base: z.number().finite().optional(),
|
|
115
|
+
top: z.number().finite().optional(),
|
|
116
|
+
isHidden: z.boolean().optional(),
|
|
117
|
+
})
|
|
118
|
+
.strict()
|
|
119
|
+
export type PluginSectionPatch = z.infer<typeof PluginSectionPatch>
|
|
120
|
+
|
|
121
|
+
export const PluginSectionUpdateArgs = PluginSectionIdArgs.extend({
|
|
122
|
+
patch: PluginSectionPatch,
|
|
123
|
+
})
|
|
124
|
+
export type PluginSectionUpdateArgs = z.infer<typeof PluginSectionUpdateArgs>
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Options for {@linkcode PluginPresentationSectionsApi.getCut}.
|
|
128
|
+
*
|
|
129
|
+
* | Property | Type | Description |
|
|
130
|
+
* |---|---|---|
|
|
131
|
+
* | `maxSegmentsPerElement` | `number \| undefined` | Outline segments to return per element, 0 to 2000 (default 0: none) |
|
|
132
|
+
*/
|
|
133
|
+
export const PluginSectionCutOptions = z
|
|
134
|
+
.object({
|
|
135
|
+
maxSegmentsPerElement: z.number().int().min(0).max(2000).optional(),
|
|
136
|
+
})
|
|
137
|
+
.strict()
|
|
138
|
+
export type PluginSectionCutOptions = z.infer<typeof PluginSectionCutOptions>
|
|
139
|
+
|
|
140
|
+
export const PluginSectionCutArgs = PluginSectionIdArgs.extend({
|
|
141
|
+
options: PluginSectionCutOptions.optional(),
|
|
142
|
+
})
|
|
143
|
+
export type PluginSectionCutArgs = z.infer<typeof PluginSectionCutArgs>
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* A rect on the cutting plane. `u` runs along the line from the first head
|
|
147
|
+
* (0) to the second (the line's length); `v` is world Y.
|
|
148
|
+
*/
|
|
149
|
+
export const PluginSectionExtent = z.object({
|
|
150
|
+
uMin: z.number(),
|
|
151
|
+
uMax: z.number(),
|
|
152
|
+
vMin: z.number(),
|
|
153
|
+
vMax: z.number(),
|
|
154
|
+
})
|
|
155
|
+
export type PluginSectionExtent = z.infer<typeof PluginSectionExtent>
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* One element a section cuts.
|
|
159
|
+
*
|
|
160
|
+
* | Property | Type | Description |
|
|
161
|
+
* |---|---|---|
|
|
162
|
+
* | `entityId` | `string` | The element's component id (a `ComponentHandle`) |
|
|
163
|
+
* | `type` | `string` | Its component type ("wall", "slab", "mass", …) |
|
|
164
|
+
* | `area` | `number` | Cut area inside the section's extents, square babylon units |
|
|
165
|
+
* | `perimeter` | `number` | Length of the cut outline inside the extents, babylon units |
|
|
166
|
+
* | `extent` | {@linkcode PluginSectionExtent} | Where the cut lies on the plane |
|
|
167
|
+
* | `isHatched` | `boolean` | `false` for masses and voids, which the drawing leaves unfilled |
|
|
168
|
+
* | `isOpening` | `boolean` | Doors and windows, which the drawing fills white |
|
|
169
|
+
* | `segments` | `[u0, v0, u1, v1][]` | Cut outline segments, when asked for |
|
|
170
|
+
* | `droppedSegmentCount` | `number` | Segments not returned because of `maxSegmentsPerElement` |
|
|
171
|
+
*/
|
|
172
|
+
export const PluginSectionCutElement = z.object({
|
|
173
|
+
entityId: z.string(),
|
|
174
|
+
type: z.string(),
|
|
175
|
+
area: z.number(),
|
|
176
|
+
perimeter: z.number(),
|
|
177
|
+
extent: PluginSectionExtent,
|
|
178
|
+
isHatched: z.boolean(),
|
|
179
|
+
isOpening: z.boolean(),
|
|
180
|
+
segments: z.array(z.tuple([z.number(), z.number(), z.number(), z.number()])),
|
|
181
|
+
droppedSegmentCount: z.number().int(),
|
|
182
|
+
})
|
|
183
|
+
export type PluginSectionCutElement = z.infer<typeof PluginSectionCutElement>
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* What a section cuts, from {@linkcode PluginPresentationSectionsApi.getCut}.
|
|
187
|
+
*
|
|
188
|
+
* | Property | Type | Description |
|
|
189
|
+
* |---|---|---|
|
|
190
|
+
* | `sectionId` | `string` | The section |
|
|
191
|
+
* | `origin` | `{ x, y, z }` | World point at `u = 0, v = 0`: the first head, at Y 0 |
|
|
192
|
+
* | `uAxis` | `{ x, y, z }` | Unit direction of `u`: from the first head to the second |
|
|
193
|
+
* | `normal` | `{ x, y, z }` | Unit direction the section looks |
|
|
194
|
+
* | `extent` | {@linkcode PluginSectionExtent} | The cut rect: `u` 0 to the line's length, `v` base to top |
|
|
195
|
+
* | `elements` | {@linkcode PluginSectionCutElement}`[]` | What it cuts, largest area first |
|
|
196
|
+
* | `candidateCount` | `number` | Meshes near the plane that were tested |
|
|
197
|
+
* | `durationInMs` | `number` | Time the query took |
|
|
198
|
+
*/
|
|
199
|
+
export const PluginSectionCut = z.object({
|
|
200
|
+
sectionId: z.string(),
|
|
201
|
+
origin: Vec3Components,
|
|
202
|
+
uAxis: Vec3Components,
|
|
203
|
+
normal: Vec3Components,
|
|
204
|
+
extent: PluginSectionExtent,
|
|
205
|
+
elements: z.array(PluginSectionCutElement),
|
|
206
|
+
candidateCount: z.number().int(),
|
|
207
|
+
durationInMs: z.number(),
|
|
208
|
+
})
|
|
209
|
+
export type PluginSectionCut = z.infer<typeof PluginSectionCut>
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* Sections: lines on the plan that cut the model, each with its own section
|
|
213
|
+
* view.
|
|
214
|
+
*
|
|
215
|
+
* A section is a cutting plane through its line, vertical, looking one way
|
|
216
|
+
* along it; its view keeps `depth` behind the line, between `base` and `top`.
|
|
217
|
+
* Create, read, edit and delete sections (`create`, `list`, `get`, `update`,
|
|
218
|
+
* `delete`), open one's view (`setActive`, `getActive`), and ask what it cuts
|
|
219
|
+
* (`getCut`): which elements the plane passes through, with the area, outline
|
|
220
|
+
* and extent of each cut. `getCut` is computed from the model, needs no open
|
|
221
|
+
* view and changes nothing.
|
|
222
|
+
*
|
|
223
|
+
* Writes are write-gated and each call is one undo step. Geometry edits
|
|
224
|
+
* (`start`, `end`, `isFlipped`, `depth`, `base`, `top`) are refused on a locked
|
|
225
|
+
* section; names, marks and hiding are not, and repeating a locked section's
|
|
226
|
+
* geometry unchanged is not a geometry edit. View-only collaborators cannot
|
|
227
|
+
* write.
|
|
228
|
+
*
|
|
229
|
+
* Positions are world coordinates in internal `babylon` units (1 unit =
|
|
230
|
+
* 0.254 m, Y up); a section's heads are plan points `{ x, z }`. Accessed via
|
|
231
|
+
* `snaptrude.presentation.sections`.
|
|
232
|
+
*/
|
|
233
|
+
export abstract class PluginPresentationSectionsApi {
|
|
234
|
+
constructor() {}
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* List the project's sections, in Views panel order.
|
|
238
|
+
*
|
|
239
|
+
* @returns Every {@linkcode PluginSection} (`[]` when there are none).
|
|
240
|
+
*
|
|
241
|
+
* @examplePrompt Which sections are there?
|
|
242
|
+
* @examplePrompt List the section lines in this project
|
|
243
|
+
* @examplePrompt Is there a section through the stair?
|
|
244
|
+
*
|
|
245
|
+
* # Example
|
|
246
|
+
* ```ts
|
|
247
|
+
* const sections = await snaptrude.presentation.sections.list()
|
|
248
|
+
* ```
|
|
249
|
+
*/
|
|
250
|
+
public abstract list(): PluginApiReturn<PluginSection[]>
|
|
251
|
+
|
|
252
|
+
/**
|
|
253
|
+
* Get one section by id.
|
|
254
|
+
*
|
|
255
|
+
* @param sectionId - The section's id
|
|
256
|
+
* @returns The {@linkcode PluginSection}, or `null` when there is none with that id.
|
|
257
|
+
*
|
|
258
|
+
* @examplePrompt Where does Section A run?
|
|
259
|
+
* @examplePrompt How deep is this section?
|
|
260
|
+
*
|
|
261
|
+
* # Example
|
|
262
|
+
* ```ts
|
|
263
|
+
* const section = await snaptrude.presentation.sections.get(sectionId)
|
|
264
|
+
* console.log(section?.start, section?.end)
|
|
265
|
+
* ```
|
|
266
|
+
*/
|
|
267
|
+
public abstract get(sectionId: string): PluginApiReturn<PluginSection | null>
|
|
268
|
+
|
|
269
|
+
/**
|
|
270
|
+
* Get the section whose view is open.
|
|
271
|
+
*
|
|
272
|
+
* @returns The open {@linkcode PluginSection}, or `null` when no section view is open.
|
|
273
|
+
*
|
|
274
|
+
* @examplePrompt Which section am I looking at?
|
|
275
|
+
*
|
|
276
|
+
* # Example
|
|
277
|
+
* ```ts
|
|
278
|
+
* const open = await snaptrude.presentation.sections.getActive()
|
|
279
|
+
* ```
|
|
280
|
+
*/
|
|
281
|
+
public abstract getActive(): PluginApiReturn<PluginSection | null>
|
|
282
|
+
|
|
283
|
+
/**
|
|
284
|
+
* Open a section's view, or close the open one with `null`. Opening frames
|
|
285
|
+
* the section's saved camera, or a straight-on view when it has none.
|
|
286
|
+
* Closing returns to 3D; with no section view open, `null` does nothing. Not
|
|
287
|
+
* an edit: nothing is added to the undo history.
|
|
288
|
+
*
|
|
289
|
+
* @param sectionId - The section to open, or `null` to close the section view
|
|
290
|
+
* @returns The open {@linkcode PluginSection}, or `null` after closing.
|
|
291
|
+
* @throws HANDLE_INVALID when there is no section with that id.
|
|
292
|
+
*
|
|
293
|
+
* @examplePrompt Open Section A
|
|
294
|
+
* @examplePrompt Show me the section through the atrium
|
|
295
|
+
* @examplePrompt Close the section view
|
|
296
|
+
*
|
|
297
|
+
* # Example
|
|
298
|
+
* ```ts
|
|
299
|
+
* await snaptrude.presentation.sections.setActive(section.sectionId)
|
|
300
|
+
* await snaptrude.presentation.sections.setActive(null)
|
|
301
|
+
* ```
|
|
302
|
+
*/
|
|
303
|
+
public abstract setActive(
|
|
304
|
+
sectionId: string | null,
|
|
305
|
+
): PluginApiReturn<PluginSection | null>
|
|
306
|
+
|
|
307
|
+
/**
|
|
308
|
+
* Draw a section line from `start` to `end` on the plan. The section looks
|
|
309
|
+
* along the line's direction turned a quarter turn — a line drawn toward +x
|
|
310
|
+
* looks toward +z; flip it with `update(id, { isFlipped: true })`. Its slice
|
|
311
|
+
* defaults to the building's full height and its depth to the far side of
|
|
312
|
+
* the model. Write-gated; one undo step.
|
|
313
|
+
*
|
|
314
|
+
* @param start - First head, a plan point `{ x, z }`
|
|
315
|
+
* @param end - Second head; must differ from `start`
|
|
316
|
+
* @param options - Name, mark, depth, slice, building and whether to open it ({@linkcode PluginSectionCreateOptions})
|
|
317
|
+
* @returns The new {@linkcode PluginSection}.
|
|
318
|
+
* @throws METHOD_NOT_PERMITTED when plugin writes are disabled. VALIDATION when
|
|
319
|
+
* `start` and `end` coincide or `top` is not above `base`. PRECONDITION_FAILED
|
|
320
|
+
* when the project is view-only or has no model to cut.
|
|
321
|
+
*
|
|
322
|
+
* @examplePrompt Cut a section through the middle of the building, east to west
|
|
323
|
+
* @examplePrompt Add a section across the stair core
|
|
324
|
+
* @examplePrompt Draw a longitudinal section and open it
|
|
325
|
+
*
|
|
326
|
+
* # Example
|
|
327
|
+
* ```ts
|
|
328
|
+
* const section = await snaptrude.presentation.sections.create(
|
|
329
|
+
* { x: -40, z: 10 },
|
|
330
|
+
* { x: 40, z: 10 },
|
|
331
|
+
* { name: "Longitudinal", isActive: true },
|
|
332
|
+
* )
|
|
333
|
+
* ```
|
|
334
|
+
*/
|
|
335
|
+
public abstract create(
|
|
336
|
+
start: PluginSectionPoint,
|
|
337
|
+
end: PluginSectionPoint,
|
|
338
|
+
options?: PluginSectionCreateOptions,
|
|
339
|
+
): PluginApiReturn<PluginSection>
|
|
340
|
+
|
|
341
|
+
/**
|
|
342
|
+
* Change a section. Only the given fields change; the whole patch is one
|
|
343
|
+
* undo step. Flipping without a `depth` carries the depth to the far side of
|
|
344
|
+
* the model in the new direction, as `create` does. Write-gated.
|
|
345
|
+
*
|
|
346
|
+
* @param sectionId - The section's id
|
|
347
|
+
* @param patch - The fields to change ({@linkcode PluginSectionPatch})
|
|
348
|
+
* @returns The updated {@linkcode PluginSection}.
|
|
349
|
+
* @throws METHOD_NOT_PERMITTED when plugin writes are disabled. HANDLE_INVALID when
|
|
350
|
+
* there is no section with that id. VALIDATION when the heads coincide or `top`
|
|
351
|
+
* is not above `base`. PRECONDITION_FAILED when the project is view-only, or the
|
|
352
|
+
* patch changes a locked section's geometry.
|
|
353
|
+
*
|
|
354
|
+
* @examplePrompt Make Section A look the other way
|
|
355
|
+
* @examplePrompt Only show the ground floor in this section
|
|
356
|
+
* @examplePrompt Rename the section to "Through atrium"
|
|
357
|
+
* @examplePrompt Move the section line 5 m north
|
|
358
|
+
*
|
|
359
|
+
* # Example
|
|
360
|
+
* ```ts
|
|
361
|
+
* await snaptrude.presentation.sections.update(sectionId, {
|
|
362
|
+
* isFlipped: true,
|
|
363
|
+
* depth: 60,
|
|
364
|
+
* })
|
|
365
|
+
* ```
|
|
366
|
+
*/
|
|
367
|
+
public abstract update(
|
|
368
|
+
sectionId: string,
|
|
369
|
+
patch: PluginSectionPatch,
|
|
370
|
+
): PluginApiReturn<PluginSection>
|
|
371
|
+
|
|
372
|
+
/**
|
|
373
|
+
* Delete a section. Closes its view first if it is open. Write-gated; one
|
|
374
|
+
* undo step.
|
|
375
|
+
*
|
|
376
|
+
* @param sectionId - The section's id
|
|
377
|
+
* @returns `true` once it has been deleted.
|
|
378
|
+
* @throws METHOD_NOT_PERMITTED when plugin writes are disabled. HANDLE_INVALID when
|
|
379
|
+
* there is no section with that id. PRECONDITION_FAILED when the project is view-only.
|
|
380
|
+
*
|
|
381
|
+
* @examplePrompt Delete Section B
|
|
382
|
+
*
|
|
383
|
+
* # Example
|
|
384
|
+
* ```ts
|
|
385
|
+
* await snaptrude.presentation.sections.delete(sectionId)
|
|
386
|
+
* ```
|
|
387
|
+
*/
|
|
388
|
+
public abstract delete(sectionId: string): PluginApiReturn<boolean>
|
|
389
|
+
|
|
390
|
+
/**
|
|
391
|
+
* What a section cuts: every element its cutting plane passes through within
|
|
392
|
+
* the section's extents, with the cut's area, outline length and extent on
|
|
393
|
+
* the plane, largest first. Computed from the model, not from the drawing, so
|
|
394
|
+
* it needs no open view and works however the section is shown; furniture is
|
|
395
|
+
* left out, as in the drawing, and so is anything hidden in the model. Areas are exact for closed solids. Repeated
|
|
396
|
+
* calls reuse the cuts of elements that have not changed. Read-only.
|
|
397
|
+
*
|
|
398
|
+
* @param sectionId - The section's id
|
|
399
|
+
* @param options - Whether to return outline segments ({@linkcode PluginSectionCutOptions})
|
|
400
|
+
* @returns The {@linkcode PluginSectionCut}.
|
|
401
|
+
* @throws HANDLE_INVALID when there is no section with that id.
|
|
402
|
+
*
|
|
403
|
+
* @examplePrompt Which walls does Section A cut?
|
|
404
|
+
* @examplePrompt How thick is the slab where the section crosses it?
|
|
405
|
+
* @examplePrompt Does this section go through the stair?
|
|
406
|
+
* @examplePrompt What is the floor-to-floor height in this section?
|
|
407
|
+
*
|
|
408
|
+
* # Example
|
|
409
|
+
* ```ts
|
|
410
|
+
* const cut = await snaptrude.presentation.sections.getCut(sectionId)
|
|
411
|
+
* const walls = cut.elements.filter((element) => element.type === "wall")
|
|
412
|
+
* const thickest = walls[0]
|
|
413
|
+
* console.log(thickest.extent.uMax - thickest.extent.uMin)
|
|
414
|
+
* ```
|
|
415
|
+
*/
|
|
416
|
+
public abstract getCut(
|
|
417
|
+
sectionId: string,
|
|
418
|
+
options?: PluginSectionCutOptions,
|
|
419
|
+
): PluginApiReturn<PluginSectionCut>
|
|
420
|
+
}
|