### set object as Active
#bpy.context.scene.objects.active = bpy.data.objects['Cube.'+objNumber]
### add Boolean and set the target to Cube
bpy.ops.object.modifier_add(type='BOOLEAN')
bpy.context.object.modifiers["Boolean"].object = bpy.data.objects["Bool.Box"]
### to_mesh - for some reason doesn't work
#bpy.context.object.to_mesh(scene = bpy.context.scene, apply_modifiers = True, settings = 'PREVIEW')
bpy.ops.object.modifier_apply(apply_as='DATA', modifier="Boolean")
vertexCount = len(bpy.context.object.data.vertices)
print(vertexCount)
if vertexCount == 0:
bpy.ops.object.delete(use_global=False)
if vertexCount > 0:
bpy.ops.object.group_link(group='Group')