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 changing tables

Youssef0980a7cb5766
diff --git a/scripts/ikea/build.ts b/scripts/ikea/build.ts
index b04ba42..55343cc 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"]);
+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"]);
function baseMatch(name: string, draw: Draw): CatalogEntry | undefined {
const fam = fold(name);
diff --git a/scripts/ikea/classify.ts b/scripts/ikea/classify.ts
index c02ae33..40b866e 100644
--- a/scripts/ikea/classify.ts
+++ b/scripts/ikea/classify.ts
@@ -73,7 +73,7 @@ export function measure(s: string): Size | null {
return { n: parts.map((p) => Number(p.split("/")[0])), ext: parts.some((p) => p.includes("/")), text: parts.join(" × ") + " cm" };
}
-const UPRIGHT = new Set<Kind>(["cube", "bookcase", "open", "chest", "nightstand", "wardrobe", "cabinet", "sideboard", "tv", "shoe", "wallcab", "wallshelf", "kitchen", "mixed", "sliding", "slidecab", "washstand", "sinkcab", "appliance", "shoerack", "clothesrack"]);
+const UPRIGHT = new Set<Kind>(["cube", "bookcase", "open", "chest", "nightstand", "wardrobe", "cabinet", "sideboard", "tv", "shoe", "wallcab", "wallshelf", "kitchen", "mixed", "sliding", "slidecab", "washstand", "sinkcab", "appliance", "shoerack", "clothesrack", "changing"]);
const FLAT = new Set<Kind>(["desk", "coffee", "side", "dining", "bar", "console", "kidstable", "trolley", "bench"]);
/** Office chairs IKEA sells with armrests although the type doesn't say so. */
@@ -276,6 +276,9 @@ const RULES: Rule[] = [
[/^(tv bench|tv bench with (\d )?doors|tv unit|tv storage unit)$/, (m, c) =>
c.f.name === "KALLAX" ? "cube shelf with door inserts" : { kind: "tv", x: m[0] === "tv bench" && /^(BESTÅ|LACK)$/.test(c.f.name) ? { doors: 0 } : {} }],
[/^(shoe rack|open shoe storage unit)$/, () => ({ kind: "shoerack" })],
+ // changing tables: a chest of drawers or an open frame with shelves, and a changing top on it
+ [/^changing table(?: with drawers|\/chest of drawers|\/bookshelf|\/desk)?$/, (m, c) =>
+ c.f.spr ? "changing table sold as a combination" : { kind: "changing", x: /drawers/.test(m[0]) ? { rows: 3 } : { shelves: /desk/.test(m[0]) ? 1 : 2 } }],
// freestanding clothes racks: two uprights on feet, a rail across the top, a shoe shelf or a lower rail
[/^(clothes rack|clothes rack with shoe storage|coat rack with shoe storage unit)$/, (m) => ({ kind: "clothesrack", x: /shoe/.test(m[1]) ? { shelf: true } : {} })],
[/^(shoe cabinet|shoe cabinet\/storage|shoe cabinet with (\d) compartments)$/, (m) => ({ kind: "shoe", x: m[2] ? { c: Number(m[2]) } : {} })],
@@ -398,6 +401,8 @@ export function classify(f: Fact, hints: Hints): Verdict {
else if (kind === "clothesrack" && RACK_SIZE[family]) set(...RACK_SIZE[family]);
else return { skip: "no size given" };
if (kind === "clothesrack" && h < 100) return { skip: "clothes rack measured in a way we can't read" };
+ // a changing table is wider than it's deep, whichever way round IKEA writes it
+ if (kind === "changing" && d > w) [w, d] = [d, w];
if (guessed.d && hint?.kind === kind && Math.abs(hint.w - w) < 60) d = hint.d;
// a cabinet with drawers is as deep as the family's cabinet
const twin = kind === "mixed" || kind === "slidecab" ? "cabinet" : kind === "sliding" ? "wardrobe" : undefined;
diff --git a/scripts/ikea/slugs.json b/scripts/ikea/slugs.json
index fc67b9d..5adbb13 100644
--- a/scripts/ikea/slugs.json
+++ b/scripts/ikea/slugs.json
@@ -15,6 +15,7 @@
"ÅLHULT|Extendable table, 120/170 × 80 cm": "alhult-extendable-table-120-170-x-80",
"ÅLHULT|Extendable table, 170/220 × 80 cm": "alhult-extendable-table-170-220-x-80",
"ÅLHULT|Table, 120 × 80 cm": "alhult-table-120-x-80",
+ "ÄLSKVÄRD|Changing table/chest of drawers, 94 × 77 × 106 cm": "alskvard-changing-table-chest-drawers-94-x-77-x",
"ÄLSKVÄRD|Cot, 70 × 140 cm": "alskvard-cot-70-x-140",
"ÄLVDALEN|3-seat sofa-bed": "alvdalen-3-seat-sofa-bed",
"ÄLVDALEN|3-seat sofa-bed with chaise longue": "alvdalen-3-seat-sofa-bed-chaise-longue",
@@ -295,6 +296,7 @@
"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|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",
"GULLVALLA|2-seat sofa": "gullvalla-2-seat-sofa",
"GULLVALLA|3-seat sofa": "gullvalla-3-seat-sofa",
@@ -762,6 +764,7 @@
"MUSKAN|Bench, 58 × 38 cm": "muskan-bench-58-x-38",
"MUSKAN|Shelving unit, 37 × 140 cm": "muskan-shelving-unit-37-x-140",
"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",
"NACKANÄS|Table, 140 × 76 cm": "nackanas-table-140-x-76",
"NÄMMARÖ|2-seat sofa, 126 cm": "nammaro-2-seat-sofa-126",
@@ -1004,6 +1007,7 @@
"SLATORP|4-seat sofa with chaise longues": "slatorp-4-seat-sofa-chaise-longues",
"SLATTUM|Upholstered bed frame, Standard Double, 135 × 190 cm": "slattum-upholstered-bed-frame-standard-double-13",
"SLATTUM|Upholstered bed frame, Standard Single, 90 × 190 cm": "slattum-upholstered-bed-frame-standard-single-90",
+ "SMÅGÖRA|Changing table/bookshelf, 60 × 81 × 103 cm": "smagora-changing-table-bookshelf-60-x-81-x-103",
"SMÅGÖRA|Cot, 70 × 140 cm": "smagora-cot-70-x-140",
"SMÅGÖRA|Desk, 93 × 51 cm": "smagora-desk-93-x-51",
"SMÅGÖRA|Shelf unit, 29 × 88 cm": "smagora-shelf-unit-29-x-88",
@@ -1018,6 +1022,7 @@
"SMÅSTAD / PLATSA|Wardrobe, 60 × 57 × 123 cm": "smastad-platsa-wardrobe-60-x-57-x-123",
"SMÅSTAD / PLATSA|Wardrobe, 60 × 57 × 181 cm": "smastad-platsa-wardrobe-60-x-57-x-181",
"SMÅSTAD|Bench, 90 × 50 × 48 cm": "smastad-bench-90-x-50-x-48",
+ "SMÅSTAD|Changing table/desk, 90 × 79 × 100 cm": "smastad-changing-table-desk-90-x-79-x-100",
"SMÅSTAD|Desk, 90 × 79 × 100 cm": "smastad-desk-90-x-79-x-100",
"SMÅSTAD|Wall cabinet, 60 × 32 × 60 cm": "smastad-wall-cabinet-60-x-32-x-60",
"SMÅSTAD|Wardrobe, 60 × 42 × 181 cm": "smastad-wardrobe-60-x-42-x-181",
@@ -1028,6 +1033,7 @@
"SMYGA|Bed frame, 90 × 200 cm": "smyga-bed-frame-90-x-200",
"SMYGA|Desk, 122 × 60 cm": "smyga-desk-122-x-60",
"SNIGLAR|Bed frame with slatted bed base, 70 × 160 cm": "sniglar-bed-frame-slatted-bed-base-70-x-160",
+ "SNIGLAR|Changing table, 53 × 72 × 87 cm": "sniglar-changing-table-53-x-72-x-87",
"SNIGLAR|Cot, 60 × 120 cm": "sniglar-cot-60-x-120",
"SÖDERHAMN|1-seat section": "soderhamn-1-seat-section",
"SÖDERHAMN|2-seat sofa": "soderhamn-2-seat-sofa",
@@ -1090,6 +1096,7 @@
"SUNDSÖ|Folding chair": "sundso-folding-chair",
"SUNDSÖ|Table, 65 × 65 cm": "sundso-table-65-x-65",
"SUNDSÖ|Table, 65 cm": "sundso-table-65",
+ "SUNDVIK|Changing table/chest of drawers, 78 × 79 × 99 cm": "sundvik-changing-table-chest-drawers-78-x-79-x-9",
"SUNDVIK|Children's chair": "sundvik-children-s-chair",
"SUNDVIK|Children's table, 76 × 50 cm": "sundvik-children-s-table-76-x-50",
"SUNDVIK|Cot, 70 × 140 cm": "sundvik-cot-70-x-140",
diff --git a/src/data/ikea-items.ts b/src/data/ikea-items.ts
index 1b4ae9a..e283fc9 100644
--- a/src/data/ikea-items.ts
+++ b/src/data/ikea-items.ts
@@ -17,6 +17,7 @@ alhult-chair|50600801 40600774
alhult-extendable-table-120-170-x-80|60597921 20600789
alhult-extendable-table-170-220-x-80|50600783 40597922
alhult-table-120-x-80|40600793 00597919
+alskvard-changing-table-chest-drawers-94-x-77-x|80466679
alskvard-cot-70-x-140|40466704
alvdalen-3-seat-sofa-bed|10530650 10530645
alvdalen-3-seat-sofa-bed-chaise-longue|70530666 70530671
@@ -320,6 +321,7 @@ 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-wardrobe-128-x-64-x-201|00609903 80609904
+gulliver-changing-table-82-x-54-x-93|20307037
gulliver-cot-60-x-120|20589503 10248519
gullvalla-2-seat-sofa|80618507 20618510
gullvalla-3-seat-sofa|60618513 50618504
@@ -832,6 +834,7 @@ mullsjo-swivel-chair|70576584
muskan-bench-58-x-38|50345957
muskan-shelving-unit-37-x-140|50424327
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
nackanas-table-140-x-76|40511056
nammaro-2-seat-sofa-126|59610240 39611170 19579307 49607511 09621509 09575423
@@ -1082,12 +1085,14 @@ slatorp-3-seat-sofa-chaise-longue|59577580 79577598 39577576
slatorp-4-seat-sofa-chaise-longues|59577603
slattum-upholstered-bed-frame-standard-double-13|50571257 30571258
slattum-upholstered-bed-frame-standard-single-90|90578737
+smagora-changing-table-bookshelf-60-x-81-x-103|10597952
smagora-cot-70-x-140|20461236
smagora-desk-93-x-51|90489883
smagora-shelf-unit-29-x-88|30465489
smagora-wardrobe-80-x-50-x-187|10460888
smallen-swivel-chair|00503435
smastad-bench-90-x-50-x-48|80433542
+smastad-changing-table-desk-90-x-79-x-100|60594946
smastad-desk-90-x-79-x-100|29583224 59583227 99583193 69583217
smastad-platsa-bookcase-60-x-57-x-123|49387806 09396346 69544669 29544671
smastad-platsa-bookcase-60-x-57-x-181|19388039 09396426 69483265 79542641 19542644 79483298
@@ -1106,6 +1111,7 @@ smyga-bed-frame-90-x-200|60480780
smyga-bed-frame-storage-90-x-200|59444142
smyga-desk-122-x-60|40480781
sniglar-bed-frame-slatted-bed-base-70-x-160|19185433
+sniglar-changing-table-53-x-72-x-87|20045205
sniglar-cot-60-x-120|30248537
soderhamn-1-seat-section|69305664 39449640 09621590 49621593 79621596 79452051 69621587
soderhamn-2-seat-sofa|29305755
@@ -1173,6 +1179,7 @@ sundso-cabinet-60-x-35-x-86|80586243 70584188 10584186
sundso-folding-chair|50575887 40575883 90575890 10575889 30575888 90575885 70575891
sundso-table-65|80575895 40575897
sundso-table-65-x-65|60582585 10582583 90575507 50582581 80575560 30582577 90582579
+sundvik-changing-table-chest-drawers-78-x-79-x-9|30591299
sundvik-children-s-chair|70628314 60196358 10494020
sundvik-children-s-table-76-x-50|20628316 10201673
sundvik-cot-70-x-140|60497587
diff --git a/src/data/ikea-rows.ts b/src/data/ikea-rows.ts
index 9b80c0c..7cb09d3 100644
--- a/src/data/ikea-rows.ts
+++ b/src/data/ikea-rows.ts
@@ -16,6 +16,7 @@ ALEX|open|Storage unit, 36 × 70 cm|36|70|35
ÅLHULT|dining|Extendable table, 120/170 × 80 cm|120|74|80
ÅLHULT|dining|Table, 120 × 80 cm|120|74|80
ÅLHULT|dining|Extendable table, 170/220 × 80 cm|170|74|80
+ÄLSKVÄRD|changing|Changing table/chest of drawers, 94 × 77 × 106 cm|94|106|77|rows=3|kids children
ÄLSKVÄRD|cot|Cot, 70 × 140 cm|150|86|78|m=70,l=140
ÄLVDALEN|chaise|3-seat sofa-bed with chaise longue|226|85|160|seats=3,arms=wide,chaise=right,sd=92
ÄLVDALEN|sofa|3-seat sofa-bed|230|85|92|seats=3
@@ -296,6 +297,7 @@ 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
GULLABERG|shoe|Shoe cabinet with 4 compartments, 105 × 22 × 107 cm|105|107|22|c=4
GULLABERG|wardrobe|Wardrobe, 128 × 64 × 201 cm|128|201|64
+GULLIVER|changing|Changing table, 82 × 54 × 93 cm|82|93|54|shelves=2|kids children
GULLIVER|cot|Cot, 60 × 120 cm|130|82|68|m=60,l=120
GULLVALLA|sofa|2-seat sofa|170|85|92|seats=2
GULLVALLA|sofa|3-seat sofa|230|85|92|seats=3
@@ -763,6 +765,7 @@ MULLSJÖ|office|Swivel chair|60|105|64|arms=none
MUSKAN|bench|Bench, 58 × 38 cm|58|45|38
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
MYLLRA|cot|Cot with drawer, 70 × 140 cm|150|86|78|m=70,l=140,drawer=1
NACKANÄS|dining|Table, 140 × 76 cm|140|74|76
NÄMMARÖ|bar|Bar table, outdoor, 120 × 40 cm|120|105|40||outdoor garden
@@ -1005,12 +1008,14 @@ SLATORP|sofa|2-seat sofa|170|85|92|seats=2
SLATORP|sofa|3-seat sofa|230|85|92|seats=3
SLATTUM|bed|Upholstered bed frame, Standard Single, 90 × 190 cm|106|85|199|m=90,l=190,f=30
SLATTUM|bed|Upholstered bed frame, Standard Double, 135 × 190 cm|151|85|199|m=135,l=190,f=30
+SMÅGÖRA|changing|Changing table/bookshelf, 60 × 81 × 103 cm|81|103|60|shelves=2|kids children
SMÅGÖRA|cot|Cot, 70 × 140 cm|150|86|78|m=70,l=140
SMÅGÖRA|desk|Desk, 93 × 51 cm|93|74|51||kids children
SMÅGÖRA|open|Shelf unit, 29 × 88 cm|29|88|35||kids children
SMÅGÖRA|wardrobe|Wardrobe, 80 × 50 × 187 cm|80|187|50
SMÄLLEN|office|Swivel chair|60|105|64|arms=none
SMÅSTAD|bench|Bench, 90 × 50 × 48 cm|90|48|50||kids children
+SMÅSTAD|changing|Changing table/desk, 90 × 79 × 100 cm|90|100|79|shelves=1|kids children
SMÅSTAD|desk|Desk, 90 × 79 × 100 cm|90|100|79||kids children
SMÅSTAD|wallcab|Wall cabinet, 60 × 32 × 60 cm|60|60|32||kids children
SMÅSTAD|wardrobe|Wardrobe, 60 × 42 × 181 cm|60|181|42||kids children
@@ -1029,6 +1034,7 @@ SMYGA|bed|Bed frame with storage, 90 × 200 cm|106|100|209|m=90
SMYGA|bed|Bed frame, 90 × 200 cm|106|100|209|m=90
SMYGA|desk|Desk, 122 × 60 cm|122|74|60||kids children
SNIGLAR|bed|Bed frame with slatted bed base, 70 × 160 cm|86|64|169|m=70,l=160,f=50
+SNIGLAR|changing|Changing table, 53 × 72 × 87 cm|72|87|53|shelves=2|kids children
SNIGLAR|cot|Cot, 60 × 120 cm|130|82|68|m=60,l=120
SÖDERHAMN|chaise|4-seat sofa with chaise longue|259|69|167|seats=4,arms=slim,chaise=right,sd=99
SÖDERHAMN|corner|Corner sofa, 4-seat|228|69|168|seats=4,arms=slim,corner=left,sd=99
@@ -1092,6 +1098,7 @@ SUNDSÖ|chair|Folding chair|44|88|50||outdoor garden
SUNDSÖ|dining|Table, 65 × 65 cm|65|74|65||outdoor garden
SUNDSÖ|dining|Table, 65 cm|65|74|65|round=1|outdoor garden
SUNDVIK|armchair|Rocking-chair|75|90|80
+SUNDVIK|changing|Changing table/chest of drawers, 78 × 79 × 99 cm|79|99|78|rows=3|kids children
SUNDVIK|cot|Cot, 70 × 140 cm|150|86|78|m=70,l=140
SUNDVIK|kidschair|Children's chair|34|60|34||kids
SUNDVIK|kidstable|Children's table, 76 × 50 cm|76|48|50||kids
diff --git a/src/lib/plan/changing.ts b/src/lib/plan/changing.ts
new file mode 100644
index 0000000..6fa6946
--- /dev/null
+++ b/src/lib/plan/changing.ts
@@ -0,0 +1,56 @@
+import type { PartPiece, ProductSpec, Vec3 } from "../types";
+import { HW, PlanBuilder, type FitOpts } from "./builder";
+import { anchorStep } from "./frame";
+
+const RIM = 100; // mm: the changing top's raised edge at the back and sides
+
+/**
+ * Changing tables: a chest of drawers or an open shelf unit, built exactly as one, with a changing top on it:
+ * a board with a raised edge at the back and the sides. A chest is shallower than its top, which lines up at the back
+ * and reaches out over the front. The top goes on last, once the unit stands fixed to the wall.
+ */
+export function buildChanging(b: PlanBuilder, s: ProductSpec, unit: (b: PlanBuilder, s: ProductSpec) => void) {
+ const chest = !!s.drawers;
+ const W = s.size.w * 10, D = s.size.d * 10;
+ const Du = chest ? Math.min(D, 520) : D;
+ const Hu = s.size.h * 10 - RIM;
+ const inner: ProductSpec = chest
+ ? { ...s, size: { w: s.size.w, h: Hu / 10, d: Du / 10 }, drawers: { ...s.drawers, changing: undefined } }
+ : { ...s, size: { w: s.size.w, h: Hu / 10, d: Du / 10 }, shelf: { ...s.shelf, changing: undefined } };
+ unit(b, inner);
+ // a changing table is always fixed to the wall, however low it is
+ if (b.steps[b.steps.length - 1]?.kind !== "anchor") {
+ const topType = b.parts.find((p) => p.name === "Top panel");
+ const topItem = b.items.find((it) => it.kind === "part" && it.ref === topType?.id);
+ if (topItem) anchorStep(b, { W, D: Du, top: topItem.key, y: Hu, backZ: -Du / 2, severe: true });
+ }
+
+ const floor = 18, wall = 18, lip = 30;
+ const pieces: PartPiece[] = [
+ { shape: "box", size: [W, floor, D], pos: [0, floor / 2, 0] },
+ { shape: "box", size: [W, RIM, wall], pos: [0, RIM / 2, -D / 2 + wall / 2] },
+ { shape: "box", size: [wall, RIM, D - wall], pos: [-W / 2 + wall / 2, RIM / 2, wall / 2] },
+ { shape: "box", size: [wall, RIM, D - wall], pos: [W / 2 - wall / 2, RIM / 2, wall / 2] },
+ { shape: "box", size: [W - 2 * wall, lip, wall], pos: [0, lip / 2, D / 2 - wall / 2] },
+ ];
+ const c = b.compound("Changing top", pieces);
+ // the backs line up
+ const z0 = -Du / 2 + D / 2;
+ const top = b.place(c.type, [c.mid[0], Hu + c.mid[1], z0 + c.mid[2]]);
+ b.step(
+ {
+ title: "Screw on the changing top",
+ detail: "Raised edges at the back and the sides. Screw it down into the top, so it can't slide. Never leave a baby on it alone.",
+ tools: ["screwdriver"],
+ kind: "screws",
+ people: W > 900 ? 2 : 1,
+ },
+ () => {
+ b.add(top, [0, 300, 0]);
+ b.then(0.15);
+ const list: FitOpts[] = [];
+ for (const x of [-W / 2 + 80, W / 2 - 80]) for (const z of [-Du / 2 + 60, Du / 2 - 60]) list.push({ on: top, at: [x, Hu + floor, z] as Vec3, dir: [0, -1, 0] as Vec3, hole: false });
+ b.fits(HW.screwM, list, 0.1);
+ },
+ );
+}
diff --git a/src/lib/plan/drawers.ts b/src/lib/plan/drawers.ts
index a8fc685..ef66775 100644
--- a/src/lib/plan/drawers.ts
+++ b/src/lib/plan/drawers.ts
@@ -2,6 +2,7 @@ import type { DrawersParams, ProductSpec } from "../types";
import { HW, PlanBuilder, type FitOpts } from "./builder";
import { FrameKit } from "./frame";
import { clamp } from "./math";
+import { buildChanging } from "./changing";
export function defaultsDrawers(s: ProductSpec): DrawersParams {
const p = s.drawers ?? {};
@@ -15,6 +16,7 @@ export function defaultsDrawers(s: ProductSpec): DrawersParams {
}
export function buildDrawers(b: PlanBuilder, s: ProductSpec) {
+ if (s.drawers?.changing) return buildChanging(b, s, buildDrawers);
const p = defaultsDrawers(s);
const W = s.size.w * 10, H = s.size.h * 10, D = s.size.d * 10;
const t = p.thickness;
diff --git a/src/lib/plan/shelf.ts b/src/lib/plan/shelf.ts
index e14b05e..49d8abb 100644
--- a/src/lib/plan/shelf.ts
+++ b/src/lib/plan/shelf.ts
@@ -2,6 +2,7 @@ import type { PartPiece, ProductSpec, ShelfParams, Vec3 } from "../types";
import { HW, PlanBuilder, type FitOpts } from "./builder";
import { FrameKit, anchorStep } from "./frame";
import { clamp } from "./math";
+import { buildChanging } from "./changing";
import { buildRack } from "./rack";
export function defaultsShelf(s: ProductSpec): ShelfParams {
@@ -21,6 +22,7 @@ export function defaultsShelf(s: ProductSpec): ShelfParams {
}
export function buildShelf(b: PlanBuilder, s: ProductSpec) {
+ if (s.shelf?.changing) return buildChanging(b, s, buildShelf);
if (s.shelf?.style === "rack") return buildRack(b, s);
const p = defaultsShelf(s);
if (p.style === "grid") return s.shelf?.underframe ? onUnderframe(b, s, p) : s.shelf?.inserts ? withInserts(b, s, p) : grid(b, s, p);
diff --git a/src/lib/products.ts b/src/lib/products.ts
index 7b9c28d..12a083e 100644
--- a/src/lib/products.ts
+++ b/src/lib/products.ts
@@ -54,7 +54,8 @@ export type Kind =
| "sinkcab"
| "appliance"
| "shoerack"
- | "clothesrack";
+ | "clothesrack"
+ | "changing";
export type X = {
rows?: number;
@@ -269,7 +270,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,
+ 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,
};
const CATEGORY: Record<Kind, string> = {
@@ -278,7 +279,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",
+ 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",
};
export const KIND_ARCH: Record<Kind, Archetype> = {
@@ -286,7 +287,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",
+ 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",
};
const round = (x: X) => (x.round ? { round: true } : {});
@@ -382,6 +383,14 @@ export function specFor(kind: Kind, name: string, variant: string, w: number, h:
return { ...base, shelf: { style: "bookcase", shelves: x.shelves ?? Math.max(1, Math.round(h / 45) - 1), fixedShelf: h > 150, back: true, plinth: h > 100, outer: 16 } };
case "open":
return { ...base, difficulty: 1, shelf: { style: "bookcase", shelves: x.shelves ?? Math.max(1, Math.round(h / 45) - 1), fixedShelf: h > 150, back: false, plinth: false, outer: 18 } };
+ case "changing": {
+ // x.rows: a chest of that many drawers under the changing top; otherwise an open frame with x.shelves
+ if (x.rows) {
+ const rows = x.rows;
+ return { ...base, minutes: x.min ?? 45 + 20 * rows, people: 2, difficulty: 3, drawers: { cols: 1, rows, knobs: x.knobs ?? "knob", plinth: false, thickness: 16, changing: true } };
+ }
+ return { ...base, archetype: "shelf", minutes: x.min ?? MIN.changing, difficulty: 2, shelf: { style: "bookcase", shelves: x.shelves ?? 2, fixedShelf: false, back: false, plinth: false, outer: 18, changing: true } };
+ }
case "clothesrack":
// x.shelf: a shoe shelf low down instead of a lower rail
return { ...base, difficulty: 1, people: 1, shelf: { style: "rack", ...(x.shelf ? { shoes: true } : {}) } };
@@ -531,5 +540,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],
+ 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],
};
diff --git a/src/lib/search.ts b/src/lib/search.ts
index 56a5a31..c669719 100644
--- a/src/lib/search.ts
+++ b/src/lib/search.ts
@@ -21,6 +21,7 @@ const CATEGORY_WORDS: [Kind, string[]][] = [
["washstand", ["wash stand", "washstand", "vanity", "vanity unit", "bathroom vanity", "basin unit", "basin cabinet", "wash basin cabinet", "washbasin cabinet", "bathroom cabinet", "sink vanity"]],
["sinkcab", ["sink cabinet", "sink base", "sink base cabinet", "sink unit", "kitchen sink cabinet", "under sink cabinet", "cabinet for sink", "sink cupboard"]],
["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"]],
+ ["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"]],
["shoerack", ["shoe rack", "shoe shelf", "shoe stand", "shoe bench", "open shoe storage"]],
["shoe", ["shoe", "shoes", "shoe cabinet", "shoe rack"]],
diff --git a/src/lib/types.ts b/src/lib/types.ts
index af4dcef..8bcf487 100644
--- a/src/lib/types.ts
+++ b/src/lib/types.ts
@@ -16,6 +16,7 @@ export interface ShelfParams {
underframe?: number; // cm: a cube grid standing on an underframe this tall (size.h takes it in)
inserts?: number; // a cube grid sold with this many inserts with a door, from the bottom row up
shoes?: boolean; // a rack with a shoe shelf low down instead of a lower rail
+ changing?: boolean; // a changing table: a changing top goes on last (size.h takes it in)
}
export interface DrawersParams {
@@ -24,6 +25,7 @@ export interface DrawersParams {
knobs: "none" | "knob" | "bar";
plinth: boolean;
thickness: number;
+ changing?: boolean; // a changing table: a changing top goes on last (size.h and size.d take it in)
}
export interface TableParams {