Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions AUTHORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,4 @@
- Eric Gozzi <<eric.gozzi@arch.ethz.ch>> [@ericgozzi](https://github.com/ericgozzi)
- Daniel Nunes Locatelli <<nuneslocatelli@arch.ethz.ch>> [@daniel-locatelli](https://github.com/daniel-locatelli)
- Mengxi He <<m.he@lekolabs.com>> [@mengxihex](https://github.com/mengxihex)
- Arian Moeini <<arianmoeini11@gmail.com>> [@ArianMoeini](https://github.com/ArianMoeini)
2 changes: 1 addition & 1 deletion src/compas/datastructures/volmesh/volmesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ def __data__(self):
"cell": {str(cell): faces for cell, faces in _cell.items()},
"edge_data": self._edge_data,
"face_data": self._face_data,
"cell_data": {str(cell): attr for cell, attr in self._cell_data},
"cell_data": {str(cell): attr for cell, attr in self._cell_data.items()},
"max_vertex": self._max_vertex,
"max_face": self._max_face,
"max_cell": self._max_cell,
Expand Down
12 changes: 12 additions & 0 deletions tests/compas/datastructures/test_volmesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,18 @@ def test_volmesh_data():
assert VolMesh.validate_data(other.__data__)


def test_volmesh_cell_attributes_survive_json_roundtrip(halfface):
cells = list(halfface.cells())
halfface.cell_attribute(cells[0], "material", "mycelium")
halfface.cell_attribute(cells[-1], "density", 0.5)

restored = compas.json_loads(compas.json_dumps(halfface))

assert restored.cell_attribute(cells[0], "material") == "mycelium"
assert restored.cell_attribute(cells[-1], "density") == 0.5
assert restored.__data__["cell_data"] == halfface.__data__["cell_data"]


# ==============================================================================
# Builders
# ==============================================================================
Expand Down