Single place to convert your 2D floor plans to 3d model (no LLM)
Python
Merge #4: furniture tool on the review page
23f200563931d572216145
diff --cc README.mdindex dd1f4df,39a0752..17a58fc--- a/README.md+++ b/README.md@@@ -84,8 -84,8 +84,9 @@@ python server.p| | ||---|---|| **Review before building** | Detected walls, doors, windows and rooms drawn over your PDF. Click to change or delete, draw walls, add doors and windows, set the scale |+| **Floor finish and wall paint** | Pick a room's floor (marble, wood, tiles, bathroom tiles, terracotta, concrete; Auto follows the room type) and one wall colour for the house. Saved in the plan as `room.floor` and `wall_color` (`#rrggbb`) || **Furniture on or off** | Untick **Furniture** for empty rooms |+ | **Move your furniture** | The **Furniture** tool on the review page shows each item: drag to move, turn it 90°, delete it, or add one from the list || **Time estimate** | The build box shows about how long is left, learned from earlier builds on the same machine || **Walkthrough** | W A S D and mouse on desktop, two thumbs on a phone. Starts at the entrance side of the plan || **Top view** (T) | The house from above, one storey at a time |diff --cc server.pyindex 2b500b8,4a97ca7..eb00756--- a/server.py+++ b/server.py@@@ -394,14 -435,7 +436,15 @@@ class H(BaseHTTPRequestHandler)if what == "plan":if not isinstance(req.get("floors"), list) or not req["floors"]:return self.send(400, {"error": "invalid plan"})+ # both go to Blender as material names / colours: only values it knows+ rooms = [z for f in req["floors"] if isinstance(f, dict) and isinstance(f.get("rooms"), list)+ for z in f["rooms"] if isinstance(z, dict)]+ if any("floor" in z and z["floor"] not in FINISHES for z in rooms):+ return self.send(400, {"error": "Unknown floor finish."})+ wall = req.get("wall_color")+ if "wall_color" in req and not (isinstance(wall, str) and re.fullmatch(r"#[0-9a-fA-F]{6}", wall)):+ return self.send(400, {"error": "Wall colour must look like #rrggbb."})+ check_items(req)with open(os.path.join(jdir(jid), "plan.json"), "w") as fh:json.dump(req, fh)return self.send(200, {"ok": True})diff --cc tests/test_server.pyindex c752499,969384a..aac5493--- a/tests/test_server.py+++ b/tests/test_server.py@@@ -42,18 -42,39 +42,47 @@@ tryassert call("POST", f"/api/jobs/{done}/plan", b"not json")[0] == 400assert call("POST", f"/api/jobs/{done}/plan", b'{"floors": [{"name": "G"}]}')[0] == 200assert json.load(open(os.path.join(server.jdir(done), "plan.json")))["floors"][0]["name"] == "G"+ # room finishes and wall colour reach Blender as material names and colours: only known values pass+ plan = lambda room, **kw: json.dumps({"floors": [{"rooms": [room]}], **kw}).encode()+ for bad in (plan({"floor": "lava"}), plan({"floor": ["wood"]}), plan({}, wall_color="red"), plan({}, wall_color="#12345g"),+ plan({}, wall_color="#123456\n"), plan({}, wall_color=None)):+ assert call("POST", f"/api/jobs/{done}/plan", bad)[0] == 400, bad+ assert call("POST", f"/api/jobs/{done}/plan", plan({"floor": "wood"}, wall_color="#C3cdb4"))[0] == 200+ saved = json.load(open(os.path.join(server.jdir(done), "plan.json")))+ assert saved["floors"][0]["rooms"][0]["floor"] == "wood" and saved["wall_color"] == "#C3cdb4"assert call("POST", f"/api/jobs/{done}/export")[0] == 400 # nothing built yetassert call("DELETE", f"/api/jobs/{done}")[0] == 200 and not os.path.exists(server.jdir(done))- print("ok server: hidden files, busy plans, bad bodies")+ print("ok server: hidden files, busy plans, bad bodies, room finishes")+ # furniture: the rules' list until the review page sends its own; an empty list is an empty floor+ jid = job("detected")+ assert call("GET", f"/api/jobs/{jid}/furniture")[0] == 404 # not read yet+ plan = detect.detect(os.path.join(ROOT, "examples", "sample_plan.pdf"))+ json.dump(plan, open(os.path.join(server.jdir(jid), "plan.json"), "w"))+ code, out = call("GET", f"/api/jobs/{jid}/furniture")+ out = json.loads(out)+ assert code == 200 and len(out["floors"]) == len(plan["floors"]) and "bed" in out["catalog"], out+ rules = out["floors"][0]+ assert {"bed", "kitchen_run", "wall_cab2"} <= {it["fn"] for it in rules}+ post = lambda p: call("POST", f"/api/jobs/{jid}/plan", json.dumps(p).encode())[0]+ plan["floors"][0]["items"] = rules # the rules' own items pass as they are+ assert post(plan) == 200+ plan["floors"][0]["items"] = []+ assert post(plan) == 200 and json.loads(call("GET", f"/api/jobs/{jid}/furniture")[1])["floors"][0] == []+ bed = next(it for it in rules if it["fn"] == "bed")+ for bad in (dict(bed, fn="model", args=["../../x", 1, 1, 0]), dict(bed, fn="nope"), dict(bed, args=[1, "../x", 0]),+ dict(bed, args=[1, float("nan"), 0]), dict(bed, box=[0, 1, 2]), dict(bed, kw={"w": [5]}),+ dict(bed, kw={"a/b": 1}), dict(bed, kw={"m": "rug\n"}), dict(bed, kw=None), dict(bed, fn=[]), "bed"):+ plan["floors"][0]["items"] = [bad]+ assert post(plan) == 400, bad+ plan["floors"][0]["items"] = [bed] * 401+ assert post(plan) == 400+ plan["floors"][0]["items"] = [dict(bed, args=[1, 2, 90])]+ assert post(plan) == 200+ plan["furnish"] = False+ assert post(plan) == 200 and json.loads(call("GET", f"/api/jobs/{jid}/furniture")[1])["floors"] == [[]] * len(plan["floors"])+ print("ok server: furniture lists, item checks")+# a title sheet with no drawing before the plan: the plan on page 2 is found, and its page is the one drawncover = os.path.join(server.JOBS, "cover.pdf")open(cover, "wb").write(M.pdf_page(b""))