docs: 更新V2版机器人手臂零件设计说明与渲染截图

This commit is contained in:
cbb
2026-09-27 00:28:49 +08:00
parent 1dfd48278b
commit b3d0890809
67 changed files with 9122 additions and 264 deletions
+28 -22
View File
@@ -10,27 +10,33 @@ try:
except Exception:
pass
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
from armcore import WEB, DOCS
from armcore import WEB, DOCS, WORKSPACE
SRC = os.path.dirname(os.path.abspath(__file__))
three = io.open(WEB + "/three_inline.js", encoding="utf-8").read()
assert len(three) > 400000, len(three)
data = io.open(WEB + "/mesh_arm.json", encoding="utf-8").read()
sheets = io.open(WEB + "/sheets.jsdata", encoding="utf-8").read()
col = io.open(DOCS + "/collision.json", encoding="utf-8").read() if os.path.exists(
DOCS + "/collision.json") else "[]"
trv = io.open(DOCS + "/travel.json", encoding="utf-8").read() if os.path.exists(
DOCS + "/travel.json") else "[]"
tpl = io.open(SRC + "/viewer_tpl.html", encoding="utf-8").read()
out = (tpl.replace("/*__THREE__*/", three)
.replace("/*__DATA__*/", data)
.replace("/*__SHEETS__*/", sheets)
.replace("/*__COL__*/", col)
.replace("/*__TRAVEL__*/", trv))
assert "/*__" not in out, [l for l in out.split("\n") if "/*__" in l][:3]
dst = WEB + "/机器人手臂3D查看器.html"
io.open(dst, "w", encoding="utf-8").write(out)
io.open(WEB + "/index.html", "w", encoding="utf-8").write(out)
print("viewer %s %.2f MB (three %.0f KB + data %.0f KB + sheets %.0f KB)" % (
dst, os.path.getsize(dst) / 1e6, len(three) / 1024, len(data) / 1024, len(sheets) / 1024))
os._exit(0)
def rebuild_viewer():
three = io.open(WEB + "/three_inline.js", encoding="utf-8").read()
assert len(three) > 400000, len(three)
data = io.open(WEB + "/mesh_arm.json", encoding="utf-8").read()
sheets = io.open(WEB + "/sheets.jsdata", encoding="utf-8").read()
col = io.open(DOCS + "/collision.json", encoding="utf-8").read() if os.path.exists(
DOCS + "/collision.json") else "[]"
trv = io.open(DOCS + "/travel.json", encoding="utf-8").read() if os.path.exists(
DOCS + "/travel.json") else "[]"
tpl = io.open(SRC + "/viewer_tpl.html", encoding="utf-8").read()
out = (tpl.replace("/*__THREE__*/", three)
.replace("/*__DATA__*/", data)
.replace("/*__SHEETS__*/", sheets)
.replace("/*__COL__*/", col)
.replace("/*__TRAVEL__*/", trv))
assert "/*__" not in out, [l for l in out.split("\n") if "/*__" in l][:3]
dst = WEB + "/机器人手臂3D查看器.html"
io.open(dst, "w", encoding="utf-8").write(out)
io.open(WEB + "/index.html", "w", encoding="utf-8").write(out)
io.open(WORKSPACE + "/机器人手臂3D查看器.html", "w", encoding="utf-8").write(out)
print("viewer %s (and in %s) %.2f MB (three %.0f KB + data %.0f KB + sheets %.0f KB)" % (
dst, WORKSPACE, os.path.getsize(dst) / 1e6, len(three) / 1024, len(data) / 1024, len(sheets) / 1024))
if __name__ == "__main__":
rebuild_viewer()
os._exit(0)