Page 1 of 1

Bulid newgroup

Posted: Wed Jul 13, 2016 12:14 am
by snfge
Hi
When I run my code , I want to bulid a newgroup with my own name, and add the objects to the newgroup, or add the objects to the exist group, how can do it with code? thank you.

Re: Bulid newgroup

Posted: Wed Jul 13, 2016 8:04 am
by snfge
Hi
For another problem, how can I traverse all the objects in the DBtree and list the names?

Re: Bulid newgroup

Posted: Thu Jul 14, 2016 7:14 am
by daniel
A group is simple a ccHObject:

Code: Select all

ccHObject* group = new ccHObject("Group name");
Then add the entities to this group as children (addChild).

And to access the DB tree objects from a plugin, see the qPCV plugin (qPCV.cpp, line 132). There's no example of how to traverse the whole set of entities, but it shouldn't be too hard to implement.