# VTK file created using Python API is showing missing elements

**URL:** https://discourse.vtk.org/t/vtk-file-created-using-python-api-is-showing-missing-elements/10723
**Category:** Support
**Tags:** python
**Created:** [February 17, 2023, 8:02pm UTC](https://discourse.vtk.org/t/vtk-file-created-using-python-api-is-showing-missing-elements/10723 "2023-02-17T20:02:52Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Renard](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/r/e99b99/32.png) [@Renard](https://discourse.vtk.org/u/Renard)
#### Post date: [February 17, 2023, 8:02pm UTC](https://discourse.vtk.org/t/vtk-file-created-using-python-api-is-showing-missing-elements/10723/1 "2023-02-17T20:02:52Z")

</div>

Hi,  
I’m using the Python API of VTK to convert some Vector data to VTP files. My vector data is in the following format.  
(1) A `coord.out` file, which contains the cell number and the cartesian coordinates of each cell  
(2) A `vector_data.out` file which contains the values of the vectors at each cell point.

I have written a Python script that reads information from these two files and creates a `vtp` file which can be viewed in Paraview and it is working fine in most cases. However, in some specific cases, the vtp files that are written contain some missing elements. Here is a minimum working example in which I could reproduce the error. I’m also attaching two images to highlight the error. In this

 ![image](https://discourse.vtk.org/uploads/default/original/2X/b/bfe88115818121f2dc5cf904a55e11eaf947bfd0.png) the vector data is visualized in our own visualization tool, each sphere indicates a data point with a vector. Here is a screenshot of the same data exported as a vtp file and opened in ParaView  
 ![Paraview_image](https://discourse.vtk.org/uploads/default/original/2X/2/2300bd860ac2a02f4b6556c5b3b771aa1334487a.png). There is one data point missing, which is indicated with a yellow circle. The Python code, the data files, and the vtp file generated are also attached. Can anyone help me identify the issue here? Thanks.

Python code

```auto
"""
16/Feb/2023
* Python script to read the data from the restart
file and to create a VTP file
* Usage: run this code in the directory which contains the
vector_data.out and coord.out files
* Make sure there are only ONE restart and coord files in
the running directory.
"""

import numpy as np
import vtk

coord_file_name = "coord.out" # Contains the cartesian coordinates of the cells/points
restart_file_name = "vector_data.out" # Contains the vector field information at each point/cell
print(f"reading data from: {coord_file_name} and {restart_file_name}")

# read the cord file for cordinates
coord_data = np.loadtxt(coord_file_name)
atom_array = coord_data[:, 0]

file_points = np.column_stack((coord_data[:, 1],
                               coord_data[:, 2],
                               coord_data[:, 3]))

number_of_atoms = len(atom_array)
print(f"number of atoms = {number_of_atoms}")
moment_data = np.loadtxt(restart_file_name)

file_vectors = moment_data[:, 4:]
points = vtk.vtkPoints()
vectors = vtk.vtkFloatArray()
vectors.SetNumberOfComponents(3)
vectors.SetName("vectors")
for point, vector in zip(file_points, file_vectors):
    points.InsertNextPoint(point)
    vectors.InsertNextTuple(vector)
# Create a polydata object and add the points and vectors for the VTK
polydata = vtk.vtkPolyData()
polydata.SetPoints(points)
polydata.GetPointData().SetVectors(vectors)

# Write the polydata to a VTP file
writer = vtk.vtkXMLPolyDataWriter()
fname = str("restart1")+".vtp"
writer.SetFileName(fname)
writer.SetInputData(polydata)
writer.Write()
print (f"Files written: restart1.vtp")
    
    
    

```

coord.out

```auto
      1 0.000000 0.000000 0.000000 1 1
      2 0.000000 0.000000 1.000000 2 2
      3 0.000000 0.000000 2.000000 3 3
      4 0.000000 0.000000 3.000000 4 4
      5 0.000000 0.000000 4.000000 5 5
      6 0.000000 0.000000 5.000000 6 6
      7 0.000000 0.000000 6.000000 7 7
      8 0.000000 0.000000 7.000000 8 8
      9 0.000000 0.000000 8.000000 9 9
     10 0.000000 0.000000 9.000000 10 10
     11 1.000000 0.000000 0.000000 1 1
     12 1.000000 0.000000 1.000000 2 2
     13 1.000000 0.000000 2.000000 3 3
     14 1.000000 0.000000 3.000000 4 4
     15 1.000000 0.000000 4.000000 5 5
     16 1.000000 0.000000 5.000000 6 6
     17 1.000000 0.000000 6.000000 7 7
     18 1.000000 0.000000 7.000000 8 8
     19 1.000000 0.000000 8.000000 9 9
     20 1.000000 0.000000 9.000000 10 10
     21 2.000000 0.000000 0.000000 1 1
     22 2.000000 0.000000 1.000000 2 2
     23 2.000000 0.000000 2.000000 3 3
     24 2.000000 0.000000 3.000000 4 4
     25 2.000000 0.000000 4.000000 5 5
     26 2.000000 0.000000 5.000000 6 6
     27 2.000000 0.000000 6.000000 7 7
     28 2.000000 0.000000 7.000000 8 8
     29 2.000000 0.000000 8.000000 9 9
     30 2.000000 0.000000 9.000000 10 10
     31 0.000000 1.000000 0.000000 1 1
     32 0.000000 1.000000 1.000000 2 2
     33 0.000000 1.000000 2.000000 3 3
     34 0.000000 1.000000 3.000000 4 4
     35 0.000000 1.000000 4.000000 5 5
     36 0.000000 1.000000 5.000000 6 6
     37 0.000000 1.000000 6.000000 7 7
     38 0.000000 1.000000 7.000000 8 8
     39 0.000000 1.000000 8.000000 9 9
     40 0.000000 1.000000 9.000000 10 10
     41 1.000000 1.000000 0.000000 1 1
     42 1.000000 1.000000 1.000000 2 2
     43 1.000000 1.000000 2.000000 3 3
     44 1.000000 1.000000 3.000000 4 4
     45 1.000000 1.000000 4.000000 5 5
     46 1.000000 1.000000 5.000000 6 6
     47 1.000000 1.000000 6.000000 7 7
     48 1.000000 1.000000 7.000000 8 8
     49 1.000000 1.000000 8.000000 9 9
     50 1.000000 1.000000 9.000000 10 10
     51 2.000000 1.000000 0.000000 1 1
     52 2.000000 1.000000 1.000000 2 2
     53 2.000000 1.000000 2.000000 3 3
     54 2.000000 1.000000 3.000000 4 4
     55 2.000000 1.000000 4.000000 5 5
     56 2.000000 1.000000 5.000000 6 6
     57 2.000000 1.000000 6.000000 7 7
     58 2.000000 1.000000 7.000000 8 8
     59 2.000000 1.000000 8.000000 9 9
     60 2.000000 1.000000 9.000000 10 10
     61 0.000000 2.000000 0.000000 1 1
     62 0.000000 2.000000 1.000000 2 2
     63 0.000000 2.000000 2.000000 3 3
     64 0.000000 2.000000 3.000000 4 4
     65 0.000000 2.000000 4.000000 5 5
     66 0.000000 2.000000 5.000000 6 6
     67 0.000000 2.000000 6.000000 7 7
     68 0.000000 2.000000 7.000000 8 8
     69 0.000000 2.000000 8.000000 9 9
     70 0.000000 2.000000 9.000000 10 10
     71 1.000000 2.000000 0.000000 1 1
     72 1.000000 2.000000 1.000000 2 2
     73 1.000000 2.000000 2.000000 3 3
     74 1.000000 2.000000 3.000000 4 4
     75 1.000000 2.000000 4.000000 5 5
     76 1.000000 2.000000 5.000000 6 6
     77 1.000000 2.000000 6.000000 7 7
     78 1.000000 2.000000 7.000000 8 8
     79 1.000000 2.000000 8.000000 9 9
     80 1.000000 2.000000 9.000000 10 10
     81 2.000000 2.000000 0.000000 1 1
     82 2.000000 2.000000 1.000000 2 2
     83 2.000000 2.000000 2.000000 3 3
     84 2.000000 2.000000 3.000000 4 4
     85 2.000000 2.000000 4.000000 5 5
     86 2.000000 2.000000 5.000000 6 6
     87 2.000000 2.000000 6.000000 7 7
     88 2.000000 2.000000 7.000000 8 8
     89 2.000000 2.000000 8.000000 9 9
     90 2.000000 2.000000 9.000000 10 10

```

vector\_data.out

```auto
 #iterens iatom |Mom| M_x M_y M_z
      -1 1 1 2.23000000E+00 9.92080191E-01 2.80639967E-02 1.22430821E-01
      -1 1 2 2.23000000E+00 9.89687981E-01 6.32348809E-02 1.28526459E-01
      -1 1 3 2.23000000E+00 9.87507192E-01 6.39845665E-02 1.43998338E-01
      -1 1 4 2.23000000E+00 9.99952001E-01 6.96513257E-03 6.89082640E-03
      -1 1 5 2.23000000E+00 9.99880449E-01 1.39002110E-02 6.77293142E-03
      -1 1 6 2.23000000E+00 -9.99834880E-01 7.08217242E-03 -1.67348472E-02
      -1 1 7 2.23000000E+00 9.99996243E-01 2.39478993E-03 1.33407110E-03
      -1 1 8 2.23000000E+00 -9.99700866E-01 -1.64301910E-02 -1.81170363E-02
      -1 1 9 2.23000000E+00 9.99325556E-01 3.30329379E-02 1.60392887E-02
      -1 1 10 2.23000000E+00 9.99586786E-01 -2.65954204E-02 1.09059596E-02
      -1 1 11 2.23000000E+00 9.89932200E-01 4.87957695E-02 1.32865394E-01
      -1 1 12 2.23000000E+00 9.91690444E-01 5.44111552E-02 1.16573962E-01
      -1 1 13 2.23000000E+00 9.95527733E-01 2.89385757E-02 8.99282532E-02
      -1 1 14 2.23000000E+00 9.99755365E-01 2.18384998E-02 3.50577120E-03
      -1 1 15 2.23000000E+00 9.99735092E-01 1.20853253E-02 -1.95880049E-02
      -1 1 16 2.23000000E+00 -9.99726960E-01 -1.23219757E-03 2.33342441E-02
      -1 1 17 2.23000000E+00 9.99455439E-01 1.94783670E-02 -2.66349298E-02
      -1 1 18 2.23000000E+00 -9.99888318E-01 -1.22907796E-02 -8.50223813E-03
      -1 1 19 2.23000000E+00 9.99978746E-01 2.68412812E-03 5.94160402E-03
      -1 1 20 2.23000000E+00 9.99988894E-01 3.76324073E-03 2.83733760E-03
      -1 1 21 2.23000000E+00 9.95036321E-01 2.87829252E-02 9.52589221E-02
      -1 1 22 2.23000000E+00 9.93204049E-01 7.62520094E-02 8.79280842E-02
      -1 1 23 2.23000000E+00 9.93971103E-01 6.55367179E-02 8.78998528E-02
      -1 1 24 2.23000000E+00 9.99690667E-01 -6.45548874E-03 2.40186759E-02
      -1 1 25 2.23000000E+00 9.99785320E-01 5.22554682E-03 2.00501495E-02
      -1 1 26 2.23000000E+00 -9.99924518E-01 -6.70090382E-03 -1.02983768E-02
      -1 1 27 2.23000000E+00 9.99980548E-01 -2.98448497E-03 5.47698377E-03
      -1 1 28 2.23000000E+00 -9.99664911E-01 2.54815790E-02 -4.55569720E-03
      -1 1 29 2.23000000E+00 9.99984272E-01 -4.71425411E-03 3.03823812E-03
      -1 1 30 2.23000000E+00 9.99439569E-01 2.11730912E-02 2.59277639E-02
      -1 1 31 2.23000000E+00 9.90037592E-01 5.73724139E-02 1.28584497E-01
      -1 1 32 2.23000000E+00 9.89611065E-01 8.09521689E-02 1.18813659E-01
      -1 1 33 2.23000000E+00 9.93309258E-01 5.14838057E-02 1.03373764E-01
      -1 1 34 2.23000000E+00 9.99223061E-01 3.31665733E-02 2.12897174E-02
      -1 1 35 2.23000000E+00 9.99944778E-01 -5.65687514E-03 -8.85670437E-03
      -1 1 36 2.23000000E+00 -9.99465099E-01 1.80636901E-02 2.72620579E-02
      -1 1 37 2.23000000E+00 9.99898438E-01 1.29073296E-02 -6.04271363E-03
      -1 1 38 2.23000000E+00 -9.99947201E-01 2.26567431E-03 1.00230385E-02
      -1 1 39 2.23000000E+00 9.99942664E-01 -3.02681571E-03 1.02716434E-02
      -1 1 40 2.23000000E+00 9.99880687E-01 1.49532705E-02 -3.87444333E-03
      -1 1 41 2.23000000E+00 9.90874406E-01 2.55661141E-02 1.32341551E-01
      -1 1 42 2.23000000E+00 9.92052315E-01 6.27654185E-02 1.09053688E-01
      -1 1 43 2.23000000E+00 9.94883276E-01 6.74650287E-02 7.52046344E-02
      -1 1 44 2.23000000E+00 9.99893419E-01 6.79238013E-03 1.29233731E-02
      -1 1 45 2.23000000E+00 9.99686412E-01 -1.00579277E-04 -2.50413090E-02
      -1 1 46 2.23000000E+00 -9.99980683E-01 5.57174008E-03 -2.75482373E-03
      -1 1 47 2.23000000E+00 9.99906753E-01 3.58188085E-03 -1.31778168E-02
      -1 1 48 2.23000000E+00 -9.99855227E-01 -2.12095563E-03 -1.68827522E-02
      -1 1 49 2.23000000E+00 9.99706295E-01 -2.39902336E-02 -3.43406882E-03
      -1 1 50 2.23000000E+00 9.98128991E-01 -5.46842778E-02 2.73522717E-02
      -1 1 51 2.23000000E+00 9.96348479E-01 2.33877637E-02 8.21140714E-02
      -1 1 52 2.23000000E+00 9.92999504E-01 6.96498382E-02 9.53985595E-02
      -1 1 53 2.23000000E+00 9.95985592E-01 3.50434104E-02 8.23690484E-02
      -1 1 54 2.23000000E+00 9.99264819E-01 1.31135280E-02 3.60257893E-02
      -1 1 55 2.23000000E+00 9.99996119E-01 2.49960196E-03 1.23039883E-03
      -1 1 56 2.23000000E+00 -9.99617953E-01 -1.27405831E-02 -2.45280576E-02
      -1 1 57 2.23000000E+00 9.99972325E-01 5.70090622E-03 4.78009693E-03
      -1 1 58 2.23000000E+00 -9.99967341E-01 -5.28749961E-03 -6.11215615E-03
      -1 1 59 2.23000000E+00 9.99708532E-01 -1.77261436E-02 1.63900717E-02
      -1 1 60 2.23000000E+00 9.99852518E-01 -1.36503624E-02 -1.04216383E-02
      -1 1 61 2.23000000E+00 9.95671770E-01 5.07067878E-02 7.78880548E-02
      -1 1 62 2.23000000E+00 9.94660253E-01 5.47749131E-02 8.74682245E-02
      -1 1 63 2.23000000E+00 9.94054341E-01 7.57436935E-02 7.82231477E-02
      -1 1 64 2.23000000E+00 9.99436762E-01 3.10893935E-02 1.26336215E-02
      -1 1 65 2.23000000E+00 9.99991416E-01 -3.61005299E-03 2.03346374E-03
      -1 1 66 2.23000000E+00 -9.99771710E-01 2.09079020E-02 4.40307559E-03
      -1 1 67 2.23000000E+00 9.99562300E-01 -1.97757566E-02 -2.20029017E-02
      -1 1 68 2.23000000E+00 -9.99464383E-01 2.26819824E-02 2.35897119E-02
      -1 1 69 2.23000000E+00 9.99789709E-01 1.03860938E-02 -1.76824007E-02
      -1 1 70 2.23000000E+00 9.99504758E-01 2.40226923E-02 -2.03260684E-02
      -1 1 71 2.23000000E+00 9.96582552E-01 8.27045884E-03 8.21876969E-02
      -1 1 72 2.23000000E+00 9.96198224E-01 6.55064037E-02 5.74283079E-02
      -1 1 73 2.23000000E+00 9.93404889E-01 6.23305584E-02 9.62373494E-02
      -1 1 74 2.23000000E+00 9.98917893E-01 2.80054655E-02 -3.71313569E-02
      -1 1 75 2.23000000E+00 9.99923524E-01 -7.14435545E-05 -1.23669380E-02
      -1 1 76 2.23000000E+00 -9.99420244E-01 -2.48519825E-02 2.32713346E-02
      -1 1 77 2.23000000E+00 9.99963789E-01 -7.51129149E-03 -4.00026584E-03
      -1 1 78 2.23000000E+00 -9.99372517E-01 3.49810018E-02 -5.55889274E-03
      -1 1 79 2.23000000E+00 9.99376345E-01 3.31224097E-02 -1.22404150E-02
      -1 1 80 2.23000000E+00 9.98700392E-01 -2.72946713E-02 -4.30410046E-02
      -1 1 81 2.23000000E+00 9.95686561E-01 1.97075118E-02 9.06635870E-02
      -1 1 82 2.23000000E+00 9.93794735E-01 6.09751549E-02 9.30271708E-02
      -1 1 83 2.23000000E+00 9.91160113E-01 8.20697130E-02 1.04241035E-01
      -1 1 84 2.23000000E+00 9.99990167E-01 4.31856347E-03 1.00775365E-03
      -1 1 85 2.23000000E+00 9.99406164E-01 2.39964743E-02 -2.47283003E-02
      -1 1 86 2.23000000E+00 -9.99887431E-01 -1.39303533E-02 5.57403669E-03
      -1 1 87 2.23000000E+00 9.99934245E-01 -2.68869047E-03 -1.11479042E-02
      -1 1 88 2.23000000E+00 -9.99971920E-01 6.49882384E-03 3.73144785E-03
      -1 1 89 2.23000000E+00 9.99945078E-01 9.82881943E-03 -3.63814442E-03
      -1 1 90 2.23000000E+00 9.99556516E-01 -2.77188054E-02 -1.08829705E-02

```

restart1.vtp

```auto
<?xml version="1.0"?>
<VTKFile type="PolyData" version="0.1" byte_order="LittleEndian" header_type="UInt32" compressor="vtkZLibDataCompressor">
  <PolyData>
    <Piece NumberOfPoints="90" NumberOfVerts="0" NumberOfLines="0" NumberOfStrips="0" NumberOfPolys="0" >
      <PointData Vectors="vectors">
        <DataArray type="Float32" Name="vectors" NumberOfComponents="3" format="appended" RangeMin="0.99999997185" RangeMax="1.0000000297" offset="0" />
      </PointData>
      <CellData>
      </CellData>
      <Points>
        <DataArray type="Float32" Name="Points" NumberOfComponents="3" format="appended" RangeMin="0" RangeMax="9.4339811321" offset="1436" />
      </Points>
      <Verts>
        <DataArray type="Int64" Name="connectivity" format="appended" RangeMin="" RangeMax="" offset="1708" />
        <DataArray type="Int64" Name="offsets" format="appended" RangeMin="" RangeMax="" offset="1724" />
      </Verts>
      <Lines>
        <DataArray type="Int64" Name="connectivity" format="appended" RangeMin="" RangeMax="" offset="1740" />
        <DataArray type="Int64" Name="offsets" format="appended" RangeMin="" RangeMax="" offset="1756" />
      </Lines>
      <Strips>
        <DataArray type="Int64" Name="connectivity" format="appended" RangeMin="" RangeMax="" offset="1772" />
        <DataArray type="Int64" Name="offsets" format="appended" RangeMin="" RangeMax="" offset="1788" />
      </Strips>
      <Polys>
        <DataArray type="Int64" Name="connectivity" format="appended" RangeMin="" RangeMax="" offset="1804" />
        <DataArray type="Int64" Name="offsets" format="appended" RangeMin="" RangeMax="" offset="1820" />
      </Polys>
    </Piece>
  </PolyData>
  <AppendedData encoding="base64">
   _AQAAAACAAAA4BAAAIQQAAA==eJwNk3tQlGUUxmMgUEouIWCDjBE2EJQXMhTe93BQEdBiUUSwUcO85AhIMuDd/V6562IGrbeQAmkxDFjDRQb2e5cvZDHTSALM4RIrcQmVIChxvQB9/5555jznPL9zzGYlHhwcoJaGZ7B4sxLXpKVBcqFl0KrmoxhrmwERqU5BXS8YGkk/Sf6ll/iYGdYYttMDo3+QBY+ZlO84RLJcT/CGaYZDY3PJdJc2cOcwkwrPZ/MF8ad5cxvDkxE20L4jgz7qZ6jp6eAPtH7UL1GJTj1h0DNrRtAekxJJz8cQXT8CQ50Cnnf4myreqQXzKMPvBq9S54adRDPCMMcilFofKOZuI0yqSruo3+cl0bXdDF/PL6JscSfXmpkUEreaP/3wFX5hiqHf0ELyc9V1EirPVl28nxSPBxCdXkDfW4/oXNdGKFohoKVPIWicqqE/VUD3Zdlwz6oa9I8Y5h9vE1uuG+nIGEMHUk78gzXU7jmTlqu7xGy9N9fL/T86t1JcdVBHbB8ySapvoY/DzohmuT7jcIH4rnsYCe1iuDilku7/tJ26pSgxZjoeysotg7xilRh8qxTU0f9C5moBr9yPguJrbeDczLCiwwZu7NLSbXLmkVvqxBo3Rz7ezSTFMzXVRpvoxqcMQw6tp48tboiqF0y6dmQ2qVg6nwbJetWWUHHnGm+6QGaUN5VK4x4qxfHLSrTZ+xvNzbQJmv9Eid65x0AVa4KKHwR081VBn1UBWMk9v/6yh5zi62mKvLvrSGttkmcz51NMektdQ0JVS8R+WTNpiCdNf8XyjAkmidO2oi5CxX8cZuibY+Tudp+I27IYFr2IM5gc79OrDgyvnpNoom8ZLH1fQLXmFERtbYQHZgG1J+zBraoMWu8wnNcZQ3/6wgkkmdGWFk+yYdXFwIlBJvUa1nLH0Zt8kZxn+a96srmkkHRPMqlxRaV4JPymOCj7Jvjn80Mh2TRmgmFTaRzPknz4xn4Bh6si4UZGEdiVCHh501ZQvamDjYcFTJ93Afa9VwwuMpeFV6Zo8KSC7pV9NWcTxe6VLxPbMSa9GlZOK8PyyLo++eZfKuFJWM0H5fzz79RRf2ygy8YZfubjQ6905vFcE0O4baRd6Zf4zDcYth6zodZRZdBhzTDAOxvGAxLgZqSA0QoGLnOawLmOYW3CAJ3lOscw+Yzhk7Yztbpv1nCLTiZtP3ub53xbT4snGYZ7TIiXZ2eIvb8zCcLtIc6rRvS4J+dTbgPWJ8N5+/cMnb4yceMHiwzrBgS8lHyR3q2sgw27BXRpOAQzsuqhnCvRZ3YZrD96FzbJO/L0z0mBS2agcwfD5aeN1EJ9ixfJ/+JJd/Ddl2pI1XOG9UsWibpSf/62zN3lv3aiyE0lu+S7sp/pQUf3JIn//Cn/8mt9XKnw4/8DiM0T9g==AQAAAACAAAA4BAAAugAAAA==eJxt0oGNgCAMBdCO4EZXN2OUjsIojHLxkuKTnAnxCZpPixH/XeOHh4R44MITLxz3y+v+ZrSf+57P14kHLjzxwkHWk2s97b/1ZC7f3P0OLjzxwkHWdX/rPGs1/3HigQtPvHCQ1X0+++voPnfuXsOFJ144yOo+n2dpXvd515tvbrvwxAsHWd3n84zdh+eceODCEy8cZO3/2XM4arbuxAMXnnjhIGv/z+4rv5mOxAMXnnj5PVnX/QvOpXAeAAAAAACAAAAAAAAAAAAAAACAAAAAAAAAAAAAAACAAAAAAAAAAAAAAACAAAAAAAAAAAAAAACAAAAAAAAAAAAAAACAAAAAAAAAAAAAAACAAAAAAAAAAAAAAACAAAAAAAAA
  </AppendedData>
</VTKFile>

```

---

<div class="post-metadata">

### Author: ![dgobbi](https://discourse.vtk.org/user_avatar/discourse.vtk.org/dgobbi/32/18_2.png) [@dgobbi](https://discourse.vtk.org/u/dgobbi)
#### Post date: [February 17, 2023, 11:01pm UTC](https://discourse.vtk.org/t/vtk-file-created-using-python-api-is-showing-missing-elements/10723/2 "2023-02-17T23:01:04Z")

</div>

The vtp file is missing. You can paste it as text if discourse doesn’t allow you to upload it.

---

<div class="post-metadata">

### Author: ![Renard](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/r/e99b99/32.png) [@Renard](https://discourse.vtk.org/u/Renard)
#### Post date: [February 18, 2023, 12:18pm UTC](https://discourse.vtk.org/t/vtk-file-created-using-python-api-is-showing-missing-elements/10723/3 "2023-02-18T12:18:53Z")

</div>

I have added the VTP files.

---

<div class="post-metadata">

### Author: ![dgobbi](https://discourse.vtk.org/user_avatar/discourse.vtk.org/dgobbi/32/18_2.png) [@dgobbi](https://discourse.vtk.org/u/dgobbi)
#### Post date: [February 19, 2023, 2:44am UTC](https://discourse.vtk.org/t/vtk-file-created-using-python-api-is-showing-missing-elements/10723/4 "2023-02-19T02:44:40Z")

</div>

The ,vtp file looks fine. You might have uncovered a bug in the glyph filter (either in ParaView or in VTK itself).

To see that all the points are there, add vert cells so that you can see the points without glyphing:

```python
cells = vtk.vtkCellArray()
for point, vector in zip(file_points, file_vectors):
    i = points.InsertNextPoint(point)
    cells.InsertNextCell(1)
    cells.InsertCellPoint(i)
    vectors.InsertNextTuple(vector)

# Create a polydata object and add the points and vectors for the VTK
polydata = vtk.vtkPolyData()
polydata.SetPoints(points)
polydata.SetVerts(cells)
polydata.GetPointData().SetVectors(vectors)

```

---

<div class="post-metadata">

### Author: ![Renard](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/r/e99b99/32.png) [@Renard](https://discourse.vtk.org/u/Renard)
#### Post date: [February 19, 2023, 5:07pm UTC](https://discourse.vtk.org/t/vtk-file-created-using-python-api-is-showing-missing-elements/10723/5 "2023-02-19T17:07:52Z")

</div>

Hi,  
Thanks. This modification is working fine. Do you think it is helpful to report this bug? Should I make another post for that?

---

<div class="post-metadata">

### Author: ![dgobbi](https://discourse.vtk.org/user_avatar/discourse.vtk.org/dgobbi/32/18_2.png) [@dgobbi](https://discourse.vtk.org/u/dgobbi)
#### Post date: [February 19, 2023, 7:37pm UTC](https://discourse.vtk.org/t/vtk-file-created-using-python-api-is-showing-missing-elements/10723/6 "2023-02-19T19:37:01Z")

</div>

I’ve checked the .vtp file and it contains all the points and vectors, the vtkGlyph3D filter doesn’t have any problem with it either. So you can try posting the .vtp and your screenshot to the ParaView issue tracker to see what they think.
