79420507

Date: 2025-02-07 10:21:51
Score: 0.5
Natty:
Report link

With the nearest neighbor method from scipy one can find the nearest vertex and then assign the color or other things to the sliced mesh.

from scipy.spatial import cKDTree

if hasattr(mesh.visual, 'vertex_colors') and mesh.visual.vertex_colors is not None:
        tree = cKDTree(mesh.vertices)
        _, indices = tree.query(cut_mesh.vertices)
        cut_mesh.visual.vertex_colors = mesh.visual.vertex_colors[indices]
Reasons:
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (0.5):
Posted by: SGKlee