You can achieve what you want with merge breps from rhinocommon. There is command in rhino, and heres code in gh