Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
19 changes: 13 additions & 6 deletions src/types/common/boundingBoxSchema.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
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")
const BoundingBoxSchema = z.object({
max: z.tuple([
z.number().positive(),
z.number().positive(),
z.number().positive()
]).describe("Maximum corner in millimeters and defined in the local coordianate system"),

}).openapi({
description: "The bounding box of an element in millimeters.",
description: "Local bounding box aligned to element's own axes, origin at (0,0,0). Dimensions in millimeters."
});

type BoundingBox = z.infer<typeof BoundingBoxSchema>;
export { BoundingBoxSchema, BoundingBox };

export {
BoundingBoxSchema,
BoundingBox,
};
15 changes: 12 additions & 3 deletions src/types/common/dimensionalAttributesSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,18 @@ import { z } from "zod";
import { RangeSchema } from "./rangeSchema";

const DimensionalAttributesSchema = z.object({
width: RangeSchema,
height: RangeSchema,
length: 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<typeof DimensionalAttributesSchema>;
Expand Down
4 changes: 2 additions & 2 deletions src/types/entities/prefabElementSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.")
.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")
Expand Down