1) You can do it as any other plugin creating new point clouds: use the 'm_app' member of the plugin (all plugins have it and it is automatically initialized by CC when the plugin is loaded) and call:
The entity will be automatically displayed in the active 3D view.
As the dummy plugin states, most of the (authorized) interactions with the application are done with this 'm_app' member (see the ccMainAppInterface
class for all its methods). If necessary it's always possible to add new methods.
2) To retrieve a point cloud that is already in the DB tree, you have several options.
a) The most common (in CC) is to let the user select the cloud, and then call the plugin action (see how it works with the simple 'qPCV' plugin for instace). You just have to ask to 'm_app' the selected entities:
Code: Select all
const ccHObject::Container& selectedEntities = m_app->getSelectedEntities();
Then check that the selected entities are indeed what you are expecting (by the way you can enable or disable the plugin action based on the current selection - see the 'onNewSelection' method that can be re-implemented).
b) Another option is to let the user choose among a list of candidate entities. qPCV also does this:
Code: Select all
ccHObject* root = m_app->dbRootObject();
root->filterChildren(clouds, true, CC_TYPES::POINT_CLOUD);
for (size_t i = 0; i < clouds.size(); ++i)
c) Lastly, if it's an entity your plugin already 'know' about (because it has a specific name, or it has already been processed by the plugin) then you can try to find it. Once again via the 'dbRootObject' object returned by 'm_app'. You can either find an entity via it's unique ID (see ccHObject::find). Or you can look recursively at the DB tree contents and look 'manually' for an entity with a given name, etc.
Don't hesitate to ask for more specific questions if necessary.