Hi Alessia - I’ve created RH-57580 for a developer to take a look.
Note that this does not mean that this can be fixed and even if it can, it will be something that will go into Rhino 7 or beyond. You are running Rhino 5 and thus need to find a way around this.
When you run the
Intersect command on a pair of the objects, you will notice that several curves are returned. One of these curves is closed and can be used to trim surfaces that can then be used to create a closed polysurface. I don’t know if that is something that you can use as a post-process in your code.
An alternative would be to work on making cleaner input. Without knowing anything about the design history, the green objects seem to be unnecessarily messy. It would seem that simple lines and arcs could be used to create geometry that won’t have problems with the Boolean operation: