SALOME error when fusing a lot of spheres and cylinders

Hi,

I've a close-packed sphere (860 spheres) geomerty. Also, I've more than 2700 cylinders that I have created to avoid the mesh error at the contact points. All cylinders are separate from each other to avoid self-intersection errors. But I can't fuse spheres and cylinders as only one part. It gives " Boolean operation aborted : non valid shape result" error. I'm only interested in the outside of geometry. The code written by me on SALOME's Python kernel.

The code and images are attached. Any help would be much appreciated.

Kind regards,
Said.