Dear python users,
I need to create vtu file from python so I can use paraview on it.I am using python version 3.6 but I have tried and ended up with the same error with python-2.7 -"No module named 'vtk'". This is the code I found on internet and that I am currently using (btw I installed vtk 7.1.1 and I am using windows 7):
###############
import pygmsh
import numpy as np
import meshio
geom = pygmsh.built_in.Geometry()
# Draw a cross.
poly = geom.add_polygon([
[0.0, 0.5, 0.0],
[-0.1, 0.1, 0.0],
[-0.5, 0.0, 0.0],
[-0.1, -0.1, 0.0],
[0.0, -0.5, 0.0],
[0.1, -0.1, 0.0],
[0.5, 0.0, 0.0],
[0.1, 0.1, 0.0]
],
lcar=0.05
)
axis = [0, 0, 1]
geom.extrude(
poly,
translation_axis=axis,
rotation_axis=axis,
point_on_axis=[0, 0, 0],
angle=2.0 / 6.0 * np.pi
)
points, cells, point_data, cell_data, field_data = pygmsh.generate_mesh(geom)
meshio.write('test.vtu', points, cells, cell_data=cell_data)
##################
Can anyone help me? It seems to be very hard but I believe in python forum programmers
