add a new command line

Feel free to ask any question here
Post Reply
Tyyrem
Posts: 4
Joined: Fri Oct 15, 2021 3:02 pm

add a new command line

Post by Tyyrem »

Hey Daniel !
I'm trying to automatize a method to filter colors on a cloud, I saw we can do it through a conversion rgb to sf, and then filter the sf. However, it seems that the command RGB_CONVERT_TO_SF has not been created yet.

I have basic programming skills, so maybe I would be able to add it if you gave me some indications, or an example of how you added the command SF_CONVERT_TO_RGB, I could copy it a little ;)

Thanks a lot !
daniel
Site Admin
Posts: 7711
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: add a new command line

Post by daniel »

Ah, indeed it should be relatively easy to add.

The main 'command line' class is ccCommandLineCommands (.h/.cpp). You can for instance look at 'CommandSFConvertToRGB' and 'CommandConvertNormalsToSFs'.

The first one will help you see how colors are handled, and the second one will help you mimic a command line option that converts something (here, normals) to 3 scalar fields.

To simplify your work, I added an intermediary ccEntityAction::sfFromColor method that takes 5 booleans as input parameters: exportR, exportG, exportB, exportAlpha, and exportComposite (see the latest code on the master branch).

Hopefully the rest shouldn't be too hard.
Daniel, CloudCompare admin
daniel
Site Admin
Posts: 7711
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: add a new command line

Post by daniel »

And once you'll have created your own 'CommandConvertRFBToSFs' sub-class or something equivalent, don't forget to 'register' it in the ccCommandLineParser::registerBuiltInCommands() method. That should be all.
Daniel, CloudCompare admin
Tyyrem
Posts: 4
Joined: Fri Oct 15, 2021 3:02 pm

Re: add a new command line

Post by Tyyrem »

Ok thanks ! I'll try to do it then ;)
Post Reply