Skip to content

Commit 341b0ce

Browse files
authored
Fix 3mf export on scenes with multiple nodes with same geometry (#2473)
- Change 3mf file used on round trip test to cover the case - Fixed by getting model id of the geometry instead of the node, if available
2 parents 57d48b9 + 533c6e7 commit 341b0ce

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

models/pyramids.3mf

32.2 KB
Binary file not shown.

tests/test_3mf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ def test_roundtrip(self):
5757

5858
# test a scene round-tripped through the
5959
# 3MF exporter and importer
60-
s = g.get_mesh("cycloidal.3DXML")
61-
assert len(s.geometry) == 13
60+
s = g.get_mesh("pyramids.3mf")
61+
assert len(s.geometry) == 6
6262

6363
# export and reload
6464
r = g.trimesh.load(

trimesh/exchange/threemf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,7 @@ def model_id(x):
420420
etree.Element(
421421
"item",
422422
{
423-
"objectid": model_id(node),
423+
"objectid": model_id(data.get('geometry', node)),
424424
"transform": transform,
425425
uuid_tag: str(uuid.uuid4()),
426426
},

0 commit comments

Comments
 (0)