wall tool draft
This commit is contained in:
@@ -17,5 +17,6 @@ export { RoofNode } from './nodes/roof'
|
||||
export { ScanNode } from './nodes/scan'
|
||||
export { GuideNode } from './nodes/guide'
|
||||
export type { AnyNodeId, AnyNodeType } from './types'
|
||||
export { WindowNode } from './nodes/window'
|
||||
// Union types
|
||||
export { AnyNode } from './types'
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
import dedent from 'dedent'
|
||||
import { z } from 'zod'
|
||||
import { BaseNode, nodeType, objectId } from '../base'
|
||||
|
||||
export const WindowNode = BaseNode.extend({
|
||||
id: objectId('window'),
|
||||
type: nodeType('window'),
|
||||
|
||||
// Position in wall-local coordinate system (center of window)
|
||||
position: z.tuple([z.number(), z.number(), z.number()]).default([0, 0, 0]),
|
||||
rotation: z.tuple([z.number(), z.number(), z.number()]).default([0, 0, 0]),
|
||||
side: z.enum(['front', 'back']).optional(),
|
||||
|
||||
// Wall reference
|
||||
wallId: z.string().optional(),
|
||||
|
||||
// Overall dimensions
|
||||
width: z.number().default(1.5),
|
||||
height: z.number().default(1.5),
|
||||
|
||||
// Frame
|
||||
frameThickness: z.number().default(0.05),
|
||||
frameDepth: z.number().default(0.07),
|
||||
|
||||
// Divisions — ratios allow non-uniform panes
|
||||
// [0.5, 0.5] = two equal panes
|
||||
// [0.6, 0.4] = one larger, one smaller
|
||||
// [1] = single pane (no division)
|
||||
columnRatios: z.array(z.number()).default([1]),
|
||||
rowRatios: z.array(z.number()).default([1]),
|
||||
dividerThickness: z.number().default(0.03),
|
||||
|
||||
// Sill
|
||||
sill: z.boolean().default(true),
|
||||
sillDepth: z.number().default(0.08),
|
||||
sillThickness: z.number().default(0.03),
|
||||
}).describe(dedent`Window node - a parametric window placed on a wall
|
||||
- position: center of the window in wall-local coordinate system
|
||||
- width/height: overall outer dimensions
|
||||
- frameThickness: width of the frame members
|
||||
- frameDepth: how deep the frame sits within the wall
|
||||
- columnRatios/rowRatios: pane division ratios
|
||||
- sill: whether to show a window sill
|
||||
`)
|
||||
|
||||
export type WindowNode = z.infer<typeof WindowNode>
|
||||
@@ -9,6 +9,7 @@ import { ScanNode } from './nodes/scan'
|
||||
import { SiteNode } from './nodes/site'
|
||||
import { SlabNode } from './nodes/slab'
|
||||
import { WallNode } from './nodes/wall'
|
||||
import { WindowNode } from './nodes/window'
|
||||
import { ZoneNode } from './nodes/zone'
|
||||
|
||||
export const AnyNode = z.discriminatedUnion('type', [
|
||||
@@ -23,6 +24,7 @@ export const AnyNode = z.discriminatedUnion('type', [
|
||||
RoofNode,
|
||||
ScanNode,
|
||||
GuideNode,
|
||||
WindowNode,
|
||||
])
|
||||
|
||||
export type AnyNode = z.infer<typeof AnyNode>
|
||||
|
||||
Reference in New Issue
Block a user