Skip to content

mapping cell and point data deletion #819

Answered by marcomusy
19kdc3 asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @19kdc3 try:

pip install -U git+https://github.com/marcomusy/vedo.git

then use move=False, e.g.:

from vedo import *

mesh1 = Mesh(dataurl+'icosahedron.vtk').linewidth(0.1).flat()

mesh1.pointdata["Yscalars_p"] = mesh1.points()[:, 1]
mesh1.pointdata["Zscalars_p"] = mesh1.points()[:, 2]
mesh1.celldata[ "Zscalars_c"] = mesh1.cell_centers()[:, 2]

print("-------- Before:")
mesh2 = mesh1.clone(deep=False)
print("pointdata", mesh2.pointdata.keys())
print("celldata",mesh2.celldata.keys())

print("-------- After:")
mesh2.map_points_to_cells(['Zscalars_p'], move=False)
print("pointdata",mesh2.pointdata.keys())
print("celldata",mesh2.celldata.keys())

Output:

-------- Before:
pointdata ['Normals…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@19kdc3
Comment options

Answer selected by marcomusy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants