feat: harden CAD showcase skill and delivery pipeline

This commit is contained in:
2026-07-10 09:21:13 +08:00
parent a6856f903d
commit 8b1b1d5e89
53 changed files with 5405 additions and 1327 deletions

View File

@@ -23,7 +23,7 @@ def parse_args() -> argparse.Namespace:
if "--" in argv:
argv = argv[argv.index("--") + 1 :]
else:
argv = []
argv = argv[1:]
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("--meshes", required=True, help="Mesh JSON from extract_ifc_meshes.py")
parser.add_argument("--out-dir", required=True)
@@ -149,7 +149,9 @@ def main() -> int:
try:
import bpy # type: ignore
except ImportError as exc:
raise SystemExit("Run this script with Blender: blender -b --python render_ifc_meshes_blender.py -- --meshes ...") from exc
raise SystemExit(
"Run this script with Blender: blender -b --python render_ifc_meshes_blender.py -- --meshes ..."
) from exc
payload = json.loads(Path(args.meshes).read_text(encoding="utf-8"))
out_dir = Path(args.out_dir)
out_dir.mkdir(parents=True, exist_ok=True)
@@ -171,7 +173,17 @@ def main() -> int:
bpy.ops.export_scene.gltf(filepath=str(glb_path), export_format="GLB")
bpy.context.scene.render.filepath = str(png_path)
bpy.ops.render.render(write_still=True)
print(json.dumps({"blend": str(blend_path), "glb": str(glb_path), "png": str(png_path), "mesh_objects": [obj.name for obj in objects]}, ensure_ascii=False))
print(
json.dumps(
{
"blend": str(blend_path),
"glb": str(glb_path),
"png": str(png_path),
"mesh_objects": [obj.name for obj in objects],
},
ensure_ascii=False,
)
)
return 0