Room interior layout via AI
by Mach3 ·
Room design in OpenSCAD is so much more useful compared to purely artistic nano-banana visualization: all the dimensions are correct and could be verified, so this is actually useful for interior layout.
Interactive Preview & Customizer
3D preview with browser-based OpenSCAD rendering on parameter changes.
Loading preview...
Toggle to show/hide the ceiling
Toggle to show/hide front wall (entrance wall) for viewing
Toggle to show/hide right wall for viewing
Toggle to show/hide left wall for viewing
Toggle to show/hide back wall for viewing
Toggle to show/hide floor
Toggle to show/hide furniture
step 10
step 10
step 10
step 1
step 10
step 10
step 5
step 5
step 10
step 5
step 5
step 10
step 5
step 10
step 5
WASM compiler loads on first parameter change.
Screenshots
Prompt Assets
Prompt image
Prompt
design this room interior with L-shaped sofa and a desk near the window. visualized in nano banana.
OpenSCAD Code
// OpenSCAD Room Design Model
// Version: v08
// Dimensions in CENTIMETERS
/* [View Control] */
// Toggle to show/hide the ceiling
show_ceiling = false;
// Toggle to show/hide front wall (entrance wall) for viewing
show_front_wall = false;
// Toggle to show/hide right wall for viewing
show_right_wall = false;
// Toggle to show/hide left wall for viewing
show_left_wall = true;
// Toggle to show/hide back wall for viewing
show_back_wall = true;
// Toggle to show/hide floor
show_floor = true;
// Toggle to show/hide furniture
show_furniture = true;
/* [Room Dimensions] */
room_w = 300; // [250:10:500]
room_d = 360; // [250:10:500]
room_h = 254; // [200:10:400]
wall_t = 10; // [5:1:30]
/* [Furniture Dimensions] */
sofa_long_len = 200; // [150:10:300]
sofa_short_len = 150; // [100:10:250]
sofa_depth = 85; // [60:5:120]
sofa_height = 75; // [50:5:100]
table_w = 120; // [80:10:200]
table_d = 60; // [40:5:100]
table_h = 75; // [60:5:100]
wardrobe_w = 200; // [100:10:300]
wardrobe_d = 45; // [30:5:80]
wardrobe_h = 220; // [150:10:250]
wardrobe_y = 155; // [50:5:200]
/* [Hidden] */
$fn = 32;
// Colors
color_wall = [0.95, 0.95, 0.90]; // Cream/off-white
color_floor = [0.65, 0.50, 0.35]; // Warm oak parquet
color_ceiling = [0.98, 0.98, 0.98]; // Pure white
color_frame = [0.95, 0.95, 0.95]; // White PVC frame
color_glass = [0.70, 0.90, 1.00, 0.4]; // Transparent blue glass
color_door = [0.92, 0.92, 0.92]; // White entrance door
color_sofa = [0.28, 0.35, 0.45]; // Slate blue fabric
color_cushion = [0.35, 0.43, 0.53]; // Slightly lighter slate blue
color_wood = [0.72, 0.52, 0.32]; // Tabletop oak
color_metal = [0.15, 0.15, 0.15]; // Black metal desk legs
color_radiator = [0.90, 0.90, 0.90]; // Light grey metal
color_wardrobe = [0.93, 0.93, 0.93]; // Off-white wardrobe body
color_wardrobe_door = [0.96, 0.96, 0.96]; // Satin white doors
color_outlet = [0.94, 0.94, 0.94]; // Off-white plastic outlets
// Helper module for rounded boxes (fast using hull of cylinders along Z)
module rounded_box_z(size, r) {
hull() {
translate([r, r, 0]) cylinder(h=size[2], r=r);
translate([size[0]-r, r, 0]) cylinder(h=size[2], r=r);
translate([r, size[1]-r, 0]) cylinder(h=size[2], r=r);
translate([size[0]-r, size[1]-r, 0]) cylinder(h=size[2], r=r);
}
}
// Full rounded box (using spheres at corners for cushions)
module rounded_box_3d(size, r) {
hull() {
translate([r, r, r]) sphere(r=r, $fn=16);
translate([size[0]-r, r, r]) sphere(r=r, $fn=16);
translate([r, size[1]-r, r]) sphere(r=r, $fn=16);
translate([size[0]-r, size[1]-r, r]) sphere(r=r, $fn=16);
translate([r, r, size[2]-r]) sphere(r=r, $fn=16);
translate([size[0]-r, r, size[2]-r]) sphere(r=r, $fn=16);
translate([r, size[1]-r, size[2]-r]) sphere(r=r, $fn=16);
translate([size[0]-r, size[1]-r, size[2]-r]) sphere(r=r, $fn=16);
}
}
module room_shell() {
// Floor
if (show_floor) {
color(color_floor)
translate([0, 0, -2])
cube([room_w, room_d, 2]);
}
// Ceiling
if (show_ceiling) {
color(color_ceiling)
translate([0, 0, room_h])
cube([room_w, room_d, 2]);
}
// Walls
difference() {
union() {
// Left Wall
if (show_left_wall) {
color(color_wall)
translate([-wall_t, -wall_t, 0])
cube([wall_t, room_d + 2*wall_t, room_h]);
}
// Right Wall
if (show_right_wall) {
color(color_wall)
translate([room_w, -wall_t, 0])
cube([wall_t, room_d + 2*wall_t, room_h]);
}
// Front Wall
if (show_front_wall) {
color(color_wall)
translate([-wall_t, -wall_t, 0])
cube([room_w + 2*wall_t, wall_t, room_h]);
}
// Back Wall
if (show_back_wall) {
color(color_wall)
translate([-wall_t, room_d, 0])
cube([room_w + 2*wall_t, wall_t, room_h]);
}
}
// Entrance Door Opening (cut-out)
translate([170, -wall_t - 5, 0])
cube([80, wall_t + 10, 210]);
// Window opening
translate([76, room_d - 5, 90])
cube([90, wall_t + 10, 120]);
// Balcony door opening
translate([166, room_d - 5, 0])
cube([63, wall_t + 10, 210]);
}
}
module entrance_door() {
// Frame
color(color_frame) {
// Left post
translate([0, -2, 0]) cube([4, 4 + wall_t, 210]);
// Right post
translate([80 - 4, -2, 0]) cube([4, 4 + wall_t, 210]);
// Top header
translate([0, -2, 210 - 4]) cube([80, 4 + wall_t, 4]);
}
// Door slab - Hinge is on the right side
color(color_door) {
translate([80 - 4, 0, 0])
rotate([0, 0, -110])
translate([-72, -4, 0])
cube([72, 4, 206]);
}
}
module window_balcony_unit() {
frame_w = 5;
// White PVC Outer Frame
color(color_frame) {
// Bottom window sill outer frame (from X=0 to 90, Z=90)
translate([0, -2, 90]) cube([90, 4, frame_w]);
// Bottom door sill (from X=90 to 153, Z=0)
translate([90, -2, 0]) cube([63, 4, frame_w]);
// Left vertical post
translate([0, -2, 90]) cube([frame_w, 4, 120]);
// Middle vertical post
translate([90 - frame_w/2, -2, 0]) cube([frame_w, 4, 210]);
// Right vertical post
translate([153 - frame_w, -2, 0]) cube([frame_w, 4, 210]);
// Top header
translate([0, -2, 210 - frame_w]) cube([153, 4, frame_w]);
// Window sill board (internal, wood, extending into room)
translate([-2, -8, 88]) cube([94, 8, 2]);
}
// Window Glass
color(color_glass) {
translate([frame_w, 0, 90 + frame_w])
cube([90 - 1.5*frame_w, 0.5, 120 - 2*frame_w]);
}
// Balcony Door slab - Hinge is on the right side
translate([153 - frame_w, 0, 0])
rotate([0, 0, 110])
translate([-(63 - 1.5*frame_w), -2, 0]) {
// Door slab frame
color(color_frame) {
difference() {
cube([63 - 1.5*frame_w, 4, 210 - frame_w]);
// Glass cut-out
translate([frame_w, -1, frame_w])
cube([63 - 3.5*frame_w, 6, 210 - 3*frame_w]);
}
}
// Door slab glass
color(color_glass) {
translate([frame_w, 1.5, frame_w])
cube([63 - 3.5*frame_w, 0.5, 210 - 3*frame_w]);
}
}
}
module radiator() {
color(color_radiator) {
// Back support plate
translate([0, 2, 10]) cube([76, 2, 35]);
// 9 heating fins
for (i = [0 : 8]) {
translate([i * 9 + 2, 0, 0])
cube([4, 8, 50]);
}
}
}
module l_sofa() {
seat_h = 42;
back_w = 15;
arm_w = 15;
leg_h = 8;
cushion_thick = 12;
// Sofa Base Frame (Long side and Short side)
color(color_sofa) {
// Legs
for (pos = [
[5, 5],
[sofa_depth-7, 5],
[5, sofa_long_len-7],
[sofa_depth-7, sofa_long_len-7],
[sofa_short_len-7, 5],
[sofa_short_len-7, sofa_depth-7]
]) {
translate([pos[0], pos[1], 0])
cylinder(h=leg_h, r=2, $fn=16);
}
// Long side base block
translate([0, 0, leg_h])
rounded_box_z([sofa_depth, sofa_long_len, seat_h - leg_h - cushion_thick], 2);
// Short side base block (excluding overlap)
translate([sofa_depth, 0, leg_h])
rounded_box_z([sofa_short_len - sofa_depth, sofa_depth, seat_h - leg_h - cushion_thick], 2);
// Long side backrest (along left wall, X=0)
translate([0, sofa_depth, seat_h - cushion_thick])
rounded_box_z([back_w, sofa_long_len - sofa_depth, sofa_height - seat_h + cushion_thick], 2);
// Short side backrest (along front wall, Y=0) - extended to full width
translate([0, 0, seat_h - cushion_thick])
rounded_box_z([sofa_short_len, back_w, sofa_height - seat_h + cushion_thick], 2);
// Armrest Left (long side end, Y = sofa_long_len)
translate([0, sofa_long_len - arm_w, leg_h])
rounded_box_z([sofa_depth, arm_w, 60 - leg_h], 2);
}
// Seating cushions
color(color_cushion) {
// Corner Cushion
translate([back_w + 1, back_w + 1, seat_h - cushion_thick])
rounded_box_3d([sofa_depth - back_w - 2, sofa_depth - back_w - 2, cushion_thick], 2);
// Long side cushions
long_cushion_y = sofa_long_len - sofa_depth - arm_w;
num_long_cushions = 2;
for (i = [0 : num_long_cushions - 1]) {
translate([back_w + 1, sofa_depth + i * (long_cushion_y / num_long_cushions) + 1, seat_h - cushion_thick])
rounded_box_3d([sofa_depth - back_w - 2, (long_cushion_y / num_long_cushions) - 2, cushion_thick], 2);
}
// Short side cushion - expanded to full remaining width (65cm) due to removed armrest
short_cushion_x = sofa_short_len - sofa_depth;
num_short_cushions = 1;
for (i = [0 : num_short_cushions - 1]) {
translate([sofa_depth + i * (short_cushion_x / num_short_cushions) + 1, back_w + 1, seat_h - cushion_thick])
rounded_box_3d([(short_cushion_x / num_short_cushions) - 2, sofa_depth - back_w - 2, cushion_thick], 2);
}
}
}
module working_table() {
// Tabletop
color(color_wood)
translate([0, 0, table_h - 3])
rounded_box_z([table_w, table_d, 3], 1);
// Legs
color(color_metal) {
for (pos = [
[5, 5],
[table_w - 7, 5],
[5, table_d - 7],
[table_w - 7, table_d - 7]
]) {
translate([pos[0], pos[1], 0])
cylinder(h=table_h - 3, r=1.5);
}
}
}
module office_chair() {
chair_h = 45;
color([0.2, 0.2, 0.22]) {
// Wheels/base
translate([0, 0, 5]) cylinder(h=3, r=22, $fn=16);
// Center post
translate([0, 0, 8]) cylinder(h=chair_h - 10, r=2.5, $fn=16);
// Seat cushion
translate([-20, -20, chair_h]) rounded_box_z([40, 40, 5], 3);
// Backrest support
translate([-2, -18, chair_h + 5]) cube([4, 4, 35]);
// Backrest
translate([-18, -22, chair_h + 32]) rounded_box_z([36, 4, 28], 3);
}
}
module laptop() {
color([0.75, 0.75, 0.75]) {
// Base
translate([-15, -10, 0]) cube([30, 20, 0.8]);
// Screen (opened at 110 degrees)
translate([0, 9, 0.8])
rotate([-20, 0, 0])
translate([-15, -0.8, 0])
cube([30, 0.8, 20]);
}
// Screen light
color([0.9, 0.95, 1.0, 0.7])
translate([0, 9, 0.8])
rotate([-20, 0, 0])
translate([-14, 0.1, 1])
cube([28, 0.1, 18]);
}
module ceiling_lamp() {
// Cord
color([0.2, 0.2, 0.2])
cylinder(h=50, r=0.5);
// Chandelier body
color([0.9, 0.9, 0.75])
translate([0, 0, -15])
cylinder(h=15, r=12);
// Bulb glow
color([1.0, 1.0, 0.8, 0.3])
translate([0, 0, -18])
sphere(r=8);
}
module wardrobe() {
// Main body structure
color(color_wardrobe) {
rounded_box_z([wardrobe_d, wardrobe_w, wardrobe_h], 1);
}
// Wardrobe sliding doors
color(color_wardrobe_door) {
num_doors = 3;
door_w = wardrobe_w / num_doors;
for (i = [0 : num_doors - 1]) {
slide_x = (i == 1) ? -1.5 : 0;
translate([slide_x, i * door_w + 1, 4]) {
difference() {
rounded_box_z([2, door_w - 2, wardrobe_h - 8], 0.5);
for (line = [0.2, 0.5, 0.8]) {
translate([-0.5, (door_w - 2) * line, 10])
cube([1, 0.2, wardrobe_h - 38]);
}
}
color(color_wood) {
handle_y = (i == 0) ? door_w - 5 : ((i == 2) ? 2 : door_w/2 - 1.5);
translate([slide_x - 1, handle_y, wardrobe_h/2 - 30])
rounded_box_z([1.2, 3, 60], 0.5);
}
}
}
}
}
// Electrical wall double outlet module
module double_outlet() {
color(color_outlet) {
// Faceplate
rounded_box_z([14, 0.8, 8], 0.5);
// Recessed circles & socket details
color([0.3, 0.3, 0.3]) {
translate([3.5, 0.81, 4])
rotate([90, 0, 0])
cylinder(h=0.1, r=1.8, center=true, $fn=16);
translate([3.5 - 0.8, 0.82, 4])
rotate([90, 0, 0])
cylinder(h=0.2, r=0.3, center=true, $fn=8);
translate([3.5 + 0.8, 0.82, 4])
rotate([90, 0, 0])
cylinder(h=0.2, r=0.3, center=true, $fn=8);
translate([10.5, 0.81, 4])
rotate([90, 0, 0])
cylinder(h=0.1, r=1.8, center=true, $fn=16);
translate([10.5 - 0.8, 0.82, 4])
rotate([90, 0, 0])
cylinder(h=0.2, r=0.3, center=true, $fn=8);
translate([10.5 + 0.8, 0.82, 4])
rotate([90, 0, 0])
cylinder(h=0.2, r=0.3, center=true, $fn=8);
}
}
}
// Light Switch module
module light_switch() {
color(color_outlet) {
// Plate
rounded_box_z([8, 0.8, 8], 0.5);
// Rocker toggle
color([0.88, 0.88, 0.88])
translate([1, 0.81, 1])
rounded_box_z([6, 0.1, 6], 0.5);
}
}
// Headboard Shelf between entry wall (Y = 0) and Sofa (offset Y = 20)
module headboard_shelf() {
// Wood top shelf board (depth 20cm)
color(color_wood)
translate([0, 0, 73])
rounded_box_z([150, 20, 3], 1);
// Supporting casing box (cream/white wall colored to integrate)
color(color_wall)
translate([0, 1, 0])
cube([150, 18, 73]);
}
module smartphone() {
// Phone body
color([0.15, 0.15, 0.17])
rounded_box_z([8, 15, 0.8], 0.5);
// Screen light glow
color([0.85, 0.92, 1.0, 0.8])
translate([0.4, 0.4, 0.8])
cube([7.2, 14.2, 0.1]);
}
module water_bottle() {
// Transparent bottle body
color([0.7, 0.9, 1.0, 0.45]) {
cylinder(h=18, r=3.5, $fn=16);
translate([0, 0, 18])
cylinder(h=3, r1=3.5, r2=1.5, $fn=16);
}
// Cap
color([0.3, 0.6, 0.9]) {
translate([0, 0, 21])
cylinder(h=2, r=1.6, $fn=12);
}
}
// Assemble the scene
module main_scene() {
// Room structure
room_shell();
// Doors & Windows (always drawn)
translate([170, 0, 0]) entrance_door();
translate([76, room_d, 0]) window_balcony_unit();
translate([81, room_d - 12, 0]) radiator();
// Wall Outlets & Light Switch (Elevated to Z = 90cm for headboard shelf accessibility)
// 1. Front wall, left of sofa (Y = 0, above headboard shelf)
translate([20, 0.1, 90]) double_outlet();
// 2. Front wall, right of sofa (Y = 0, relocated above stand at X = 130cm)
translate([130, 0.1, 90]) double_outlet();
// 3. Left wall, above desk (X = 0, at height Z = 90cm)
translate([0.1, 300, 90])
rotate([0, 0, -90])
double_outlet();
// Light Switch next to door (X = 152cm, Z = 105cm), leaving exactly 10cm padding from the door frame (starts X = 170cm)
translate([152, 0.1, 105])
light_switch();
// Furniture
if (show_furniture) {
// Wooden headboard shelf behind the sofa short L-shape (20cm depth)
translate([0, 0, 0]) headboard_shelf();
// Items resting on the shelf (centered at Y = 10cm)
// Smartphone
translate([30, 10, 76])
rotate([0, 0, 15])
smartphone();
// Water bottle
translate([110, 10, 76])
water_bottle();
// L-Sofa shifted Y = 20cm to sit flush against the 20cm shelf
translate([0, 20, 0]) l_sofa();
// Working table along the left wall (Y = 240cm to 360cm)
translate([table_d, 240, 0]) {
rotate([0, 0, 90])
working_table();
// Laptop on the desk
translate([-table_d / 2, table_w / 2, table_h])
rotate([0, 0, 90])
laptop();
}
// Office chair tucked under the desk (X = 72cm) and rotated +90° to face the left wall
translate([72, 300, 0])
rotate([0, 0, 90])
office_chair();
// Large wardrobe on the right wall - shifted close to the balcony wall (Y = 155cm to 355cm)
translate([room_w - wardrobe_d, wardrobe_y, 0])
wardrobe();
}
// Ceiling light
translate([room_w / 2, room_d / 2, room_h])
ceiling_lamp();
}
main_scene();