CloudCompare icon indicating copy to clipboard operation
CloudCompare copied to clipboard

How to access command line mode and call plugins?

Open OH8HO opened this issue 9 years ago • 26 comments

This is a two part question:

  1. 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?
  2. 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!

OH8HO avatar Jun 21 '16 16:06 OH8HO

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.

dgirardeau avatar Jun 21 '16 16:06 dgirardeau

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?

OH8HO avatar Jun 21 '16 17:06 OH8HO

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?

dgirardeau avatar Jun 21 '16 18:06 dgirardeau

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?

OH8HO avatar Jun 21 '16 21:06 OH8HO

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 ;).

dgirardeau avatar Jun 22 '16 19:06 dgirardeau

Would be really nice to have that by the command line. I unfortunately can not do it by myself.

dh81 avatar Jun 23 '16 07:06 dh81

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 ... :)

OH8HO avatar Jun 23 '16 19:06 OH8HO

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...

juliajing72 avatar Nov 10 '16 12:11 juliajing72

Nope, not yet.

dgirardeau avatar Nov 11 '16 10:11 dgirardeau

Good day, I need little help in running Ransac plugin in Command line mode to perform certain tasks.

  1. Execute qRANSAC_SD in command line mode and perform shape detection for cylinder, plane and cones etc for a given point cloud.
  2. Save those separated sub point clouds after shape detection to specific location.

Is it possible? I will be thankful for your help.

Thanks

SHAH920 avatar Nov 15 '17 08:11 SHAH920

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).

dgirardeau avatar Nov 15 '17 20:11 dgirardeau

hi @dgirardeau , are there any news on the abovementioned task? maybe in 2.10? thank you in advance and keep up the good work!

spono avatar Feb 27 '18 14:02 spono

Nope, nobody took this action up to know.

dgirardeau avatar Feb 27 '18 20:02 dgirardeau

Hi @dgirardeau , any progress on @SHAH920 question?

Thanks in advance, you the real mvp!

arsicm avatar May 04 '18 13:05 arsicm

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).

dgirardeau avatar May 04 '18 13:05 dgirardeau

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

damithnh avatar Dec 02 '18 14:12 damithnh

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).

dgirardeau avatar Dec 02 '18 14:12 dgirardeau

I will try to implement this. Thanks for this great software.

damithnh avatar Dec 02 '18 14:12 damithnh

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!

arsicm avatar Dec 04 '18 20:12 arsicm

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!

GreKro avatar Dec 04 '18 21:12 GreKro

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

Pimax18 avatar Jun 11 '19 14:06 Pimax18

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

dgirardeau avatar Jun 14 '19 20:06 dgirardeau

It seems to be a little bit too much for my level ;)

Thank you for your answer !

Pierre

Pimax18 avatar Jun 17 '19 13:06 Pimax18

Hi ! @dgirardeau @damithnh any progress on RANSAC plugin command line interface ?

Thanks

adityapande-1995 avatar Nov 14 '19 06:11 adityapande-1995

Not that I am aware of. Someone needs to do it or to motivate someone else to do it :D

dgirardeau avatar Nov 14 '19 08:11 dgirardeau

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

ryanthara avatar Oct 17 '20 17:10 ryanthara