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 storage benches and boxes with a lid

Youssef05350c021103
diff --git a/scripts/ikea/build.ts b/scripts/ikea/build.ts
index 4a407fe..78d63d7 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", "daybed", "mixed", "sliding", "slidecab", "bookrow", "cabrow", "section", "gateleg", "washstand", "sinkcab", "appliance", "shoerack", "clothesrack", "changing", "divider", "backbench", "junior", "lounge", "highchair", "cornercab", "cornerrobe", "usofa", "lounger", "swivel", "conference", "cornerdesk", "conftable"]);
+const LATER_KINDS = new Set<Kind>(["office", "chaise", "corner", "cot", "bunk", "loft", "dropleaf", "daybed", "mixed", "sliding", "slidecab", "bookrow", "cabrow", "section", "gateleg", "washstand", "sinkcab", "appliance", "shoerack", "clothesrack", "changing", "divider", "backbench", "junior", "lounge", "highchair", "cornercab", "cornerrobe", "usofa", "lounger", "swivel", "conference", "cornerdesk", "conftable", "lidbox"]);
function baseMatch(name: string, draw: Draw): CatalogEntry | undefined {
const fam = fold(name);
@@ -72,6 +72,8 @@ function baseMatch(name: string, draw: Draw): CatalogEntry | undefined {
if (e.archetype !== spec.archetype && e.category !== spec.category) continue;
// the newer kinds draw a different shape from anything hand made in their archetype
if (LATER_KINDS.has(draw.kind) && e.category !== spec.category) continue;
+ // IKEA's own name for what it is sets it apart from a hand made entry of another category
+ if (draw.x.cat && e.category !== spec.category) continue;
if (draw.kind === "bed") {
if (e.bed?.mattressW === draw.x.m && (e.bed?.mattressL ?? 200) === (draw.x.l ?? 200)) return e;
continue;
diff --git a/scripts/ikea/check.ts b/scripts/ikea/check.ts
index 60a0eb7..49a386a 100644
--- a/scripts/ikea/check.ts
+++ b/scripts/ikea/check.ts
@@ -132,6 +132,11 @@ async function main() {
// a corner cabinet when asked for, without taking the family's wall cabinets
expect("metod corner base cabinet", "metod-corner-base-cabinet-carousel-88-x-88");
expect("metod wall cabinet", "metod-wall-cabinet-w-shelves-glass-door-30-x-80");
+ // a storage bench with a lid when asked for, the family's bench or table otherwise
+ expect("kallso storage bench", "kallso-storage-bench-80-x-38-x-56");
+ expect("kallso bench", "kallso-bench-shoe-storage-80-x-38-x-56");
+ expect("hol storage table", "hol-storage-table-98-x-50");
+ expect("hol", "hol-side-table-50-x-50");
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 86e2061..7ee2fe7 100644
--- a/scripts/ikea/classify.ts
+++ b/scripts/ikea/classify.ts
@@ -154,6 +154,13 @@ const DAYBED_SIZE: Record<string, [number, number, number]> = { HEMNES: [210, 83
const BLIND_DOOR: Record<string, number> = { METOD: 60, KNOXHULT: 50 };
/** Corner base cabinets IKEA measures wide by high, with the worktop on top, and how deep they are. */
const CORNER_WH: Record<string, number> = { KNOXHULT: 61 };
+/** Boxes with a lid IKEA gives no size for, or only part of one (w, h, d): typical ones of each kind. */
+const LIDBOX_SIZE: Record<string, [number, number, number]> = {
+ "Footstool with storage": [62, 42, 42],
+ "Pouffe with storage": [38, 38, 38],
+ "Storage stool": [36, 46, 36],
+ "Storage table": [98, 50, 50],
+};
type Pick = { kind: Kind; x?: X } | string;
type Rule = [RegExp, (m: RegExpMatchArray, c: Ctx) => Pick];
@@ -378,6 +385,14 @@ const RULES: Rule[] = [
[/^(?:cabinet with (\d) drawers|drawer unit with drop-file storage|modular chest of drawers)$/, (m) =>
({ kind: "chest", x: m[1] ? { rows: Number(m[1]) } : /drop-file/.test(m[0]) ? { rows: 2 } : {} })],
[/^cabinet with \d compartments$/, () => ({ kind: "cube" })],
+ // boxes with a lid on hinges: storage benches, a storage table, footstools and pouffes with a padded lid (a round
+ // basket table and benches built from frames and fronts stay skipped)
+ [/^(storage bench|storage table|footstool with storage|pouffe with storage|storage stool)$/, (m, c) => {
+ if (c.f.name === "PLATSA") return "storage bench built from frames and fronts";
+ if (m[1] === "storage table" && c.sz.n.length === 1) return "round storage table";
+ const cat = { "storage table": "Storage table", "footstool with storage": "Footstool with storage", "pouffe with storage": "Pouffe with storage", "storage stool": "Storage stool" }[m[1]];
+ return { kind: "lidbox", x: cat ? { cat } : {} };
+ }],
[/^wall cb (?:with (\d) doors?|w (\d) shlf\/door|w (\d) shelves)$/, (m) =>
({ kind: "wallcab", x: m[3] ? { doors: 0, shelves: Number(m[3]) } : m[2] ? { doors: 1, shelves: Number(m[2]) } : { doors: Number(m[1]) > 1 ? 2 : 1 } })],
[/^(?:wall frame with shelves|wall shelf frame|wall-mounted bedside table)$/, () => ({ kind: "wallshelf" })],
@@ -692,6 +707,13 @@ export function classify(f: Fact, hints: Hints): Verdict {
else set(v[0], 80, v[1]);
guessed.h = v.length === 2 && !x.hung && !CORNER_WH[family];
if (hint?.x.knobs) x.knobs = hint.x.knobs;
+ } else if (kind === "lidbox") {
+ // wide by deep by high; a table measured from above; a stool by its height
+ const typical = LIDBOX_SIZE[x.cat ?? ""];
+ if (typical) [w, h, d] = typical;
+ if (v.length === 3) set(v[0], v[2], v[1]);
+ else if (v.length === 2) set(v[0], undefined, v[1]);
+ else if (v.length === 1) set(undefined, v[0]);
} else if (kind === "office") {
// IKEA gives no size for office chairs: a typical one, taller with a headrest, smaller for children
if (v.length === 3) set(v[0], v[2], v[1]);
diff --git a/scripts/ikea/slugs.json b/scripts/ikea/slugs.json
index e389df1..32b7347 100644
--- a/scripts/ikea/slugs.json
+++ b/scripts/ikea/slugs.json
@@ -285,6 +285,7 @@
"GALANT|Cabinet with sliding doors, 160 × 120 cm": "galant-cabinet-sliding-doors-160-x-120",
"GALANT|Drawer unit on castors, 45 × 55 cm": "galant-drawer-unit-on-castors-45-x-55",
"GALANT|Drawer unit, 80 × 80 cm": "galant-drawer-unit-80-x-80",
+ "GAMLEHULT|Footstool with storage": "gamlehult-footstool-storage",
"GARNANÄS|Coffee table, 65 × 65 cm": "garnanas-coffee-table-65-x-65",
"GÄVLE|Easy chair": "gavle-easy-chair",
"GILLERSBERG|Bedside table, 39 × 39 × 56 cm": "gillersberg-bedside-table-39-x-39-x-56",
@@ -304,6 +305,7 @@
"GRÅFJÄLLET|Wall-mounted bedside table, 42 × 29 × 31 cm": "grafjallet-wall-mounted-bedside-table-42-x-29-x",
"GREJSIMOJS|Children's stool": "grejsimojs-children-s-stool",
"GREJSIMOJS|Children's table, 84 × 42 cm": "grejsimojs-children-s-table-84-x-42",
+ "GREJSIMOJS|Pouffe with storage": "grejsimojs-pouffe-storage",
"GRILLSKÄR|Side table, outdoor, 30 × 61 cm": "grillskar-side-table-outdoor-30-x-61",
"GRÖNFJÄLL|Office chair with arm/headrest": "gronfjall-office-chair-arm-headrest",
"GRÖNFJÄLL|Office chair with armrests": "gronfjall-office-chair-armrests",
@@ -328,6 +330,7 @@
"GULLABERG|Desk, 155 × 65 × 75 cm": "gullaberg-desk-155-x-65-x-75",
"GULLABERG|Shoe cabinet with 2 compartments, 88 × 30 × 122 cm": "gullaberg-shoe-cabinet-2-compartments-88-x-30-x",
"GULLABERG|Shoe cabinet with 4 compartments, 105 × 22 × 107 cm": "gullaberg-shoe-cabinet-4-compartments-105-x-22-x",
+ "GULLABERG|Storage bench, 148 × 43 × 52 cm": "gullaberg-storage-bench-148-x-43-x-52",
"GULLABERG|Wardrobe, 128 × 64 × 201 cm": "gullaberg-wardrobe-128-x-64-x-201",
"GULLIVER|Changing table, 82 × 54 × 93 cm": "gulliver-changing-table-82-x-54-x-93",
"GULLIVER|Cot, 60 × 120 cm": "gulliver-cot-60-x-120",
@@ -400,6 +403,7 @@
"HERRÅKRA|Armchair": "herrakra-armchair",
"HÖGVED|Chair": "hogved-chair",
"HOL|Side table, 50 × 50 cm": "hol-side-table-50-x-50",
+ "HOL|Storage table, 98 × 50 cm": "hol-storage-table-98-x-50",
"HOLMERUD|Side table, 80 × 31 cm": "holmerud-side-table-80-x-31",
"HOLMSTA / FRÖKNABO|Armchair": "holmsta-froknabo-armchair",
"HOLMSTA|Armchair": "holmsta-armchair",
@@ -518,6 +522,7 @@
"KALLAX|Shelving unit, 77 × 112 cm": "kallax-shelving-unit-77-x-112",
"KALLAX|Shelving unit, 77 × 41 cm": "kallax-shelving-unit-77-x-41",
"KALLSÖ|Bench with shoe storage, 80 × 38 × 56 cm": "kallso-bench-shoe-storage-80-x-38-x-56",
+ "KALLSÖ|Storage bench, 80 × 38 × 56 cm": "kallso-storage-bench-80-x-38-x-56",
"KARSKÄR|Chair": "karskar-chair",
"KARSKÄR|Extendable table, 160/220 × 90 cm": "karskar-extendable-table-160-220-x-90",
"KARSKÄR|Extendable table, 240/300 × 100 cm": "karskar-extendable-table-240-300-x-100",
@@ -869,6 +874,7 @@
"MULLSJÖ|Swivel chair": "mullsjo-swivel-chair",
"MUSKAN|Bench, 58 × 38 cm": "muskan-bench-58-x-38",
"MUSKAN|Shelving unit, 37 × 140 cm": "muskan-shelving-unit-37-x-140",
+ "MUSKAN|Storage stool, 50 cm": "muskan-storage-stool-50",
"MYDAL|Bunk bed frame, 90 × 200 cm": "mydal-bunk-bed-frame-90-x-200",
"MYLLRA|Changing table with drawers, 85 × 79 × 97 cm": "myllra-changing-table-drawers-85-x-79-x-97",
"MYLLRA|Cot with drawer, 70 × 140 cm": "myllra-cot-drawer-70-x-140",
diff --git a/src/data/ikea-items.ts b/src/data/ikea-items.ts
index 8ccc76b..1688ea4 100644
--- a/src/data/ikea-items.ts
+++ b/src/data/ikea-items.ts
@@ -309,6 +309,7 @@ galant-cabinet-doors-80-x-120|10365141 50365139
galant-cabinet-sliding-doors-160-x-120|30365135 20365131
galant-drawer-unit-80-x-80|90365161 30365159
galant-drawer-unit-on-castors-45-x-55|10365155 60365153
+gamlehult-footstool-storage|10434309
garnanas-coffee-table-65-x-65|00556508
gavle-easy-chair|80588845 50588842
gillersberg-bedside-table-39-x-39-x-56|30608983
@@ -329,6 +330,7 @@ grafjallet-room-divider-150-x-175|10570226
grafjallet-wall-mounted-bedside-table-42-x-29-x|00603114
grejsimojs-children-s-stool|60598973 50598959
grejsimojs-children-s-table-84-x-42|70598963
+grejsimojs-pouffe-storage|60603644
grillskar-side-table-outdoor-30-x-61|00523179
gronfjall-office-chair-arm-headrest|89513921
gronfjall-office-chair-armrests|20503477
@@ -353,6 +355,7 @@ gullaberg-desk-120-x-65-x-75|20609681
gullaberg-desk-155-x-65-x-75|50601669
gullaberg-shoe-cabinet-2-compartments-88-x-30-x|50587692 40587697
gullaberg-shoe-cabinet-4-compartments-105-x-22-x|10587707 50587710
+gullaberg-storage-bench-148-x-43-x-52|40573959 80573957
gullaberg-wardrobe-128-x-64-x-201|00609903 80609904
gulliver-changing-table-82-x-54-x-93|20307037
gulliver-cot-60-x-120|20589503 10248519
@@ -436,6 +439,7 @@ hemnes-wash-stand-2-drawers-60-x-47-x-83|50217667 20217664 90217665
herrakra-armchair|20544717 80535545 80535550
hogved-chair|90606820
hol-side-table-50-x-50|70161320
+hol-storage-table-98-x-50|50161321
holmerud-coffee-table-90-x-55|90540706 00541418
holmerud-side-table-80-x-31|40541421 20538721
holmsta-armchair|90508551
@@ -567,6 +571,7 @@ kallax-shelving-unit-underframe-147-x-94|29442677 39442686 89442679 79442689 594
kallax-shelving-unit-underframe-77-x-164|69442642 89442655 19442654 99442645 79442646 49442643 29442615 79607557
kallax-shelving-unit-underframe-77-x-94|89442617 59442628 49442619 69442618 79442627 09442616 29634983
kallso-bench-shoe-storage-80-x-38-x-56|20599328
+kallso-storage-bench-80-x-38-x-56|80599325
karskar-chair|00611251
karskar-extendable-table-160-220-x-90|50611263
karskar-extendable-table-240-300-x-100|00611265
@@ -939,6 +944,7 @@ mullsjo-desk-135-x-70|30553240
mullsjo-swivel-chair|70576584
muskan-bench-58-x-38|50345957
muskan-shelving-unit-37-x-140|50424327
+muskan-storage-stool-50|00360587
mydal-bunk-bed-frame-90-x-200|20467629 00102452
myllra-changing-table-drawers-85-x-79-x-97|40595744
myllra-cot-drawer-70-x-140|80597048 60483590
diff --git a/src/data/ikea-rows.ts b/src/data/ikea-rows.ts
index 6f988b6..82312bb 100644
--- a/src/data/ikea-rows.ts
+++ b/src/data/ikea-rows.ts
@@ -286,6 +286,7 @@ GALANT|cabinet|Cabinet with doors, 80 × 120 cm|80|120|40
GALANT|chest|Drawer unit on castors, 45 × 55 cm|45|55|48|rows=4
GALANT|chest|Drawer unit, 80 × 80 cm|80|80|48|rows=6
GALANT|slidecab|Cabinet with sliding doors, 160 × 120 cm|160|120|45|slides=2
+GAMLEHULT|lidbox|Footstool with storage|62|42|42|cat=Footstool with storage
GARNANÄS|coffee|Coffee table, 65 × 65 cm|65|45|65
GÄVLE|armchair|Easy chair|75|90|80
GILLERSBERG|nightstand|Bedside table, 39 × 39 × 56 cm|39|56|39|rows=1
@@ -304,6 +305,7 @@ GRÅFJÄLLET|divider|Room divider, 150 × 175 cm|150|175|25
GRÅFJÄLLET|nightstand|Bedside table, 45 × 36 × 59 cm|45|59|36|rows=1
GRÅFJÄLLET|wallshelf|Wall-mounted bedside table, 42 × 29 × 31 cm|42|31|29
GREJSIMOJS|kidstable|Children's table, 84 × 42 cm|84|48|42||kids
+GREJSIMOJS|lidbox|Pouffe with storage|38|38|38|cat=Pouffe with storage
GREJSIMOJS|stool|Children's stool|35|30|35||kids
GRILLSKÄR|side|Side table, outdoor, 30 × 61 cm|30|50|61||outdoor garden
GRÖNFJÄLL|office|Office chair with armrests|64|105|64|arms=slim
@@ -325,6 +327,7 @@ GULLABERG|chest|Chest of 3 drawers, 99 × 48 × 100 cm|99|100|48|rows=3
GULLABERG|chest|Chest of 8 drawers, 168 × 48 × 100 cm|168|100|48|rows=4,cols=2
GULLABERG|desk|Desk, 120 × 65 × 75 cm|120|75|65
GULLABERG|desk|Desk, 155 × 65 × 75 cm|155|75|65
+GULLABERG|lidbox|Storage bench, 148 × 43 × 52 cm|148|52|43
GULLABERG|nightstand|Bedside table, 38 × 40 × 75 cm|38|75|40|rows=2
GULLABERG|nightstand|Bedside table, 53 × 43 × 69 cm|53|69|43|rows=2
GULLABERG|shoe|Shoe cabinet with 2 compartments, 88 × 30 × 122 cm|88|122|30|c=2
@@ -400,6 +403,7 @@ HEMNES / VÄSTERSJÖN|washstand|Open wash-stand w drawer/wash-basin, 82 × 48 ×
HEMNES / VÄSTERSJÖN|washstand|Open wsh-stnd w drw/wash-basin/tap, 82 × 48 × 90 cm|82|90|48|knobs=knob,z=o1+r1@18,basin=7
HERRÅKRA|armchair|Armchair|75|90|80
HÖGVED|chair|Chair|44|88|50
+HOL|lidbox|Storage table, 98 × 50 cm|98|50|50|cat=Storage table
HOL|side|Side table, 50 × 50 cm|50|50|50
HOLMERUD|side|Side table, 80 × 31 cm|80|50|31
HOLMSTA|armchair|Armchair|75|90|80
@@ -519,6 +523,7 @@ KALLAX|cube|Shelving unit with 10 inserts, 182 × 182 cm|182|182|39|ins=10
KALLAX|cube|Shelving unit, 182 × 182 cm|182|182|39
KALLAX|desk|Desk, 111 × 39 cm|111|74|39
KALLSÖ|bench|Bench with shoe storage, 80 × 38 × 56 cm|80|56|38
+KALLSÖ|lidbox|Storage bench, 80 × 38 × 56 cm|80|56|38
KARSKÄR|chair|Chair|44|88|50
KARSKÄR|dining|Extendable table, 160/220 × 90 cm|160|74|90
KARSKÄR|dining|Extendable table, 240/300 × 100 cm|240|74|100
@@ -869,6 +874,7 @@ MULIG|clothesrack|Clothes rack, 99 × 152 cm|99|152|46
MULLSJÖ|desk|Desk, 135 × 70 cm|135|74|70
MULLSJÖ|office|Swivel chair|60|105|64|arms=none
MUSKAN|bench|Bench, 58 × 38 cm|58|45|38
+MUSKAN|lidbox|Storage stool, 50 cm|36|50|36|cat=Storage stool
MUSKAN|open|Shelving unit, 37 × 140 cm|37|140|35
MYDAL|bunk|Bunk bed frame, 90 × 200 cm|211|160|100|m=90
MYLLRA|changing|Changing table with drawers, 85 × 79 × 97 cm|85|97|79|rows=3|kids children
diff --git a/src/lib/ikea.ts b/src/lib/ikea.ts
index 36b5b6c..2b8f689 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", "under", "mats", "dtop", "rail", "slides", "n", "of", "hinge", "use", "z", "basin", "hung", "uf", "ins", "blind", "inner", "u", "v", "cu", "rock"] as const;
-const FLAGS = new Set<string>(["plinth", "shelf", "round", "open", "drawer", "dtop", "rail", "hinge", "hung", "rock"]);
-const WORDS = new Set<string>(["knobs", "arms", "legs", "attach", "chaise", "corner", "under", "of", "use", "z", "inner", "u", "v"]);
+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", "dtop", "rail", "slides", "n", "of", "hinge", "use", "z", "basin", "hung", "uf", "ins", "blind", "inner", "u", "v", "cu", "rock", "cat", "cast", "mods", "dr", "foot", "st", "low", "box", "t", "mirror"] as const;
+const FLAGS = new Set<string>(["plinth", "shelf", "round", "open", "drawer", "dtop", "rail", "hinge", "hung", "rock", "cast", "foot", "mirror"]);
+const WORDS = new Set<string>(["knobs", "arms", "legs", "attach", "chaise", "corner", "under", "of", "use", "z", "inner", "u", "v", "cat"]);
export function encodeX(x: X): string {
const out: string[] = [];
diff --git a/src/lib/plan/cabinet.ts b/src/lib/plan/cabinet.ts
index 334a784..8f601d6 100644
--- a/src/lib/plan/cabinet.ts
+++ b/src/lib/plan/cabinet.ts
@@ -6,6 +6,7 @@ import { buildFitted } from "./fitted";
import { buildMixed } from "./mixed";
import { buildSliding } from "./sliding";
import { buildCornerCabinet } from "./cornercab";
+import { buildLidBox } from "./lidbox";
export function defaultsCabinet(s: ProductSpec): CabinetParams {
const p = s.cabinet ?? {};
@@ -23,6 +24,7 @@ export function defaultsCabinet(s: ProductSpec): CabinetParams {
}
export function buildCabinet(b: PlanBuilder, s: ProductSpec) {
+ if (s.cabinet?.lid) return buildLidBox(b, s);
if (s.cabinet?.corner) return buildCornerCabinet(b, s);
if (s.cabinet?.fit) return buildFitted(b, s);
if (s.cabinet?.drawers) return buildMixed(b, s);
diff --git a/src/lib/plan/lidbox.ts b/src/lib/plan/lidbox.ts
new file mode 100644
index 0000000..e6410fd
--- /dev/null
+++ b/src/lib/plan/lidbox.ts
@@ -0,0 +1,156 @@
+import type { ProductSpec, Vec3 } from "../types";
+import { HW, PlanBuilder, type FitOpts } from "./builder";
+
+/**
+ * A box with a lid on hinges: storage benches (GULLABERG, KALLSÖ), a storage table (HOL), footstools and
+ * pouffes with storage. Two ends stand on the floor; the front and back go between them, a bottom slides into
+ * their grooves, and the lid is hinged along the back. A padded lid when it's a footstool or a pouffe.
+ */
+export function buildLidBox(b: PlanBuilder, s: ProductSpec) {
+ const W = s.size.w * 10, H = s.size.h * 10, D = s.size.d * 10;
+ const soft = !!s.cabinet?.lid?.soft;
+ const t = 18;
+ const lt = soft ? Math.min(90, H * 0.2) : 20; // the lid, padded on a footstool
+ const Hb = H - lt; // top of the box
+ const foot = Math.min(60, Hb * 0.12); // the ends reach down to the floor, the front and back stop short
+ const iw = W - 2 * t;
+ const big = W > 1200;
+ const sx = W / 2 - t / 2;
+ const zp = D / 2 - t / 2;
+
+ const endT = b.part("End panel", [t, Hb, D]);
+ const ends = [b.place(endT, [-sx, Hb / 2, 0]), b.place(endT, [sx, Hb / 2, 0], [0, Math.PI, 0])];
+ const fbT = b.part("Front and back panel", [iw, Hb - foot, t]);
+ const yPanel = foot + (Hb - foot) / 2;
+ const back = b.place(fbT, [0, yPanel, -zp]);
+ const front = b.place(fbT, [0, yPanel, zp], [0, Math.PI, 0]);
+ const botT = b.part("Bottom panel", [iw - 2, 6, D - 2 * t + 16], { material: "fiber" });
+ const yBot = foot + 30;
+ const bottom = b.place(botT, [0, yBot, 0]);
+ const lidT = b.part(soft ? "Padded lid" : "Lid", [W, lt, D], { material: soft ? "soft" : "board" });
+ const lid = b.place(lidT, [0, Hb + lt / 2, 0]);
+
+ // where the front and back meet the ends: a dowel and a bolt at each corner, top and bottom
+ const ys = [foot + 50, Hb - 50];
+ const joints = (side: number) => {
+ const xi = side < 0 ? -W / 2 + t : W / 2 - t;
+ const into: Vec3 = [side < 0 ? -1 : 1, 0, 0];
+ const dowels: FitOpts[] = [], bolts: FitOpts[] = [];
+ for (const [k, z] of [[back, -zp], [front, zp]] as const)
+ for (const y of ys) {
+ dowels.push({ on: ends[side < 0 ? 0 : 1], at: [xi, y, z + (z < 0 ? 4 : -4)], dir: into, mate: k });
+ bolts.push({ on: ends[side < 0 ? 0 : 1], at: [xi, y + (y < Hb / 2 ? 30 : -30), z], dir: into, mate: k, mateHole: 4 });
+ }
+ return { dowels, bolts };
+ };
+
+ b.step(
+ {
+ title: "Fit the dowels and bolts into both ends",
+ detail: "Tap the dowels in gently. Twist the bolts in by hand until they stop.",
+ tools: ["hammer", "screwdriver"],
+ scene: "prep",
+ kind: "dowels",
+ warnings: ["floor"],
+ },
+ () => {
+ b.stagger(0.18);
+ ends.forEach((k, i) => b.stage(k, [0, t / 2, (i === 0 ? -1 : 1) * (Hb / 2 + 60)], [0, 0, Math.PI / 2], [0, 120, 0]));
+ b.then(0.2);
+ const l = joints(-1), r = joints(1);
+ b.fits(HW.dowel, [...l.dowels, ...r.dowels], 0.06);
+ b.then(0.15);
+ b.fits(HW.camScrew, [...l.bolts, ...r.bolts], 0.06);
+ },
+ );
+
+ b.step(
+ {
+ title: "Push the front and back onto one end",
+ detail: "Their grooves face each other, inside and low down, ready for the bottom.",
+ kind: "join",
+ warnings: ["face"],
+ },
+ () => {
+ b.add(ends[0], [-260, 0, 0]);
+ b.then(0.1);
+ b.stagger(0.25);
+ b.add(back, [300, 0, 0]);
+ b.add(front, [300, 0, 0]);
+ },
+ );
+
+ b.step(
+ {
+ title: "Slide in the bottom",
+ detail: "Smooth side up. It runs along both grooves until it meets the end.",
+ kind: "join",
+ },
+ () => b.add(bottom, [W * 0.7, 0, 0]),
+ );
+
+ b.step(
+ {
+ title: "Add the other end",
+ detail: "Line up the bolts with the holes, then press it on evenly.",
+ kind: "join",
+ people: big ? 2 : 1,
+ },
+ () => b.add(ends[1], [320, 0, 0]),
+ );
+
+ b.step(
+ {
+ title: "Lock the cam locks",
+ detail: "Drop each one in with the arrow pointing at the bolt, then turn clockwise until it bites.",
+ tools: ["screwdriver"],
+ kind: "cams",
+ },
+ () => {
+ const list: FitOpts[] = [];
+ for (const [k, z] of [[back, -zp + t / 2], [front, zp - t / 2]] as const)
+ for (const x of [-W / 2 + t + 30, W / 2 - t - 30]) for (const y of ys) list.push({ on: k, at: [x, y + (y < Hb / 2 ? 30 : -30), z], dir: [0, 0, z < 0 ? -1 : 1] });
+ b.fits(HW.cam, list, 0.07);
+ },
+ );
+
+ // two hinges along the back edge
+ const hx = W > 900 ? [-W / 3, W / 3] : [-W / 4, W / 4];
+ const hingeAt = (x: number): FitOpts => ({ on: lid, at: [x, Hb, -D / 2 + t + 2], dir: [0, 1, 0], hole: false });
+ b.step(
+ {
+ title: "Screw the hinges onto the lid",
+ detail: soft ? "Lay it padded side down. The hinges go along its back edge." : "Lay it face down on the flattened box. The hinges go along its back edge.",
+ tools: ["screwdriver"],
+ scene: "lid",
+ kind: "hinges",
+ warnings: ["floor"],
+ },
+ () => {
+ b.stage(lid, [0, lt / 2, 0], [Math.PI, 0, 0], [0, 160, 0]);
+ b.then(0.1);
+ b.fits(HW.flatHinge, hx.map(hingeAt), 0.15);
+ b.then(0.05);
+ const sc: FitOpts[] = [];
+ for (const x of hx) for (const dx of [-18, 18]) sc.push({ on: lid, at: [x + dx, Hb, -D / 2 + t + 12], dir: [0, 1, 0], hole: false });
+ b.fits(HW.screwS, sc, 0.05);
+ },
+ );
+
+ b.step(
+ {
+ title: "Put the lid on",
+ detail: "Screw the other half of each hinge to the top of the back. Check the lid opens and closes freely.",
+ tools: ["screwdriver"],
+ kind: "hinges",
+ people: big ? 2 : 1,
+ },
+ () => {
+ b.add(lid, [0, 260, 0]);
+ b.then(0.15);
+ const sc: FitOpts[] = [];
+ for (const x of hx) for (const dx of [-18, 18]) sc.push({ on: back, at: [x + dx, Hb, -zp], dir: [0, -1, 0], hole: false });
+ b.fits(HW.screwS, sc, 0.06);
+ },
+ );
+}
diff --git a/src/lib/products.ts b/src/lib/products.ts
index fbd0855..31b7396 100644
--- a/src/lib/products.ts
+++ b/src/lib/products.ts
@@ -70,7 +70,9 @@ export type Kind =
| "swivel"
| "conference"
| "cornerdesk"
- | "conftable";
+ | "conftable"
+ // the long tail of single pieces
+ | "lidbox";
export type X = {
rows?: number;
@@ -118,6 +120,26 @@ export type X = {
cu?: number;
inner?: "shelf" | "carousel" | "pullout";
rock?: boolean;
+ /** IKEA's own kind of product when the kind's category doesn't name it ("Storage table", "Pouffe") */
+ cat?: string;
+ /** stands on castors */
+ cast?: boolean;
+ /** a modular chest: this many columns side by side (NORDLI) */
+ mods?: number;
+ /** drawers, when there are fewer than the slots: the rest stay open */
+ dr?: number;
+ /** comes with a footstool */
+ foot?: boolean;
+ /** cm: a side table module at the right-hand end */
+ st?: number;
+ /** cm: a cabinet with doors this high at the bottom, open shelves above */
+ low?: number;
+ /** cm: room under the bottom shelf for a storage box on castors */
+ box?: number;
+ /** mm: panel thickness, when it isn't the kind's own */
+ t?: number;
+ /** a mirror on top */
+ mirror?: boolean;
};
export type Row = [name: string, kind: Kind, variant: string, w: number, h: number, d: number, x?: X, keywords?: string];
@@ -291,7 +313,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, daybed: 60, mixed: 50, sliding: 110, slidecab: 60, bookrow: 120, cabrow: 120, section: 25, gateleg: 50, washstand: 35, sinkcab: 45, appliance: 50, shoerack: 25, clothesrack: 20, changing: 50, divider: 20, backbench: 35, junior: 25, lounge: 30, highchair: 15, cornercab: 45, cornerrobe: 150, usofa: 110, lounger: 35, swivel: 25, conference: 20, cornerdesk: 35, conftable: 30,
+ office: 20, chaise: 55, corner: 70, cot: 35, bunk: 90, loft: 75, dropleaf: 40, daybed: 60, mixed: 50, sliding: 110, slidecab: 60, bookrow: 120, cabrow: 120, section: 25, gateleg: 50, washstand: 35, sinkcab: 45, appliance: 50, shoerack: 25, clothesrack: 20, changing: 50, divider: 20, backbench: 35, junior: 25, lounge: 30, highchair: 15, cornercab: 45, cornerrobe: 150, usofa: 110, lounger: 35, swivel: 25, conference: 20, cornerdesk: 35, conftable: 30, lidbox: 30,
};
const CATEGORY: Record<Kind, string> = {
@@ -300,7 +322,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", daybed: "Day-bed", mixed: "Cabinet with doors and drawers", sliding: "Wardrobe with sliding doors", slidecab: "Cabinet with sliding doors", bookrow: "Bookcase combination", cabrow: "Storage combination", section: "Sofa section", gateleg: "Gateleg table", washstand: "Wash-stand", sinkcab: "Sink cabinet", appliance: "Appliance cabinet", shoerack: "Shoe rack", clothesrack: "Clothes rack", changing: "Changing table", divider: "Room divider", backbench: "Bench with backrest", junior: "Junior chair", lounge: "Lounge chair", highchair: "Highchair", cornercab: "Corner base cabinet", cornerrobe: "Corner wardrobe", usofa: "U-shaped sofa", lounger: "Sun lounger", swivel: "Swivel easy chair", conference: "Conference chair", cornerdesk: "Corner desk", conftable: "Conference 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", mixed: "Cabinet with doors and drawers", sliding: "Wardrobe with sliding doors", slidecab: "Cabinet with sliding doors", bookrow: "Bookcase combination", cabrow: "Storage combination", section: "Sofa section", gateleg: "Gateleg table", washstand: "Wash-stand", sinkcab: "Sink cabinet", appliance: "Appliance cabinet", shoerack: "Shoe rack", clothesrack: "Clothes rack", changing: "Changing table", divider: "Room divider", backbench: "Bench with backrest", junior: "Junior chair", lounge: "Lounge chair", highchair: "Highchair", cornercab: "Corner base cabinet", cornerrobe: "Corner wardrobe", usofa: "U-shaped sofa", lounger: "Sun lounger", swivel: "Swivel easy chair", conference: "Conference chair", cornerdesk: "Corner desk", conftable: "Conference table", lidbox: "Storage bench",
};
export const KIND_ARCH: Record<Kind, Archetype> = {
@@ -308,7 +330,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", daybed: "bed", mixed: "cabinet", sliding: "cabinet", slidecab: "cabinet", bookrow: "shelf", cabrow: "cabinet", section: "sofa", gateleg: "table", washstand: "cabinet", sinkcab: "cabinet", appliance: "cabinet", shoerack: "shelf", clothesrack: "shelf", changing: "drawers", divider: "shelf", backbench: "seat", junior: "seat", lounge: "seat", highchair: "seat", cornercab: "cabinet", cornerrobe: "cabinet", usofa: "sofa", lounger: "seat", swivel: "seat", conference: "seat", cornerdesk: "table", conftable: "table",
+ office: "seat", chaise: "sofa", corner: "sofa", cot: "bed", bunk: "bed", loft: "bed", dropleaf: "table", daybed: "bed", mixed: "cabinet", sliding: "cabinet", slidecab: "cabinet", bookrow: "shelf", cabrow: "cabinet", section: "sofa", gateleg: "table", washstand: "cabinet", sinkcab: "cabinet", appliance: "cabinet", shoerack: "shelf", clothesrack: "shelf", changing: "drawers", divider: "shelf", backbench: "seat", junior: "seat", lounge: "seat", highchair: "seat", cornercab: "cabinet", cornerrobe: "cabinet", usofa: "sofa", lounger: "seat", swivel: "seat", conference: "seat", cornerdesk: "table", conftable: "table", lidbox: "cabinet",
};
const round = (x: X) => (x.round ? { round: true } : {});
@@ -378,6 +400,12 @@ function fitted(kind: Kind, base: Omit<ProductSpec, "source">, w: number, h: num
/** Turn a kind and a size into a full product spec. */
export function specFor(kind: Kind, name: string, variant: string, w: number, h: number, d: number, x: X = {}): Omit<ProductSpec, "source"> {
+ const spec = specOf(kind, name, variant, w, h, d, x);
+ // IKEA's own name for what it is, when the kind's category doesn't say it
+ return x.cat ? { ...spec, category: x.cat } : spec;
+}
+
+function specOf(kind: Kind, name: string, variant: string, w: number, h: number, d: number, x: X): Omit<ProductSpec, "source"> {
const big = h > 150 || w > 150;
const base = {
name,
@@ -577,6 +605,11 @@ export function specFor(kind: Kind, name: string, variant: string, w: number, h:
const minutes = x.min ?? MIN.cornercab + (door ? 15 : 0) + (x.inner ? 15 : 0) + (x.rows ? 30 : 0) + 5 * (x.shelves ?? 0);
return { ...base, category: hung ? "Corner wall cabinet" : CATEGORY.cornercab, minutes, people: w > 100 ? 2 : 1, difficulty: x.rows ? 3 : 2, cabinet: { doors: door ? 1 : 0, shelves: x.shelves ?? 0, rail: false, plinth: !hung, handles: x.knobs ?? "bar", thickness: 18, ...(hung ? { wall: true } : {}), corner } };
}
+ case "lidbox": {
+ // a box with a lid on hinges: a storage bench, a storage table, a footstool or pouffe with a padded lid
+ const soft = /pouffe|footstool/i.test(x.cat ?? "");
+ return { ...base, minutes: x.min ?? MIN.lidbox + (w > 100 ? 15 : 0), people: w > 120 ? 2 : 1, difficulty: 2, cabinet: { doors: 0, shelves: 0, rail: false, plinth: false, handles: "none", thickness: 18, lid: soft ? { soft: true } : {} } };
+ }
case "cornerrobe": {
// an L of wardrobe frames: x.u along the back wall, ending at its far end, x.v along the left-hand wall, ending at its
// front, and between them an add-on corner unit x.cu deep with its back to the left-hand wall (cm, "100+50")
@@ -661,5 +694,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], daybed: [207, 83, 91], mixed: [80, 120, 40], sliding: [118, 200, 60], slidecab: [80, 110, 45], bookrow: [160, 202, 28], cabrow: [240, 48, 42], section: [192, 83, 92], gateleg: [151, 75, 90], washstand: [60, 83, 47], sinkcab: [60, 80, 60], appliance: [60, 200, 60], shoerack: [80, 40, 32], clothesrack: [100, 160, 46], changing: [80, 100, 55], divider: [150, 170, 25], backbench: [120, 86, 60], junior: [43, 91, 52], lounge: [72, 88, 80], highchair: [58, 90, 62], cornercab: [88, 80, 88], cornerrobe: [161, 201, 111], usofa: [306, 83, 241], lounger: [66, 87, 195], swivel: [78, 98, 80], conference: [60, 86, 60], cornerdesk: [140, 74, 130], conftable: [140, 74, 68],
+ 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], mixed: [80, 120, 40], sliding: [118, 200, 60], slidecab: [80, 110, 45], bookrow: [160, 202, 28], cabrow: [240, 48, 42], section: [192, 83, 92], gateleg: [151, 75, 90], washstand: [60, 83, 47], sinkcab: [60, 80, 60], appliance: [60, 200, 60], shoerack: [80, 40, 32], clothesrack: [100, 160, 46], changing: [80, 100, 55], divider: [150, 170, 25], backbench: [120, 86, 60], junior: [43, 91, 52], lounge: [72, 88, 80], highchair: [58, 90, 62], cornercab: [88, 80, 88], cornerrobe: [161, 201, 111], usofa: [306, 83, 241], lounger: [66, 87, 195], swivel: [78, 98, 80], conference: [60, 86, 60], cornerdesk: [140, 74, 130], conftable: [140, 74, 68], lidbox: [100, 48, 42],
};
diff --git a/src/lib/search.ts b/src/lib/search.ts
index dcb8fd3..078fb19 100644
--- a/src/lib/search.ts
+++ b/src/lib/search.ts
@@ -23,6 +23,7 @@ const CATEGORY_WORDS: [Kind, string[]][] = [
["appliance", ["appliance cabinet", "oven cabinet", "oven housing", "oven unit", "tall oven unit", "wall oven cabinet", "cabinet for oven", "fridge cabinet", "fridge housing", "refrigerator cabinet", "freezer cabinet", "cabinet for fridge", "microwave cabinet", "hob cabinet", "hob unit", "cooktop cabinet", "hood cabinet", "extractor hood cabinet"]],
["cornerrobe", ["corner wardrobe", "corner closet", "corner armoire", "l shaped wardrobe", "l shaped closet", "corner wardrobe unit"]],
["cornercab", ["corner cabinet", "corner base cabinet", "corner wall cabinet", "corner cupboard", "corner base unit", "corner wall unit", "corner kitchen cabinet", "corner kitchen unit", "blind corner", "blind corner cabinet", "lazy susan", "lazy susan cabinet", "carousel unit", "carousel cabinet"]],
+ ["lidbox", ["storage bench", "storage chest", "storage table", "storage ottoman", "storage footstool", "footstool with storage", "pouffe with storage", "pouf with storage", "storage pouffe", "storage pouf", "storage stool", "blanket box", "toy box", "toy chest", "bench with lid", "hope chest"]],
["divider", ["room divider", "room dividers", "folding screen", "privacy screen", "partition screen", "room screen"]],
["changing", ["changing table", "changing unit", "baby changing table", "changing station", "diaper changing table", "nappy changing table"]],
["clothesrack", ["clothes rack", "clothes rail", "clothing rack", "clothing rail", "garment rack", "garment rail", "coat rack", "coat stand"]],
@@ -78,7 +79,7 @@ const CATEGORY_WORDS: [Kind, string[]][] = [
];
const KIND_WORDS = new Map(CATEGORY_WORDS);
// rows, sections, and kinds drawn later than a family's other pieces, which only come first when asked for
-const LESSER = new Set<Kind>(["bookrow", "cabrow", "section", "sinkcab", "appliance", "washstand", "shoerack", "clothesrack", "changing", "divider", "backbench", "junior", "lounge", "highchair", "cornercab", "cornerrobe", "usofa", "lounger", "swivel", "conference", "cornerdesk", "conftable"]);
+const LESSER = new Set<Kind>(["bookrow", "cabrow", "section", "sinkcab", "appliance", "washstand", "shoerack", "clothesrack", "changing", "divider", "backbench", "junior", "lounge", "highchair", "cornercab", "cornerrobe", "usofa", "lounger", "swivel", "conference", "cornerdesk", "conftable", "lidbox"]);
export function kindOf(q: string): Kind | null {
const f = " " + fold(q) + " ";
diff --git a/src/lib/types.ts b/src/lib/types.ts
index c6ad64b..d9d7d72 100644
--- a/src/lib/types.ts
+++ b/src/lib/types.ts
@@ -72,6 +72,7 @@ export interface CabinetParams {
slides?: number; // sliding doors: how many, running in two tracks
fit?: FitParams; // built around a basin, a sink or an appliance that is fitted afterwards
corner?: CornerCab; // a kitchen corner cabinet
+ lid?: { soft?: boolean }; // a box with a lid on hinges instead (storage benches); a padded lid on a footstool
}
/**