import { OpenPlans } from 'openplans';
async function createApartment() {
const container = document.getElementById('app');
const openPlans = new OpenPlans(container);
await openPlans.setupOpenGeometry();
openPlans.showGrid = false;
// Create bedroom
const bedroom = openPlans.rectangle({
center: [2, 0, 1.75],
width: 4,
breadth: 3.5,
color: 0x000000
});
// Create living room
const livingRoom = openPlans.rectangle({
center: [7, 0, 2],
width: 6,
breadth: 4,
color: 0x000000
});
// Add entrance door
const entranceDoor = openPlans.baseDoor({
labelName: 'Entrance',
doorPosition: [0, 0, 1],
doorLength: 2,
doorHeight: 2.1,
doorThickness: 0.1,
doorColor: 0x8B4513,
doorQuadrant: 1
});
// Add bedroom door
const bedroomDoor = openPlans.baseDoor({
labelName: 'Bedroom',
doorPosition: [4, 0, 2],
doorLength: 1.8,
doorHeight: 2.1,
doorThickness: 0.1,
doorColor: 0x8B4513,
doorQuadrant: 2
});
// Add windows
const bedroomWindow = openPlans.baseSingleWindow({
labelName: 'Bedroom Window',
windowPosition: [2, 0, 3.5],
windowLength: 1.5,
windowHeight: 1.2
});
const livingRoomWindow = openPlans.baseDoubleWindow({
labelName: 'Living Room Windows',
windowPosition: [7, 0, 4],
windowLength: 2.5,
windowHeight: 1.5
});
// Fit camera to view all elements
openPlans.fit('RectanglePrimitive');
}
createApartment();