Skip to content

armgit / SOMA

Public Imported from GitHub
0

Desktop app for designing parametric 3D models in CadQuery together with the coding agent of your choice

soma: Kennzeichen solid im GLB für die Schnittansicht

Kai-Jungsthoefelad6f66607200
diff --git a/python/soma/build.py b/python/soma/build.py
index 1dd4ab4..1a1e623 100644
--- a/python/soma/build.py
+++ b/python/soma/build.py
@@ -166,7 +166,8 @@ def write_outputs(root, parts, project_name):
bbox=[[round(bb.xmin, 3), round(bb.ymin, 3), round(bb.zmin, 3)],
[round(bb.xmax, 3), round(bb.ymax, 3), round(bb.zmax, 3)]],
volume=round(p["shape"].Volume(), 3)))
- glb_parts.append(dict(meta=dict(partId=pid, name=p["name"], role=p["role"], group=group),
+ # solid: geschlossener Koerper. Nur dann fuellt der Viewer die Schnittflaeche (bei offenen Flaechen waere das falsch)
+ glb_parts.append(dict(meta=dict(partId=pid, name=p["name"], role=p["role"], group=group, solid=bool(p["shape"].Solids())),
mesh=mesher.mesh_shape(p["shape"], tol, 0.3), color=p["color"]))
glb_size = mesher.write_glb(root / ".soma" / "model.glb", glb_parts)
(root / ".soma" / "model.map.json").write_text(
diff --git a/python/soma/preview.py b/python/soma/preview.py
index 593fdfa..5e560ca 100644
--- a/python/soma/preview.py
+++ b/python/soma/preview.py
@@ -48,7 +48,7 @@ def step_to_glb(step_path, out_dir):
bbox=[[round(bb.xmin, 3), round(bb.ymin, 3), round(bb.zmin, 3)],
[round(bb.xmax, 3), round(bb.ymax, 3), round(bb.zmax, 3)]],
volume=round(shape.Volume(), 3)))
- glb_parts.append(dict(meta=dict(partId=pid, name=name, role="basic", group=groups[i]),
+ glb_parts.append(dict(meta=dict(partId=pid, name=name, role="basic", group=groups[i], solid=bool(shape.Solids())),
mesh=mesher.mesh_shape(shape, tol, 0.3), color=rgba))
mesher.write_glb(out / "model.glb", glb_parts)
(out / "model.map.json").write_text(json.dumps(dict(version=0, build=build_id, parts=map_parts), indent=1, ensure_ascii=False), encoding="utf-8")