Open smoothumut opened 1 year ago
Sorry for the late reply, this really looks like a bug... but I could not spot the problem for now. A workaround is to add m.pointdata.remove("PointsRGBA") m.pointcolors[idpoint] = [255,0,0,255]
On Mon, 31 Jul 2023 at 15:10, smoothumut @.***> wrote:
Hi Marco, I have struggling with coloring points using vedo. I have changed your example like below in order to use point colors and it looks it have a problem. I couldnt figure out what the problem is eventhough I checked pointcolors definitions in your pointcloud class. somehow it doesnt figure out after first assignment
the code is here
"""Colorize a mesh cell by clicking on it""" from vedo import Mesh, Plotter, dataurl
Define the callback function to change the color of the clicked cell to red
def func(evt): msh = evt.actor if not msh: return pt = evt.picked3d
idcell = msh.closest_point(pt, return_cell_id=True)
# m.cellcolors[idcell] = [255,0,0,255] #RGBA idpoint = msh.closest_point(pt,return_point_id=True) m.pointcolors[idpoint] = [255,0,0,255]
Load a 3D mesh of a panther from a file and set its color to blue
m = Mesh(dataurl + "panther.stl").c("blue7")
Make the mesh opaque and set its line width to 1
m.force_opaque().linewidth(1)
Create a Plotter object and add the callback function to it
plt = Plotter() plt.add_callback("mouse click", func)
Display the mesh with the Plotter object and the docstring
plt.show(m, doc, axes=1).close()
thanks in advance
— Reply to this email directly, view it on GitHub https://github.com/marcomusy/vedo/issues/908, or unsubscribe https://github.com/notifications/unsubscribe-auth/AH2TUB2KYTOLOPPCIP443YTXS6VFRANCNFSM6AAAAAA26HUSYY . You are receiving this because you are subscribed to this thread.Message ID: @.***>
-- Dr. Marco Musy Sharpe Laboratory, room 563 CRG - Center for Genomic Regulation
C/ Dr. Aiguader 88, E-08003 Barcelona tel. +34933160185, fax. +34933160099
Thanks a lot Marco, I have worked with cellcolors instead of pointcolors this time. But If I need to use pointcolors, I will definitely use this workaround, thanks a lot again and have a good day Best Regards
Hi Marco, I have struggling with coloring points using vedo. I have changed your example like below in order to use point colors and it looks it have a problem. I couldnt figure out what the problem is eventhough I checked pointcolors definitions in your pointcloud class. somehow it doesnt figure out after first assignment
the code is here
thanks in advance