Single place to convert your 2D floor plans to 3d model (no LLM)
Python
Out-of-date houses are marked; the review page shows build times before and during a build
23f200563989812e74a076
diff --git a/AGENTS.md b/AGENTS.mdindex 63db5ff..ee520f6 100644--- a/AGENTS.md+++ b/AGENTS.md@@ -66,6 +66,7 @@ If you change `examples/make_sample.py`, run it to rewrite the PDF and keep its- **A new theme:** an entry in `themes.THEMES`. Furniture rules read only sizes from it (`Room.sizes`), so a model that does not fit falls back to the built-in piece in the theme's colours. Check it with `tests/test_themes.py` and look at a build: rules can be right and a room still look wrong.- **A new built-in piece style:** a `style=` branch in its builder, listed in `themes.STYLES`. New materials go in `lib.py`; a coloured one goes in `PAINT` in `gen.py` so themes repaint it.- **A new room type:** add its keywords to `ROOM_TYPES` in `detect.py`, a rule in `furnish.py`, a floor material in `quantities.py` (`FLOOR_MAT`, and `INDOOR` in `furnish.py`), and a colour in `web/edit.js` (`TYPES`, `ZCOL`).+- **A change to what a house looks like** (anything in `blender/`, `furnish.py` or a theme that changes a build): raise `ENGINE` in `jobs.py`, so houses built before it are marked out of date.- **A detector fix:** make it general, not a special case for one drawing. Check the sample still passes. The scores on real drawings need private fixtures (`PLANTO3D_FIXTURES`) that are not in the repository.- **A new API call:** add it in `server.py` (`do_GET` / `do_POST` / `do_DELETE`), and to the table in `README.md`.- **A new texture or model:** add its Poly Haven name to `fetch_assets.py`; never commit asset files.diff --git a/README.md b/README.mdindex 7359fdd..d177611 100644--- a/README.md+++ b/README.md@@ -171,7 +171,7 @@ sequenceDiagram|---|---|| `GET /api/system` | What is installed: `{ ready, blender, pdf_tools, viewer, materials }` || `POST /api/upload` | Body: the PDF. Header `X-Filename`. Returns `{ id }` and starts detection |-| `GET /api/jobs/{id}` | `{ stage, progress, message, floors, eta_left }`. Stages: `detecting`, `detected`, `queued`, `building`, `done`, `failed` |+| `GET /api/jobs/{id}` | `{ stage, progress, message, floors, eta_left, elapsed, eta, outdated }`. Stages: `detecting`, `detected`, `queued`, `building`, `done`, `failed`. `eta` (seconds per quality) before a build; `outdated` when the house was built before the build last changed || `GET /jobs/{id}/plan.json` | The detected plan (feet): walls, openings, rooms, stairs per storey || `POST /api/jobs/{id}/plan` | Save an edited plan. `"furnish": false` builds empty rooms. A floor's `items` list (furniture placed on the review page) replaces the rules for that floor || `GET /api/jobs/{id}/quantities` | Areas in sq ft from the saved plan: `{ floors: [{ rooms: [{ name, finish, area, paint, tiles }] }], finishes, paint, ceiling, tiles, openings, furniture }`. `/web/quantities.html?job={id}` shows it as a page |diff --git a/jobs.py b/jobs.pyindex 6218439..89d7395 100644--- a/jobs.py+++ b/jobs.py@@ -9,6 +9,9 @@ THREE = os.path.join(HERE, "node_modules", "three")BLENDER = os.environ.get("BLENDER") or shutil.which("blender") or "blender" # set BLENDER to its full path if it is not on PATHBUILD_TIMEOUT = 2 * 3600 # seconds; a high-quality build of a large house takes well under an hourID = re.compile(r"^[a-f0-9]{12}$")+# raise ENGINE when a change to the build (blender/, furnish.py, themes.py) fixes or changes what a house looks like:+# houses built before it are then marked out of date in the review page and the walkthrough+ENGINE = 1import catalog, detect, fetch_assets, furnish, themes # noqa: E402os.makedirs(JOBS, exist_ok=True)@@ -251,7 +254,8 @@ def builder():for f in ("house.blend", "house.blend1", "house_baked.blend1"): # keep house_baked.blend onlyif os.path.exists(os.path.join(d, f)):os.remove(os.path.join(d, f))- status(jid, stage="done", progress=100, message="Ready", quality=quality, build_seconds=round(time.time() - t0))+ status(jid, stage="done", progress=100, message="Ready", quality=quality, build_seconds=round(time.time() - t0),+ engine=ENGINE)except Exception as e:traceback.print_exc()status(jid, stage="failed", message=str(e))diff --git a/server.py b/server.pyindex d245b1a..40ac635 100644--- a/server.py+++ b/server.py@@ -119,6 +119,11 @@ class H(BaseHTTPRequestHandler):if st and st.get("stage") == "building" and st.get("started"): # counted here: the viewer's clock may differleft = st["started"] + st["eta_total"] - time.time()st["eta_left"] = max(0, round(min(left, 15) if st.get("progress", 0) >= 92 else left)) # 92 = exporting, the last step+ st["elapsed"] = round(time.time() - st["started"])+ if st and st.get("stage") not in jobs.BUSY: # before a build: how long each quality should take+ st["eta"] = {q: round(jobs.estimate(m.group(1), q)) for q in ("draft", "high")}+ if st and st.get("stage") == "done": # built before a fix to the build: worth building again+ st["outdated"] = st.get("engine", 0) < jobs.ENGINEreturn self.send(200 if st else 404, st or {"error": "no such job"})m = re.match(r"^/api/jobs/([a-f0-9]{12})/furniture$", p)if m:diff --git a/tests/test_server.py b/tests/test_server.pyindex 4be306c..35f5e63 100644--- a/tests/test_server.py+++ b/tests/test_server.py@@ -1,7 +1,7 @@"""The server's guards, without Blender: files outside the web folders stay hidden, a plan that is being read or builtcannot be changed or deleted, bad request bodies get an answer, furniture from the review page reaches Blender onlyas known items with plain values, the website zip holds the viewer and the house only, and a cover sheet before the-plan is not taken for a scan. python3 tests/test_server.py"""+plan is not taken for a scan, and a house built before the build last changed is marked out of date. python3 tests/test_server.py"""import json, os, shutil, subprocess, sys, tempfile, threading, urllib.error, urllib.request, zipfileHERE = os.path.dirname(os.path.abspath(__file__))@@ -141,6 +141,15 @@ try:assert call("DELETE", "/api/themes/royal")[0] == 404assert call("DELETE", f"/api/themes/{tid}")[0] == 200 and tid not in themes.custom_ids()print("ok server: interior themes")++ # a house built before the build last changed is out of date; before a build, each quality says how long it takes+ old, new = job("done"), job("done")+ jobs.status(new, engine=jobs.ENGINE, quality="high", build_seconds=300, floors=["G"])+ get = lambda jid: json.loads(call("GET", f"/api/jobs/{jid}")[1])+ assert get(old)["outdated"] and not get(new)["outdated"]+ assert get(old)["eta"]["high"] == 300 # the last high-quality build here, scaled by storeys (1 + the site)+ assert "outdated" not in get(job("building"))+ print("ok server: out-of-date houses, build estimates")finally:httpd.shutdown()shutil.rmtree(jobs.JOBS)diff --git a/web/edit.html b/web/edit.htmlindex 13b7e35..3904af6 100644--- a/web/edit.html+++ b/web/edit.html@@ -35,6 +35,7 @@#bspin path { stroke-dasharray: 100; animation: drawhouse 2.6s ease-in-out infinite; } /* drawn, held, wiped away */@keyframes drawhouse { 0% { stroke-dashoffset: 100; } 55%, 72% { stroke-dashoffset: 0; } 100% { stroke-dashoffset: -100; } }@media (prefers-reduced-motion: reduce) { #bspin path { animation: none; } }+ .note { font-size: 13px; margin: 6px 0 0; padding: 8px 10px; border-radius: 6px; background: color-mix(in srgb, var(--accent) 12%, transparent); }#wait { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: var(--bg); flex-direction: column; gap: 10px; padding: 16px; text-align: center; }@media (max-width: 760px) { main { flex-direction: column; } aside { width: auto; max-height: 45vh; border-left: 0; border-top: 1px solid var(--line); } }</style>@@ -103,7 +104,9 @@<h3 id="bhead">3D build<span id="beta"></span></h3><div class="bar"><i id="bbar"></i></div><p id="bfun" hidden><svg id="bspin" viewBox="0 0 24 24" aria-hidden="true"><path pathLength="100" d="M3 11 12 3l9 8M5 9.5V21h14V9.5M10 21v-6h4v6"/></svg><span id="bword"></span></p>+ <p id="belapsed" class="muted" style="font-size:13px;margin:4px 0 0"></p><p id="bmsg" class="muted" style="font-size:13px;margin-top:4px"></p>+ <p id="bold" class="note" hidden>Built before the latest fixes. Press <b>Build 3D</b> to update this house.</p><a class="btn" id="open" hidden>Open walkthrough</a></div></aside>diff --git a/web/edit.js b/web/edit.jsindex ef3a036..b2bd083 100644--- a/web/edit.js+++ b/web/edit.js@@ -88,7 +88,20 @@ function funWords(on) {fun = setInterval(next, 2800);}const secs = (s) => (s >= 90 ? `${Math.round(s / 60)} min` : `${s} s`);+const clock = (s) => `${Math.floor(s / 60)}:${String(s % 60).padStart(2, '0')}`;+let tick = null; // the elapsed time counts every second between the server's answersfunction buildStatus(st) {+ if (st.eta) { // before a build: how long each quality takes here, from the last builds on this machine+ $('quality').options[0].text = `Draft · about ${secs(st.eta.draft)}`;+ $('quality').options[1].text = `High quality · about ${secs(st.eta.high)}`;+ }+ clearInterval(tick);+ if (st.stage === 'building' && st.elapsed != null) {+ const t0 = Date.now() - st.elapsed * 1000;+ const show = () => { $('belapsed').textContent = `${clock(Math.round((Date.now() - t0) / 1000))} elapsed`; };+ show();+ tick = setInterval(show, 1000);+ } else $('belapsed').textContent = '';if (!['queued', 'building', 'done', 'failed'].includes(st.stage)) return;$('buildbox').hidden = false;$('bbar').style.width = (st.progress || 0) + '%';@@ -99,6 +112,7 @@ function buildStatus(st) {const step = st.stage === 'building' && !/cooling/.test(st.message) ? '' : st.message; // Blender's step names stay out of sight$('bmsg').textContent = st.stage === 'failed' ? `Failed: ${st.message}` : [step, took].filter(Boolean).join(' · ');$('bmsg').className = st.stage === 'failed' ? 'err' : 'muted';+ $('bold').hidden = !st.outdated;$('open').hidden = st.stage !== 'done';$('open').href = `/web/view.html?job=${job}`;$('build').disabled = ['queued', 'building'].includes(st.stage);diff --git a/web/view.html b/web/view.htmlindex 03758a0..4f623fd 100644--- a/web/view.html+++ b/web/view.html@@ -16,6 +16,11 @@#room { position: fixed; top: 14px; left: 50%; transform: translateX(-50%); color: #fff; background: rgba(0,0,0,.45);padding: 6px 14px; border-radius: 18px; font-size: 14px; pointer-events: none; white-space: nowrap; }#room:empty { display: none; }+ #old { position: fixed; top: 52px; left: 50%; transform: translateX(-50%); background: rgba(0,0,0,.6); color: #fff;+ padding: 6px 8px 6px 14px; border-radius: 18px; font-size: 13px; display: flex; gap: 10px; align-items: center; }+ #old[hidden] { display: none; }+ #old a { color: #ffc89e; }+ #old button { background: none; border: 0; color: #ccc; cursor: pointer; font-size: 15px; padding: 0 4px; }#cross { position: fixed; left: 50%; top: 50%; width: 6px; height: 6px; margin: -3px; border-radius: 50%;background: rgba(255,255,255,.7); pointer-events: none; }#bar { position: fixed; bottom: 12px; left: 12px; right: 12px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }@@ -56,6 +61,7 @@<p class="touch">Left thumb: move · right thumb: look</p></div><div id="room"></div>+<div id="old" hidden>Built before the latest fixes. <a id="oldlink">Rebuild it</a><button id="oldx" title="Hide" aria-label="Hide">×</button></div><div id="cross"></div><div id="bar"><button id="topbtn">Top view</button><span id="floors"></span><button id="measure" title="Measure a distance: click two points (N)">Measure</button><button id="vr" hidden title="Walk through in a VR headset: left stick walks, right stick turns">VR</button><button id="finbtn" title="Try another wall colour, or another floor in this room (F)">Finishes</button><button id="shot" title="Save a picture of this view (P)">Screenshot</button><button id="rec" title="Record a video of your walk (R)">Record</button><button id="tour" title="Walk through every room by itself and record it as a video where this browser can record (G); any key or click stops">Tour</button><button id="blend" title="Download this house as a Blender file (.zip)">Blender file</button><button id="qty" title="Floor areas, wall paint and tiles, doors, windows and furniture of this plan">Quantities</button><button id="site" title="Download this walkthrough as a website for any web host (.zip)">Website</button><a href="/" id="newplan" style="color:#ccc;font-size:13px">Home</a><span id="fps"></span></div><div id="fin" hidden>diff --git a/web/view.js b/web/view.jsindex 1a96308..60e850e 100644--- a/web/view.js+++ b/web/view.js@@ -26,6 +26,13 @@ const camera = new THREE.PerspectiveCamera(70, innerWidth / innerHeight, 0.05, 4const env = new THREE.PMREMGenerator(renderer).fromScene(new RoomEnvironment(), 0.04).texture;const meta = await fetch(base + 'meta.json').then((r) => r.json());+if (!site) { // a house built before a fix to the build: say so, with the way to build it again+ fetch(`/api/jobs/${job}`).then((r) => r.json()).then((st) => {+ $('old').hidden = !st.outdated;+ $('oldlink').href = `/web/edit.html?job=${job}`;+ }).catch(() => {});+ $('oldx').onclick = () => { $('old').hidden = true; };+}const draco = new DRACOLoader().setDecoderPath((site ? '.' : '') + '/three/examples/jsm/libs/draco/');const gltf = await new GLTFLoader().setDRACOLoader(draco).loadAsync(base + 'house.glb', (e) => {if (e.total) $('status').textContent = `Loading model… ${Math.round(100 * e.loaded / e.total)}%`;