pushpull returns a status indicator for the operation, not the entities created by the operation, so panne is nothing you can add to a group. That’s the cause of the error message.
you should create the group first then add and manipulate your geometry within the group’s entities collection (this order of operations is recommended in the API docs).
the line entities=model.active_entities likely doesn’t do what you expect. It returns the edit context (model, group’s entities, or component’s entities) currently open for edit in the model. So, the group you are creating will be nested in whatever context is open at the time you invoke your method.
@TIG
going further…
is there somewhere a simple tutorial for creating an icon to call my panne_delard function with a window in which i can fill for the parameters ( without opening the ruby console ) ?
I assume largeur and hauter are dimensions [aka ‘lengths’] ?
And if pente is an angle in degrees - to use that = pente.degrees, which turns it into radians for coding use…
Not sure what ‘plat’ represents ? If it’s Z ‘level’ use a ‘length’ like 0.0.cm ??
SketchUp’s Ruby API is very aggressive about deleting empty groups. So, you should have something (typically a cpoint) ready before you create the group and add that something to the group’s entities immediately after creating the group. If it was purely a temporary for this purpose, you can erase the something later after you have added the real content. Doing it that way avoids any possibility that SU will kill the group before you get around to adding content.