-
Hi! Im trying to merge multiple lines and points into a mesh, then render the lines as tubes connecting the points instead of lines. Creating and merging the mesh is done the following way: import vedo as v
...
#Creates the mesh with only points at coordinates 'coord'
elements = v.Mesh([coord, None])
for i in range(nel):
# Coordinates for line ends are stored in an array, disregard this part
coord1,coord2 = tools.get_coord_from_edof(edof[i,:],dof)
dx = coord[coord2,0] - coord[coord1,0]
dy = coord[coord2,1] - coord[coord1,1]
dz = coord[coord2,2] - coord[coord1,2]
x = coord[coord1,0] + 0.5*dx
y = coord[coord1,1] + 0.5*dy
z = coord[coord1,2] + 0.5*dz
# Lines are created and merged with the existing mesh
elements = v.merge([elements, v.Line(p0=[x-0.5*dx,y-0.5*dy,z-0.5*dz], p1=[x+0.5*dx,y+0.5*dy,z+0.5*dz])]) The mesh works and is rendered correctly appart from still being lines. This is despite renderLinesAsTubes() used on the mesh: self.vp += elements.renderLinesAsTubes(True) Here 'self.vp' is the vedo plotter. I've also tried changing the global settings like this: v.settings.renderLinesAsTubes = True Am I doing anything wrong? Is the 'renderLinesAsTubes()'-function applied incorrectly? I find it confusing that the global settings are not even working in that case, and suspect something else is wrong. I've tried using the function on the mesh after the merge is done, i.e. after the loop in the first code-snippet. Also tried using it when the mesh is created, both give the same result however. Thanks in advance for any replies! EDIT:
So the function seems to be doing something, and yet the lines are not rendered as tubes. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
Hi Andreas from vedo import *
s = Sphere(res=4)
s.lw(20).lc('orange8').renderLinesAsTubes()
show(s, axes=1) make sure you have the latest |
Beta Was this translation helpful? Give feedback.
-
Yes, these are not "real" lines (in computer graphics are called "impostors" if i remember..), they simulate a tube but there is nothing physical there...
Yes, I'm afraid... you can still create your tubes and associate a constant scalar id to all points/cells of these cylinders, so once you merge them you'll be able to use |
Beta Was this translation helpful? Give feedback.
Yes, these are not "real" lines (in computer graphics are called "impostors" if i remember..), they simulate a tube but there is nothing physical there...
Yes, I'm afraid... you can still create your tubes and associate a constant scalar id to all points/cells of these cylinders, so once you merge them you'll be able to use
cmap()