PlugIn Examples

For any question about plugins!
daniel
Site Admin
Posts: 7332
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: PlugIn Examples

Post by daniel »

To remove an entity, simply call 'removeFromDB' in mainwindow.cpp, and 'm_app->removeFromDB' in a plugin (m_app gives you access to most components of CloudCompare from the plugin by the way).

An alternative is to disable the entities instead of deleting them (in the case the user made a mistake or wants to use them later).

ccMesh is a child of the ccHObject class (as all 3D entities). You can have a look at the code documentation on the 'Documentation' page of the website (see http://www.cloudcompare.org/doc/qCC_db/ ... tated.html for instance). There's all the libraries and the CloudCompare application. However it's a bit outdated, so it may be a good idea to generate the documentation on your side. It's very easy:
- download doxygen
- start it and select the doxygen file in the 'doc' folder of the part of the project you are interested in (there's no extension, generally it's called XXX_doxygen_file)
- run doxygen and you'll get a nice up-to-date html documentation (you only have to do it once)
Daniel, CloudCompare admin
Charlesw
Posts: 45
Joined: Mon Apr 10, 2017 3:54 pm

Re: PlugIn Examples

Post by Charlesw »

If someone uses the load file button, the program adds their file to the DB using addToDB.

How do you use the code to access elements within the DB?

I do not see many functions outside of find(UniqueID), to pull elements from the DB for use while coding unless the user selects the item themselves.

I did run doxygen, worked fine, definitely added more to the documentation.

I could probably pass with the find() function, however I am unclear on how to obtain the UniqueID for different elements in the db tree if they were imported using your current file->load command from the menu...
daniel
Site Admin
Posts: 7332
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: PlugIn Examples

Post by daniel »

Well, the mainwindow class is meant to be used 'by the user' and thus only the selected entities are considered by the functions. There are only a few cases when CC needs to find specific entities inside the DB (and generally it selects them by their type for instance).

It would be easier to keep track of specific entities into a plugin (as you can have your own loading dialog and then store a reference or at least the unique ID of the files you have loaded this way).

Otherwise it's relatively easy to go through all the entities to select the ones you are interested in. But how are you going to recognize them? By their name?
Daniel, CloudCompare admin
Post Reply