Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assign RGB color to polyline, point, mesh #125

Open
mariolino007 opened this issue Sep 23, 2024 · 17 comments
Open

Assign RGB color to polyline, point, mesh #125

mariolino007 opened this issue Sep 23, 2024 · 17 comments

Comments

@mariolino007
Copy link

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

@tmontaigu
Copy link
Owner

Yes that is normal because the python runtime that is within CloudCompare 2.13 is old and does not have these functions

@mariolino007
Copy link
Author

verified with 2.14 built 29/9/2024
the error persist

AttributeError: module 'pycc_runtime' has no attribute 'Rgb'

At:
(14):

Error

@tmontaigu
Copy link
Owner

Hum that is because the version of the python runtime that is is CC's installer is also too old

Maybe you could try using the installer that is linked in the readme

@mariolino007
Copy link
Author

there is something like this

import sys
print(sys.version)
import platform
print(platform.python_version())

to check the python runtime version ?

I need to be able to assign RGB color to points, polyline and mesh, possibly I will open a request to daniel on CC forum for a make a new build with updated python runtime environment....

@tmontaigu
Copy link
Owner

No there is no way to check the version of the CloudCompare python bindings

@mariolino007
Copy link
Author

unfortunately not even in the latest version of CC (2.14.alpha 10/14/2024) the script for the color wont works, how can I solve the problem ? What can I ask Daniel to get the correct version of CloudCompare-PythonRuntime implemented ? Can I ask you if you are sure that the part of your code on this aspect is correct can you verify it ?

Thanks

@tmontaigu
Copy link
Owner

I'll verify

@mariolino007
Copy link
Author

Unfortunately, it does not work even in version 2.14 of 04/11/2024...

@tmontaigu
Copy link
Owner

Yes because it seems its still not using the latest version of the runtime

What you can do is download the runtime installer from here https://u.pcloud.link/publink/show?code=XZlNs00Z5koREF3zkzSSFRmBs9tQUFj5Cq97
and use it to install the latest version (you may have to first run it to uninstall the current version first then re-run it to install)

@dgirardeau
Copy link
Collaborator

Is the latest version of the runtime compatible with the latest 'sf_double' branch? I'm mostly waiting for this plugin to work with this branch to merge and update everything...

@tmontaigu
Copy link
Owner

I'll do it this week end

@tmontaigu
Copy link
Owner

I have this double-sf it compiles and works, but it needs a bit more work to be more robust and also some tests

@dgirardeau
Copy link
Collaborator

Thanks. Can I still issue a new 'alpha' release or should I wait a little bit more?

@tmontaigu
Copy link
Owner

Should wait that I confirm there is no trivial bug

@tmontaigu
Copy link
Owner

I just pushed some small fixes, you can try to have a new alpha

@dgirardeau
Copy link
Collaborator

Perfect

@dgirardeau
Copy link
Collaborator

Ok, it's now online!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants