@snaptrude/plugin-core 0.9.4 → 0.9.6
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/CHANGELOG.md +11 -0
- package/api-manifest.json +154 -1
- package/dist/api/core/camera/index.d.ts +16 -0
- package/dist/api/core/camera/index.d.ts.map +1 -1
- package/dist/api/core/io/underlay/index.d.ts +519 -0
- package/dist/api/core/io/underlay/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/storeys/index.d.ts +14 -0
- package/dist/api/core/storeys/index.d.ts.map +1 -1
- 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/query/index.d.ts +127 -0
- package/dist/api/design/query/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/index.cjs +209 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +186 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/api/core/camera/index.ts +17 -0
- package/src/api/core/io/underlay/index.ts +418 -8
- package/src/api/core/project/index.ts +62 -1
- package/src/api/core/storeys/index.ts +15 -0
- package/src/api/design/furniture/index.ts +34 -0
- package/src/api/design/query/index.ts +99 -0
- package/src/api/design/visibility.ts +34 -0
- package/api-manifest.full.json +0 -8133
|
@@ -1041,8 +1041,107 @@ export abstract class PluginDesignQueryApi {
|
|
|
1041
1041
|
public abstract getBoundingBox(
|
|
1042
1042
|
components: ComponentHandle[],
|
|
1043
1043
|
): PluginApiReturn<BBoxComponents | null>
|
|
1044
|
+
|
|
1045
|
+
/**
|
|
1046
|
+
* Compute the plan **outline of what is built on a storey** — the union of
|
|
1047
|
+
* the storey's wall (by default) footprints as polygons-with-holes. This is
|
|
1048
|
+
* the footprint-from-the-built-model query: by the time slabs are needed the
|
|
1049
|
+
* walls exist, and the engine's own solids (snapped, joined and mitred at
|
|
1050
|
+
* creation) are the cleanest wall network available — no CAD re-tracing.
|
|
1051
|
+
*
|
|
1052
|
+
* Semantics: the union of wall solids is the wall *material* — a ring-shaped
|
|
1053
|
+
* polygon. The **outer ring is the OUTSIDE wall face** (the slab boundary);
|
|
1054
|
+
* every enclosed region — rooms AND courtyards — appears as a hole. When the
|
|
1055
|
+
* largest hole is ~zero the walls don't enclose anything: the footprint
|
|
1056
|
+
* reports `enclosed: false` (an open wall network), never a garbage outline.
|
|
1057
|
+
* Detached buildings come back as separate footprints.
|
|
1058
|
+
*
|
|
1059
|
+
* A read — nothing is created. Feed a footprint's `outline` to
|
|
1060
|
+
* `core.geom.create.profileFromLinePoints` → `design.create.slab` to build
|
|
1061
|
+
* the floor/roof plate. Coordinates are world-space plan (x, z) in Snaptrude
|
|
1062
|
+
* internal units; `areaSq` values are in squared internal units.
|
|
1063
|
+
*
|
|
1064
|
+
* @param options - storey / included kinds / debris filter; see
|
|
1065
|
+
* {@linkcode PluginStoreyOutlineOptions}.
|
|
1066
|
+
* @returns the storey's footprints (possibly several for detached buildings)
|
|
1067
|
+
* plus pieces discarded by `minArea` (`footprints: []` when nothing matches).
|
|
1068
|
+
*
|
|
1069
|
+
* @examplePrompt What is the building footprint on the ground floor?
|
|
1070
|
+
* @examplePrompt Create a floor slab covering the whole storey
|
|
1071
|
+
* @examplePrompt Get the outline of the walls on storey 1
|
|
1072
|
+
* @examplePrompt How much area do the ground-floor walls enclose?
|
|
1073
|
+
*
|
|
1074
|
+
* # Example
|
|
1075
|
+
* ```ts
|
|
1076
|
+
* const r = await snaptrude.design.query.storeyOutline({ storey: 1 })
|
|
1077
|
+
* const main = r.footprints.find((f) => f.enclosed)
|
|
1078
|
+
* if (main) {
|
|
1079
|
+
* const profile = await snaptrude.core.geom.create.profileFromLinePoints(
|
|
1080
|
+
* main.outline.map((p) => ({ x: p.x, y: 0, z: p.z })),
|
|
1081
|
+
* )
|
|
1082
|
+
* // → design.create.slab with the profile's contour
|
|
1083
|
+
* }
|
|
1084
|
+
* ```
|
|
1085
|
+
*/
|
|
1086
|
+
public abstract storeyOutline(
|
|
1087
|
+
options?: PluginStoreyOutlineOptions,
|
|
1088
|
+
): PluginApiReturn<PluginStoreyOutlineResult>
|
|
1044
1089
|
}
|
|
1045
1090
|
|
|
1091
|
+
|
|
1092
|
+
/** A point in the world-space plan (x, z) projection, Snaptrude internal units. */
|
|
1093
|
+
export const PluginOutlinePlanPoint = z.object({ x: z.number(), z: z.number() })
|
|
1094
|
+
export type PluginOutlinePlanPoint = z.infer<typeof PluginOutlinePlanPoint>
|
|
1095
|
+
|
|
1096
|
+
/**
|
|
1097
|
+
* Options for {@link PluginDesignQueryApi.storeyOutline}.
|
|
1098
|
+
*
|
|
1099
|
+
* | Property | Type | Description |
|
|
1100
|
+
* |---|---|---|
|
|
1101
|
+
* | `storey` | `number`? | Only components on this storey (default: all storeys) |
|
|
1102
|
+
* | `include` | {@link PluginEntityType}`[]`? | Component kinds to union (default `["wall"]`) |
|
|
1103
|
+
* | `minArea` | `number`? | Drop union pieces below this plan area, squared internal units (default `1`) |
|
|
1104
|
+
*/
|
|
1105
|
+
export const PluginStoreyOutlineOptions = z.object({
|
|
1106
|
+
storey: z.number().int().optional(),
|
|
1107
|
+
include: z.array(PluginEntityType).nonempty().default(["wall"]),
|
|
1108
|
+
minArea: z.number().nonnegative().default(1),
|
|
1109
|
+
})
|
|
1110
|
+
export type PluginStoreyOutlineOptions = z.input<
|
|
1111
|
+
typeof PluginStoreyOutlineOptions
|
|
1112
|
+
>
|
|
1113
|
+
|
|
1114
|
+
/**
|
|
1115
|
+
* One connected footprint from {@link PluginDesignQueryApi.storeyOutline}.
|
|
1116
|
+
* `outline` traces the OUTSIDE wall face; `holes` are the enclosed regions
|
|
1117
|
+
* (rooms and courtyards). `enclosed` is `false` when the wall network does not
|
|
1118
|
+
* close around any region (open C-shape) — don't slab an unenclosed outline
|
|
1119
|
+
* without checking it.
|
|
1120
|
+
*/
|
|
1121
|
+
export const PluginStoreyFootprint = z.object({
|
|
1122
|
+
outline: z.array(PluginOutlinePlanPoint),
|
|
1123
|
+
holes: z.array(
|
|
1124
|
+
z.object({
|
|
1125
|
+
ring: z.array(PluginOutlinePlanPoint),
|
|
1126
|
+
areaSq: z.number().nonnegative(),
|
|
1127
|
+
}),
|
|
1128
|
+
),
|
|
1129
|
+
areaSq: z.number().nonnegative(),
|
|
1130
|
+
enclosed: z.boolean(),
|
|
1131
|
+
})
|
|
1132
|
+
export type PluginStoreyFootprint = z.infer<typeof PluginStoreyFootprint>
|
|
1133
|
+
|
|
1134
|
+
/** Result of {@link PluginDesignQueryApi.storeyOutline}. */
|
|
1135
|
+
export const PluginStoreyOutlineResult = z.object({
|
|
1136
|
+
footprints: z.array(PluginStoreyFootprint),
|
|
1137
|
+
discarded: z.array(
|
|
1138
|
+
z.object({ areaSq: z.number().nonnegative(), reason: z.string() }),
|
|
1139
|
+
),
|
|
1140
|
+
})
|
|
1141
|
+
export type PluginStoreyOutlineResult = z.infer<
|
|
1142
|
+
typeof PluginStoreyOutlineResult
|
|
1143
|
+
>
|
|
1144
|
+
|
|
1046
1145
|
export * from "./geometry"
|
|
1047
1146
|
export * from "./spaces"
|
|
1048
1147
|
export * from "./referenceLines"
|
|
@@ -39,6 +39,26 @@ export abstract class PluginDesignVisibilityApi {
|
|
|
39
39
|
components: ComponentHandle[],
|
|
40
40
|
): PluginApiReturn<PluginDesignChangeResult>
|
|
41
41
|
|
|
42
|
+
/**
|
|
43
|
+
* Reveal specific hidden components — the inverse of
|
|
44
|
+
* {@linkcode PluginDesignVisibilityApi.hide}. Use
|
|
45
|
+
* {@linkcode PluginDesignVisibilityApi.showAll} to reveal everything.
|
|
46
|
+
*
|
|
47
|
+
* @param components - The components to reveal.
|
|
48
|
+
* @returns A {@linkcode PluginDesignChangeResult} echoing the components shown.
|
|
49
|
+
*
|
|
50
|
+
* @examplePrompt Show these walls again
|
|
51
|
+
* @examplePrompt Unhide the selected furniture
|
|
52
|
+
*
|
|
53
|
+
* # Example
|
|
54
|
+
* ```ts
|
|
55
|
+
* await snaptrude.design.visibility.show([wall])
|
|
56
|
+
* ```
|
|
57
|
+
*/
|
|
58
|
+
public abstract show(
|
|
59
|
+
components: ComponentHandle[],
|
|
60
|
+
): PluginApiReturn<PluginDesignChangeResult>
|
|
61
|
+
|
|
42
62
|
/**
|
|
43
63
|
* Isolate entities — hide everything else so only the given entities remain
|
|
44
64
|
* visible (the "Isolate" / solo action). Undoable. Reverse it with
|
|
@@ -94,6 +114,20 @@ export const PluginDesignVisibilityHideArgs = z.object({
|
|
|
94
114
|
})
|
|
95
115
|
export type PluginDesignVisibilityHideArgs = z.infer<typeof PluginDesignVisibilityHideArgs>
|
|
96
116
|
|
|
117
|
+
/**
|
|
118
|
+
* Arguments for {@linkcode PluginDesignVisibilityApi.show}.
|
|
119
|
+
*
|
|
120
|
+
* | Property | Type | Description |
|
|
121
|
+
* |---|---|---|
|
|
122
|
+
* | `components` | {@linkcode ComponentHandle}`[]` | Entities to reveal |
|
|
123
|
+
*/
|
|
124
|
+
export const PluginDesignVisibilityShowArgs = z.object({
|
|
125
|
+
components: z.array(ComponentHandle),
|
|
126
|
+
})
|
|
127
|
+
export type PluginDesignVisibilityShowArgs = z.infer<
|
|
128
|
+
typeof PluginDesignVisibilityShowArgs
|
|
129
|
+
>
|
|
130
|
+
|
|
97
131
|
/**
|
|
98
132
|
* Arguments for {@linkcode PluginDesignVisibilityApi.isolate}.
|
|
99
133
|
*
|