[vtkusers] Cannot recover user defined vtkInformation from vtkUnstructuredGrid
David Gobbi
david.gobbi at gmail.com
Sun Dec 3 19:19:00 EST 2017
Before you load the data, re-make the keys so that VTK will register them
as valid keys:
quantity_key = keys.MakeKey(vtk.vtkInformationStringKey, "Quantity", "1")
increment_key = keys.MakeKey(vtk.vtkInformationIntegerKey, "Increment", "2")
# the keys are defined now, so you should be able to load the data
On Sun, Dec 3, 2017 at 4:00 PM, scotsman60 <doug at beachmailing.com> wrote:
> Hello!!
>
> I'm using the Python API to vtk and I'm unable to import custom
> vtkInformation from a vtkUnstructuredGrid.
>
> First of all I'm associating custom information to CellData in a
> vtkUnstructuredGrid using the following code - where self.mesh is the
> vtkUnstructuredGrid
>
> #Add the information keys
> info = densityScalars.GetInformation()
>
> # First the Quantity type
> quantity_key = keys.MakeKey(vtk.vtkInformationStringKey, "Quantity",
> "1")
> quantity_key.Set(info, "Topology Density")
>
> #Now the Increment number
> increment_key = keys.MakeKey(vtk.vtkInformationIntegerKey,
> "Increment",
> "2")
> increment_key.Set(info, increment)
>
>
> #Add the array to the mesh
> self.mesh.GetCellData().AddArray(densityScalars)
>
>
> Later I save the vtkUnstructuredGrid using vtkUnstructuredGridWriter, then
> Import it into a new Python session (Basically my program uses the
> vtkUnstructuredGrid as its persistence mechanism.........)
>
> When I read the grid using vtkUnstructuredGridReader I get a whole bunch of
> warnings from vtk
>
> Warning: In ..\IO\Legacy\vtkDataReader.cxx, line 2668
> vtkUnstructuredGridReader (00000000044D7520): Could not locate key
> 2::Increment. Is the module
> in which it is defined linked?
>
> Warning: In ..\IO\Legacy\vtkDataReader.cxx, line 2907
> vtkUnstructuredGridReader (00000000044D7520): Ignoring line in
> INFORMATION block: DATA 1
>
> Warning: In ..\IO\Legacy\vtkDataReader.cxx, line 2668
> vtkUnstructuredGridReader (00000000044D7520): Could not locate key
> 2::Increment. Is the module
> in which it is defined linked?
>
> Warning: In ..\IO\Legacy\vtkDataReader.cxx, line 2907
> vtkUnstructuredGridReader (00000000044D7520): Ignoring line in
> INFORMATION block: DATA 2
>
> Warning: In ..\IO\Legacy\vtkDataReader.cxx, line 2668
> vtkUnstructuredGridReader (00000000044D7520): Could not locate key
> 1::Quantity. Is the module in
> which it is defined linked?
>
> Warning: In ..\IO\Legacy\vtkDataReader.cxx, line 2907
> vtkUnstructuredGridReader (00000000044D7520): Ignoring line in
> INFORMATION block: DATA
> Topology%20Density
>
>
> Any ideas on what's going on here?
>
> Thanks in advance,
>
> Doug
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20171203/c92008fb/attachment.html>
More information about the vtkusers
mailing list