replicator-workshop 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- replicator/__init__.py +6 -0
- replicator/app.py +204 -0
- replicator/config.py +48 -0
- replicator/core/__init__.py +0 -0
- replicator/core/assembly.py +117 -0
- replicator/core/blender_link.py +161 -0
- replicator/core/critique.py +594 -0
- replicator/core/drawing.py +389 -0
- replicator/core/dxf.py +120 -0
- replicator/core/evaluate.py +439 -0
- replicator/core/explain.py +139 -0
- replicator/core/export.py +96 -0
- replicator/core/fit.py +170 -0
- replicator/core/importers.py +185 -0
- replicator/core/materials.py +104 -0
- replicator/core/ops_advanced.py +496 -0
- replicator/core/ops_engineering.py +223 -0
- replicator/core/physics.py +147 -0
- replicator/core/printers.py +100 -0
- replicator/core/program.py +298 -0
- replicator/core/render.py +145 -0
- replicator/core/reverse.py +350 -0
- replicator/core/robot.py +153 -0
- replicator/core/step.py +245 -0
- replicator/fixtures/gaming_pc_liquid.json +2259 -0
- replicator/fixtures/gas_generator_rocket.json +876 -0
- replicator/fixtures/gas_generator_rocket_aero.json +861 -0
- replicator/fixtures/house_two_bed.json +979 -0
- replicator/fixtures/quadcopter_drone.json +687 -0
- replicator/fixtures/raspberry_pi_5.json +884 -0
- replicator/fixtures/rocket_engine.json +652 -0
- replicator/fixtures/turbofan.json +931 -0
- replicator/fixtures/vector_engine.json +314 -0
- replicator/gpu.py +81 -0
- replicator/image3d/__init__.py +0 -0
- replicator/image3d/comfy.py +181 -0
- replicator/image3d/pipeline.py +208 -0
- replicator/image3d/sheet.py +154 -0
- replicator/knowledge/__init__.py +61 -0
- replicator/knowledge/car_wheel_corner.md +21 -0
- replicator/knowledge/desk_lamp.md +21 -0
- replicator/knowledge/desktop_pc.md +20 -0
- replicator/knowledge/electronics_board.md +21 -0
- replicator/knowledge/exoskeleton.md +21 -0
- replicator/knowledge/house.md +22 -0
- replicator/knowledge/light_aircraft.md +22 -0
- replicator/knowledge/multirotor_drone.md +25 -0
- replicator/knowledge/print_replica.md +13 -0
- replicator/knowledge/rocket_engine.md +27 -0
- replicator/knowledge/turbofan.md +23 -0
- replicator/llm/__init__.py +0 -0
- replicator/llm/client.py +424 -0
- replicator/llm/prompts/blueprint.md +28 -0
- replicator/llm/prompts/edit.md +15 -0
- replicator/llm/prompts/explain.md +37 -0
- replicator/llm/prompts/name_parts.md +13 -0
- replicator/llm/prompts/program.md +72 -0
- replicator/llm/prompts/research_queries.md +8 -0
- replicator/mcp_server.py +307 -0
- replicator/qml/Main.qml +874 -0
- replicator/qml/Replicator/UI/Chip.qml +17 -0
- replicator/qml/Replicator/UI/DockHeader.qml +27 -0
- replicator/qml/Replicator/UI/Icon.qml +118 -0
- replicator/qml/Replicator/UI/IconButton.qml +31 -0
- replicator/qml/Replicator/UI/Kbd.qml +18 -0
- replicator/qml/Replicator/UI/NumField.qml +69 -0
- replicator/qml/Replicator/UI/Pill.qml +28 -0
- replicator/qml/Replicator/UI/RCombo.qml +51 -0
- replicator/qml/Replicator/UI/RMenu.qml +42 -0
- replicator/qml/Replicator/UI/RSlider.qml +23 -0
- replicator/qml/Replicator/UI/Segmented.qml +63 -0
- replicator/qml/Replicator/UI/Swatch.qml +47 -0
- replicator/qml/Replicator/UI/Theme.qml +149 -0
- replicator/qml/Replicator/UI/qmldir +14 -0
- replicator/qml/panels/AgentPrompt.qml +53 -0
- replicator/qml/panels/AttributeManager.qml +171 -0
- replicator/qml/panels/Commander.qml +136 -0
- replicator/qml/panels/HolodeckPanel.qml +117 -0
- replicator/qml/panels/IssuesCard.qml +78 -0
- replicator/qml/panels/LedgerPanel.qml +110 -0
- replicator/qml/panels/MaterialShelf.qml +97 -0
- replicator/qml/panels/ObjectManager.qml +107 -0
- replicator/qml/panels/Preferences.qml +211 -0
- replicator/qml/panels/Presenter.qml +316 -0
- replicator/qml/panels/StatusBar.qml +77 -0
- replicator/qml/panels/Timeline.qml +149 -0
- replicator/qml/panels/Welcome.qml +126 -0
- replicator/qml/viewport/Callouts.qml +87 -0
- replicator/qml/viewport/EdgeMaterial.qml +16 -0
- replicator/qml/viewport/GridMaterial.qml +16 -0
- replicator/qml/viewport/HoloMaterial.qml +23 -0
- replicator/qml/viewport/NavGizmo.qml +72 -0
- replicator/qml/viewport/ReferenceMaterial.qml +17 -0
- replicator/qml/viewport/Viewport.qml +583 -0
- replicator/qt/__init__.py +0 -0
- replicator/qt/bridge.py +1427 -0
- replicator/qt/drawing_sheet.py +33 -0
- replicator/qt/envmap.py +40 -0
- replicator/qt/library.py +68 -0
- replicator/qt/mesh_geometry.py +167 -0
- replicator/qt/svg.py +41 -0
- replicator/research/__init__.py +0 -0
- replicator/research/lane.py +281 -0
- replicator/shaders/edge.frag +9 -0
- replicator/shaders/edge.vert +7 -0
- replicator/shaders/grid.frag +52 -0
- replicator/shaders/grid.vert +6 -0
- replicator/shaders/holo.frag +41 -0
- replicator/shaders/reference.frag +15 -0
- replicator/shaders/reference.vert +6 -0
- replicator/voice.py +120 -0
- replicator_workshop-0.1.0.dist-info/METADATA +410 -0
- replicator_workshop-0.1.0.dist-info/RECORD +118 -0
- replicator_workshop-0.1.0.dist-info/WHEEL +5 -0
- replicator_workshop-0.1.0.dist-info/entry_points.txt +3 -0
- replicator_workshop-0.1.0.dist-info/licenses/LICENSE +21 -0
- replicator_workshop-0.1.0.dist-info/licenses/vendor/mcp-for-blender/LICENSE +21 -0
- replicator_workshop-0.1.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
"""Image or Holodeck sheet -> clean, real-scale GLB that Reverse can take apart.
|
|
2
|
+
|
|
3
|
+
sheet / picture --split (CPU)--> views --BiRefNet (GPU)--> masks --square on white, one scale (CPU)-->
|
|
4
|
+
Hunyuan3D-2mv (sheet: front/left/back/right) or Hunyuan3D 2.1 (one picture) --> raw GLB (file units ~ +-1)
|
|
5
|
+
--decimate, stand on the floor, scale to millimetres (CPU)--> <out>/model.glb
|
|
6
|
+
|
|
7
|
+
Both GPU jobs run in your ComfyUI (`comfy.acquire` / `comfy.release`, with an optional GPU hand-off bridge), so
|
|
8
|
+
nothing loads a model in this process. Everything else runs on the CPU in this process.
|
|
9
|
+
|
|
10
|
+
CLI (no UI): python -m replicator.image3d.pipeline <image-or-sheet.png> [--out DIR] [--single] [--side-as right]
|
|
11
|
+
"""
|
|
12
|
+
from __future__ import annotations
|
|
13
|
+
|
|
14
|
+
import argparse
|
|
15
|
+
import json
|
|
16
|
+
import time
|
|
17
|
+
from pathlib import Path
|
|
18
|
+
|
|
19
|
+
import numpy as np
|
|
20
|
+
from PIL import Image
|
|
21
|
+
|
|
22
|
+
from . import comfy, sheet
|
|
23
|
+
|
|
24
|
+
OUT = Path.home() / "Replicator" / "image3d"
|
|
25
|
+
MV_KEYS = {"front": "front", "back": "back", "left": "left", "right": "right"}
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def is_sheet(path: Path, meta: dict | None = None) -> bool:
|
|
29
|
+
meta = meta if meta is not None else sheet.sidecar(path)
|
|
30
|
+
wf = str(meta.get("workflow") or meta.get("ui", {}).get("wf") or "")
|
|
31
|
+
return wf.startswith("sheet") or "/characters/" in str(path) or "reference sheet" in meta.get("prompt", "")
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def _views_for(path: Path, single: bool, side_as: str):
|
|
35
|
+
"""[(label, mv_key or "image", PIL image)], plus metadata."""
|
|
36
|
+
meta = sheet.sidecar(path)
|
|
37
|
+
if is_sheet(path, meta) and not single:
|
|
38
|
+
views, meta = sheet.load(path)
|
|
39
|
+
out = []
|
|
40
|
+
for v in views:
|
|
41
|
+
key = MV_KEYS.get(v.label) or (side_as if v.label == "side" else None)
|
|
42
|
+
if key and key not in [k for _, k, _ in out]:
|
|
43
|
+
out.append((v.label, key, v.image))
|
|
44
|
+
if len(out) >= 2:
|
|
45
|
+
return out, meta, "multi"
|
|
46
|
+
front = next((v for v in views if v.label == "front"), views[0])
|
|
47
|
+
return [(front.label, "image", front.image)], meta, "single"
|
|
48
|
+
return [("image", "image", Image.open(path).convert("RGB"))], meta, "single"
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
def finish_mesh(raw: Path, dest: Path, height_mm: float, max_faces: int, log=print) -> tuple[dict, list]:
|
|
52
|
+
"""Clean the generated surface and bring it to real scale. Returns (stats, pieces).
|
|
53
|
+
|
|
54
|
+
Surface extraction leaves thousands of specks around fur and thin edges; only connected parts with at least
|
|
55
|
+
0.5 % of the largest part's faces stay (horns, plates, a held weapon). The kept parts are decimated to max_faces
|
|
56
|
+
in total, stood on the floor (min Y = 0), centred on X/Z and scaled to height_mm."""
|
|
57
|
+
import trimesh
|
|
58
|
+
mesh = trimesh.load(raw, force="scene").to_geometry()
|
|
59
|
+
tri0 = len(mesh.faces)
|
|
60
|
+
mesh.merge_vertices()
|
|
61
|
+
parts = sorted(mesh.split(only_watertight=False), key=lambda m: -len(m.faces))
|
|
62
|
+
keep = [m for m in parts if len(m.faces) >= 0.005 * len(parts[0].faces)][:12]
|
|
63
|
+
dropped = len(parts) - len(keep)
|
|
64
|
+
kept_faces = sum(len(m.faces) for m in keep)
|
|
65
|
+
if kept_faces > max_faces:
|
|
66
|
+
keep = [m.simplify_quadric_decimation(face_count=max(200, int(len(m.faces) * max_faces / kept_faces)))
|
|
67
|
+
for m in keep]
|
|
68
|
+
whole = trimesh.util.concatenate(keep)
|
|
69
|
+
lo, hi = whole.bounds
|
|
70
|
+
s = height_mm / (float(hi[1] - lo[1]) or 1.0)
|
|
71
|
+
shift = [-(lo[0] + hi[0]) / 2, -lo[1], -(lo[2] + hi[2]) / 2]
|
|
72
|
+
for m in keep:
|
|
73
|
+
m.apply_translation(shift)
|
|
74
|
+
m.apply_scale(s)
|
|
75
|
+
whole = trimesh.util.concatenate(keep)
|
|
76
|
+
whole.visual = trimesh.visual.ColorVisuals(whole, face_colors=[200, 202, 206, 255])
|
|
77
|
+
whole.export(dest)
|
|
78
|
+
log(f"image3d: {tri0:,} triangles in {len(parts):,} parts -> kept {len(keep)} parts, "
|
|
79
|
+
f"{len(whole.faces):,} triangles ({dropped:,} specks dropped)")
|
|
80
|
+
ext = whole.bounds[1] - whole.bounds[0]
|
|
81
|
+
stats = {"triangles_raw": tri0, "triangles": int(len(whole.faces)), "parts_raw": len(parts),
|
|
82
|
+
"parts": len(keep), "specks_dropped": dropped, "size_mm": [round(float(x), 1) for x in ext],
|
|
83
|
+
"watertight_parts": int(sum(m.is_watertight for m in keep)), "scale": s}
|
|
84
|
+
return stats, keep
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
def write_program(out: Path, info: dict, pieces: list) -> tuple[dict, dict]:
|
|
88
|
+
"""A BuildProgram (one `mesh` op per kept part, one component) and a Reverse report with an evidence ledger."""
|
|
89
|
+
from ..core.reverse import ledger_entry
|
|
90
|
+
assets = out / "assets"
|
|
91
|
+
assets.mkdir(exist_ok=True)
|
|
92
|
+
name = info["subject"][:1].upper() + info["subject"][1:]
|
|
93
|
+
comp = {"id": "c1", "label": name[:60], "role": "generated from " + ("a character sheet" if info["kind"] == "multi"
|
|
94
|
+
else "a picture"), "evidence": "image to 3D"}
|
|
95
|
+
ops = []
|
|
96
|
+
for i, m in enumerate(pieces):
|
|
97
|
+
rel = f"assets/part_{i:02d}.npz"
|
|
98
|
+
np.savez_compressed(out / rel, V=np.asarray(m.vertices, np.float32), F=np.asarray(m.faces, np.uint32))
|
|
99
|
+
ops.append({"id": "body" if i == 0 else f"part{i}", "op": "mesh", "label": "Body" if i == 0 else f"Detached part {i}",
|
|
100
|
+
"part": "body" if i == 0 else "detached", "component": "c1", "material": "clay", "params": {"asset": rel}})
|
|
101
|
+
views = ", ".join(f"{lab} as {key}" if key != "image" else lab for lab, key in info["views"])
|
|
102
|
+
src = Path(info["source"]).name
|
|
103
|
+
ledger = [
|
|
104
|
+
ledger_entry(f"shape generated by {info['model'].split('.')[0]} from {len(info['views'])} view(s) of {src}",
|
|
105
|
+
"observed", f"views used: {views}; seed {info['seed']}; {info['gpu_seconds']} s on the card"),
|
|
106
|
+
ledger_entry(f"{info['parts_raw']:,} connected parts, {info['triangles_raw']:,} triangles in the raw surface",
|
|
107
|
+
"observed", "VoxelToMesh surface net, threshold 0.6"),
|
|
108
|
+
ledger_entry(f"kept {info['parts']} part(s), {info['triangles']:,} triangles; {info['specks_dropped']:,} specks dropped",
|
|
109
|
+
"observed", "parts under 0.5 % of the largest are noise from the surface extraction"),
|
|
110
|
+
ledger_entry("overall size {:.0f} x {:.0f} x {:.0f} mm".format(*info["size_mm"]), "inferred",
|
|
111
|
+
f"height set to {info['size_mm'][1]:.0f} mm (a sheet is read as a person-sized figure); "
|
|
112
|
+
"change it with Scale", confidence=0.4),
|
|
113
|
+
ledger_entry("surfaces hidden in every view (under arms, between legs) are the model's guess", "inferred",
|
|
114
|
+
"image-to-3D completes what no view shows", confidence=0.5),
|
|
115
|
+
ledger_entry("materials and colours", "unknown", "shape only: Hunyuan3D shape models make no texture"),
|
|
116
|
+
]
|
|
117
|
+
checklist = [
|
|
118
|
+
{"q": "What does it look like in 3D?", "status": "answered", "by": "generated shape"},
|
|
119
|
+
{"q": "What is it made of?", "status": "partly answered", "by": f"{len(ops)} connected part(s)"},
|
|
120
|
+
{"q": "How big is it?", "status": "partly answered", "by": "assumed height; set the real one"},
|
|
121
|
+
{"q": "What material is each part?", "status": "unresolved", "by": "no texture yet (M3 next: AI texturing)"},
|
|
122
|
+
]
|
|
123
|
+
program = {"version": 1, "name": name, "units": "mm",
|
|
124
|
+
"materials": {"clay": {"base_color": [0.78, 0.76, 0.72], "metalness": 0.0, "roughness": 0.62}},
|
|
125
|
+
"components": [comp], "ops": ops,
|
|
126
|
+
"reference": {"source": info["source"],
|
|
127
|
+
"views": [{"label": lab, "key": key, "image": f"views/{key}.png"} for lab, key in info["views"]]},
|
|
128
|
+
"blueprint": {"summary": f"Generated from {src} by {info['model'].split('.')[0]}: {views}.",
|
|
129
|
+
"source": info["source"]}}
|
|
130
|
+
report = {"input": {"file": src, "format": "image to 3D"}, "ledger": ledger, "checklist": checklist,
|
|
131
|
+
"patterns": [], "components": [comp]}
|
|
132
|
+
(out / "program.json").write_text(json.dumps(program, indent=1))
|
|
133
|
+
(out / "reverse_report.json").write_text(json.dumps(report, indent=1))
|
|
134
|
+
return program, report
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
def image_to_mesh(src: Path, out: Path | None = None, *, single: bool = False, side_as: str = "left",
|
|
138
|
+
height_mm: float | None = None, seed: int = 0, max_faces: int = 150_000, log=print) -> dict:
|
|
139
|
+
src = Path(src)
|
|
140
|
+
out = out or OUT / (src.stem + time.strftime("-%Y%m%d-%H%M%S"))
|
|
141
|
+
vdir = out / "views"
|
|
142
|
+
vdir.mkdir(parents=True, exist_ok=True)
|
|
143
|
+
views, meta, kind = _views_for(src, single, side_as)
|
|
144
|
+
log(f"image3d: {src.name}: {len(views)} view(s) [{', '.join(f'{lab}->{key}' for lab, key, _ in views)}]")
|
|
145
|
+
crops = []
|
|
146
|
+
for lab, key, img in views:
|
|
147
|
+
p = vdir / f"{key}_crop.png"
|
|
148
|
+
img.save(p)
|
|
149
|
+
crops.append(p)
|
|
150
|
+
tag = f"replicator/{out.name}"
|
|
151
|
+
t0 = time.time()
|
|
152
|
+
comfy.acquire(log)
|
|
153
|
+
try:
|
|
154
|
+
names = [comfy.upload(p) for p in crops]
|
|
155
|
+
res = comfy.run(comfy.mask_workflow(names, tag), log)
|
|
156
|
+
masks = []
|
|
157
|
+
for i in range(len(views)):
|
|
158
|
+
item = res[f"save{i}"]["images"][0]
|
|
159
|
+
mp = vdir / f"{views[i][1]}_mask.png"
|
|
160
|
+
mp.write_bytes(comfy.fetch(item))
|
|
161
|
+
masks.append(Image.open(mp))
|
|
162
|
+
scale = sheet.shared_scale(masks)
|
|
163
|
+
cond = {}
|
|
164
|
+
for (lab, key, img), mk in zip(views, masks):
|
|
165
|
+
sq = sheet.square_on_white(img, mk, scale)
|
|
166
|
+
p = vdir / f"{key}.png"
|
|
167
|
+
sq.save(p)
|
|
168
|
+
cond[key] = comfy.upload(p)
|
|
169
|
+
model = comfy.MODEL_MULTI if kind == "multi" else comfy.MODEL_SINGLE
|
|
170
|
+
log(f"image3d: generating the shape with {model}")
|
|
171
|
+
res = comfy.run(comfy.mesh_workflow(cond, tag, seed=seed), log)
|
|
172
|
+
item = res["save"]["3d"][0]
|
|
173
|
+
raw = out / "raw.glb"
|
|
174
|
+
raw.write_bytes(comfy.fetch(item))
|
|
175
|
+
finally:
|
|
176
|
+
comfy.release()
|
|
177
|
+
gpu_s = time.time() - t0
|
|
178
|
+
log(f"image3d: shape ready in {gpu_s:.0f}s; the card is released")
|
|
179
|
+
if height_mm is None:
|
|
180
|
+
height_mm = 1800.0 if kind == "multi" or is_sheet(src, meta) else 300.0
|
|
181
|
+
dest = out / "model.glb"
|
|
182
|
+
stats, pieces = finish_mesh(raw, dest, height_mm, max_faces, log)
|
|
183
|
+
info = {"source": str(src), "kind": kind, "model": model, "views": [[lab, key] for lab, key, _ in views],
|
|
184
|
+
"subject": sheet.subject(meta) if meta.get("prompt") else src.stem.replace("_", " "), "seed": seed,
|
|
185
|
+
"gpu_seconds": round(gpu_s, 1), "glb": str(dest), "raw": str(raw), **stats}
|
|
186
|
+
(out / "image3d.json").write_text(json.dumps(info, indent=1))
|
|
187
|
+
write_program(out, info, pieces)
|
|
188
|
+
info["program"] = str(out / "program.json")
|
|
189
|
+
return info
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
def main() -> None:
|
|
193
|
+
ap = argparse.ArgumentParser(description=__doc__.split("\n")[0])
|
|
194
|
+
ap.add_argument("image")
|
|
195
|
+
ap.add_argument("--out")
|
|
196
|
+
ap.add_argument("--single", action="store_true", help="use one picture (the front view of a sheet)")
|
|
197
|
+
ap.add_argument("--side-as", default="left", choices=["left", "right"], help="which Hunyuan view a sheet's side view is")
|
|
198
|
+
ap.add_argument("--height", type=float, help="model height in mm (sheet default 1800, picture default 300)")
|
|
199
|
+
ap.add_argument("--seed", type=int, default=0)
|
|
200
|
+
ap.add_argument("--max-faces", type=int, default=150_000)
|
|
201
|
+
a = ap.parse_args()
|
|
202
|
+
info = image_to_mesh(Path(a.image), Path(a.out) if a.out else None, single=a.single, side_as=a.side_as,
|
|
203
|
+
height_mm=a.height, seed=a.seed, max_faces=a.max_faces)
|
|
204
|
+
print(json.dumps(info, indent=1))
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
if __name__ == "__main__":
|
|
208
|
+
main()
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
"""Character sheets (a ComfyUI workflow's multi-view renders; folder $REPLICATOR_SHEETS): find the views, cut them apart, square them up for image-to-3D.
|
|
2
|
+
|
|
3
|
+
A Holodeck sheet (`characters/sheet-*.png` plus a `.png.json` sidecar with the prompt) shows one character several
|
|
4
|
+
times side by side, for example "front view, three-quarter view, side view and back view". This module reads the
|
|
5
|
+
view order from the prompt, finds the gutters between the figures and returns one crop per view. Background removal
|
|
6
|
+
happens later on the GPU (BiRefNet in ComfyUI); `square_on_white` then centres every view at one shared scale, the
|
|
7
|
+
way Hunyuan3D-2mv's training renders were framed. CPU only (numpy + Pillow).
|
|
8
|
+
"""
|
|
9
|
+
from __future__ import annotations
|
|
10
|
+
|
|
11
|
+
import json
|
|
12
|
+
import os
|
|
13
|
+
import re
|
|
14
|
+
from dataclasses import dataclass
|
|
15
|
+
from pathlib import Path
|
|
16
|
+
|
|
17
|
+
import numpy as np
|
|
18
|
+
from PIL import Image
|
|
19
|
+
|
|
20
|
+
CHARACTERS = Path(os.environ.get("REPLICATOR_SHEETS", "~/ComfyUI/output/characters")).expanduser()
|
|
21
|
+
VIEW_WORDS = [("three-quarter", "three-quarter"), ("three quarter", "three-quarter"), ("3/4", "three-quarter"),
|
|
22
|
+
("front", "front"), ("side", "side"), ("profile", "side"), ("back", "back"), ("rear", "back"),
|
|
23
|
+
("left", "left"), ("right", "right")]
|
|
24
|
+
NUMBERS = {"two": 2, "three": 3, "four": 4, "five": 5, "six": 6}
|
|
25
|
+
DEFAULT_LABELS = {1: ["front"], 2: ["front", "back"], 3: ["front", "side", "back"],
|
|
26
|
+
4: ["front", "three-quarter", "side", "back"]}
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
@dataclass
|
|
30
|
+
class View:
|
|
31
|
+
label: str
|
|
32
|
+
box: tuple[int, int, int, int] # x0, y0, x1, y1 in the sheet
|
|
33
|
+
image: Image.Image
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def sidecar(path: Path) -> dict:
|
|
37
|
+
"""The Holodeck/gen.py metadata next to an output image, or {}."""
|
|
38
|
+
p = Path(str(path) + ".json")
|
|
39
|
+
try:
|
|
40
|
+
return json.loads(p.read_text())
|
|
41
|
+
except (OSError, json.JSONDecodeError):
|
|
42
|
+
return {}
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def view_labels(prompt: str) -> list[str]:
|
|
46
|
+
"""View order as the prompt names it ("front view, three-quarter view, side view and back view")."""
|
|
47
|
+
words = re.findall(r"(three[- ]quarter|3/4|front|back|side|profile|rear|left|right)\s+view", prompt.lower())
|
|
48
|
+
canon = dict(VIEW_WORDS)
|
|
49
|
+
out = []
|
|
50
|
+
for w in words: # the sheet template can repeat; keep first occurrences in order
|
|
51
|
+
lab = canon.get(w, canon.get(w.replace("-", " "), w))
|
|
52
|
+
if lab not in out:
|
|
53
|
+
out.append(lab)
|
|
54
|
+
return out
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def view_count(prompt: str, labels: list[str]) -> int:
|
|
58
|
+
m = re.search(r"shown (\w+) times", prompt.lower())
|
|
59
|
+
if m and m.group(1) in NUMBERS:
|
|
60
|
+
return NUMBERS[m.group(1)]
|
|
61
|
+
return len(labels) or 4
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def _profile(img: Image.Image) -> np.ndarray:
|
|
65
|
+
"""Per-column 'how much figure is here', robust to a textured backdrop."""
|
|
66
|
+
a = np.asarray(img.convert("RGB"), dtype=np.float32)
|
|
67
|
+
h, w, _ = a.shape
|
|
68
|
+
border = np.concatenate([a[: h // 20].reshape(-1, 3), a[:, : w // 60].reshape(-1, 3), a[:, -w // 60:].reshape(-1, 3)])
|
|
69
|
+
bg = np.median(border, axis=0)
|
|
70
|
+
diff = np.linalg.norm(a - bg, axis=2)
|
|
71
|
+
thr = max(28.0, float(np.percentile(diff, 55)))
|
|
72
|
+
occ = (diff > thr).mean(axis=0)
|
|
73
|
+
k = max(3, w // 80)
|
|
74
|
+
return np.convolve(occ, np.ones(k) / k, mode="same")
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
def split(img: Image.Image, n: int) -> list[tuple[int, int, int, int]]:
|
|
78
|
+
"""n side-by-side figures -> n boxes; each gutter is the emptiest column near its even-split position."""
|
|
79
|
+
w, h = img.size
|
|
80
|
+
if n <= 1:
|
|
81
|
+
return [(0, 0, w, h)]
|
|
82
|
+
prof = _profile(img)
|
|
83
|
+
cuts = [0]
|
|
84
|
+
for i in range(1, n):
|
|
85
|
+
centre = i * w / n
|
|
86
|
+
span = 0.35 * w / n
|
|
87
|
+
lo, hi = int(centre - span), int(centre + span)
|
|
88
|
+
cuts.append(lo + int(np.argmin(prof[lo:hi])))
|
|
89
|
+
cuts.append(w)
|
|
90
|
+
return [(cuts[i], 0, cuts[i + 1], h) for i in range(n)]
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
def load(path: Path) -> tuple[list[View], dict]:
|
|
94
|
+
"""All views of a sheet, labelled, plus its sidecar metadata."""
|
|
95
|
+
meta = sidecar(path)
|
|
96
|
+
prompt = meta.get("prompt", "")
|
|
97
|
+
labels = view_labels(prompt)
|
|
98
|
+
n = view_count(prompt, labels)
|
|
99
|
+
if len(labels) != n:
|
|
100
|
+
labels = DEFAULT_LABELS.get(n, [f"view {i + 1}" for i in range(n)])
|
|
101
|
+
img = Image.open(path).convert("RGB")
|
|
102
|
+
views = [View(lab, box, img.crop(box)) for lab, box in zip(labels, split(img, n))]
|
|
103
|
+
return views, meta
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
def subject(meta: dict) -> str:
|
|
107
|
+
"""The character description without the sheet template ("an orc warlord in bone armour...")."""
|
|
108
|
+
p = meta.get("prompt", "")
|
|
109
|
+
tail = p.split(",")[-1].strip() if "," in p else p
|
|
110
|
+
return tail[:120] or "Holodeck character"
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
def clean_mask(mask: Image.Image, size: tuple[int, int] | None = None) -> np.ndarray:
|
|
114
|
+
"""Float mask in 0..1 that keeps the figure and drops stray specks and watermarks: the largest connected
|
|
115
|
+
region plus any region at least 8 % of its area (a held weapon, a detached cape)."""
|
|
116
|
+
from scipy import ndimage
|
|
117
|
+
m = mask.convert("L")
|
|
118
|
+
if size and m.size != size:
|
|
119
|
+
m = m.resize(size, Image.BILINEAR)
|
|
120
|
+
a = np.asarray(m, dtype=np.float32) / 255.0
|
|
121
|
+
lab, n = ndimage.label(a > 0.5)
|
|
122
|
+
if n > 1:
|
|
123
|
+
areas = ndimage.sum(np.ones_like(a), lab, index=range(1, n + 1))
|
|
124
|
+
keep = [i + 1 for i, ar in enumerate(areas) if ar >= 0.08 * areas.max()]
|
|
125
|
+
a = a * np.isin(lab, keep)
|
|
126
|
+
return a
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
def square_on_white(rgb: Image.Image, mask: Image.Image, scale: float, size: int = 512) -> Image.Image:
|
|
130
|
+
"""Cut the figure out with its mask and centre it on a white square at the given pixels-per-pixel scale."""
|
|
131
|
+
m = clean_mask(mask, rgb.size)
|
|
132
|
+
ys, xs = np.nonzero(m > 0.5)
|
|
133
|
+
if len(xs) == 0:
|
|
134
|
+
raise ValueError("background removal found no figure in this view")
|
|
135
|
+
x0, x1, y0, y1 = xs.min(), xs.max() + 1, ys.min(), ys.max() + 1
|
|
136
|
+
a = np.asarray(rgb, dtype=np.float32)
|
|
137
|
+
comp = a * m[..., None] + 255.0 * (1 - m[..., None])
|
|
138
|
+
fig = Image.fromarray(comp[y0:y1, x0:x1].astype(np.uint8))
|
|
139
|
+
fw, fh = max(1, round(fig.width * scale)), max(1, round(fig.height * scale))
|
|
140
|
+
fig = fig.resize((fw, fh), Image.LANCZOS)
|
|
141
|
+
out = Image.new("RGB", (size, size), (255, 255, 255))
|
|
142
|
+
out.paste(fig, ((size - fw) // 2, (size - fh) // 2))
|
|
143
|
+
return out
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
def shared_scale(masks: list[Image.Image], size: int = 512, border: float = 0.15) -> float:
|
|
147
|
+
"""One scale for every view, so the figure keeps the same height in each (largest extent fills 1 - 2*border)."""
|
|
148
|
+
ext = 1
|
|
149
|
+
for mk in masks:
|
|
150
|
+
m = clean_mask(mk) > 0.5
|
|
151
|
+
ys, xs = np.nonzero(m)
|
|
152
|
+
if len(xs):
|
|
153
|
+
ext = max(ext, xs.max() - xs.min() + 1, ys.max() - ys.min() + 1)
|
|
154
|
+
return size * (1 - 2 * border) / ext
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"""Knowledge cards: short, curated notes on how real things are built and sized, picked for a request by keyword.
|
|
2
|
+
|
|
3
|
+
A local 27B model plans better from a page of real proportions than from memory. Each card is one markdown file
|
|
4
|
+
with a `keywords:` line in its front matter; the request's words choose at most two cards.
|
|
5
|
+
"""
|
|
6
|
+
from __future__ import annotations
|
|
7
|
+
|
|
8
|
+
import re
|
|
9
|
+
from dataclasses import dataclass
|
|
10
|
+
from pathlib import Path
|
|
11
|
+
|
|
12
|
+
DIR = Path(__file__).parent
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
@dataclass(frozen=True)
|
|
16
|
+
class Rise:
|
|
17
|
+
word: str
|
|
18
|
+
lo: float
|
|
19
|
+
hi: float
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
@dataclass(frozen=True)
|
|
23
|
+
class Card:
|
|
24
|
+
name: str
|
|
25
|
+
title: str
|
|
26
|
+
keywords: tuple[str, ...]
|
|
27
|
+
body: str
|
|
28
|
+
rises: tuple[Rise, ...] = ()
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
_RISE = re.compile(r"\b(\w+)\s+(\d+(?:\.\d+)?)\s*-\s*(\d+(?:\.\d+)?)\b")
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def _parse(path: Path) -> Card:
|
|
35
|
+
head, body = path.read_text().split("\n---\n", 1)
|
|
36
|
+
meta = dict(line.split(":", 1) for line in head.strip("-\n").splitlines() if ":" in line)
|
|
37
|
+
kws = tuple(k.strip().lower() for k in meta["keywords"].split(",") if k.strip())
|
|
38
|
+
rises = []
|
|
39
|
+
for entry in meta.get("rise", "").split(";"):
|
|
40
|
+
m = _RISE.fullmatch(entry.strip())
|
|
41
|
+
if m:
|
|
42
|
+
rises.append(Rise(m.group(1), float(m.group(2)), float(m.group(3))))
|
|
43
|
+
return Card(path.stem, meta["title"].strip(), kws, body.strip(), tuple(rises))
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
CARDS = [_parse(p) for p in sorted(DIR.glob("*.md"))]
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def pick(request: str, limit: int = 2) -> list[Card]:
|
|
50
|
+
text = " " + re.sub(r"[^a-z0-9]+", " ", request.lower()) + " "
|
|
51
|
+
scored = [(sum(f" {k} " in text for k in c.keywords), c) for c in CARDS]
|
|
52
|
+
return [c for score, c in sorted(scored, key=lambda t: -t[0]) if score][:limit]
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
def block(request: str) -> str:
|
|
56
|
+
cards = pick(request)
|
|
57
|
+
if not cards:
|
|
58
|
+
return ""
|
|
59
|
+
parts = [f"## {c.title}\n{c.body}" for c in cards]
|
|
60
|
+
return ("\nREFERENCE NOTES (curated facts about how this kind of object is really built; follow its proportions "
|
|
61
|
+
"and part list):\n\n" + "\n\n".join(parts) + "\n")
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Car wheel and suspension corner
|
|
3
|
+
keywords: car wheel, wheel, rim, tyre, tire, suspension, brake disc, brake rotor, brake caliper, macpherson, strut, steering knuckle, control arm, wheel hub
|
|
4
|
+
---
|
|
5
|
+
Orientation: the wheel spins around its axle, which runs along X for a car facing Z; the tyre, rim and brake disc are `torus` or `tube` or `cylinder` ops with "rotate": [0, 0, 90] so the axis is X. The tyre touches y = 0.
|
|
6
|
+
|
|
7
|
+
Tyre size reads 205/55 R16: 205 mm section width, sidewall height 55 % of that (113 mm), 16 inch rim (406 mm). Overall diameter = rim + 2 x sidewall = 632 mm. Passenger cars run 600 to 700 mm overall, 175 to 255 mm wide, rims 15 to 19 inch.
|
|
8
|
+
|
|
9
|
+
From the wheel inward, on the axle line:
|
|
10
|
+
- Tyre: rubber, with a tread band and two sidewalls; the section is nearly round at the shoulders.
|
|
11
|
+
- Rim: a barrel the width of the tyre minus about 30 mm, with a flange at each edge, and a spoke face (5 to 10 spokes) dished inward.
|
|
12
|
+
- Hub flange: bolt circle of 4 or 5 studs, usually 5 x 114.3 mm; M12 x 1.5 studs with 17 or 19 mm hex nuts; centre bore about 60 to 73 mm.
|
|
13
|
+
- Brake disc: 280 to 330 mm diameter on a 16 to 18 inch rim, 10 to 12 mm thick solid or 22 to 32 mm ventilated, behind the rim spokes.
|
|
14
|
+
- Brake caliper: a C-shaped body straddling the disc at the top or rear, 40 to 60 mm wide, pads on both sides of the disc.
|
|
15
|
+
- Wheel bearing and steering knuckle: a cast knuckle holds the bearing behind the hub and carries the caliper, the strut and the lower arm.
|
|
16
|
+
|
|
17
|
+
Suspension (MacPherson, the common front layout):
|
|
18
|
+
- Strut: a damper tube 45 to 55 mm in diameter, with a coil spring 120 to 160 mm across around it, running up and slightly inward from the knuckle to a top mount in the wheel arch.
|
|
19
|
+
- Lower control arm: an A- or L-shaped arm from the knuckle to the subframe, two rubber bushings on the car side and a ball joint at the wheel.
|
|
20
|
+
- Tie rod from the steering rack to the knuckle, anti-roll bar link to the strut.
|
|
21
|
+
- Wheel travel: roughly 150 to 200 mm between full droop and full bump; the wheel is vertical or leans 0.5 to 1.5 degrees (negative camber).
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Balanced-arm desk lamp
|
|
3
|
+
keywords: desk lamp, task lamp, balanced arm, balanced-arm, anglepoise, architect lamp, reading lamp, lamp
|
|
4
|
+
rise: arm 35-80
|
|
5
|
+
---
|
|
6
|
+
Orientation: Y is up, the base sits on the desk at y = 0, and the lamp reaches forward over the work surface in +Z.
|
|
7
|
+
|
|
8
|
+
Base: a heavy round or square plate 150 to 200 mm across, 20 to 40 mm thick, 1 to 3 kg of solid steel or cast aluminium, flat on the desk. It must counterweight the extended arm and shade.
|
|
9
|
+
|
|
10
|
+
Pivot: a small boss on the base top, 30 to 50 mm high, carries the lower arm on a vertical pin so the whole arm assembly swings side to side.
|
|
11
|
+
|
|
12
|
+
Arms:
|
|
13
|
+
- Lower arm: 300 to 450 mm, a rectangular aluminium section 20 to 30 mm wide and 30 to 40 mm deep, rising 45 to 75 degrees from horizontal at rest.
|
|
14
|
+
- Elbow: a round joint 40 to 60 mm across at the lower arm's end.
|
|
15
|
+
- Upper arm: 250 to 400 mm, the same section, typically 20 to 60 degrees from horizontal, reaching forward over the desk.
|
|
16
|
+
|
|
17
|
+
Shade: hangs from the upper arm's end on a short yoke, its mouth 350 to 550 mm above the desk, pointing down at the work; 150 to 250 mm deep.
|
|
18
|
+
|
|
19
|
+
Springs: one per arm, each running parallel to its arm right beside it, anchored at both ends of the arm segment; 14 to 20 mm coil diameter on 3 to 4 mm wire.
|
|
20
|
+
|
|
21
|
+
Overall: at rest the lamp stands about 450 to 700 mm tall and reaches 400 to 600 mm forward.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Desktop computer
|
|
3
|
+
keywords: computer, pc, desktop, gaming pc, workstation, tower, case, motherboard, graphics card, gpu, cpu cooler, server, mini pc, itx
|
|
4
|
+
---
|
|
5
|
+
Orientation: the case stands on y = 0. X is its width (the glass side panel faces -X), Z its depth (front panel at +Z).
|
|
6
|
+
|
|
7
|
+
Standard sizes (millimetres):
|
|
8
|
+
- Mid-tower case: about 220 wide, 470 high, 450 deep. Steel panels about 0.8 thick, tempered glass side about 4 thick. Make it hollow with an open or glass side so the build shows.
|
|
9
|
+
- Motherboards: ATX 305 x 244, micro-ATX 244 x 244, mini-ITX 170 x 170, all 1.6 thick, mounted on 6 mm standoffs against the right-hand side panel, rear I/O at the top rear.
|
|
10
|
+
- Rear I/O opening 159 x 44. Expansion slots at the rear: 7 on ATX, 20.32 apart.
|
|
11
|
+
- CPU socket near the top centre of the board; RAM slots (4) just to its right; each DIMM is 133.35 long and about 31 (bare) to 45 (with heat spreader) tall.
|
|
12
|
+
- Tower CPU cooler: a finned aluminium block 120 to 165 tall with copper heat pipes and a 120 mm fan on its side. Or an AIO: a pump block on the CPU and a radiator (120, 240 or 360 long, 27 thick) behind the front or top fans.
|
|
13
|
+
- Graphics card: in the top PCIe x16 slot below the CPU, lying horizontally, 240 to 340 long, about 110 to 140 tall, 2 to 3.5 slots thick (40 to 70); 2 or 3 axial fans of 90 to 100 underneath, a backplate on top.
|
|
14
|
+
- Power supply (ATX): 150 x 86 x 140 to 180, at the bottom rear, often under a shroud.
|
|
15
|
+
- Case fans: 120 x 120 x 25 or 140 x 140 x 25; usually three intake fans at the front, one exhaust at the rear.
|
|
16
|
+
- Storage: M.2 2280 is 22 x 80 on the board; a 2.5 inch SSD is 100 x 70 x 7.
|
|
17
|
+
|
|
18
|
+
Building it: use `grille` for vents and fan grilles, `rotor` (hub_radius about 20, tip_radius 58, 7 to 9 blades) for fans with a square frame (box minus cylinder) around them, `box` for boards and cards, thin boxes for fins arrayed linearly for heat sinks.
|
|
19
|
+
|
|
20
|
+
Materials: black or white painted steel case, smoked glass panel, green or black PCB, aluminium heat sinks, copper heat pipes, matte black plastic fan frames, RGB emissive strips used sparingly.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Electronics board and enclosure
|
|
3
|
+
keywords: circuit board, pcb, electronics, electronic, arduino, raspberry pi, microcontroller, controller board, router, gadget, enclosure, sensor board, motherboard, device, synthesizer, amplifier
|
|
4
|
+
---
|
|
5
|
+
Orientation: the board lies flat in the XZ plane with components on top (+Y); X is its length, Z its width. Millimetres.
|
|
6
|
+
|
|
7
|
+
Board and parts (real sizes):
|
|
8
|
+
- PCB thickness 1.6 (common), green, black or blue solder mask. Mounting holes for M2.5 or M3 screws about 3 from
|
|
9
|
+
the edges.
|
|
10
|
+
- Reference boards: Raspberry Pi 4 is 85 x 56; Arduino Uno is about 68.6 x 53.4.
|
|
11
|
+
- Pin headers: 2.54 pitch; the plastic base is about 2.5 tall, pins rise about 6 above it. Rows sit along an edge.
|
|
12
|
+
- Chips: SOIC-8 body about 4.9 x 3.9 x 1.5; QFP and QFN microcontrollers about 5 x 5 to 14 x 14, about 1 to 1.6
|
|
13
|
+
tall. Small passives (0805) about 2.0 x 1.25; place them in neat rows near the chip they serve.
|
|
14
|
+
- Electrolytic capacitors: cylinders 5 to 10 across, 5 to 12 tall. Crystal: about 11 x 4.5 x 3.5.
|
|
15
|
+
- Connectors on the board edge, overhanging slightly: USB-C receptacle about 9 x 3.3 opening, 7 to 8 deep; RJ45
|
|
16
|
+
about 16 x 13.5 x 21; DC barrel jack about 9 x 11 x 14.
|
|
17
|
+
- Heat sinks: finned aluminium, fins about 1 thick, 2 to 3 apart.
|
|
18
|
+
- Enclosure: walls 2 to 3 thick, 1 to 2 clearance around the board, the board on standoffs 3 to 5 tall; cut-outs in
|
|
19
|
+
the walls line up with the edge connectors.
|
|
20
|
+
|
|
21
|
+
Every part sits on the board surface (y = board top), never floating above it.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Powered exoskeleton
|
|
3
|
+
keywords: exoskeleton, exosuit, exo suit, wearable robot, powered armor, power armor, powered suit, walking assist, exo
|
|
4
|
+
---
|
|
5
|
+
Orientation: the wearer stands along Y, facing +Z, feet on y = 0. Build the frame in a standing pose, symmetric about the x = 0 plane (use a mirror array for the left/right limbs). The frame sits just outside the body, 20 to 40 mm clear of it, and its joint axes line up with the wearer's joints.
|
|
6
|
+
|
|
7
|
+
Joint heights as a fraction of standing height H (Drillis and Contini): ankle 0.04, knee 0.285, hip 0.53, shoulder 0.82, elbow 0.63, wrist 0.485. Segment lengths: thigh 0.245 H, shank 0.246 H, upper arm 0.186 H, forearm 0.146 H. For H = 1.75 m: knee at about 0.50 m, hip at about 0.93 m, shoulder at about 1.43 m. Hip axes of a frame sit roughly 0.35 to 0.45 m apart; make the links adjustable in length by 5 to 10 %.
|
|
8
|
+
|
|
9
|
+
Parts, bottom to top:
|
|
10
|
+
- Foot plates and ankle joint: a rigid sole under or beside each boot, carrying the load into the ground.
|
|
11
|
+
- Shank and thigh links: tubes or flat bars, each with a joint housing at both ends and a cuff or strap pad around the limb.
|
|
12
|
+
- Knee actuator: motor, gearbox and encoder in one housing coaxial with the joint, or a linear actuator along the thigh.
|
|
13
|
+
- Hip actuators: one coaxial with the hip flexion axis; a second joint for abduction is often passive.
|
|
14
|
+
- Pelvis frame and back plate: carries the hip joints, the battery and the controller; a belt or harness ties it to the wearer.
|
|
15
|
+
- Shoulder frame (upper-body or full-body suits): a yoke on the back plate with arm links, a hand tool mount or a load-bearing arm.
|
|
16
|
+
|
|
17
|
+
Actuators: brushless frameless torque motor with a strain-wave (harmonic) gearbox at 50:1 to 120:1, or a quasi-direct-drive motor with a planetary gearbox at 6:1 to 10:1; hydraulic cylinders for heavy loads. Walking needs about 1 N m of joint torque per kg of body mass at hip and ankle.
|
|
18
|
+
|
|
19
|
+
Materials: Ti-6Al-4V (4430 kg/m3, yield about 880 MPa) for joint housings and brackets; 7075-T6 aluminium (2810 kg/m3) for plates; carbon-fibre tube (about 1600 kg/m3), 25 to 40 mm outside diameter with 2 to 3 mm wall, for the long links.
|
|
20
|
+
|
|
21
|
+
Battery: a 24 to 48 V lithium-ion pack of 1 to 3 kg low on the back plate, close to the wearer's centre of mass, so it adds no lever arm. Powered lower-limb suits weigh 12 to 25 kg in total.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: House and floor plan
|
|
3
|
+
keywords: house, home, floor plan, floorplan, bungalow, cabin, cottage, apartment, villa, building, rooms, bedroom, kitchen, residence, architecture
|
|
4
|
+
---
|
|
5
|
+
Orientation: the building stands on y = 0; X is width, Z is depth, front door on the +Z side. Millimetres.
|
|
6
|
+
|
|
7
|
+
Build it the way a plan is drawn: a floor slab, then walls as long thin boxes, then openings cut with boolean
|
|
8
|
+
difference (a door or window is a box subtracted from the wall it sits in), then the roof. Give every room's walls
|
|
9
|
+
or floor its own component named for the room, so the plan and the parts list read as rooms.
|
|
10
|
+
|
|
11
|
+
Typical dimensions (residential, conservative ranges):
|
|
12
|
+
- Floor slab 150 to 200 thick. Ceiling height 2400 to 2700 (finished floor to ceiling).
|
|
13
|
+
- Exterior walls 200 to 300 thick; interior partitions 100 to 120 thick.
|
|
14
|
+
- Interior doors 820 to 920 wide, 2040 to 2100 high; front door about 900 to 1000 wide.
|
|
15
|
+
- Windows: sill about 900 above the floor, head about 2100; typical widths 900 to 1800.
|
|
16
|
+
- Rooms: bedroom at least about 3000 x 3000 (main bedroom 3600 x 4000 or more); bathroom about 1800 x 2400 to
|
|
17
|
+
2400 x 3000; kitchen at least about 2400 wide; living room about 4000 x 5000 or more; hallway 900 to 1200 wide.
|
|
18
|
+
- Stairs: riser 170 to 190, tread (going) 250 to 280, width at least 900.
|
|
19
|
+
- Pitched roof 20 to 45 degrees, eaves overhang 300 to 600; a flat roof has a parapet about 300 to 1000 high.
|
|
20
|
+
- A small single-storey house is often about 10 000 x 8000 to 15 000 x 10 000 overall.
|
|
21
|
+
|
|
22
|
+
Walls must meet at corners (overlap or butt them; never leave gaps), and every room needs a door into it.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Light aircraft
|
|
3
|
+
keywords: plane, airplane, aeroplane, aircraft, cessna, light aircraft, glider, airliner, jet plane, fighter, fuselage, wing, propeller plane, ultralight, drone plane, uav
|
|
4
|
+
---
|
|
5
|
+
Orientation: the aircraft lies along Z with the nose at +Z, wings along X, up is Y; it rests on its landing gear
|
|
6
|
+
at y = 0. Use the `wing` op for the main wing, horizontal tail and fin (a fin is a wing with "mirror": false
|
|
7
|
+
rotated 90 degrees about Z), `loft` or `revolve` for the fuselage and spinner, `rotor` for the propeller.
|
|
8
|
+
|
|
9
|
+
Reference: a Cessna 172 is about 11.0 m span, 8.3 m long and 2.7 m high, with a wing chord about 1.5 m and a
|
|
10
|
+
propeller about 1.9 m across. Use these proportions for a four-seat light aircraft.
|
|
11
|
+
|
|
12
|
+
Proportions and layout (conservative):
|
|
13
|
+
- Wing aspect ratio (span / mean chord) about 6 to 9 for light aircraft, 15 to 30 for gliders. Dihedral 1 to 5
|
|
14
|
+
degrees; sweep near 0 for propeller aircraft. Wing thickness about 12 to 15 % of chord.
|
|
15
|
+
- High wing (on top of the cabin) or low wing (under the floor). The wing sits roughly a quarter to a third of the
|
|
16
|
+
way back from the nose; the centre of gravity is near the wing's quarter chord.
|
|
17
|
+
- Horizontal tail span about a third of the wing span, its area about 15 to 25 % of the wing area; it sits at the
|
|
18
|
+
very back, about 2.5 to 3 mean chords behind the wing. Vertical fin about half the tail span tall.
|
|
19
|
+
- Fuselage widest at the cabin (about 1.0 to 1.2 m for side-by-side seats) and tapering to the tail.
|
|
20
|
+
- Tricycle gear: a nose wheel and two main wheels just behind the centre of gravity; wheels about 400 to 500 across.
|
|
21
|
+
|
|
22
|
+
Materials: painted aluminium skin, clear canopy (glass), black rubber tyres, a metal or composite propeller.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Multirotor drone
|
|
3
|
+
keywords: drone, quadcopter, quadrotor, multirotor, hexacopter, octocopter, fpv, uav, uas
|
|
4
|
+
---
|
|
5
|
+
Orientation: the drone is flat in the XZ plane, up is +Y, front is +Z. Propellers spin around Y, so `cylinder` and `tube` ops need no rotation.
|
|
6
|
+
|
|
7
|
+
Layout (quad X, the usual one): four motors on the corners of a square, arms running diagonally from a central body. Frame size is the diagonal motor-to-motor distance. Neighbouring motors must be at least one propeller diameter apart, so the diagonal is at least 1.41 times the prop diameter; real frames leave a 10 to 25 % margin.
|
|
8
|
+
|
|
9
|
+
Frame size by propeller (typical):
|
|
10
|
+
- 3 inch prop (76 mm): 120 to 150 mm frame.
|
|
11
|
+
- 5 inch prop (127 mm): 210 to 250 mm.
|
|
12
|
+
- 7 inch prop (178 mm): 295 to 330 mm.
|
|
13
|
+
- 10 inch prop (254 mm): 450 to 500 mm.
|
|
14
|
+
- 15 inch prop (381 mm): 650 to 800 mm.
|
|
15
|
+
|
|
16
|
+
Motors: named by stator size, so 2306 is a 23 mm wide, 6 mm tall stator; the bell is a few mm wider and about 30 mm tall overall. Motors spin alternately clockwise and counter-clockwise around the square. Typical KV: 5 inch on 4S to 6S, 1700 to 2700 KV; 7 inch on 6S, 1300 to 1700 KV; 10 inch on 4S, 700 to 1000 KV; 15 inch on 6S, 300 to 500 KV. A larger prop needs a lower KV.
|
|
17
|
+
|
|
18
|
+
Parts:
|
|
19
|
+
- Arms: carbon-fibre plate 3 to 5 mm thick (5 inch) or tube 12 to 25 mm (large frames), bolted to a centre plate.
|
|
20
|
+
- Centre plates: two parallel plates 15 to 30 mm apart carrying the stack; the flight controller and the 4-in-1 ESC board sit on a 30.5 x 30.5 mm bolt pattern (20 x 20 mm on small frames), each board about 36 mm square.
|
|
21
|
+
- Battery: a LiPo brick (4S 1300 to 1500 mAh, about 150 to 200 g, 75 x 35 x 30 mm) on the centre line, under or on top of the plates, so the centre of gravity sits at the middle of the motor square. Heavy payloads hang below.
|
|
22
|
+
- ESCs: on the stack for small drones, or one per arm near the motor on large ones; the flight controller is the middle of the stack.
|
|
23
|
+
- Camera or gimbal at the front, antennas on short mounts at the back, landing legs or a skid under the centre.
|
|
24
|
+
|
|
25
|
+
Weight: a 5 inch freestyle drone is about 600 to 700 g with its battery; thrust is at least twice the weight.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Printing a replica on a Bambu bed
|
|
3
|
+
keywords: 3d print, 3d printer, 3d printed, printable, print replica, replica, printer, fdm, filament, bambu
|
|
4
|
+
---
|
|
5
|
+
Replicator prints at whatever scale fits the bed (its fit functions scale the build uniformly), so design the part at full size and the app fits it. These facts keep a design printable at any scale.
|
|
6
|
+
|
|
7
|
+
Beds: the Bambu X1 Carbon, P1S, P1P and A1 build 256 x 256 x 256 mm; the A1 mini 180 x 180 x 180; the H2D about 350 x 320 x 325 (published figures, to verify on the device). A 2 mm safety margin is kept off the walls and the gantry.
|
|
8
|
+
|
|
9
|
+
Walls and detail: a 0.4 mm nozzle (0.2 on the small machines) is the smallest feature that prints at all. Give every wall at least 0.8 mm (two nozzle lines) and load-bearing parts 1.2 to 2 mm, at full scale. Anything thinner than one nozzle line does not print: railings, mullions, pins and thin fins vanish, and text smaller than about 1 mm disappears, so give details a printable minimum or drop them.
|
|
10
|
+
|
|
11
|
+
Orientation: the part lies flat on the bed. Keep the build's base (its Y-up ground face) flat and as wide as you can, and keep overhangs within about 45 degrees of horizontal or they need supports; prefer drafted, braced shapes. Horizontal spans (bridges) print without support.
|
|
12
|
+
|
|
13
|
+
Scaling: a 1:50 replica of a house is a few tens of millimetres across, so windows, doors and anything smaller than roughly 5 mm at full scale become unprintable slivers; a print-ready design keeps its details chunky. The build stands on its own flat base; a tall thin part (a model rocket) prints standing up, never lying on its side.
|