@snaptrude/plugin-core 0.1.3 → 0.3.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/dist/api/index.d.ts +2 -2
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/tools/copy.d.ts +59 -0
- package/dist/api/tools/copy.d.ts.map +1 -0
- package/dist/api/tools/index.d.ts +11 -0
- package/dist/api/tools/index.d.ts.map +1 -1
- package/dist/api/tools/offset.d.ts +43 -0
- package/dist/api/tools/offset.d.ts.map +1 -0
- package/dist/index.cjs +67 -32
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +62 -32
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/api/index.ts +2 -2
- package/src/api/tools/copy.ts +55 -0
- package/src/api/tools/index.ts +15 -0
- package/src/api/tools/offset.ts +43 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import * as z from "zod"
|
|
2
|
+
import type { ComponentId } from "../../types"
|
|
3
|
+
import { PVec3 } from "../core/math/vec3"
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Arguments for `snaptrude.tools.offset`.
|
|
7
|
+
*
|
|
8
|
+
* Runs Snaptrude's offset/split operation on the top profile of a scene
|
|
9
|
+
* component. A positive distance offsets outward from the selected profile;
|
|
10
|
+
* a negative distance offsets inward. If `profilePickPoint` is omitted, the
|
|
11
|
+
* outer top profile is used. If `profilePickPoint` is provided, the nearest top
|
|
12
|
+
* contour profile to that point is used, matching the interactive offset tool's
|
|
13
|
+
* pick behavior.
|
|
14
|
+
*
|
|
15
|
+
* | Property | Type | Description |
|
|
16
|
+
* |---|---|---|
|
|
17
|
+
* | `componentId` | `string` | Component ID to offset |
|
|
18
|
+
* | `distance` | `number` | Signed offset distance in Snaptrude units |
|
|
19
|
+
* | `profilePickPoint` | {@linkcode PVec3} | Optional point used to choose a top contour profile |
|
|
20
|
+
*/
|
|
21
|
+
export const PluginOffsetArgs = z.object({
|
|
22
|
+
componentId: z.string().min(1),
|
|
23
|
+
distance: z.number(),
|
|
24
|
+
profilePickPoint: PVec3.optional(),
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
export type PluginOffsetArgs = z.infer<typeof PluginOffsetArgs>
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Result of `snaptrude.tools.offset`.
|
|
31
|
+
*
|
|
32
|
+
* `createdIds` are the components created by the offset operation. `deletedIds`
|
|
33
|
+
* are components removed by split-style offsets.
|
|
34
|
+
*/
|
|
35
|
+
export const PluginOffsetResult = z.object({
|
|
36
|
+
createdIds: z.array(z.string()),
|
|
37
|
+
deletedIds: z.array(z.string()),
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
export type PluginOffsetResult = {
|
|
41
|
+
createdIds: ComponentId[]
|
|
42
|
+
deletedIds: ComponentId[]
|
|
43
|
+
}
|