Block and symbol visibility

Block and symbol visibility
 1draw = impact.active_drawing
 2if not draw.isNone():
 3    ot = impact.gui.output_toolbox
 4    lay = draw.active_layer
 5
 6    # toggle the visibility of a specific block, if it exists
 7    blockname = "DAL"
 8    blk = lay.blocks.item(blockname)
 9    if not blk.isNone():
10        blk.visible = not blk.visible
11    else:
12        ot.add("Block '" + str(blockname) + "' not found in this layer")
13
14    # toggle the visibility of a specific symbol, if it exists
15    symbolname = "GRIFF"
16    sym = draw.symbols.item(symbolname)
17    if not sym.isNone():
18        sym.visible = not sym.visible
19    else:
20        ot.add("Symbol '" + str(symbolname) + "' not found in this drawing")