You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to implement the solution in #253 to color a triangular mesh by face color. Some of the time, the solution as is works great, but some of the time the coloring returns to the default with no change to the code. using
import numpy as np
from mayavi import mlab
import time
# Create cone
n = 8
t = np.linspace(-np.pi, np.pi, n)
z = np.exp(1j*t)
x = z.real.copy()
y = z.imag.copy()
z = np.zeros_like(x)
triangles = [(0, i, i+1) for i in range(n)]
x = np.r_[0, x]
y = np.r_[0, y]
z = np.r_[1, z]
t = np.r_[0, t]
# These are the scalar values for each triangle
f = np.mean(t[np.array(triangles)], axis=1)
# Plot it
mesh = mlab.triangular_mesh(x, y, z, triangles,
representation='wireframe',
opacity=0)
mesh.mlab_source.dataset.cell_data.scalars = f
mesh.mlab_source.dataset.cell_data.scalars.name = 'Cell data'
mesh.mlab_source.update()
mesh.parent.update()
mesh2 = mlab.pipeline.set_active_attribute(mesh,
cell_scalars='Cell data')
s2 = mlab.pipeline.surface(mesh2)
mlab.show()
as my script and simply running "python /path/to/script.py" multiple times produces different results. This is on OSX using qt 5.6.2 as the backend and python 3.5.4
The text was updated successfully, but these errors were encountered:
Thanks for the example. On mayavi master I am unable to reproduce this and each time I run the script I get the same result. Can you please try with master or a recent release and let me know how it goes.
Hi, I just pulled master and reinstalled with the same results. Sometimes when I run the default shading is used as if no colors have been specified. Sometimes I run and it shows the correct shading. This is really odd... Also sorry about the delay. For some reason I never got a notification someone had responded.
Never mind, it seems to be working now. I had to create an entirely new environment but it seems to produce the same results every time now. I guess there was something funky in one of the dependencies in the environment I was using.
I am trying to implement the solution in #253 to color a triangular mesh by face color. Some of the time, the solution as is works great, but some of the time the coloring returns to the default with no change to the code. using
as my script and simply running "python /path/to/script.py" multiple times produces different results. This is on OSX using qt 5.6.2 as the backend and python 3.5.4
The text was updated successfully, but these errors were encountered: