Skip to content

Commit 35fecec

Browse files
committed
bug fix for mesh ids with overlapping names
1 parent 141ec16 commit 35fecec

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

fdsreader/simulation.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -313,9 +313,11 @@ def _load_mesh(self, smv_file: TextIO, line: str) -> Mesh:
313313
if mesh_id == other_mesh.id: # first mesh with same id
314314
mesh_id = mesh_id + "_1"
315315
else: # n-th mesh with same id
316-
other_mesh_id, last_num = other_mesh.id.split("_")
317-
if other_mesh_id == mesh_id and last_num.isdigit():
318-
mesh_id = mesh_id + "_" + str(int(last_num) + 1)
316+
# apply increment, only if the naming of the mesh id allows for it
317+
if len(other_mesh.id.split("_")) == 2:
318+
other_mesh_id, last_num = other_mesh.id.split("_")
319+
if other_mesh_id == mesh_id and last_num.isdigit():
320+
mesh_id = mesh_id + "_" + str(int(last_num) + 1)
319321

320322
mesh = Mesh(coordinates, extents, mesh_id)
321323

0 commit comments

Comments
 (0)