@@ -133,10 +133,7 @@ def _parse_vtk(
133
133
tshape_label = SHAPE_MAP [tshape_num ]
134
134
type_ref [etype_ind ] = TARGE170_MAP .get (tshape_label , 0 )
135
135
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
140
137
141
138
offset , celltypes , cells = _reader .ans_vtk_convert (
142
139
mesh ._elem , mesh ._elem_off , type_ref , nnum , True
@@ -161,7 +158,13 @@ def _parse_vtk(
161
158
grid = pv .UnstructuredGrid (offset , cells , celltypes , nodes , deep = True )
162
159
163
160
# 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
+
165
168
grid .cell_data ["ansys_elem_num" ] = mesh .enum
166
169
grid .cell_data ["ansys_real_constant" ] = mesh .elem_real_constant
167
170
grid .cell_data ["ansys_material_type" ] = mesh .material_type
0 commit comments