It's been a long time I try to convert all components into groups by ruby... See here...
Yes, thomthom, bug appears when parent of entities to group are not model.
I have made a set of tools for components and groups. One of these tools can convert one component into a group. It also works with sub components!! It works because you have to select it before conversion, and if you want to select, you have to enter in the first component. So SU parent is the component definition... so 'model.entities.add_group' works. Now tool I want to create could convert ALL components into groups. It works well with components with model parent, but there is a bug with the other components....
Sorry for my poor english it's quite difficult to explain clearly what I noticed !