feat: Latest production version with interior scene and glass
Includes room interior with floor, walls, glass you can see through, and all uncommitted production changes that were running live. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -8,55 +8,27 @@
|
||||
// MANUFACTURING CONSTANTS
|
||||
// ============================================
|
||||
|
||||
/**
|
||||
* Steel Profile Dimensions (40x40mm Square Tube)
|
||||
* Standard industrial steel door profile
|
||||
*/
|
||||
export const PROFILE_WIDTH = 40; // mm - Face width
|
||||
export const PROFILE_DEPTH = 40; // mm - Tube depth
|
||||
export const PROFILE_CORNER_RADIUS = 2; // mm - Rounded corners for welding
|
||||
|
||||
/**
|
||||
* Steel Profile Named Exports (aliases for pricing/manufacturing clarity)
|
||||
*/
|
||||
export const STILE_WIDTH = 40; // mm - Vertical profiles (same as PROFILE_WIDTH)
|
||||
export const STILE_WIDTH = 40; // mm - Vertical profiles
|
||||
export const RAIL_WIDTH = 20; // mm - Horizontal slim-line profiles
|
||||
|
||||
/**
|
||||
* Glass Specifications - Standard 33.1 laminated safety glass (VSG 33.1)
|
||||
*/
|
||||
export const GLASS_THICKNESS = 7; // mm - Standard 33.1 Safety Glass
|
||||
export const GLASS_OFFSET = 15; // mm - Center glass in 40mm profile: (40-7)/2 - 1.5mm clearance
|
||||
export const GLASS_OFFSET = 15; // mm - Center glass in 40mm profile
|
||||
|
||||
/**
|
||||
* Rail Height Variations
|
||||
*/
|
||||
export const RAIL_HEIGHT_SLIM = 20; // mm - Slim horizontal rails
|
||||
export const RAIL_HEIGHT_ROBUST = 40; // mm - Standard robust rails (same as profile)
|
||||
export const RAIL_HEIGHT_ROBUST = 40; // mm - Standard robust rails
|
||||
|
||||
/**
|
||||
* Taats (Pivot) Door Mechanism
|
||||
*/
|
||||
export const TAATS_PIVOT_OFFSET = 60; // mm - Pivot axis offset from wall for Taats doors
|
||||
export const TAATS_PIVOT_OFFSET = 60; // mm
|
||||
export const STELRUIMTE = 10; // mm
|
||||
export const HANGNAAD = 3; // mm
|
||||
export const WALL_THICKNESS = 150; // mm
|
||||
|
||||
/**
|
||||
* Wall Mounting Dimensions (Sparingsmaat / Deurmaat)
|
||||
* Dutch building standard: Sparingsmaat = rough wall opening
|
||||
*/
|
||||
export const STELRUIMTE = 10; // mm - Total tolerance between wall and frame (5mm per side)
|
||||
export const HANGNAAD = 3; // mm - Gap between frame and door leaf per side
|
||||
export const WALL_THICKNESS = 150; // mm - Standard interior wall thickness
|
||||
|
||||
/**
|
||||
* Calculate mounting dimensions from Sparingsmaat (wall opening).
|
||||
*
|
||||
* Sparingsmaat (input) -> Frame -> Door Leaf
|
||||
* Frame = Sparingsmaat - STELRUIMTE (10mm tolerance)
|
||||
* DoorLeaf = Frame - 2*PROFILE_WIDTH - 2*HANGNAAD (6mm gap)
|
||||
*/
|
||||
export function calculateMountingDimensions(sparingsmaatWidth: number, sparingsmaatHeight: number) {
|
||||
const frameOuterWidth = sparingsmaatWidth - STELRUIMTE;
|
||||
const frameOuterHeight = sparingsmaatHeight - STELRUIMTE / 2; // 5mm top tolerance only
|
||||
const frameOuterHeight = sparingsmaatHeight - STELRUIMTE / 2;
|
||||
const doorLeafWidth = frameOuterWidth - (2 * HANGNAAD);
|
||||
const doorLeafHeight = frameOuterHeight - (2 * HANGNAAD);
|
||||
|
||||
@@ -67,8 +39,8 @@ export function calculateMountingDimensions(sparingsmaatWidth: number, sparingsm
|
||||
frameOuterHeight,
|
||||
doorLeafWidth,
|
||||
doorLeafHeight,
|
||||
stelruimtePerSide: STELRUIMTE / 2, // 5mm gap visible on each side
|
||||
hangnaadPerSide: HANGNAAD, // 3mm gap between frame and leaf
|
||||
stelruimtePerSide: STELRUIMTE / 2,
|
||||
hangnaadPerSide: HANGNAAD,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -78,51 +50,69 @@ export function calculateMountingDimensions(sparingsmaatWidth: number, sparingsm
|
||||
|
||||
export type PartType = 'stile' | 'rail' | 'glass' | 'divider';
|
||||
export type DoorModel = 'taats' | 'scharnier' | 'paneel';
|
||||
export type GridLayout = '3-vlak' | '4-vlak' | 'geen';
|
||||
export type GridLayout =
|
||||
| 'geen'
|
||||
| '2-vlak'
|
||||
| '3-vlak'
|
||||
| '4-vlak'
|
||||
| '6-vlak'
|
||||
| '8-vlak'
|
||||
| 'kruis'
|
||||
| 'ongelijk-3'
|
||||
| 'boerderij'
|
||||
| 'herenhuis';
|
||||
|
||||
/**
|
||||
* Physical Door Component
|
||||
* Represents an actual steel part that will be manufactured
|
||||
*/
|
||||
export interface PhysicalPart {
|
||||
type: PartType;
|
||||
// Position in 3D space (in mm, relative to door center)
|
||||
x: number;
|
||||
y: number;
|
||||
z: number;
|
||||
// Dimensions in mm
|
||||
width: number;
|
||||
height: number;
|
||||
depth: number;
|
||||
// Metadata
|
||||
label?: string;
|
||||
isGlass?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Complete Door Assembly
|
||||
*/
|
||||
export interface DoorAssembly {
|
||||
modelId: DoorModel;
|
||||
gridLayout: GridLayout;
|
||||
doorWidth: number; // mm - Actual door leaf width
|
||||
doorHeight: number; // mm - Door height
|
||||
doorWidth: number;
|
||||
doorHeight: number;
|
||||
parts: PhysicalPart[];
|
||||
}
|
||||
|
||||
// ============================================
|
||||
// GRID PATTERN DEFINITIONS (DATA-DRIVEN)
|
||||
// ============================================
|
||||
|
||||
/**
|
||||
* Grid pattern definition as data.
|
||||
* horizontalPositions: fractional Y positions (0 = bottom, 1 = top) for horizontal dividers
|
||||
* verticalPositions: fractional X positions (0 = left, 1 = right) for vertical dividers
|
||||
*/
|
||||
interface GridPatternDef {
|
||||
horizontalPositions: number[];
|
||||
verticalPositions: number[];
|
||||
}
|
||||
|
||||
const GRID_PATTERNS: Record<GridLayout, GridPatternDef> = {
|
||||
'geen': { horizontalPositions: [], verticalPositions: [] },
|
||||
'2-vlak': { horizontalPositions: [0.5], verticalPositions: [] },
|
||||
'3-vlak': { horizontalPositions: [1 / 3, 2 / 3], verticalPositions: [] },
|
||||
'4-vlak': { horizontalPositions: [0.25, 0.5, 0.75], verticalPositions: [] },
|
||||
'6-vlak': { horizontalPositions: [1 / 3, 2 / 3], verticalPositions: [0.5] },
|
||||
'8-vlak': { horizontalPositions: [0.25, 0.5, 0.75], verticalPositions: [0.5] },
|
||||
'kruis': { horizontalPositions: [0.5], verticalPositions: [0.5] },
|
||||
'ongelijk-3': { horizontalPositions: [0.35, 0.65], verticalPositions: [] },
|
||||
'boerderij': { horizontalPositions: [0.7], verticalPositions: [0.5] },
|
||||
'herenhuis': { horizontalPositions: [0.3, 0.7], verticalPositions: [] },
|
||||
};
|
||||
|
||||
// ============================================
|
||||
// LAYOUT GENERATION
|
||||
// ============================================
|
||||
|
||||
/**
|
||||
* Generate physical parts list for door manufacturing
|
||||
*
|
||||
* @param modelId - Door model (taats, scharnier, paneel)
|
||||
* @param gridLayout - Grid division (3-vlak, 4-vlak, geen)
|
||||
* @param doorWidth - Door leaf width in mm
|
||||
* @param doorHeight - Door height in mm
|
||||
* @returns Complete assembly with all physical parts
|
||||
*/
|
||||
export function generateDoorAssembly(
|
||||
modelId: DoorModel,
|
||||
gridLayout: GridLayout,
|
||||
@@ -130,12 +120,13 @@ export function generateDoorAssembly(
|
||||
doorHeight: number
|
||||
): DoorAssembly {
|
||||
const parts: PhysicalPart[] = [];
|
||||
const pattern = GRID_PATTERNS[gridLayout] || GRID_PATTERNS['geen'];
|
||||
|
||||
// ============================================
|
||||
// PERIMETER FRAME (All door types)
|
||||
// PERIMETER FRAME
|
||||
// ============================================
|
||||
|
||||
// LEFT STILE (Vertical)
|
||||
// LEFT STILE
|
||||
parts.push({
|
||||
type: 'stile',
|
||||
x: -doorWidth / 2 + PROFILE_WIDTH / 2,
|
||||
@@ -147,7 +138,7 @@ export function generateDoorAssembly(
|
||||
label: 'Left Stile',
|
||||
});
|
||||
|
||||
// RIGHT STILE (Vertical)
|
||||
// RIGHT STILE
|
||||
parts.push({
|
||||
type: 'stile',
|
||||
x: doorWidth / 2 - PROFILE_WIDTH / 2,
|
||||
@@ -159,7 +150,7 @@ export function generateDoorAssembly(
|
||||
label: 'Right Stile',
|
||||
});
|
||||
|
||||
// TOP RAIL (Horizontal)
|
||||
// TOP RAIL
|
||||
const topRailWidth = doorWidth - PROFILE_WIDTH * 2;
|
||||
parts.push({
|
||||
type: 'rail',
|
||||
@@ -172,7 +163,7 @@ export function generateDoorAssembly(
|
||||
label: 'Top Rail',
|
||||
});
|
||||
|
||||
// BOTTOM RAIL (Horizontal)
|
||||
// BOTTOM RAIL
|
||||
parts.push({
|
||||
type: 'rail',
|
||||
x: 0,
|
||||
@@ -185,80 +176,57 @@ export function generateDoorAssembly(
|
||||
});
|
||||
|
||||
// ============================================
|
||||
// GRID DIVIDERS (Based on layout)
|
||||
// HORIZONTAL DIVIDERS (from pattern data)
|
||||
// ============================================
|
||||
|
||||
if (gridLayout === '3-vlak') {
|
||||
// Two horizontal dividers at 1/3 and 2/3 height
|
||||
const divider1Y = doorHeight / 2 - doorHeight / 3;
|
||||
const divider2Y = doorHeight / 2 - (2 * doorHeight) / 3;
|
||||
const innerHeight = doorHeight - RAIL_HEIGHT_ROBUST * 2;
|
||||
const innerBottom = -doorHeight / 2 + RAIL_HEIGHT_ROBUST;
|
||||
|
||||
for (const fraction of pattern.horizontalPositions) {
|
||||
const dividerY = innerBottom + innerHeight * fraction;
|
||||
|
||||
// Determine width: if there are vertical dividers, horizontal dividers span full width
|
||||
// (vertical dividers will be handled separately)
|
||||
parts.push({
|
||||
type: 'divider',
|
||||
x: 0,
|
||||
y: divider1Y,
|
||||
y: dividerY,
|
||||
z: 0,
|
||||
width: topRailWidth,
|
||||
height: RAIL_HEIGHT_SLIM,
|
||||
depth: PROFILE_DEPTH,
|
||||
label: 'Divider 1/3',
|
||||
});
|
||||
|
||||
parts.push({
|
||||
type: 'divider',
|
||||
x: 0,
|
||||
y: divider2Y,
|
||||
z: 0,
|
||||
width: topRailWidth,
|
||||
height: RAIL_HEIGHT_SLIM,
|
||||
depth: PROFILE_DEPTH,
|
||||
label: 'Divider 2/3',
|
||||
});
|
||||
} else if (gridLayout === '4-vlak') {
|
||||
// Three horizontal dividers at 1/4, 1/2, 3/4 height
|
||||
const divider1Y = doorHeight / 2 - doorHeight / 4;
|
||||
const divider2Y = 0;
|
||||
const divider3Y = doorHeight / 2 - (3 * doorHeight) / 4;
|
||||
|
||||
parts.push({
|
||||
type: 'divider',
|
||||
x: 0,
|
||||
y: divider1Y,
|
||||
z: 0,
|
||||
width: topRailWidth,
|
||||
height: RAIL_HEIGHT_SLIM,
|
||||
depth: PROFILE_DEPTH,
|
||||
label: 'Divider 1/4',
|
||||
});
|
||||
|
||||
parts.push({
|
||||
type: 'divider',
|
||||
x: 0,
|
||||
y: divider2Y,
|
||||
z: 0,
|
||||
width: topRailWidth,
|
||||
height: RAIL_HEIGHT_SLIM,
|
||||
depth: PROFILE_DEPTH,
|
||||
label: 'Divider 1/2',
|
||||
});
|
||||
|
||||
parts.push({
|
||||
type: 'divider',
|
||||
x: 0,
|
||||
y: divider3Y,
|
||||
z: 0,
|
||||
width: topRailWidth,
|
||||
height: RAIL_HEIGHT_SLIM,
|
||||
depth: PROFILE_DEPTH,
|
||||
label: 'Divider 3/4',
|
||||
label: `H-Divider ${Math.round(fraction * 100)}%`,
|
||||
});
|
||||
}
|
||||
|
||||
// ============================================
|
||||
// VERTICAL CENTER DIVIDER (Paneel type only)
|
||||
// VERTICAL DIVIDERS (from pattern data)
|
||||
// ============================================
|
||||
|
||||
if (modelId === 'paneel') {
|
||||
const innerWidth = doorWidth - PROFILE_WIDTH * 2;
|
||||
const innerLeft = -doorWidth / 2 + PROFILE_WIDTH;
|
||||
|
||||
for (const fraction of pattern.verticalPositions) {
|
||||
const dividerX = innerLeft + innerWidth * fraction;
|
||||
const verticalDividerHeight = innerHeight;
|
||||
|
||||
parts.push({
|
||||
type: 'divider',
|
||||
x: dividerX,
|
||||
y: 0,
|
||||
z: 0,
|
||||
width: PROFILE_WIDTH,
|
||||
height: verticalDividerHeight,
|
||||
depth: PROFILE_DEPTH,
|
||||
label: `V-Divider ${Math.round(fraction * 100)}%`,
|
||||
});
|
||||
}
|
||||
|
||||
// ============================================
|
||||
// PANEEL TYPE CENTER VERTICAL DIVIDER
|
||||
// ============================================
|
||||
|
||||
if (modelId === 'paneel' && !pattern.verticalPositions.includes(0.5)) {
|
||||
const verticalDividerHeight = doorHeight - RAIL_HEIGHT_ROBUST * 2;
|
||||
|
||||
parts.push({
|
||||
@@ -277,7 +245,6 @@ export function generateDoorAssembly(
|
||||
// GLASS PANELS
|
||||
// ============================================
|
||||
|
||||
// Calculate glass dimensions (inside frame with offset)
|
||||
const glassWidth = doorWidth - PROFILE_WIDTH * 2 - GLASS_OFFSET * 2;
|
||||
const glassHeight = doorHeight - RAIL_HEIGHT_ROBUST * 2 - GLASS_OFFSET * 2;
|
||||
|
||||
@@ -302,41 +269,32 @@ export function generateDoorAssembly(
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert mm to meters for Three.js 3D scene
|
||||
*/
|
||||
export function mmToMeters(mm: number): number {
|
||||
return mm / 1000;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get divider positions in meters (for backward compatibility)
|
||||
*/
|
||||
export function getDividerPositions(
|
||||
gridLayout: GridLayout,
|
||||
doorHeight: number
|
||||
): number[] {
|
||||
const pattern = GRID_PATTERNS[gridLayout];
|
||||
if (!pattern) return [];
|
||||
|
||||
const doorHeightMeters = mmToMeters(doorHeight);
|
||||
const innerHeight = doorHeightMeters - mmToMeters(RAIL_HEIGHT_ROBUST * 2);
|
||||
const innerBottom = -doorHeightMeters / 2 + mmToMeters(RAIL_HEIGHT_ROBUST);
|
||||
|
||||
if (gridLayout === '3-vlak') {
|
||||
return [-doorHeightMeters / 3, doorHeightMeters / 3];
|
||||
} else if (gridLayout === '4-vlak') {
|
||||
return [-doorHeightMeters / 2, 0, doorHeightMeters / 2];
|
||||
}
|
||||
|
||||
return [];
|
||||
return pattern.horizontalPositions.map(
|
||||
(fraction) => innerBottom + innerHeight * fraction
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Validation: Check if door dimensions are manufacturable
|
||||
*/
|
||||
export function validateDoorDimensions(
|
||||
doorWidth: number,
|
||||
doorHeight: number
|
||||
): { valid: boolean; errors: string[] } {
|
||||
const errors: string[] = [];
|
||||
|
||||
// Minimum dimensions check
|
||||
if (doorWidth < PROFILE_WIDTH * 3) {
|
||||
errors.push(`Door width too small (min: ${PROFILE_WIDTH * 3}mm)`);
|
||||
}
|
||||
@@ -345,7 +303,6 @@ export function validateDoorDimensions(
|
||||
errors.push(`Door height too small (min: ${RAIL_HEIGHT_ROBUST * 3}mm)`);
|
||||
}
|
||||
|
||||
// Maximum dimensions check (based on steel profile strength)
|
||||
if (doorWidth > 1200) {
|
||||
errors.push('Door width exceeds maximum (1200mm) - structural integrity');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user