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

Join sofa sections underneath with connector strips

Yousseffb02b9fd5f37
diff --git a/src/components/art/Hardware.tsx b/src/components/art/Hardware.tsx
index 111b089..24f9771 100644
--- a/src/components/art/Hardware.tsx
+++ b/src/components/art/Hardware.tsx
@@ -265,6 +265,21 @@ function draw(kind: HwKind, len: number, dia: number): Drawn {
</g>
),
};
+ case "connector":
+ // a flat strip with a screw hole at each end
+ return {
+ w: len,
+ h: dia,
+ scalable: true,
+ node: (
+ <g>
+ <rect x={0} y={-dia / 2} width={len} height={dia} rx={3} fill={METAL} {...stroke} />
+ {[len / 4, (3 * len) / 4].map((x) => (
+ <circle key={x} cx={x} cy={0} r={2.6} fill="#fff" {...stroke} />
+ ))}
+ </g>
+ ),
+ };
case "gasLift":
// lying down: the narrow end that drops into the base on the left, the rod for the seat on the right
return {
diff --git a/src/engine/drawable.ts b/src/engine/drawable.ts
index cf7198e..22b88f6 100644
--- a/src/engine/drawable.ts
+++ b/src/engine/drawable.ts
@@ -259,6 +259,10 @@ export function hwDrawable(kind: HwKind, len: number, dia: number) {
addSolid(d, `ca:wheel:${dia}`, () => new THREE.CylinderGeometry(r, r, dia * 0.26, 24).rotateZ(Math.PI / 2), plastic, { hull: "radial", position: [x * dia * 0.21, len - r, -dia * 0.16] });
break;
}
+ case "connector":
+ // a flat strip screwed across the joint between two sofa sections
+ addSolid(d, `cn:${len}:${dia}`, () => new THREE.BoxGeometry(len, 2, dia), metal, { position: [0, 1, 0] });
+ break;
case "gasLift": {
// the narrow end drops into the base; the rod at the top goes up into the seat
addSolid(d, "gl:foot", cyl(14, 60, 18), metal, { hull: "cyl", position: [0, -30, 0] });
diff --git a/src/lib/plan/builder.ts b/src/lib/plan/builder.ts
index 66e5694..5f23881 100644
--- a/src/lib/plan/builder.ts
+++ b/src/lib/plan/builder.ts
@@ -50,6 +50,7 @@ export const HW = {
plug: { kind: "plug", len: 35, dia: 8, notIncluded: true },
castor: { kind: "castor", len: 58, dia: 50 },
gasLift: { kind: "gasLift", len: 200, dia: 50 },
+ connector: { kind: "connector", len: 120, dia: 30 },
} satisfies Record<string, HwDef>;
const HW_NAMES: Record<HwKind, string> = {
@@ -71,6 +72,7 @@ const HW_NAMES: Record<HwKind, string> = {
plug: "Wall plug",
castor: "Castor",
gasLift: "Gas lift",
+ connector: "Connector",
};
export function hwSpecText(kind: HwKind, len: number, dia: number) {
diff --git a/src/lib/plan/corner.ts b/src/lib/plan/corner.ts
index 487f7e2..4456bea 100644
--- a/src/lib/plan/corner.ts
+++ b/src/lib/plan/corner.ts
@@ -216,24 +216,14 @@ export function buildCornerSofa(b: PlanBuilder, s: ProductSpec) {
}
},
);
- b.step(
- {
- title: "Turn them over together",
- detail: "Lift them by the frame, never by the legs.",
- pose: "+y",
- kind: "flip",
- people: 2,
- warnings: ["two"],
- },
- () => {},
- );
-
+ // still upside down: push the sections together and screw a connector across each joint underneath
const sliders = secs.filter((x) => x.slide);
b.step(
{
title: corner ? (sliders.length > 1 ? "Join the sections to the corner" : "Join the section to the corner") : sliders.length > 1 ? "Join the chaise longues to the sofa" : "Join the chaise longue to the sofa",
- detail: "Push them together, then bolt them through the frames.",
- tools: ["allen"],
+ detail: "Push them together, then screw a connector across each joint.",
+ tools: ["screwdriver"],
+ pose: "-y",
people: 2,
kind: "join",
warnings: ["two"],
@@ -246,22 +236,41 @@ export function buildCornerSofa(b: PlanBuilder, s: ProductSpec) {
b.stagger(0);
}
b.then(0.1);
- const bolts: FitOpts[] = [];
+ const plates: FitOpts[] = [];
+ const screws: FitOpts[] = [];
+ const half = HW.connector.len / 4;
for (const sec of sliders) {
const fixed = corner ? secs[1] : secs.find((x) => !x.slide);
if (!fixed) continue;
- const y = legH + 90;
- if (sec.along === "z") {
- // the return meets the corner along its back edge
- for (const f of [0.3, 0.7]) bolts.push({ on: sec.frame, at: [X(sec.x0 + (sec.x1 - sec.x0) * f), y, sec.z0], dir: [0, 0, 1], mate: fixed.frame });
- } else {
- const right = sec.x0 >= fixed.x1 - 1;
- const jx = right ? sec.x0 : sec.x1;
- for (const f of [0.3, 0.7]) bolts.push({ on: sec.frame, at: [X(jx), y, back + sd * f], dir: [X(right ? 1 : -1), 0, 0], mate: fixed.frame });
+ for (const f of [0.3, 0.7]) {
+ if (sec.along === "z") {
+ // the return meets the corner along its back edge: the connector runs front to back
+ const x = X(sec.x0 + (sec.x1 - sec.x0) * f);
+ plates.push({ on: sec.frame, at: [x, legH, sec.z0], dir: [0, 1, 0], twist: Math.PI / 2, hole: false });
+ for (const dz of [-half, half]) screws.push({ on: sec.frame, at: [x, legH - 2, sec.z0 + dz], dir: [0, 1, 0], hole: false });
+ } else {
+ const jx = X(sec.x0 >= fixed.x1 - 1 ? sec.x0 : sec.x1);
+ const z = back + sd * f;
+ plates.push({ on: sec.frame, at: [jx, legH, z], dir: [0, 1, 0], hole: false });
+ for (const dx of [-half, half]) screws.push({ on: sec.frame, at: [jx + dx, legH - 2, z], dir: [0, 1, 0], hole: false });
+ }
}
}
- b.fits(HW.boltL, bolts, 0.1);
+ b.fits(HW.connector, plates, 0.12);
+ b.then(0.1);
+ b.fits(HW.screwM, screws, 0.06);
+ },
+ );
+ b.step(
+ {
+ title: "Turn it over together",
+ detail: "Lift it by the frame, never by the legs.",
+ pose: "+y",
+ kind: "flip",
+ people: 2,
+ warnings: ["two"],
},
+ () => {},
);
if (armKeys.length) {
diff --git a/src/lib/types.ts b/src/lib/types.ts
index fac22ca..ffdb0dc 100644
--- a/src/lib/types.ts
+++ b/src/lib/types.ts
@@ -195,7 +195,8 @@ export type HwKind =
| "glide"
| "plug"
| "castor"
- | "gasLift";
+ | "gasLift"
+ | "connector";
export interface HwType {
id: string;