Skip to content

Commit d59d071

Browse files
committed
Using NLIST when ValueError
1 parent 03bbcb8 commit d59d071

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/ansys/mapdl/core/mesh/mesh.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -133,10 +133,7 @@ def _parse_vtk(
133133
tshape_label = SHAPE_MAP[tshape_num]
134134
type_ref[etype_ind] = TARGE170_MAP.get(tshape_label, 0)
135135

136-
nodes, angles = mesh.nodes, mesh.node_angles
137-
# mesh.nodes include midside nodes whereas mesh.nnum does not.
138-
# So let's use mapdl.nlist()
139-
nnum = mesh._mapdl.nlist(kinternal="internal").to_array()[:, 0].astype(np.int32)
136+
nodes, angles, nnum = mesh.nodes, mesh.node_angles, mesh.nnum
140137

141138
offset, celltypes, cells = _reader.ans_vtk_convert(
142139
mesh._elem, mesh._elem_off, type_ref, nnum, True
@@ -161,7 +158,13 @@ def _parse_vtk(
161158
grid = pv.UnstructuredGrid(offset, cells, celltypes, nodes, deep=True)
162159

163160
# Store original ANSYS element and node information
164-
grid.point_data["ansys_node_num"] = nnum
161+
try:
162+
grid.point_data["ansys_node_num"] = nnum
163+
except ValueError:
164+
grid.point_data["ansys_node_num"] = (
165+
mesh._mapdl.nlist(kinternal="internal").to_array()[:, 0].astype(np.int32)
166+
)
167+
165168
grid.cell_data["ansys_elem_num"] = mesh.enum
166169
grid.cell_data["ansys_real_constant"] = mesh.elem_real_constant
167170
grid.cell_data["ansys_material_type"] = mesh.material_type

0 commit comments

Comments
 (0)