Skip to content

armgit / bygga

Public Imported from GitHub
0

IKEA assembly, step by step: animated, manual-style 3D guides. Scan any paper manual with Together AI.

TypeScript

Draw day-beds

Youssef609727b2c79c
diff --git a/scripts/ikea/build.ts b/scripts/ikea/build.ts
index 9a67deb..2c44588 100644
--- a/scripts/ikea/build.ts
+++ b/scripts/ikea/build.ts
@@ -59,7 +59,7 @@ function hints(family: string, kind: Kind): Hint | undefined {
/* ---------- matching against hand made entries ---------- */
-const LATER_KINDS = new Set<Kind>(["office", "chaise", "corner", "cot", "bunk", "loft", "dropleaf"]);
+const LATER_KINDS = new Set<Kind>(["office", "chaise", "corner", "cot", "bunk", "loft", "dropleaf", "daybed"]);
function baseMatch(name: string, draw: Draw): CatalogEntry | undefined {
const fam = fold(name);
diff --git a/scripts/ikea/check.ts b/scripts/ikea/check.ts
index ee42349..b5045b6 100644
--- a/scripts/ikea/check.ts
+++ b/scripts/ikea/check.ts
@@ -100,6 +100,9 @@ async function main() {
expect("laktare", null);
expect("laktare chair", null);
expect("marius", "marius-stool");
+ // a day-bed is its own kind, and doesn't take over the family's bed
+ expect("hemnes daybed", "hemnes-day-bed-frame-3-drawers-80-x-200");
+ expect("hemnes bed", "hemnes-bed-frame-160-x-200");
if (articleNo("S292.975.72") !== "29297572") fail("article numbers with an S in front don't parse");
for (const [no, slug] of [["60324520", "kallax-2x2"]] as const) {
if (articleSlug(no) !== slug) fail(`article ${no} gave ${articleSlug(no)}, expected ${slug}`);
diff --git a/scripts/ikea/classify.ts b/scripts/ikea/classify.ts
index 54e9d29..57e45da 100644
--- a/scripts/ikea/classify.ts
+++ b/scripts/ikea/classify.ts
@@ -80,6 +80,8 @@ const FLAT = new Set<Kind>(["desk", "coffee", "side", "dining", "bar", "console"
const OFFICE_ARMS = new Set(["MARKUS", "ALEFJÄLL"]);
/** Office chairs with a tall back and a headrest. */
const OFFICE_TALL = new Set(["MARKUS"]);
+/** Day-beds' outer size (w, h, d) from IKEA's product pages: IKEA's measure is only the mattress size. */
+const DAYBED_SIZE: Record<string, [number, number, number]> = { HEMNES: [210, 83, 91], BRIMNES: [205, 58, 87], FLEKKE: [207, 86, 91], VIHALS: [206, 75, 86] };
type Pick = { kind: Kind; x?: X } | string;
type Rule = [RegExp, (m: RegExpMatchArray, c: Ctx) => Pick];
@@ -146,7 +148,12 @@ const RULES: Rule[] = [
[/\b(bunk|loft)\b/, () => "bunk or loft bed with a desk or underbed"],
[/^cot( with drawer)?$/, (m) => ({ kind: "cot", x: m[1] ? { drawer: true } : {} })],
[/\b(cot|crib)\b|cradle/, () => "cot bedding, mattress or cradle"],
- [/day-?bed|divan/, () => "day-bed or divan"],
+ // day-beds: a bed that pulls out with drawers in it, a trundle, storage boxes or nothing underneath, with or without mattresses
+ [/^day-bed( frame)?(?: (?:with|w) (?:(\d) drawers|(trundle bed)|(storage)|(\d) mattress))?(?:\/(\d) mattress(?:es)?)?$/, (m) => {
+ const under: X = m[2] ? { under: "pullout", rows: Number(m[2]) } : m[3] ? { under: "trundle" } : m[4] ? { under: "boxes" } : {};
+ return { kind: "daybed", x: { ...under, mats: Number(m[6] ?? m[5] ?? 0) || undefined } };
+ }],
+ [/day-?bed|divan/, () => "divan, or bedding for a day-bed"],
[/sliding/, () => "sliding doors"],
[/sink|wash-?basin|wash-?st|hob\b|oven|fridge|freezer|dishwasher|microwave|extractor|appliances|kitchenette|outdoor kitchen/, () => "appliance or sink unit"],
[/drawers?\b.*\b(doors?|fronts?|shelves|baskets?)\b|\b(doors?|fronts?|shelves|baskets?)\b.*\bdrawers?\b/, () => "mixed doors and drawers"],
@@ -303,6 +310,16 @@ export function classify(f: Fact, hints: Hints): Verdict {
if (v[1] !== 200) x.l = v[1];
set(v[1] + 11, undefined, v[0] + 10);
h = kind === "bunk" ? 160 : /reversible/.test(t) ? 116 : 195;
+ } else if (kind === "daybed") {
+ // IKEA gives the mattress size; the outer size comes from IKEA's own pages where we have it
+ if (v.length !== 2 || v[1] < 180 || v[1] > 210) return { skip: "day-bed without a mattress size" };
+ x.m = v[0];
+ if (v[1] !== 200) x.l = v[1];
+ const known = DAYBED_SIZE[family];
+ if (known) set(...known);
+ else [w, h, d] = [v[1] + 7, 83, v[0] + 11];
+ const chest = hints(family, "chest");
+ if (x.rows && chest?.x.knobs) x.knobs = chest.x.knobs;
} else if (kind === "cot") {
// IKEA gives the mattress size: a cot is a little longer and wider, about 85 cm high
if (v.length !== 2 || v[1] < 100 || v[1] > 150) return { skip: "cot without a mattress size" };
diff --git a/scripts/ikea/slugs.json b/scripts/ikea/slugs.json
index 43d0838..baaec2b 100644
--- a/scripts/ikea/slugs.json
+++ b/scripts/ikea/slugs.json
@@ -110,6 +110,8 @@
"BRIMNES|Bedside table, 39 × 41 × 53 cm": "brimnes-bedside-table-39-x-41-x-53",
"BRIMNES|Cabinet with doors, 78 × 95 cm": "brimnes-cabinet-doors-78-x-95",
"BRIMNES|Chest of 4 drawers, 78 × 46 × 124 cm": "brimnes-chest-4-drawers-78-x-46-x-124",
+ "BRIMNES|Day-bed frame with 2 drawers, 80 × 200 cm": "brimnes-day-bed-frame-2-drawers-80-x-200",
+ "BRIMNES|Day-bed w 2 drawers/2 mattresses, 80 × 200 cm": "brimnes-day-bed-w-2-drawers-2-mattresses-80-x-20",
"BRIMNES|Dressing table, 70 × 42 cm": "brimnes-dressing-table-70-x-42",
"BRIMNES|TV bench, 180 × 41 × 53 cm": "brimnes-tv-bench-180-x-41-x-53",
"BRIMNES|TV bench, 216 × 41 × 54 cm": "brimnes-tv-bench-216-x-41-x-54",
@@ -186,6 +188,8 @@
"FJÄLLBO|Shelving unit, 51 × 136 cm": "fjallbo-shelving-unit-51-x-136",
"FJÄLLBO|Sideboard, 111 × 47 × 95 cm": "fjallbo-sideboard-111-x-47-x-95",
"FJÄLLBO|TV bench, 150 × 36 × 54 cm": "fjallbo-tv-bench-150-x-36-x-54",
+ "FLEKKE|Day-bed frame with 2 drawers, 80 × 200 cm": "flekke-day-bed-frame-2-drawers-80-x-200",
+ "FLEKKE|Day-bed w 2 drawers/2 mattresses, 80 × 200 cm": "flekke-day-bed-w-2-drawers-2-mattresses-80-x-200",
"FLINTAN|Office chair": "flintan-office-chair",
"FLINTAN|Office chair with armrests": "flintan-office-chair-armrests",
"FLISAT|Children's stool": "flisat-children-s-stool",
@@ -291,6 +295,8 @@
"HAVSTEN|2-seat sofa, outdoor": "havsten-2-seat-sofa-outdoor",
"HAVSTEN|2-seat sofa, outdoor, 179 × 92 × 76 cm": "havsten-2-seat-sofa-outdoor-179-x-92-x-76",
"HAVSTEN|Armchair, outdoor": "havsten-armchair-outdoor",
+ "HEMNES|Day-bed frame with 3 drawers, 80 × 200 cm": "hemnes-day-bed-frame-3-drawers-80-x-200",
+ "HEMNES|Day-bed w 3 drawers/2 mattresses, 80 × 200 cm": "hemnes-day-bed-w-3-drawers-2-mattresses-80-x-200",
"HEMNES|Desk, 155 × 65 cm": "hemnes-desk-155-x-65",
"HERRÅKRA|Armchair": "herrakra-armchair",
"HÖGVED|Chair": "hogved-chair",
@@ -1005,6 +1011,12 @@
"VIHALS|Chest of 4 drawers, 70 × 47 × 90 cm": "vihals-chest-4-drawers-70-x-47-x-90",
"VIHALS|Chest of 6 drawers, 140 × 47 × 75 cm": "vihals-chest-6-drawers-140-x-47-x-75",
"VIHALS|Chest of 6 drawers, 70 × 47 × 120 cm": "vihals-chest-6-drawers-70-x-47-x-120",
+ "VIHALS|Day-bed frame with storage, 80 × 200 cm": "vihals-day-bed-frame-storage-80-x-200",
+ "VIHALS|Day-bed frame with trundle bed, 80 × 200 cm": "vihals-day-bed-frame-trundle-bed-80-x-200",
+ "VIHALS|Day-bed frame, 80 × 200 cm": "vihals-day-bed-frame-80-x-200",
+ "VIHALS|Day-bed w trundle bed/2 mattresses, 80 × 200 cm": "vihals-day-bed-w-trundle-bed-2-mattresses-80-x-2",
+ "VIHALS|Day-bed with 1 mattress, 80 × 200 cm": "vihals-day-bed-1-mattress-80-x-200",
+ "VIHALS|Day-bed with storage/1 mattress, 80 × 200 cm": "vihals-day-bed-storage-1-mattress-80-x-200",
"VIHALS|Extendable table, 120/180 × 74 cm": "vihals-extendable-table-120-180-x-74",
"VIHALS|Extendable table, 84/120 × 74 cm": "vihals-extendable-table-84-120-x-74",
"VIHALS|Folding chair": "vihals-folding-chair",
diff --git a/src/data/ikea-items.ts b/src/data/ikea-items.ts
index 79b7f7d..25c555c 100644
--- a/src/data/ikea-items.ts
+++ b/src/data/ikea-items.ts
@@ -125,6 +125,8 @@ brimnes-bookcase-60-x-190|40301223 90301225
brimnes-cabinet-doors-78-x-95|00300664 50300666 80300660 40300662
brimnes-chest-3-drawers|00392041
brimnes-chest-4-drawers-78-x-46-x-124|90392046
+brimnes-day-bed-frame-2-drawers-80-x-200|00228705
+brimnes-day-bed-w-2-drawers-2-mattresses-80-x-20|59521159 09521152 29494497 59497338
brimnes-dressing-table-70-x-42|70290459
brimnes-tv-bench-120-x-53|40337694 50337698
brimnes-tv-bench-180-x-41-x-53|70409873 50409874
@@ -209,6 +211,8 @@ fjallbo-shelving-unit-100-x-95|50339292
fjallbo-shelving-unit-51-x-136|70342199
fjallbo-sideboard-111-x-47-x-95|00502799
fjallbo-tv-bench-150-x-36-x-54|90339290 90501309 40579032
+flekke-day-bed-frame-2-drawers-80-x-200|00320134
+flekke-day-bed-w-2-drawers-2-mattresses-80-x-200|39521457 49495943 29497349 09521449
flintan-office-chair|50489031 30492204
flintan-office-chair-armrests|49424470 79424464
flisat-children-s-stool|30596536
@@ -324,6 +328,8 @@ helmer-drawer-unit-on-castors|00619902 70625023 20625025
hemnes-3-drawers|80424745 70610738
hemnes-bookcase-90-x-197|60413502 40596159 20452294
hemnes-chest-8-drawers|10239280
+hemnes-day-bed-frame-3-drawers-80-x-200|90349326 80622892 60372276
+hemnes-day-bed-w-3-drawers-2-mattresses-80-x-200|49521503 79610220 59521499 49521485 19428120 19390952 59610235
hemnes-desk-155-x-65|20535044
hemnes-nightstand-2-drawers|50610739
hemnes-sideboard-157-x-88|70476259 80628667
@@ -1093,6 +1099,12 @@ vihals-chair|10595123 60595125 50569103
vihals-chest-4-drawers-70-x-47-x-90|00483239
vihals-chest-6-drawers-140-x-47-x-75|80490113
vihals-chest-6-drawers-70-x-47-x-120|30483247
+vihals-day-bed-1-mattress-80-x-200|59580568 89580562 99580547 69580558
+vihals-day-bed-frame-80-x-200|00595086
+vihals-day-bed-frame-storage-80-x-200|89571586
+vihals-day-bed-frame-trundle-bed-80-x-200|09580537
+vihals-day-bed-storage-1-mattress-80-x-200|59580592 39580588 69580582 89580576
+vihals-day-bed-w-trundle-bed-2-mattresses-80-x-2|79580633 59580629 19580626 09580636
vihals-extendable-table-120-180-x-74|20589777 30592755
vihals-extendable-table-84-120-x-74|90569097
vihals-folding-chair|30569104 00592752 90651742
diff --git a/src/data/ikea-rows.ts b/src/data/ikea-rows.ts
index 439b6ad..c964140 100644
--- a/src/data/ikea-rows.ts
+++ b/src/data/ikea-rows.ts
@@ -110,6 +110,8 @@ BRÄNNBOLL|side|Side table on castors, 69 × 39 cm|69|50|39
BRIMNES|bed|Bed frame with storage, Standard Double, 135 × 190 cm|151|102|199|m=135,l=190
BRIMNES|cabinet|Cabinet with doors, 78 × 95 cm|78|95|34
BRIMNES|chest|Chest of 4 drawers, 78 × 46 × 124 cm|78|124|46|rows=4,knobs=none
+BRIMNES|daybed|Day-bed frame with 2 drawers, 80 × 200 cm|205|58|87|rows=2,knobs=none,m=80,under=pullout
+BRIMNES|daybed|Day-bed w 2 drawers/2 mattresses, 80 × 200 cm|205|58|87|rows=2,knobs=none,m=80,under=pullout,mats=2
BRIMNES|desk|Dressing table, 70 × 42 cm|70|74|42
BRIMNES|nightstand|Bedside table, 39 × 41 × 53 cm|39|53|41|rows=1,knobs=none
BRIMNES|tv|TV bench, 180 × 41 × 53 cm|180|53|41|knobs=none
@@ -187,6 +189,8 @@ FJÄLLBO|open|Shelving unit, 100 × 95 cm|100|95|35
FJÄLLBO|open|Shelving unit, 100 × 136 cm|100|136|35
FJÄLLBO|sideboard|Sideboard, 111 × 47 × 95 cm|111|95|47
FJÄLLBO|tv|TV bench, 150 × 36 × 54 cm|150|54|36
+FLEKKE|daybed|Day-bed frame with 2 drawers, 80 × 200 cm|207|86|91|rows=2,m=80,under=pullout
+FLEKKE|daybed|Day-bed w 2 drawers/2 mattresses, 80 × 200 cm|207|86|91|rows=2,m=80,under=pullout,mats=2
FLINTAN|office|Office chair|60|105|64|arms=none
FLINTAN|office|Office chair with armrests|64|105|64|arms=slim
FLISAT|kidstable|Children's table, 83 × 58 cm|83|48|58||kids
@@ -292,6 +296,8 @@ HAVSTA|open|Shelving unit, 81 × 35 × 123 cm|81|123|35
HAVSTEN|armchair|Armchair, outdoor|75|90|80||outdoor garden
HAVSTEN|sofa|2-seat sofa, outdoor|170|85|92|seats=2|outdoor garden
HAVSTEN|sofa|2-seat sofa, outdoor, 179 × 92 × 76 cm|179|76|92|seats=2|outdoor garden
+HEMNES|daybed|Day-bed frame with 3 drawers, 80 × 200 cm|210|83|91|rows=3,knobs=knob,m=80,under=pullout
+HEMNES|daybed|Day-bed w 3 drawers/2 mattresses, 80 × 200 cm|210|83|91|rows=3,knobs=knob,m=80,under=pullout,mats=2
HEMNES|desk|Desk, 155 × 65 cm|155|74|65
HERRÅKRA|armchair|Armchair|75|90|80
HÖGVED|chair|Chair|44|88|50
@@ -1006,6 +1012,12 @@ VIHALS|chair|Folding chair|44|88|50
VIHALS|chest|Chest of 4 drawers, 70 × 47 × 90 cm|70|90|47|rows=4,knobs=bar
VIHALS|chest|Chest of 6 drawers, 70 × 47 × 120 cm|70|120|47|rows=6,knobs=bar
VIHALS|chest|Chest of 6 drawers, 140 × 47 × 75 cm|140|75|47|rows=3,cols=2,knobs=bar
+VIHALS|daybed|Day-bed frame with storage, 80 × 200 cm|206|75|86|m=80,under=boxes
+VIHALS|daybed|Day-bed frame with trundle bed, 80 × 200 cm|206|75|86|m=80,under=trundle
+VIHALS|daybed|Day-bed frame, 80 × 200 cm|206|75|86|m=80
+VIHALS|daybed|Day-bed w trundle bed/2 mattresses, 80 × 200 cm|206|75|86|m=80,under=trundle,mats=2
+VIHALS|daybed|Day-bed with 1 mattress, 80 × 200 cm|206|75|86|m=80,mats=1
+VIHALS|daybed|Day-bed with storage/1 mattress, 80 × 200 cm|206|75|86|m=80,under=boxes,mats=1
VIHALS|dining|Table, 74 × 74 cm|74|74|74
VIHALS|dining|Extendable table, 84/120 × 74 cm|84|74|74
VIHALS|dining|Table, 107 cm|107|74|107|round=1
diff --git a/src/lib/ikea.ts b/src/lib/ikea.ts
index 95b7215..6fd76c9 100644
--- a/src/lib/ikea.ts
+++ b/src/lib/ikea.ts
@@ -23,9 +23,9 @@ export interface IkeaRow {
slug?: string;
}
-const X_KEYS = ["rows", "cols", "knobs", "plinth", "doors", "shelves", "c", "m", "l", "f", "seats", "arms", "legs", "attach", "shelf", "min", "round", "seatH", "chaise", "corner", "open", "sd", "drawer", "leaves", "leaf"] as const;
+const X_KEYS = ["rows", "cols", "knobs", "plinth", "doors", "shelves", "c", "m", "l", "f", "seats", "arms", "legs", "attach", "shelf", "min", "round", "seatH", "chaise", "corner", "open", "sd", "drawer", "leaves", "leaf", "under", "mats"] as const;
const FLAGS = new Set<string>(["plinth", "shelf", "round", "open", "drawer"]);
-const WORDS = new Set<string>(["knobs", "arms", "legs", "attach", "chaise", "corner"]);
+const WORDS = new Set<string>(["knobs", "arms", "legs", "attach", "chaise", "corner", "under"]);
export function encodeX(x: X): string {
const out: string[] = [];
diff --git a/src/lib/plan/bed.ts b/src/lib/plan/bed.ts
index 557f19d..91fdee1 100644
--- a/src/lib/plan/bed.ts
+++ b/src/lib/plan/bed.ts
@@ -3,6 +3,7 @@ import { HW, PlanBuilder, type FitOpts } from "./builder";
import { clamp } from "./math";
import { buildBunk } from "./bunk";
import { buildCot } from "./cot";
+import { buildDayBed } from "./daybed";
export function defaultsBed(s: ProductSpec): BedParams {
const p = s.bed ?? {};
@@ -20,6 +21,7 @@ export function defaultsBed(s: ProductSpec): BedParams {
export function buildBed(b: PlanBuilder, s: ProductSpec) {
if (s.bed?.type === "cot") return buildCot(b, s);
if (s.bed?.type === "bunk" || s.bed?.type === "loft") return buildBunk(b, s);
+ if (s.bed?.type === "daybed") return buildDayBed(b, s);
const p = defaultsBed(s);
const Wm = p.mattressW * 10, Lm = p.mattressL * 10;
const t = 22;
diff --git a/src/lib/plan/daybed.ts b/src/lib/plan/daybed.ts
new file mode 100644
index 0000000..3c63a5b
--- /dev/null
+++ b/src/lib/plan/daybed.ts
@@ -0,0 +1,515 @@
+import type { PartPiece, ProductSpec, Vec3 } from "../types";
+import { HW, PlanBuilder, type FitOpts } from "./builder";
+import { clamp } from "./math";
+
+/**
+ * Day-beds: a single bed with a back and two ends, a sofa by day. Most have a second bed underneath
+ * that pulls out to make a double: a box on castors with the drawers in it (HEMNES, BRIMNES, FLEKKE), or a
+ * trundle on castors (VIHALS). Others have storage boxes on castors, or nothing underneath.
+ * It stands lengthways across the view (x), back at the back. Built in IKEA's order: the pull-out first,
+ * then the frame around it, the drawers, and last the mattresses, stacked by day and side by side at night.
+ */
+export function buildDayBed(b: PlanBuilder, s: ProductSpec) {
+ const p = s.bed ?? {};
+ const Ml = clamp((p.mattressL ?? 200) * 10, 1800, 2100), Mm = clamp((p.mattressW ?? 80) * 10, 700, 1000);
+ const L = clamp(s.size.w * 10, Ml + 60, Ml + 200);
+ const D = clamp(s.size.d * 10, Mm + 60, Mm + 200);
+ const H = clamp(s.size.h * 10, 500, 1000);
+ const under = p.under;
+ const rolls = under === "pullout" || under === "trundle";
+ const nDr = under === "pullout" ? clamp(Math.round(p.drawers ?? 2), 0, 4) : 0;
+ const inBox = clamp(Math.round(p.mattresses ?? 0), 0, 2);
+
+ /* ---------- the frame: two ends, a back and a front rail ---------- */
+ const te = clamp((L - Ml - 20) / 2, 30, 80); // each end
+ const Li = L - 2 * te; // between the ends
+ const ex = L / 2 - te / 2;
+ const tb = 18, tf = 22;
+ const ch = HW.castor.len; // castors lift whatever rolls underneath
+ const hb = under === "pullout" ? 220 : under === "trundle" ? 160 : 180; // what rolls under, above its castors
+ const yF = Math.max(260, ch + hb + 32); // free height under the front rail
+ const railH = 90;
+ const ys = yF + 70; // top of the slats
+ const ledgeY = ys - 12 - 15;
+ const postW = 50;
+
+ const endPieces: PartPiece[] = [
+ ...[-1, 1].map((k): PartPiece => ({ shape: "box", size: [te, H, postW], pos: [-ex, H / 2, k * (D / 2 - postW / 2)] })),
+ { shape: "box", size: [te, 70, D - 2 * postW], pos: [-ex, H - 35, 0] },
+ { shape: "box", size: [Math.min(te, 18), H - 130, D - 2 * postW], pos: [-ex, 60 + (H - 130) / 2, 0] },
+ ];
+ const endC = b.compound("End", endPieces, { material: "board" });
+ const ends = [b.place(endC.type, endC.mid), b.place(endC.type, [-endC.mid[0], endC.mid[1], endC.mid[2]], [0, Math.PI, 0])];
+
+ const backY0 = 60, backY1 = H - 40;
+ const backC = b.compound(
+ "Back",
+ [
+ { shape: "box", size: [Li, backY1 - backY0, tb], pos: [0, (backY0 + backY1) / 2, -D / 2 + tb / 2] },
+ { shape: "box", size: [Li, 30, 24], pos: [0, ledgeY, -D / 2 + tb + 12], material: "wood" },
+ ],
+ { material: "board" },
+ );
+ const back = b.place(backC.type, backC.mid);
+ const frontC = b.compound(
+ "Front rail",
+ [
+ { shape: "box", size: [Li, railH, tf], pos: [0, yF + railH / 2, D / 2 - tf / 2] },
+ { shape: "box", size: [Li, 30, 24], pos: [0, ledgeY, D / 2 - tf - 12], material: "wood" },
+ ],
+ { material: "board" },
+ );
+ const front = b.place(frontC.type, frontC.mid);
+
+ // the slats rest on the supports along the back and the front rail
+ const Ls = D - 60;
+ const slatT = b.part("Slat", [70, 12, Ls], { material: "wood" });
+ const nS = Math.round(Ml / 150);
+ const slatX = (i: number, span: number) => -span / 2 + 50 + (i * (span - 100)) / (nS - 1);
+ const slats = Array.from({ length: nS }, (_, i) => b.place(slatT, [slatX(i, Ml), ys - 6, -2]));
+
+ /* ---------- the pull-out bed or trundle: cross pieces on castors, rails on top, slats ---------- */
+ const Lp = Li - 30;
+ const Dp = Ls;
+ const zc = D / 2 - Dp / 2 - 4; // closed: its front just behind the front rail
+ const oz = Dp - 40; // how far it pulls out
+ const yTop = ch + hb; // top of its rails
+ const tc = 18;
+ const nCross = nDr ? nDr + 1 : 3;
+ const crossX = (i: number) => -Lp / 2 + tc / 2 + (i * (Lp - tc)) / (nCross - 1);
+ const crossH = hb - 22;
+ const pull: string[] = [];
+ let crosses: string[] = [];
+ let topRails: string[] = [];
+ let pSlats: string[] = [];
+ if (rolls) {
+ const crossT = b.part("Cross piece", [tc, crossH, Dp], { material: "board" });
+ crosses = Array.from({ length: nCross }, (_, i) => b.place(crossT, [crossX(i), ch + crossH / 2, zc]));
+ const topT = b.part("Top rail", [Lp, 22, 80], { material: "board" });
+ topRails = [-1, 1].map((k) => b.place(topT, [0, yTop - 11, zc + k * (Dp / 2 - 40)]));
+ pSlats = Array.from({ length: nS }, (_, i) => b.place(slatT, [slatX(i, Lp), yTop + 6, zc]));
+ pull.push(...crosses, ...topRails, ...pSlats);
+ }
+
+ /* ---------- drawers in the pull-out ---------- */
+ interface Drawer {
+ x: number;
+ front: string;
+ sides: [string, string];
+ back: string;
+ bottom: string;
+ }
+ const drawers: Drawer[] = [];
+ const cw = (Lp - nCross * tc) / Math.max(1, nCross - 1); // between two cross pieces
+ const fh = crossH - 12, fw = cw - 6;
+ const dd = Dp - 70;
+ const bw = cw - 26;
+ const sh = fh - 40;
+ const zf = zc + Dp / 2 - 9; // drawer fronts, flush with the front of the cross pieces
+ const yd = ch + 6; // bottom of a drawer front
+ const runLen = Math.round((dd - 20) / 10) * 10;
+ if (nDr) {
+ const frT = b.part("Drawer front", [fw, fh, 18], { material: "board" });
+ const sdT = b.part("Drawer side", [12, sh, dd], { material: "board" });
+ const bkT = b.part("Drawer back", [bw - 24, sh - 22, 12], { material: "board" });
+ const btT = b.part("Drawer bottom", [bw - 10, 3, dd - 8], { material: "fiber" });
+ for (let i = 0; i < nDr; i++) {
+ const x = (crossX(i) + crossX(i + 1)) / 2;
+ const zBox = zf - 9 - dd / 2;
+ const sy = yd + 20 + sh / 2;
+ drawers.push({
+ x,
+ front: b.place(frT, [x, yd + fh / 2, zf]),
+ sides: [b.place(sdT, [x - bw / 2 + 6, sy, zBox]), b.place(sdT, [x + bw / 2 - 6, sy, zBox])],
+ back: b.place(bkT, [x, yd + 20 + 22 + (sh - 22) / 2, zf - 9 - dd + 6]),
+ bottom: b.place(btT, [x, yd + 20 + 9, zBox - 2]),
+ });
+ }
+ }
+ const drawerKeys = (d: Drawer) => [d.front, d.sides[0], d.sides[1], d.back, d.bottom];
+ for (const d of drawers) pull.push(...drawerKeys(d));
+
+ /* ---------- storage boxes on castors ---------- */
+ interface Box {
+ x: number;
+ parts: string[];
+ bottom: string;
+ }
+ const boxes: Box[] = [];
+ const bxW = (Li - 60) / 2, bxD = Dp, bxH = hb, bt = 16;
+ if (under === "boxes") {
+ const fbT = b.part("Box panel", [bxW, bxH - 12, bt], { material: "board" });
+ const sdT = b.part("Box side", [bt, bxH - 12, bxD - 2 * bt], { material: "board" });
+ const btT = b.part("Box bottom", [bxW, 12, bxD], { material: "board" });
+ for (const k of [-1, 1]) {
+ const x = k * (bxW / 2 + 10);
+ const y = ch + 12 + (bxH - 12) / 2;
+ boxes.push({
+ x,
+ parts: [
+ b.place(fbT, [x, y, zc + bxD / 2 - bt / 2]),
+ b.place(fbT, [x, y, zc - bxD / 2 + bt / 2]),
+ b.place(sdT, [x - bxW / 2 + bt / 2, y, zc]),
+ b.place(sdT, [x + bxW / 2 - bt / 2, y, zc]),
+ ],
+ bottom: b.place(btT, [x, ch + 6, zc]),
+ });
+ }
+ }
+
+ /* ---------- steps: the pull-out ---------- */
+ const castorFits = (keys: string[], xs: number[], zs: number[]): FitOpts[] =>
+ keys.flatMap((k, i) => zs.map((z) => ({ on: k, at: [xs[i], ch, z] as Vec3, dir: [0, 1, 0] as Vec3, travel: 70, hole: false as const })));
+ const at = (k: string) => b.partItem(k).final;
+
+ if (rolls) {
+ const what = nDr ? "pull-out bed" : "trundle";
+ b.step(
+ {
+ title: "Screw two castors under each cross piece",
+ detail: "Stand them upside down on the box. One castor near each end.",
+ tools: ["screwdriver"],
+ scene: "pullout",
+ pose: "-y",
+ kind: "screws",
+ warnings: ["floor"],
+ },
+ () => {
+ b.stagger(0.2);
+ crosses.forEach((k) => b.stage(k, at(k).pos, at(k).rot, [0, 200, 0]));
+ b.then(0.1);
+ b.fits(HW.castor, castorFits(crosses, crosses.map((k) => at(k).pos[0]), [zc - Dp / 2 + 70, zc + Dp / 2 - 70]), 0.1);
+ },
+ );
+ if (nDr) {
+ b.step(
+ {
+ title: "Screw the drawer runners onto the cross pieces",
+ detail: "The open end of each runner points to the front.",
+ tools: ["screwdriver"],
+ scene: "pullout",
+ kind: "runners",
+ warnings: ["face"],
+ },
+ () => {
+ const runner = { kind: "runner" as const, len: runLen, dia: 20 };
+ const list: FitOpts[] = [];
+ const screws: FitOpts[] = [];
+ const rz = zf - 9 - runLen / 2 - 8;
+ for (let i = 0; i < nCross; i++) {
+ const x0 = crossX(i);
+ for (const sgn of [-1, 1]) {
+ if ((i === 0 && sgn < 0) || (i === nCross - 1 && sgn > 0)) continue;
+ const xf = x0 + (sgn * tc) / 2;
+ list.push({ on: crosses[i], at: [xf, yd + 34, rz], dir: [-sgn, 0, 0], hole: false });
+ for (const dz of [-runLen / 2 + 30, runLen / 2 - 30]) screws.push({ on: crosses[i], at: [xf + sgn * 12, yd + 34, rz + dz], dir: [-sgn, 0, 0], hole: false });
+ }
+ }
+ b.fits(runner, list, 0.1);
+ b.then(0.1);
+ b.fits(HW.screwS, screws, 0.04);
+ },
+ );
+ }
+ b.step(
+ {
+ title: "Screw the top rails across the cross pieces",
+ detail: "One along the front and one along the back. Keep the cross pieces upright as you go.",
+ tools: ["screwdriver"],
+ scene: "pullout",
+ kind: "screws",
+ },
+ () => {
+ b.stagger(0.3);
+ topRails.forEach((k, i) => b.stage(k, at(k).pos, at(k).rot, [0, 260, i === 0 ? -120 : 120]));
+ b.then(0.1);
+ const sc: FitOpts[] = [];
+ for (const r of topRails) for (const c of crosses) sc.push({ on: r, at: [at(c).pos[0], yTop, at(r).pos[2]], dir: [0, -1, 0], mate: c });
+ b.fits(HW.screwM, sc, 0.05);
+ },
+ );
+ b.step(
+ {
+ title: `Lay the slats on the ${what}`,
+ detail: "Spread them evenly from end to end.",
+ scene: "pullout",
+ kind: "slats",
+ },
+ () => {
+ b.stagger(Math.min(0.08, 1.4 / pSlats.length));
+ pSlats.forEach((k) => b.stage(k, at(k).pos, at(k).rot, [0, 260, 0]));
+ },
+ );
+ }
+
+ // screws through the front and back panels into the sides, and castors under the bottom, in the assembled frame
+ const boxScrews = (bx: Box): FitOpts[] =>
+ [bx.parts[0], bx.parts[1]].flatMap((k) => {
+ const z = at(k).pos[2];
+ const out = z > zc;
+ return [-1, 1].flatMap((sx) =>
+ [ch + 60, ch + bxH - 50].map((y) => ({ on: k, at: [bx.x + sx * (bxW / 2 - bt / 2), y, z + (out ? bt / 2 : -bt / 2)] as Vec3, dir: [0, 0, out ? -1 : 1] as Vec3, hole: false as const })),
+ );
+ });
+ const boxCastors = (bx: Box): FitOpts[] =>
+ [-1, 1].flatMap((sx) => [-1, 1].map((sz) => ({ on: bx.bottom, at: [bx.x + sx * (bxW / 2 - 60), ch, zc + sz * (bxD / 2 - 60)] as Vec3, dir: [0, 1, 0] as Vec3, travel: 70, hole: false as const })));
+ if (boxes.length) {
+ const b0 = boxes[0];
+ const rel = (k: string): Vec3 => {
+ const f = at(k).pos;
+ return [f[0] - b0.x, f[1], f[2] - zc];
+ };
+ b.step(
+ {
+ title: "Put the storage boxes together",
+ detail: "Screw the sides between the front and the back.",
+ tools: ["screwdriver"],
+ scene: "box",
+ repeat: 2,
+ kind: "screws",
+ },
+ () => {
+ b.stagger(0.25);
+ b0.parts.forEach((k, i) => b.stage(k, rel(k), at(k).rot, i < 2 ? [0, 0, i === 0 ? 260 : -260] : [i === 2 ? -260 : 260, 0, 0]));
+ b.then(0.1);
+ b.fits(HW.screwM, boxScrews(b0), 0.06);
+ },
+ );
+ b.step(
+ {
+ title: "Screw on the bottom and the castors",
+ detail: "Turn the box over first. One castor near each corner.",
+ tools: ["screwdriver"],
+ scene: "box",
+ pose: "-y",
+ repeat: 2,
+ kind: "screws",
+ },
+ () => {
+ b.stage(b0.bottom, rel(b0.bottom), [0, 0, 0], [0, -200, 0]);
+ b.then(0.1);
+ b.fits(HW.castor, boxCastors(b0), 0.12);
+ },
+ );
+ }
+
+ /* ---------- steps: the frame ---------- */
+ const endBolts = (key: string, ys2: number[], z: number): FitOpts[] =>
+ ends.flatMap((e, i) => ys2.map((y) => ({ on: e, at: [(i === 0 ? -1 : 1) * (L / 2), y, z] as Vec3, dir: [i === 0 ? 1 : -1, 0, 0] as Vec3, mate: key })));
+ b.step(
+ {
+ title: "Bolt the back between the ends",
+ detail: "One holds the ends upright while the other bolts. Hand tight for now.",
+ tools: ["allen"],
+ people: 2,
+ kind: "bolts",
+ warnings: ["two", "loose"],
+ },
+ () => {
+ b.stagger(0.3);
+ ends.forEach((e, i) => b.add(e, [(i === 0 ? -1 : 1) * 320, 0, 0]));
+ b.then(0.05);
+ b.add(back, [0, 0, -320]);
+ b.then(0.1);
+ const ys2 = [backY0 + 90, (backY0 + backY1) / 2, backY1 - 90];
+ b.fits(HW.boltL, endBolts(back, ys2, -D / 2 + tb / 2), 0.08);
+ },
+ );
+ b.step(
+ {
+ title: "Bolt on the front rail",
+ detail: "Then tighten every bolt firmly.",
+ tools: ["allen"],
+ kind: "bolts",
+ },
+ () => {
+ b.add(front, [0, 0, 320]);
+ b.then(0.1);
+ b.fits(HW.boltL, endBolts(front, [yF + 25, yF + 65], D / 2 - tf / 2), 0.1);
+ },
+ );
+ b.step(
+ {
+ title: "Lay the slats in the frame",
+ detail: "They rest on the supports along the back and the front rail.",
+ kind: "slats",
+ },
+ () => {
+ b.stagger(Math.min(0.08, 1.4 / slats.length));
+ slats.forEach((k) => b.add(k, [0, 260, 0]));
+ },
+ );
+
+ if (rolls) {
+ b.step(
+ {
+ title: nDr ? "Push the pull-out bed in underneath" : "Roll the trundle in underneath",
+ detail: "It rolls in on its castors, under the slats.",
+ kind: "join",
+ weight: 1.6,
+ },
+ () => {
+ b.stagger(0);
+ [...crosses, ...topRails, ...pSlats].forEach((k) => b.add(k, [0, 0, 760]));
+ },
+ );
+ }
+ if (boxes.length) {
+ b.step(
+ {
+ title: "Roll the boxes in underneath",
+ detail: "They pull out from the front, one at each end.",
+ kind: "join",
+ weight: 1.6,
+ },
+ () => {
+ b.stagger(0.4);
+ for (const bx of boxes) {
+ b.stagger(0);
+ [...bx.parts, bx.bottom].forEach((k) => b.add(k, [0, 0, 700]));
+ b.wait(0.4);
+ }
+ // the second box comes put together
+ for (const o of boxScrews(boxes[1])) b.preset(HW.screwM, o);
+ for (const o of boxCastors(boxes[1])) b.preset(HW.castor, o);
+ },
+ );
+ }
+
+ /* ---------- steps: the drawers ---------- */
+ if (drawers.length) {
+ const d0 = drawers[0];
+ const c0: Vec3 = [d0.x, yd + fh / 2, zf - dd / 2];
+ const rel = (k: string): Vec3 => {
+ const f = at(k).pos;
+ return [f[0] - c0[0], f[1] - c0[1], f[2] - c0[2]];
+ };
+ const backScrews = (d: Drawer): FitOpts[] => {
+ const bp = at(d.back).pos;
+ return d.sides.flatMap((sd, i) => {
+ const xo = at(sd).pos[0] + (i === 0 ? -6 : 6);
+ return [-(sh - 22) / 4, (sh - 22) / 4].map((dy) => ({ on: sd, at: [xo, bp[1] + dy, bp[2]] as Vec3, dir: [i === 0 ? 1 : -1, 0, 0] as Vec3 }));
+ });
+ };
+ b.step(
+ {
+ title: nDr > 1 ? "Put the drawers together" : "Put the drawer together",
+ detail: "Sides onto the front, slide the bottom in along the grooves, then screw on the back.",
+ tools: ["screwdriver"],
+ scene: "drawer",
+ pose: "-z",
+ repeat: nDr > 1 ? nDr : undefined,
+ kind: "drawer",
+ warnings: ["floor"],
+ },
+ () => {
+ b.stage(d0.front, rel(d0.front), [0, 0, 0], [0, 0, -160]);
+ b.then(0.1);
+ b.stagger(0.25);
+ for (const sd of d0.sides) b.stage(sd, rel(sd), [0, 0, 0], [0, 0, -300]);
+ b.then(0.1);
+ b.stage(d0.bottom, rel(d0.bottom), [0, 0, 0], [0, 0, -420]);
+ b.then(0.1);
+ b.stage(d0.back, rel(d0.back), [0, 0, 0], [0, 0, -260]);
+ b.then(0.15);
+ b.fits(HW.screwM, backScrews(d0), 0.12);
+ },
+ );
+ b.step(
+ {
+ title: nDr > 1 ? "Slide the drawers into the pull-out bed" : "Slide the drawer into the pull-out bed",
+ detail: "Rest each one on its runners and push until it clicks.",
+ kind: "drawer",
+ weight: 1 + 0.4 * nDr,
+ },
+ () => {
+ for (const [i, d] of drawers.entries()) {
+ b.stagger(0);
+ for (const k of drawerKeys(d)) b.add(k, [0, 0, 520]);
+ if (i > 0) for (const o of backScrews(d)) b.preset(HW.screwM, o);
+ b.wait(0.25);
+ }
+ },
+ );
+ if (p.knobs === "knob" || p.knobs === "bar") {
+ const def = p.knobs === "bar" ? HW.handle : HW.knob;
+ b.step(
+ {
+ title: p.knobs === "bar" ? "Screw on the handles" : "Screw on the knobs",
+ detail: "Screw from inside the drawer. Snug is enough.",
+ tools: ["screwdriver"],
+ kind: "screws",
+ },
+ () => {
+ b.fits(
+ def,
+ drawers.map((d) => ({ on: d.front, at: [d.x, yd + fh / 2, zf + 9] as Vec3, dir: [0, 0, -1] as Vec3, hole: false, twist: p.knobs === "bar" ? Math.PI / 2 : 0 })),
+ 0.12,
+ );
+ },
+ );
+ }
+ }
+
+ /* ---------- mattresses, and the pull-out in use ---------- */
+ const mt = 120;
+ const mT = inBox ? b.part("Mattress", [Ml, mt, Mm], { material: "soft" }) : b.part("Your mattress", [Ml, mt, Mm], { material: "soft", extra: true });
+ const zm = -2;
+ const ms = Array.from({ length: rolls ? 2 : 1 }, (_, i) => b.place(mT, [0, ys + mt / 2 + i * mt, zm]));
+ const mats = (n: number) => (inBox ? (n > 1 ? "Add the mattresses" : "Add the mattress") : n > 1 ? "Add your mattresses" : "Add your mattress");
+ const unwrap = inBox ? " Unwrap them and give them a few hours to rise." : "";
+ if (!rolls) {
+ b.step(
+ {
+ title: mats(1),
+ detail: inBox ? "Unwrap it and give it a few hours to rise. Then it's a sofa by day and a bed at night." : "Done. It's a sofa by day and a bed at night.",
+ kind: "general",
+ },
+ () => b.add(ms[0], [0, 420, 0]),
+ );
+ return;
+ }
+
+ const opened = (k: string): Vec3 => {
+ const f = at(k).pos;
+ return [f[0], f[1], f[2] + oz];
+ };
+ b.step(
+ {
+ title: nDr ? "Pull it out to make a double bed" : "Roll out the trundle for a double bed",
+ detail: nDr ? "Pull it by the top rail, not by the drawers. It rolls out on its castors." : "Pull it all the way out, so it sits snug against the frame.",
+ kind: "general",
+ weight: 1,
+ },
+ () => {
+ b.stagger(0);
+ for (const k of pull) b.stage(k, opened(k), at(k).rot);
+ },
+ );
+ b.step(
+ {
+ title: mats(2),
+ detail: `One on each base for a double bed.${unwrap}`,
+ kind: "general",
+ },
+ () => {
+ b.stagger(0.4);
+ b.add(ms[0], [0, 420, 0]);
+ b.stage(ms[1], [0, yTop + 12 + mt / 2, zc + oz], [0, 0, 0], [0, 420, 0]);
+ },
+ );
+ b.step(
+ {
+ title: nDr ? "Push it back in for a day-bed" : "Roll the trundle back in for a day-bed",
+ detail: "Stack both mattresses on top to use it as a sofa.",
+ kind: "general",
+ weight: 1.2,
+ },
+ () => {
+ b.stagger(0);
+ for (const k of pull) b.add(k);
+ b.then(0.1);
+ b.add(ms[1]);
+ },
+ );
+}
diff --git a/src/lib/products.ts b/src/lib/products.ts
index b75b7a9..e4e6a8b 100644
--- a/src/lib/products.ts
+++ b/src/lib/products.ts
@@ -41,7 +41,8 @@ export type Kind =
| "cot"
| "bunk"
| "loft"
- | "dropleaf";
+ | "dropleaf"
+ | "daybed";
export type X = {
rows?: number;
@@ -69,6 +70,8 @@ export type X = {
drawer?: boolean;
leaves?: number;
leaf?: number;
+ under?: "pullout" | "trundle" | "boxes";
+ mats?: number;
};
export type Row = [name: string, kind: Kind, variant: string, w: number, h: number, d: number, x?: X, keywords?: string];
@@ -242,7 +245,7 @@ const MIN: Record<Kind, number> = {
cube: 40, bookcase: 50, open: 40, chest: 90, nightstand: 40, desk: 25, coffee: 20, side: 15, dining: 40,
bed: 100, wardrobe: 120, cabinet: 60, sideboard: 80, tv: 60, shoe: 45, chair: 25, stool: 12, bench: 20, sofa: 40, armchair: 30,
wallshelf: 25, wallcab: 40, kitchen: 50, trolley: 25, bar: 35, console: 30, kidstable: 15, kidschair: 20,
- office: 20, chaise: 55, corner: 70, cot: 35, bunk: 90, loft: 75, dropleaf: 40,
+ office: 20, chaise: 55, corner: 70, cot: 35, bunk: 90, loft: 75, dropleaf: 40, daybed: 60,
};
const CATEGORY: Record<Kind, string> = {
@@ -251,7 +254,7 @@ const CATEGORY: Record<Kind, string> = {
cabinet: "Cabinet", sideboard: "Sideboard", tv: "TV bench", shoe: "Shoe cabinet", chair: "Chair", stool: "Stool",
bench: "Bench", sofa: "Sofa", armchair: "Armchair", wallshelf: "Wall shelf", wallcab: "Wall cabinet", kitchen: "Kitchen cabinet",
trolley: "Trolley", bar: "Bar table", console: "Console table", kidstable: "Children's table", kidschair: "Children's chair",
- office: "Office chair", chaise: "Sofa with chaise longue", corner: "Corner sofa", cot: "Cot", bunk: "Bunk bed", loft: "Loft bed", dropleaf: "Drop-leaf table",
+ office: "Office chair", chaise: "Sofa with chaise longue", corner: "Corner sofa", cot: "Cot", bunk: "Bunk bed", loft: "Loft bed", dropleaf: "Drop-leaf table", daybed: "Day-bed",
};
export const KIND_ARCH: Record<Kind, Archetype> = {
@@ -259,7 +262,7 @@ export const KIND_ARCH: Record<Kind, Archetype> = {
side: "table", dining: "table", bed: "bed", wardrobe: "cabinet", cabinet: "cabinet", sideboard: "cabinet", tv: "cabinet",
shoe: "cabinet", chair: "seat", stool: "seat", bench: "seat", sofa: "sofa", armchair: "sofa", wallshelf: "shelf", wallcab: "cabinet",
kitchen: "cabinet", trolley: "table", bar: "table", console: "table", kidstable: "table", kidschair: "seat",
- office: "seat", chaise: "sofa", corner: "sofa", cot: "bed", bunk: "bed", loft: "bed", dropleaf: "table",
+ office: "seat", chaise: "sofa", corner: "sofa", cot: "bed", bunk: "bed", loft: "bed", dropleaf: "table", daybed: "bed",
};
const round = (x: X) => (x.round ? { round: true } : {});
@@ -348,6 +351,13 @@ export function specFor(kind: Kind, name: string, variant: string, w: number, h:
return { ...base, people: 2, difficulty: 3, bed: { type: kind, mattressW: x.m ?? 90, mattressL: x.l ?? 200, headH: h, footH: h, slats: 14, centerBeam: false } };
case "dropleaf":
return { ...base, people: w > 120 ? 2 : 1, table: { attach: "apron", legs: "square", legSize: 45, topThickness: 25, shelf: false, leaves: x.leaves ?? 2, leaf: x.leaf ?? 30 } };
+ case "daybed": {
+ // x.under: what is underneath; x.rows: drawers in the pull-out; x.mats: mattresses in the box
+ const drawers = x.under === "pullout" ? (x.rows ?? 2) : 0;
+ const minutes = x.min ?? MIN.daybed + (x.under === "pullout" ? 45 : x.under ? 25 : 0) + 15 * drawers;
+ const under = x.under ? { under: x.under } : {};
+ return { ...base, minutes, people: 2, difficulty: x.under ? 3 : 2, bed: { type: "daybed", mattressW: x.m ?? 80, mattressL: x.l ?? 200, headH: h, footH: h, slats: 13, centerBeam: false, ...under, ...(drawers ? { drawers, knobs: x.knobs ?? "none" } : {}), ...(x.mats ? { mattresses: x.mats } : {}) } };
+ }
}
}
@@ -378,5 +388,5 @@ export const KIND_DEFAULT_SIZE: Record<Kind, [number, number, number]> = {
sideboard: [140, 85, 45], tv: [150, 50, 42], shoe: [60, 100, 28], chair: [44, 88, 50], stool: [35, 45, 35], bench: [100, 45, 38],
sofa: [210, 85, 92], armchair: [75, 90, 80], wallshelf: [60, 60, 22], wallcab: [60, 60, 35], kitchen: [60, 80, 60], trolley: [50, 80, 40],
bar: [120, 105, 60], console: [100, 79, 35], kidstable: [77, 48, 55], kidschair: [34, 60, 34],
- office: [64, 105, 64], chaise: [226, 85, 160], corner: [233, 85, 171], cot: [130, 84, 68], bunk: [211, 160, 100], loft: [211, 195, 100], dropleaf: [134, 75, 80],
+ office: [64, 105, 64], chaise: [226, 85, 160], corner: [233, 85, 171], cot: [130, 84, 68], bunk: [211, 160, 100], loft: [211, 195, 100], dropleaf: [134, 75, 80], daybed: [207, 83, 91],
};
diff --git a/src/lib/search.ts b/src/lib/search.ts
index 8417624..f80112e 100644
--- a/src/lib/search.ts
+++ b/src/lib/search.ts
@@ -36,7 +36,8 @@ const CATEGORY_WORDS: [Kind, string[]][] = [
["cot", ["cot", "crib", "baby bed"]],
["bunk", ["bunk", "bunk bed", "bunkbed"]],
["loft", ["loft bed", "high sleeper"]],
- ["bed", ["bed", "bedframe", "daybed"]],
+ ["daybed", ["daybed", "day bed", "trundle bed"]],
+ ["bed", ["bed", "bedframe"]],
["wardrobe", ["wardrobe", "closet", "armoire"]],
["sideboard", ["sideboard", "buffet"]],
["cabinet", ["cabinet", "cupboard", "vitrine", "display"]],
diff --git a/src/lib/types.ts b/src/lib/types.ts
index ffdb0dc..da8469e 100644
--- a/src/lib/types.ts
+++ b/src/lib/types.ts
@@ -41,8 +41,12 @@ export interface BedParams {
footH: number; // cm, 0 for none
slats: number;
centerBeam: boolean;
- type?: "cot" | "bunk" | "loft"; // a cot with barred sides, two beds stacked on posts, or one bed up high
+ type?: "cot" | "bunk" | "loft" | "daybed"; // a cot with barred sides, two beds stacked on posts, one bed up high, or a day-bed
drawer?: boolean; // a cot with a drawer under the base
+ under?: "pullout" | "trundle" | "boxes"; // day-beds: a bed that pulls out (with drawers), a trundle, or storage boxes on castors
+ drawers?: number; // day-beds: drawers in the pull-out bed
+ knobs?: "none" | "knob" | "bar"; // day-beds: on the drawer fronts
+ mattresses?: number; // day-beds: mattresses that come in the box
}
export interface CabinetParams {