@@ -185,12 +185,18 @@ def dpf_mesh_to_vtk_op(mesh, nodes=None, as_linear=True):
185185 celltypes_pv = mesh_to_pyvista .outputs .cell_types ()
186186 if VTK9 :
187187 grid = pv .UnstructuredGrid (cells_pv , celltypes_pv , nodes_pv )
188- setattr (grid , "_dpf_cache_op" , [cells_pv , celltypes_pv , nodes_pv ])
188+ # setattr(grid, "_dpf_cache_op", [cells_pv, celltypes_pv, nodes_pv])
189+ pv .set_new_attribute (
190+ obj = grid , name = "_dpf_cache_op" , value = [cells_pv , celltypes_pv , nodes_pv ]
191+ )
189192 return grid
190193 else :
191194 offsets_pv = mesh_to_pyvista .outputs .offsets ()
192195 grid = pv .UnstructuredGrid (offsets_pv , cells_pv , celltypes_pv , nodes_pv )
193- setattr (grid , "_dpf_cache_op" , [cells_pv , celltypes_pv , nodes_pv , offsets_pv ])
196+ # setattr(grid, "_dpf_cache_op", [cells_pv, celltypes_pv, nodes_pv, offsets_pv])
197+ pv .set_new_attribute (
198+ obj = grid , name = "_dpf_cache_op" , value = [cells_pv , celltypes_pv , nodes_pv , offsets_pv ]
199+ )
194200 return grid
195201
196202
@@ -350,7 +356,10 @@ def compute_offset():
350356
351357 # Quick fix required to hold onto the data as PyVista does not make a copy.
352358 # All of those now return DPFArrays
353- setattr (grid , "_dpf_cache" , [node_coordinates , coordinates_field ])
359+ # setattr(grid, "_dpf_cache", [node_coordinates, coordinates_field])
360+ pv .set_new_attribute (
361+ obj = grid , name = "_dpf_cache" , value = [node_coordinates , coordinates_field ]
362+ )
354363
355364 return grid
356365
0 commit comments