Skip to content

Can't set cell_data scalars in UnstructuredGrid #1355

@James-Woodford

Description

@James-Woodford

Hello,

I have some code that I use to write an UnstructuredGrid mesh to vtk. I have been using Python 3.10, mayavi 4.8.2, and vtk 9.3.0 for some time without issues. I recently upgraded the mayavi version to 4.8.3 and vtk to 9.5.0 and get the following error after the code below

        unstructured_grid = tvtk.UnstructuredGrid(points=points)
        unstructured_grid.set_cells(cell_types, offset, cell_array)
       
        unstructured_grid.cell_data.sclars = cell_data  # <-- error occurs at this line when trying to access UnstructuredGrid.cell_data
        unstructured_grid.cell_data.sclars.name = 'MaterialID'

        writer = tvtk.UnstructuredGridWriter(file_name=self.filename)
        writer.set_input_data(unstructured_grid)
        writer.update()
        writer.write()

traits.trait_errors.TraitError: Cannot set the undefined 'copy_global_ids' attribute of a 'CellData' object.

Any help would be awesome! I tried installing mayavi from the master brance (I think the version is 4.8.4dev0) and the issue sticks around. I also get the same error if I try python 3.12

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions