tmontaigu / CloudCompare-PythonRuntime

Python plugin for CloudCompare
55 stars 15 forks source link

impossible to assign normals to points #84

Closed mariolino007 closed 9 months ago

mariolino007 commented 11 months ago

with this code it is not possible to assign values to the normals in the cloud and then update the database

import numpy as np import pycc cc = pycc.GetInstance() x = np.random.rand(1000) y = np.random.rand(1000) z = np.random.rand(1000) pc = pycc.ccPointCloud(x, y, z) normals = np.random.rand(1000, 3) normals_magnitude = np.linalg.norm(normals, axis=1, keepdims=True) normals /= normals_magnitude pc.reserveNormals(1000) pc.addNormal(normals) pc.setName("new") cc.addToDB(pc, autoExpandDBTree=False) cc.updateUI()

many thanks

tmontaigu commented 11 months ago

Thats expected, you are trying to call functions which do not exists, I'll add the functions wich could allow you to do that

tmontaigu commented 11 months ago

Finally found time to add it in https://github.com/tmontaigu/CloudCompare-PythonPlugin/pull/85

To use, in your example add


pc = pycc.ccPointCloud(x, y, z)

normals = np.random.rand(1000, 3)
normals_magnitude = np.linalg.norm(normals, axis=1, keepdims=True)
normals /= normals_magnitude
pc.reserveTheNormsTable()
pc.addNormals(normals[:, 0], normals[:, 1], normals[:, 2])

Do you compile the plugin yourself or use the prodived installer .

mariolino007 commented 10 months ago

I have installed a recent version of cloudcompare 'latest beta release: 2.13.beta (7 Jan 2024)' from www.cloudcompare.org but the addNormals function is still not working for me. I have also tried the exe https://u.pcloud.link/publink/show?code=XZW75aVZYzubajT4VVJJ0mfn9rCsBRRxEBTk but I cannot get cloudcompare to see it. Unfortunately I don't have the skills to compile from your source code myself. Can you maybe do an update of the package within the next downloadable release from www.cloudcompare.org ? thank you very much

tmontaigu commented 10 months ago

Yes i will generate a newer installer and ping you when its done

tmontaigu commented 10 months ago

The latest installer is update (same link in readme)

mariolino007 commented 10 months ago

many thanks for your help, but unfortunately I cannot install your program in any way even after your new compilation: CloudCompare-PythonPlugin-Setup-English-Python9-Venv.msi

I installed CC with date "Jan 18 2024" without the package of your plugin included in CC, I installed afterwards your exe in the folder "C:\Program Files\CloudCompare\plugins" but CC at startup does not recognise the plugin.

I uninstalled everything

I installed your plugin first in the folder "C:\Program Files\CloudCompare\plugins", I installed CC with date "Jan 18 2024" without your plugin package included at startup but CC at startup does not recognize the plugin.

I uninstalled everything

i installed your plugin first in the folder "C:\Program Files\CloudCompare\plugins" i copied all the unzipped files to another folder

I uninstalled everything

i installed CC with the date "Jan 18 2024" with your plugin package included, i overwritten the old files with the new unzipped ones i had kept in another folder but CC at startup does not recognize the plugin.

I don't know what else to try ...... From a comparison I noticed that your new plugin has 6867 files 539 folders and about 161 MB, while the one included in CC has 17686 files 1619 folders and about 546 MB in the CC version there are many libraries included.

Thank you Mariolino

tmontaigu commented 10 months ago

Ah I see, I recently changed the name of the plugin, I probably forgot some things which broke the installer

I'll fix that

tmontaigu commented 10 months ago

Ok so the installer is updated, and should properly work now

mariolino007 commented 10 months ago

Hi Thomas, now it works fine, I managed to install the new version even now I see two environments, I must try to install CC without the included plugin !!! Now the function to assign normals works fine! Many thanks Mariolino