How to access command line mode and call plugins?
This is a two part question:
- I've been trying to figure out how to use the command line mode with little luck thus far. I'm using windows and mac. Do we access the command line mode through CC or do we simply called it from terminal/CMD?
- Assuming question #1 is a breeze and I can now ask CC to do something in command line mode, is it possible to use plugins like M3C2 (M3C2 is windows only)?
Thanks!
Indeed you have to call the 'command line' mode from a (system) console (e.g. 'cmd' on Windows, not sure how to start this on a Mac).
Then to call the M3C2 plugin, I made changes recently so that the plugins are now loaded even in command line mode. But then one needs to modify the code to be able to call this plugin, input parameters, etc.
Thanks I've got CC running from CMD. Which code would I need to modify to call the plugin? QM3C2_PUGIN_DLL.dll or something else?
To work properly, we should create a generic mechanism to issue commands to a plugin.
A specific syntax like '-plugin:{plugin_name}'. Then all the commands after this one would be passed to the plugin.
On the plugin side (ccStdPluginInterface), we can add a generic method (e.g. 'parseCommand') that would take the remaining commands as argument. This way the plugin will be able to process its own commands and all the specific code will be on the plugin side.
Eventually you would be able to implement the specific command processing for qM3C2 easily.
Do you want me to setup this mechanism? Will you be able then to implement the specific command line process for qM3C2?
Just to clarify. The idea being that we could write:
CloudCompare -O file_1.las -O file_2.las -plugin:qM3C2 arg1:arg2:arg3
That would be incredibly helpful. M3C2 has quiet a few arguments, would it be too difficult to have access to most of them?
Yes, or to keep the syntax the same as for the other tools, it may be something like:
CloudCompare -O file_1.las -O file_2.las -plugin:qM3C2 -option1 arg1.1 arg1.2 -option2 arg2 etc.
We would have to figure out how to specify to M3C2 which cloud should be used. And indeed there's a lot of options. This is why I wondered if you were ready to implement the command line process yourself for M3C2 ;).
Would be really nice to have that by the command line. I unfortunately can not do it by myself.
I wish I could do this by myself but I wouldn't know the first thing about building command line tools. That being said I'd love to know more and if you have some pointers ... :)
Hi, I was wondering whether M3C2 is now available to be called via command line? and what is the command to do that? I've tried a few but doesn't seem to recognize M3C2...
Nope, not yet.
Good day, I need little help in running Ransac plugin in Command line mode to perform certain tasks.
- Execute qRANSAC_SD in command line mode and perform shape detection for cylinder, plane and cones etc for a given point cloud.
- Save those separated sub point clouds after shape detection to specific location.
Is it possible? I will be thankful for your help.
Thanks
Right now this is not possible. Someone needs to develop the interface method to process a dedicated command in the plugin (quite simple actually, it just takes time).
hi @dgirardeau , are there any news on the abovementioned task? maybe in 2.10? thank you in advance and keep up the good work!
Nope, nobody took this action up to know.
Hi @dgirardeau , any progress on @SHAH920 question?
Thanks in advance, you the real mvp!
Well, it is now technically possible to 'instrument' plugins so that they can be called through the command line. However, one still has to produce the instrumentation code. And up to now, this has not been done (afaik).
Hi @dgirardeau , I would like to work on Ransac plugin to make it run in Command line mode. Could you please let me know what should I do? Thank you
In the plugin code, you have to implement the "registerCommands" method.
This method must register a "ccCommandLineInterface::Command" instance that will be capable of detecting the right command line options and call the plugin/process with the right parameters.
See how it is done in Canupo for instance: https://github.com/CloudCompare/CloudCompare/blob/master/plugins/core/qCanupo/qCanupo.h#L45 https://github.com/CloudCompare/CloudCompare/blob/master/plugins/core/qCanupo/qCanupo.cpp#L509
You will probably need to reorganize the plugin code a little bit, so that the same function is called in the case the command line or the GUI version calls the plugin (i.e. make a 'process' object or method that takes the parameters as input and returns the results as output).
I will try to implement this. Thanks for this great software.
Hi @brabbit640 , I think that this functionality will be valuable tool for bulk proccessing (for example in my thesis rooftop plane segmentation). Unfortenately I don't have experience i cpp coding so I cannot help in that instance. If you need help in testing solution, I can provide assistance.
Keep me in the loop. Cheers!
Hi ! I completely agree with @arsicm , this functionality will be very useful in the automatic detection of pipes and circles. I can help with tests too, due to lack of experience in cpp coding. Best regards!
Hello everyone !
I would like to make RANSAC run in command line mode too. I'm a beginner in coding but I would like to make some runs of RANSAC with different parameters (min support points per primitive, max distance to primitive and overlooking probability) by using Python. The aim would be to compare the differents outputs (with "export plane info") from all runs with Python to determine the best parameters that suits to my using (detecting facade walls from buildings).
Does someone have an idea of how to do that ? @damithnh ?
Thanks a lot,
Pierre
Sorry I missed your question!
Basically, to support the command line, one should override the 'registerCommands(ccCommandLineInterface* cmd)' in the plugin, and pass a ccCommandLineInterface instance that will be able to detect the dedicated option in the command line input, and of course apply the process.
See how it is done in the M3C2 plugin for instance: https://github.com/CloudCompare/CloudCompare/blob/master/plugins/core/Standard/qM3C2/qM3C2.cpp#L104 https://github.com/CloudCompare/CloudCompare/blob/master/plugins/core/Standard/qM3C2/src/qM3C2Commands.h
It seems to be a little bit too much for my level ;)
Thank you for your answer !
Pierre
Hi ! @dgirardeau @damithnh any progress on RANSAC plugin command line interface ?
Thanks
Not that I am aware of. Someone needs to do it or to motivate someone else to do it :D
Indeed you have to call the 'command line' mode from a (system) console (e.g. 'cmd' on Windows, not sure how to start this on a Mac).
Just use the open command with the right set of parameters.
Example: open -a CloudCompare.app --args -O Users/path/to/the/cloud1 -O Users/path/to/the/cloud2 -MERGE_CLOUDS