Determining the active block

Determining the active block
 1# This script determines which block is the active
 2# block in the active layer. If a block is not active
 3# the 'root block' of the active layer will be the
 4# active block.
 5
 6blocks = impact.active_drawing.active_layer.blocks
 7
 8for block in blocks:
 9    if block.active:
10        impact.gui.output_toolbox.add("Block " + block.full_name + " is active")
11
12if impact.active_drawing.active_layer.root_block.active:
13    impact.gui.output_toolbox.add("The root block is active")