From 2802a361be667d686e40a8d32f7b5417298615b7 Mon Sep 17 00:00:00 2001 From: Fuhrimann Lukas Date: Wed, 25 Feb 2026 16:05:52 +0100 Subject: [PATCH 1/7] replaced boundingboxSchema with GeometrySchema --- src/types/common/boundingBoxSchema.ts | 12 --- src/types/common/geometrySchema.ts | 104 ++++++++++++++++++++++ src/types/entities/prefabElementSchema.ts | 2 +- src/types/types.ts | 2 +- 4 files changed, 106 insertions(+), 14 deletions(-) delete mode 100644 src/types/common/boundingBoxSchema.ts create mode 100644 src/types/common/geometrySchema.ts diff --git a/src/types/common/boundingBoxSchema.ts b/src/types/common/boundingBoxSchema.ts deleted file mode 100644 index a42c181..0000000 --- a/src/types/common/boundingBoxSchema.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { z } from "zod"; - -const BoundingBoxSchema = z.object({ - width: z.number().gt(0, "Width must be greater than 0"), - height: z.number().gt(0, "Height must be greater than 0"), - depth: z.number().gt(0, "Depth must be greater than 0") -}).openapi({ - description: "The bounding box of an element in millimeters.", -}); - -type BoundingBox = z.infer; -export { BoundingBoxSchema, BoundingBox }; \ No newline at end of file diff --git a/src/types/common/geometrySchema.ts b/src/types/common/geometrySchema.ts new file mode 100644 index 0000000..c171dda --- /dev/null +++ b/src/types/common/geometrySchema.ts @@ -0,0 +1,104 @@ +import { z } from "zod"; + +// Local Bounding Box (element's own coordinate system) +const LocalBoundingBoxSchema = z.object({ + min: z.tuple([ + z.literal(0), // Always 0 in local space + z.literal(0), + z.literal(0) + ]).describe("Minimum corner (always at local origin)"), + + max: z.tuple([ + z.number().positive(), // Length + z.number().positive(), // Width + z.number().positive() // Height + ]).describe("Maximum corner in millimeters"), + +}).openapi({ + description: "Local bounding box aligned to element's own axes, origin at (0,0,0). Dimensions in millimeters." +}); + +// World-Aligned Bounding Box (in global coordinates) +const WorldBoundingBoxSchema = z.object({ + min: z.tuple([ + z.number(), // Can be any value in world space + z.number(), + z.number() + ]).describe("Minimum corner in world coordinates (mm)"), + + max: z.tuple([ + z.number(), + z.number(), + z.number() + ]).describe("Maximum corner in world coordinates (mm)"), + + dimensions: z.object({ + x: z.number().positive().describe("World X extent (mm)"), + y: z.number().positive().describe("World Y extent (mm)"), + z: z.number().positive().describe("World Z extent (mm)") + }), + + center: z.tuple([ + z.number(), + z.number(), + z.number() + ]).optional().describe("Center point in world coordinates (mm)"), + + volume: z.number().positive().describe("Bounding box volume in mm³") +}).openapi({ + description: "World-aligned bounding box (AABB) in global coordinate system. May include rotation waste. Dimensions in millimeters." +}); + +// World Position & Orientation (Construction Plane) +const WorldPositionSchema = z.object({ + origin: z.tuple([ + z.number(), + z.number(), + z.number() + ]).describe("Element's local origin in world coordinates (mm)"), + + xAxis: z.tuple([ + z.number(), + z.number(), + z.number() + ]).describe("Local X-axis direction in world space (unit vector)"), + + yAxis: z.tuple([ + z.number(), + z.number(), + z.number() + ]).describe("Local Y-axis direction in world space (unit vector)"), + + zAxis: z.tuple([ + z.number(), + z.number(), + z.number() + ]).describe("Local Z-axis direction in world space (unit vector)") +}).openapi({ + description: "Element's position and orientation (construction plane) in world coordinate system." +}); + +// Complete Geometry +const GeometrySchema = z.object({ + localBoundingBox: LocalBoundingBoxSchema, + worldBoundingBox: WorldBoundingBoxSchema.optional(), + worldPosition: WorldPositionSchema +}).openapi({ + description: "Complete geometry representation with local bbox, world position, and optional world bbox." +}); + +type LocalBoundingBox = z.infer; +type WorldBoundingBox = z.infer; +type WorldPosition = z.infer; +type Geometry = z.infer; + +export { + LocalBoundingBoxSchema, + WorldBoundingBoxSchema, + WorldPositionSchema, + GeometrySchema, + LocalBoundingBox, + WorldBoundingBox, + WorldPosition, + Geometry +}; \ No newline at end of file diff --git a/src/types/entities/prefabElementSchema.ts b/src/types/entities/prefabElementSchema.ts index aa3da33..17c2f03 100644 --- a/src/types/entities/prefabElementSchema.ts +++ b/src/types/entities/prefabElementSchema.ts @@ -1,6 +1,6 @@ import { z } from "zod"; import { AestheticAndCustomizationOptionsSchema } from "../common/aestheticAndCustomizationOptionsSchema"; -import { BoundingBoxSchema } from "../common/boundingBoxSchema"; +import { BoundingBoxSchema } from "../common/geometrySchema"; import { DimensionalAttributesSchema } from "../common/dimensionalAttributesSchema"; import { DocumentationAndComplianceSchema } from "../common/documentationAndComplianceSchema"; import { EconomicFactorsSchema } from "../common/economicFactorsSchema"; diff --git a/src/types/types.ts b/src/types/types.ts index 4cd6aeb..7c8933d 100644 --- a/src/types/types.ts +++ b/src/types/types.ts @@ -1,6 +1,6 @@ export * from "./common/acousticPropertiesSchema"; export * from "./common/aestheticAndCustomizationOptionsSchema"; -export * from "./common/boundingBoxSchema"; +export * from "./common/geometrySchema"; export * from "./common/certificationsSchema"; export * from "./common/dimensionalAttributesSchema"; export * from "./common/documentationAndComplianceSchema"; From 73f47b326c2b462ed7425b6543ab0f1190644e8d Mon Sep 17 00:00:00 2001 From: Fuhrimann Lukas Date: Wed, 25 Feb 2026 16:20:24 +0100 Subject: [PATCH 2/7] renamed to boundingboxschema --- src/types/common/boundingBoxSchema.ts | 26 ++++++ src/types/common/geometrySchema.ts | 104 ---------------------- src/types/entities/prefabElementSchema.ts | 2 +- src/types/types.ts | 2 +- 4 files changed, 28 insertions(+), 106 deletions(-) create mode 100644 src/types/common/boundingBoxSchema.ts delete mode 100644 src/types/common/geometrySchema.ts diff --git a/src/types/common/boundingBoxSchema.ts b/src/types/common/boundingBoxSchema.ts new file mode 100644 index 0000000..577bec7 --- /dev/null +++ b/src/types/common/boundingBoxSchema.ts @@ -0,0 +1,26 @@ +import { z } from "zod"; + +// Local Bounding Box (element's own coordinate system) +const BoundingBoxSchema = z.object({ + min: z.tuple([ + z.literal(0), // Always 0 in local space + z.literal(0), + z.literal(0) + ]).describe("Minimum corner (always at local origin)"), + + max: z.tuple([ + z.number().positive(), // Length + z.number().positive(), // Width + z.number().positive() // Height + ]).describe("Maximum corner in millimeters"), + +}).openapi({ + description: "Local bounding box aligned to element's own axes, origin at (0,0,0). Dimensions in millimeters." +}); + +type BoundingBox = z.infer; + +export { + BoundingBoxSchema, + BoundingBox, +}; \ No newline at end of file diff --git a/src/types/common/geometrySchema.ts b/src/types/common/geometrySchema.ts deleted file mode 100644 index c171dda..0000000 --- a/src/types/common/geometrySchema.ts +++ /dev/null @@ -1,104 +0,0 @@ -import { z } from "zod"; - -// Local Bounding Box (element's own coordinate system) -const LocalBoundingBoxSchema = z.object({ - min: z.tuple([ - z.literal(0), // Always 0 in local space - z.literal(0), - z.literal(0) - ]).describe("Minimum corner (always at local origin)"), - - max: z.tuple([ - z.number().positive(), // Length - z.number().positive(), // Width - z.number().positive() // Height - ]).describe("Maximum corner in millimeters"), - -}).openapi({ - description: "Local bounding box aligned to element's own axes, origin at (0,0,0). Dimensions in millimeters." -}); - -// World-Aligned Bounding Box (in global coordinates) -const WorldBoundingBoxSchema = z.object({ - min: z.tuple([ - z.number(), // Can be any value in world space - z.number(), - z.number() - ]).describe("Minimum corner in world coordinates (mm)"), - - max: z.tuple([ - z.number(), - z.number(), - z.number() - ]).describe("Maximum corner in world coordinates (mm)"), - - dimensions: z.object({ - x: z.number().positive().describe("World X extent (mm)"), - y: z.number().positive().describe("World Y extent (mm)"), - z: z.number().positive().describe("World Z extent (mm)") - }), - - center: z.tuple([ - z.number(), - z.number(), - z.number() - ]).optional().describe("Center point in world coordinates (mm)"), - - volume: z.number().positive().describe("Bounding box volume in mm³") -}).openapi({ - description: "World-aligned bounding box (AABB) in global coordinate system. May include rotation waste. Dimensions in millimeters." -}); - -// World Position & Orientation (Construction Plane) -const WorldPositionSchema = z.object({ - origin: z.tuple([ - z.number(), - z.number(), - z.number() - ]).describe("Element's local origin in world coordinates (mm)"), - - xAxis: z.tuple([ - z.number(), - z.number(), - z.number() - ]).describe("Local X-axis direction in world space (unit vector)"), - - yAxis: z.tuple([ - z.number(), - z.number(), - z.number() - ]).describe("Local Y-axis direction in world space (unit vector)"), - - zAxis: z.tuple([ - z.number(), - z.number(), - z.number() - ]).describe("Local Z-axis direction in world space (unit vector)") -}).openapi({ - description: "Element's position and orientation (construction plane) in world coordinate system." -}); - -// Complete Geometry -const GeometrySchema = z.object({ - localBoundingBox: LocalBoundingBoxSchema, - worldBoundingBox: WorldBoundingBoxSchema.optional(), - worldPosition: WorldPositionSchema -}).openapi({ - description: "Complete geometry representation with local bbox, world position, and optional world bbox." -}); - -type LocalBoundingBox = z.infer; -type WorldBoundingBox = z.infer; -type WorldPosition = z.infer; -type Geometry = z.infer; - -export { - LocalBoundingBoxSchema, - WorldBoundingBoxSchema, - WorldPositionSchema, - GeometrySchema, - LocalBoundingBox, - WorldBoundingBox, - WorldPosition, - Geometry -}; \ No newline at end of file diff --git a/src/types/entities/prefabElementSchema.ts b/src/types/entities/prefabElementSchema.ts index 17c2f03..45fd01d 100644 --- a/src/types/entities/prefabElementSchema.ts +++ b/src/types/entities/prefabElementSchema.ts @@ -1,6 +1,6 @@ import { z } from "zod"; import { AestheticAndCustomizationOptionsSchema } from "../common/aestheticAndCustomizationOptionsSchema"; -import { BoundingBoxSchema } from "../common/geometrySchema"; +import { BoundingBoxSchema} from "../common/boundingBoxSchema"; import { DimensionalAttributesSchema } from "../common/dimensionalAttributesSchema"; import { DocumentationAndComplianceSchema } from "../common/documentationAndComplianceSchema"; import { EconomicFactorsSchema } from "../common/economicFactorsSchema"; diff --git a/src/types/types.ts b/src/types/types.ts index 7c8933d..4cd6aeb 100644 --- a/src/types/types.ts +++ b/src/types/types.ts @@ -1,6 +1,6 @@ export * from "./common/acousticPropertiesSchema"; export * from "./common/aestheticAndCustomizationOptionsSchema"; -export * from "./common/geometrySchema"; +export * from "./common/boundingBoxSchema"; export * from "./common/certificationsSchema"; export * from "./common/dimensionalAttributesSchema"; export * from "./common/documentationAndComplianceSchema"; From c47b006c9cbb412cbe5431a4afbfdcd990ee44fe Mon Sep 17 00:00:00 2001 From: Fuhrimann Lukas Date: Fri, 27 Feb 2026 09:21:17 +0100 Subject: [PATCH 3/7] added new boundingbox schema --- src/types/common/dimensionSchema.ts | 88 +++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 src/types/common/dimensionSchema.ts diff --git a/src/types/common/dimensionSchema.ts b/src/types/common/dimensionSchema.ts new file mode 100644 index 0000000..d6b9adf --- /dev/null +++ b/src/types/common/dimensionSchema.ts @@ -0,0 +1,88 @@ +import { z } from "zod"; + +// Wall dimensions +const WallDimensionsSchema = z.object({ + length: z.number().positive().optional(), + thickness: z.number().positive().optional(), + height: z.number().positive().optional() +}); + +// Balcony dimensions +const BalconyDimensionsSchema = z.object({ + length: z.number().positive().optional(), + width: z.number().positive().optional(), + height: z.number().positive().optional() +}); + +// Pod dimensions +const PodDimensionsSchema = z.object({ + length: z.number().positive().optional(), + width: z.number().positive().optional(), + height: z.number().positive().optional() +}); + +// Frame dimensions +const FrameDimensionsSchema = z.object({ + length: z.number().positive().optional(), + width: z.number().positive().optional(), + thickness: z.number().positive().optional() +}); + +// Floor dimensions +const FloorDimensionsSchema = z.object({ + length: z.number().positive().optional(), + width: z.number().positive().optional(), + thickness: z.number().positive().optional() +}); + +// Module dimensions +const ModuleDimensionsSchema = z.object({ + length: z.number().positive().optional(), + width: z.number().positive().optional(), + height: z.number().positive().optional() +}); + +// Roof dimensions +const RoofDimensionsSchema = z.object({ + length: z.number().positive().optional(), + width: z.number().positive().optional(), + thickness: z.number().positive().optional() +}); + +// Stairs dimensions +const StairsDimensionsSchema = z.object({ + length: z.number().positive().optional(), + width: z.number().positive().optional(), + height: z.number().positive().optional(), + numberOfSteps: z.number().int().positive().optional(), + riserHeight: z.number().positive().optional(), + treadDepth: z.number().positive().optional() +}); + +// Structure dimensions - SIMPLIFIED +const StructureDimensionsSchema = z.object({ + length: z.number().positive().optional(), + width: z.number().positive().optional(), + height: z.number().positive().optional(), + depth: z.number().positive().optional(), + diameter: z.number().positive().optional() +}); + +// Discriminated union by building system +const DimensionSchema = z.object({ + dimensions: z.discriminatedUnion("buildingSystem", [ + z.object({ buildingSystem: z.literal("Wall"), ...WallDimensionsSchema.shape }), + z.object({ buildingSystem: z.literal("Balcony"), ...BalconyDimensionsSchema.shape }), + z.object({ buildingSystem: z.literal("Pod"), ...PodDimensionsSchema.shape }), + z.object({ buildingSystem: z.literal("Frame"), ...FrameDimensionsSchema.shape }), + z.object({ buildingSystem: z.literal("Facade"), ...FacadeDimensionsSchema.shape }), + z.object({ buildingSystem: z.literal("Floors"), ...FloorDimensionsSchema.shape }), + z.object({ buildingSystem: z.literal("Modules"), ...ModuleDimensionsSchema.shape }), + z.object({ buildingSystem: z.literal("Plants"), ...PlantDimensionsSchema.shape }), + z.object({ buildingSystem: z.literal("Roofs"), ...RoofDimensionsSchema.shape }), + z.object({ buildingSystem: z.literal("Stairs"), ...StairsDimensionsSchema.shape }), + z.object({ buildingSystem: z.literal("Structure"), ...StructureDimensionsSchema.shape }) + ]) +}); + +export { DimensionSchema }; \ No newline at end of file From ce6eb3a34c44eeb91a8e4f73ae4a3cd889b2d084 Mon Sep 17 00:00:00 2001 From: Fuhrimann Lukas Date: Sat, 28 Feb 2026 20:08:04 +0100 Subject: [PATCH 4/7] extended DimensionalAttributesSchema --- src/types/common/dimensionSchema.ts | 88 ------------------- .../common/dimensionalAttributesSchema.ts | 5 +- src/types/common/productCategorySchema.ts | 5 +- src/types/entities/prefabElementSchema.ts | 2 +- 4 files changed, 9 insertions(+), 91 deletions(-) delete mode 100644 src/types/common/dimensionSchema.ts diff --git a/src/types/common/dimensionSchema.ts b/src/types/common/dimensionSchema.ts deleted file mode 100644 index d6b9adf..0000000 --- a/src/types/common/dimensionSchema.ts +++ /dev/null @@ -1,88 +0,0 @@ -import { z } from "zod"; - -// Wall dimensions -const WallDimensionsSchema = z.object({ - length: z.number().positive().optional(), - thickness: z.number().positive().optional(), - height: z.number().positive().optional() -}); - -// Balcony dimensions -const BalconyDimensionsSchema = z.object({ - length: z.number().positive().optional(), - width: z.number().positive().optional(), - height: z.number().positive().optional() -}); - -// Pod dimensions -const PodDimensionsSchema = z.object({ - length: z.number().positive().optional(), - width: z.number().positive().optional(), - height: z.number().positive().optional() -}); - -// Frame dimensions -const FrameDimensionsSchema = z.object({ - length: z.number().positive().optional(), - width: z.number().positive().optional(), - thickness: z.number().positive().optional() -}); - -// Floor dimensions -const FloorDimensionsSchema = z.object({ - length: z.number().positive().optional(), - width: z.number().positive().optional(), - thickness: z.number().positive().optional() -}); - -// Module dimensions -const ModuleDimensionsSchema = z.object({ - length: z.number().positive().optional(), - width: z.number().positive().optional(), - height: z.number().positive().optional() -}); - -// Roof dimensions -const RoofDimensionsSchema = z.object({ - length: z.number().positive().optional(), - width: z.number().positive().optional(), - thickness: z.number().positive().optional() -}); - -// Stairs dimensions -const StairsDimensionsSchema = z.object({ - length: z.number().positive().optional(), - width: z.number().positive().optional(), - height: z.number().positive().optional(), - numberOfSteps: z.number().int().positive().optional(), - riserHeight: z.number().positive().optional(), - treadDepth: z.number().positive().optional() -}); - -// Structure dimensions - SIMPLIFIED -const StructureDimensionsSchema = z.object({ - length: z.number().positive().optional(), - width: z.number().positive().optional(), - height: z.number().positive().optional(), - depth: z.number().positive().optional(), - diameter: z.number().positive().optional() -}); - -// Discriminated union by building system -const DimensionSchema = z.object({ - dimensions: z.discriminatedUnion("buildingSystem", [ - z.object({ buildingSystem: z.literal("Wall"), ...WallDimensionsSchema.shape }), - z.object({ buildingSystem: z.literal("Balcony"), ...BalconyDimensionsSchema.shape }), - z.object({ buildingSystem: z.literal("Pod"), ...PodDimensionsSchema.shape }), - z.object({ buildingSystem: z.literal("Frame"), ...FrameDimensionsSchema.shape }), - z.object({ buildingSystem: z.literal("Facade"), ...FacadeDimensionsSchema.shape }), - z.object({ buildingSystem: z.literal("Floors"), ...FloorDimensionsSchema.shape }), - z.object({ buildingSystem: z.literal("Modules"), ...ModuleDimensionsSchema.shape }), - z.object({ buildingSystem: z.literal("Plants"), ...PlantDimensionsSchema.shape }), - z.object({ buildingSystem: z.literal("Roofs"), ...RoofDimensionsSchema.shape }), - z.object({ buildingSystem: z.literal("Stairs"), ...StairsDimensionsSchema.shape }), - z.object({ buildingSystem: z.literal("Structure"), ...StructureDimensionsSchema.shape }) - ]) -}); - -export { DimensionSchema }; \ No newline at end of file diff --git a/src/types/common/dimensionalAttributesSchema.ts b/src/types/common/dimensionalAttributesSchema.ts index eecb412..42ee9c6 100644 --- a/src/types/common/dimensionalAttributesSchema.ts +++ b/src/types/common/dimensionalAttributesSchema.ts @@ -4,7 +4,10 @@ import { RangeSchema } from "./rangeSchema"; const DimensionalAttributesSchema = z.object({ width: RangeSchema, height: RangeSchema, - length: RangeSchema + length: RangeSchema, + depth: RangeSchema, + thickness: RangeSchema, + radius: RangeSchema, }); type DimensionalAttributes = z.infer; diff --git a/src/types/common/productCategorySchema.ts b/src/types/common/productCategorySchema.ts index 7002d28..c1ef203 100644 --- a/src/types/common/productCategorySchema.ts +++ b/src/types/common/productCategorySchema.ts @@ -11,7 +11,10 @@ const RawProductCategorySchema = z.object({ }); const productCategoryValues: z.infer[] = [ - { category: "Boarding", buildingSystem: "Wall", ifcCompatibleElements: ["IfcWall","IfcBuildingElementProxy"] }, + { category: "Boarding", + buildingSystem: "Wall", + ifcCompatibleElements: ["IfcWall","IfcBuildingElementProxy"] + }, { category: "Solid Wall Panels", buildingSystem: "Wall", ifcCompatibleElements: ["IfcWall","IfcBuildingElementProxy"] }, { category: "Closed Wall Panels", buildingSystem: "Wall", ifcCompatibleElements: ["IfcWall","IfcBuildingElementProxy"] }, { category: "Twinwall", buildingSystem: "Wall", ifcCompatibleElements: ["IfcWall","IfcBuildingElementProxy"] }, diff --git a/src/types/entities/prefabElementSchema.ts b/src/types/entities/prefabElementSchema.ts index 45fd01d..577d6a7 100644 --- a/src/types/entities/prefabElementSchema.ts +++ b/src/types/entities/prefabElementSchema.ts @@ -49,7 +49,7 @@ const PrefabElementSchema = z.object({ example: "This CLT wall panel is suitable for multi-story residential buildings and meets fire resistance standards." }), boundingBox: BoundingBoxSchema - .describe("3D bounding dimensions of the prefab element.") + .describe("3D bounding dimensions of the prefab element, located at the World Origin 0,0,0.") .openapi({ description: "3D bounding dimensions of the prefab element, defining its spatial envelope." }), From ac4f8d060fac25366de48204bf9350cce9e62ed9 Mon Sep 17 00:00:00 2001 From: Fuhrimann Lukas Date: Sat, 28 Feb 2026 20:19:36 +0100 Subject: [PATCH 5/7] removed linebreak --- src/types/common/productCategorySchema.ts | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/types/common/productCategorySchema.ts b/src/types/common/productCategorySchema.ts index c1ef203..7002d28 100644 --- a/src/types/common/productCategorySchema.ts +++ b/src/types/common/productCategorySchema.ts @@ -11,10 +11,7 @@ const RawProductCategorySchema = z.object({ }); const productCategoryValues: z.infer[] = [ - { category: "Boarding", - buildingSystem: "Wall", - ifcCompatibleElements: ["IfcWall","IfcBuildingElementProxy"] - }, + { category: "Boarding", buildingSystem: "Wall", ifcCompatibleElements: ["IfcWall","IfcBuildingElementProxy"] }, { category: "Solid Wall Panels", buildingSystem: "Wall", ifcCompatibleElements: ["IfcWall","IfcBuildingElementProxy"] }, { category: "Closed Wall Panels", buildingSystem: "Wall", ifcCompatibleElements: ["IfcWall","IfcBuildingElementProxy"] }, { category: "Twinwall", buildingSystem: "Wall", ifcCompatibleElements: ["IfcWall","IfcBuildingElementProxy"] }, From c408113d78f996c163c5b516b43cd757ca396fc6 Mon Sep 17 00:00:00 2001 From: Fuhrimann Lukas Date: Mon, 2 Mar 2026 10:48:22 +0100 Subject: [PATCH 6/7] =?UTF-8?q?=C3=9Bpdated=20comments=20and=20added=20des?= =?UTF-8?q?cription?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 ++ src/types/common/boundingBoxSchema.ts | 17 ++++++++--------- .../common/dimensionalAttributesSchema.ts | 18 ++++++++++++------ src/types/entities/prefabElementSchema.ts | 6 +++--- 4 files changed, 25 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index f543a3d..6f7714f 100644 --- a/README.md +++ b/README.md @@ -56,6 +56,8 @@ You can always find the most up-to-date [API documentation here](https://mod-con ## Data Model +> **Note on Units**: All units decsribing the geometry of prefab elements are expressed in **millimeters (mm)** unless otherwise specified. + ```mermaid erDiagram PrefabElement { diff --git a/src/types/common/boundingBoxSchema.ts b/src/types/common/boundingBoxSchema.ts index 577bec7..75154b2 100644 --- a/src/types/common/boundingBoxSchema.ts +++ b/src/types/common/boundingBoxSchema.ts @@ -1,18 +1,17 @@ import { z } from "zod"; -// Local Bounding Box (element's own coordinate system) const BoundingBoxSchema = z.object({ min: z.tuple([ - z.literal(0), // Always 0 in local space - z.literal(0), - z.literal(0) - ]).describe("Minimum corner (always at local origin)"), + z.number(), + z.number(), + z.number() + ]).default([0, 0, 0]).describe("Minimum corner (defaults at local origin (0,0,0)) in millimeters"), max: z.tuple([ - z.number().positive(), // Length - z.number().positive(), // Width - z.number().positive() // Height - ]).describe("Maximum corner in millimeters"), + z.number().positive(), + z.number().positive(), + z.number().positive() + ]).describe("Maximum corner in millimeters and defined in the local coordianate system"), }).openapi({ description: "Local bounding box aligned to element's own axes, origin at (0,0,0). Dimensions in millimeters." diff --git a/src/types/common/dimensionalAttributesSchema.ts b/src/types/common/dimensionalAttributesSchema.ts index 42ee9c6..d96e5a7 100644 --- a/src/types/common/dimensionalAttributesSchema.ts +++ b/src/types/common/dimensionalAttributesSchema.ts @@ -2,12 +2,18 @@ import { z } from "zod"; import { RangeSchema } from "./rangeSchema"; const DimensionalAttributesSchema = z.object({ - width: RangeSchema, - height: RangeSchema, - length: RangeSchema, - depth: RangeSchema, - thickness: RangeSchema, - radius: RangeSchema, + length: RangeSchema.describe("Primary dimension along the longest horizontal axis of the element. Used for linear elements like beams, walls, and slabs."), + width: RangeSchema.describe("Secondary horizontal dimension perpendicular to length. Used for planar elements like slabs, walls, and panels."), + height: RangeSchema.describe("Vertical dimension. Defines the elevation of elements like walls and columns."), + depth: RangeSchema.describe("Cross-sectional dimension of structural members like beams and columns."), + thickness: RangeSchema.describe("Smallest dimension of planar elements such as walls, slabs, or panels. Represents the cross-sectional depth."), + radius: RangeSchema.describe("Radius of circular or cylindrical elements like columns, piles, or pipes."), +}).openapi({ + description: + "Dimensional attributes defining the physical size of prefab elements. " + + "All dimensions are optional and dependent on element type. " + + "All measurements are in millimeters (mm). " + + "Ranges represent manufacturing constraints.", }); type DimensionalAttributes = z.infer; diff --git a/src/types/entities/prefabElementSchema.ts b/src/types/entities/prefabElementSchema.ts index 577d6a7..02c9abf 100644 --- a/src/types/entities/prefabElementSchema.ts +++ b/src/types/entities/prefabElementSchema.ts @@ -1,6 +1,6 @@ import { z } from "zod"; import { AestheticAndCustomizationOptionsSchema } from "../common/aestheticAndCustomizationOptionsSchema"; -import { BoundingBoxSchema} from "../common/boundingBoxSchema"; +import { BoundingBoxSchema } from "../common/boundingBoxSchema"; import { DimensionalAttributesSchema } from "../common/dimensionalAttributesSchema"; import { DocumentationAndComplianceSchema } from "../common/documentationAndComplianceSchema"; import { EconomicFactorsSchema } from "../common/economicFactorsSchema"; @@ -49,9 +49,9 @@ const PrefabElementSchema = z.object({ example: "This CLT wall panel is suitable for multi-story residential buildings and meets fire resistance standards." }), boundingBox: BoundingBoxSchema - .describe("3D bounding dimensions of the prefab element, located at the World Origin 0,0,0.") + .describe("3D bounding dimensions of the prefab element, located at the Local Origin (0,0,0).") .openapi({ - description: "3D bounding dimensions of the prefab element, defining its spatial envelope." + description: "3D bounding dimensions of the prefab element, located at the local origin (0,0,0)." }), images: z.array(z.string()).min(1, "At least one image is required") .describe("Image URLs of the element") From 6fafcc8222e4a6d32d3d25c63e368c333a8b0ab4 Mon Sep 17 00:00:00 2001 From: Fuhrimann Lukas Date: Wed, 4 Mar 2026 10:25:32 +0100 Subject: [PATCH 7/7] updated boundingbox schema --- src/types/common/boundingBoxSchema.ts | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/types/common/boundingBoxSchema.ts b/src/types/common/boundingBoxSchema.ts index 75154b2..b1b1315 100644 --- a/src/types/common/boundingBoxSchema.ts +++ b/src/types/common/boundingBoxSchema.ts @@ -1,12 +1,6 @@ import { z } from "zod"; -const BoundingBoxSchema = z.object({ - min: z.tuple([ - z.number(), - z.number(), - z.number() - ]).default([0, 0, 0]).describe("Minimum corner (defaults at local origin (0,0,0)) in millimeters"), - +const BoundingBoxSchema = z.object({ max: z.tuple([ z.number().positive(), z.number().positive(),