CloudCompare-PythonPlugin
CloudCompare-PythonPlugin copied to clipboard
Assign RGB color to polyline, point, mesh
hello Thomas,
inside CC 2.13.2, your example to assign color to polyline won’t work....
import pycc
import cccorelib
import numpy as np
CC = pycc.GetInstance()
VERTICES = np.array([
[-0.5, -0.5, 0],
[1, 1, 0],
[2, 2, 0]
])
vertices = pycc.ccPointCloud(VERTICES[:, 0], VERTICES[:, 1], VERTICES[:, 2])
polyline = pycc.ccPolyline(vertices)
polyline.setColor(pycc.Rgb(255, 0, 0)) # set the color to red
polyline.showColors(True)
polyline.setClosed(False)
# This is important, otherwise the polyline would have a size of 0
polyline.addPointIndex(0, 3)
CC.addToDB(polyline)
CC.updateUI()
polyline.getDisplay().display3DLabel("Hello, world", cccorelib.CCVector3(1, 1,0))
this is the error:
AttributeError: module 'pycc_runtime' has no attribute 'Rgb'
At:
<string>(14): <module>
Is possibile to correct the code ? How to assign color to point and mesh ?
thanks Mario