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 PLATSA wardrobes as rows of frames

Youssef2dff1be277bf
diff --git a/scripts/ikea/classify.ts b/scripts/ikea/classify.ts
index 01d1dcb..d3cda7e 100644
--- a/scripts/ikea/classify.ts
+++ b/scripts/ikea/classify.ts
@@ -286,6 +286,16 @@ const RULES: Rule[] = [
[/^(drawer unit|drawer unit on castors|chest of drawers|dresser)$/, () => ({ kind: "chest" })],
[/^(bedside table|nightstand|bedside table with (\d) drawers?)$/, (m) => ({ kind: "nightstand", x: m[2] ? { rows: Number(m[2]) } : {} })],
[/^(wardrobe frame|open wardrobe|open clothes hanging unit)$/, () => ({ kind: "wardrobe", x: { doors: 0 } })],
+ // PLATSA wardrobes are a row of identical frames: one or two doors on each, as many frames as that takes
+ [/^wardrobe w(?:ith)? (\d+) doors$/, (m, c) => {
+ const doors = Number(m[1]), w = c.sz.n[0] ?? 0;
+ if (c.f.name === "PLATSA" && c.f.spr && doors > 2) {
+ const per = doors % 2 === 0 && w / (doors / 2) >= 60 ? 2 : 1;
+ return doors / per > 4 ? "row of more than 4 wardrobe frames" : { kind: "wardrobe", x: { doors: per as 1 | 2, n: doors / per } };
+ }
+ if (/ w /.test(m[0])) return "not something we draw yet";
+ return doors > 3 ? "more than 3 doors" : { kind: "wardrobe", x: { doors: Math.min(2, doors) as 1 | 2 } };
+ }],
[/^(wardrobe|hinged wardrobe|wardrobe with (door|(\d) doors))$/, (m) => (n(m[3], 2) > 3 ? "more than 3 doors" : { kind: "wardrobe", x: m[2] ? { doors: m[2] === "door" ? 1 : (Math.min(2, Number(m[3])) as 1 | 2) } : {} })],
[/^(wall(-mounted)? cabinet|wall cabinet frame|top cabinet|mirror cabinet( with doors?)?|wall cabinet with (\d )?(glass )?doors?|wall cabinet with shelves(\/(\d )?(glass )?doors?)?|wall cab(inet)? w shelves\/(\d )?glass (drs?|doors?)|wall cabinet w shelves\/glass door)$/, (m) => withDoors("wallcab", m[0])],
[/^(base cabinet frame|base cabinet with shelves|base fr w shelves|base cabinet with (\d )?doors?|base cabinet with shelves\/(\d )?doors?|high cabinet frame|high cabinet with shelves(\/(\d )?doors?)?|high cabinet( with (\d )?doors?)?)$/, (m, c) =>
@@ -578,7 +588,8 @@ export function classify(f: Fact, hints: Hints): Verdict {
for (const k of Object.keys(x) as (keyof X)[]) if (x[k] === undefined) delete x[k];
return finish("cabrow");
}
- const unit = ROW_UNITS[family];
+ // the rule may already know how many frames there are (PLATSA)
+ const unit = x.n ? w / x.n : ROW_UNITS[family];
const n = unit ? Math.round(w / unit) : 0;
if (!unit || n < 2 || n > 4 || n * unit !== w || !["bookcase", "cabinet", "tv", "wardrobe", "wallcab"].includes(kind)) return { skip: several };
x.n = n;
diff --git a/scripts/ikea/slugs.json b/scripts/ikea/slugs.json
index 50a7b8c..71a09b5 100644
--- a/scripts/ikea/slugs.json
+++ b/scripts/ikea/slugs.json
@@ -933,9 +933,18 @@
"PLATSA|Open shelving unit, 60 × 40 × 40 cm": "platsa-open-shelving-unit-60-x-40-x-40",
"PLATSA|Open shoe storage unit, 80 × 40 × 60 cm": "platsa-open-shoe-storage-unit-80-x-40-x-60",
"PLATSA|Shoe cabinet/storage, 120 × 42 × 123 cm": "platsa-shoe-cabinet-storage-120-x-42-x-123",
+ "PLATSA|Wardrobe w 6 doors, 180 × 57 × 241 cm": "platsa-wardrobe-w-6-doors-180-x-57-x-241",
+ "PLATSA|Wardrobe w 6 doors, 240 × 57 × 221 cm": "platsa-wardrobe-w-6-doors-240-x-57-x-221",
+ "PLATSA|Wardrobe w 6 doors, 240 × 57 × 231 cm": "platsa-wardrobe-w-6-doors-240-x-57-x-231",
+ "PLATSA|Wardrobe w 6 doors, 300 × 42 × 241 cm": "platsa-wardrobe-w-6-doors-300-x-42-x-241",
"PLATSA|Wardrobe with 2 doors, 120 × 57 × 181 cm": "platsa-wardrobe-2-doors-120-x-57-x-181",
"PLATSA|Wardrobe with 2 doors, 120 × 57 × 191 cm": "platsa-wardrobe-2-doors-120-x-57-x-191",
"PLATSA|Wardrobe with 2 doors, 60 × 57 × 251 cm": "platsa-wardrobe-2-doors-60-x-57-x-251",
+ "PLATSA|Wardrobe with 3 doors, 180 × 42 × 191 cm": "platsa-wardrobe-3-doors-180-x-42-x-191",
+ "PLATSA|Wardrobe with 3 doors, 180 × 57 × 133 cm": "platsa-wardrobe-3-doors-180-x-57-x-133",
+ "PLATSA|Wardrobe with 3 doors, 180 × 57 × 181 cm": "platsa-wardrobe-3-doors-180-x-57-x-181",
+ "PLATSA|Wardrobe with 3 doors, 180 × 57 × 191 cm": "platsa-wardrobe-3-doors-180-x-57-x-191",
+ "PLATSA|Wardrobe with 4 doors, 240 × 57 × 191 cm": "platsa-wardrobe-4-doors-240-x-57-x-191",
"PLÖJKER|Bedside table, 41 × 41 × 50 cm": "plojker-bedside-table-41-x-41-x-50",
"RACKNÄS|Chest of 3 drawers, 69 × 78 cm": "racknas-chest-3-drawers-69-x-78",
"RÅDMANSÖ|Bed frame, Standard King, 150 × 200 cm": "radmanso-bed-frame-standard-king-150-x-200",
diff --git a/src/data/ikea-items.ts b/src/data/ikea-items.ts
index 7576557..820d38f 100644
--- a/src/data/ikea-items.ts
+++ b/src/data/ikea-items.ts
@@ -1010,6 +1010,15 @@ platsa-shoe-cabinet-storage-120-x-42-x-123|59615431
platsa-wardrobe-2-doors-120-x-57-x-181|69615341
platsa-wardrobe-2-doors-120-x-57-x-191|49624916
platsa-wardrobe-2-doors-60-x-57-x-251|99623735
+platsa-wardrobe-3-doors-180-x-42-x-191|69613530 69615510
+platsa-wardrobe-3-doors-180-x-57-x-133|39624969
+platsa-wardrobe-3-doors-180-x-57-x-181|19615452
+platsa-wardrobe-3-doors-180-x-57-x-191|29613527 59615520
+platsa-wardrobe-4-doors-240-x-57-x-191|69625057
+platsa-wardrobe-w-6-doors-180-x-57-x-241|79624972
+platsa-wardrobe-w-6-doors-240-x-57-x-221|09615495 29615499
+platsa-wardrobe-w-6-doors-240-x-57-x-231|99625046
+platsa-wardrobe-w-6-doors-300-x-42-x-241|69615505
plojker-bedside-table-41-x-41-x-50|30613550 80595068
poang-armchair|89627178 59627170 89502201 79627174 69502037 89502116 79429254 19627134 79627126 79627150 99627154 99627130 99625857 59627146 49627118 69627122 39627166 29627162 59501972 19502054 79502131 39502213 79429268 19429153 09429243 89617711 59625350 99625334 29625342 89625358 39625285 19625366 49625237 69625217 89501980 59501905 89625301 99240789 19502134 29502058 79625269 79625293 09625277 29625257 19625309 19618691 59625289 39625370 99625305 99625273 79625354 39625346 99625027 39625030 79625245 99625225 39625233 19625253 99625249 19625229 29412562 49598917 29598923 29551609 79551598 29551567 59551603
racknas-chest-3-drawers-69-x-78|10594524
diff --git a/src/data/ikea-rows.ts b/src/data/ikea-rows.ts
index c475fd5..780e060 100644
--- a/src/data/ikea-rows.ts
+++ b/src/data/ikea-rows.ts
@@ -927,6 +927,15 @@ PLATSA|cabinet|Frame, 60 × 55 × 60 cm|60|60|55|doors=0
PLATSA|cabinet|Frame, 60 × 55 × 120 cm|60|120|55|doors=0
PLATSA|cabinet|Frame, 60 × 55 × 180 cm|60|180|55|doors=0
PLATSA|cabinet|Frame, 80 × 40 × 180 cm|80|180|40|doors=0
+PLATSA|cabrow|Wardrobe with 3 doors, 180 × 57 × 133 cm|180|133|57|doors=1,n=3,of=wardrobe
+PLATSA|cabrow|Wardrobe with 3 doors, 180 × 57 × 181 cm|180|181|57|doors=1,n=3,of=wardrobe
+PLATSA|cabrow|Wardrobe with 3 doors, 180 × 42 × 191 cm|180|191|42|doors=1,n=3,of=wardrobe
+PLATSA|cabrow|Wardrobe with 3 doors, 180 × 57 × 191 cm|180|191|57|doors=1,n=3,of=wardrobe
+PLATSA|cabrow|Wardrobe w 6 doors, 180 × 57 × 241 cm|180|241|57|doors=2,n=3,of=wardrobe
+PLATSA|cabrow|Wardrobe with 4 doors, 240 × 57 × 191 cm|240|191|57|doors=2,n=2,of=wardrobe
+PLATSA|cabrow|Wardrobe w 6 doors, 240 × 57 × 221 cm|240|221|57|doors=2,n=3,of=wardrobe
+PLATSA|cabrow|Wardrobe w 6 doors, 240 × 57 × 231 cm|240|231|57|doors=2,n=3,of=wardrobe
+PLATSA|cabrow|Wardrobe w 6 doors, 300 × 42 × 241 cm|300|241|42|doors=2,n=3,of=wardrobe
PLATSA|nightstand|Chest of 2 drawers, 60 × 57 × 53 cm|60|53|57|rows=2
PLATSA|nightstand|Bedside table, 60 × 42 × 83 cm|60|83|42|rows=2
PLATSA|open|Open shelving unit, 60 × 40 × 40 cm|60|40|40