Removing a bridge

Removing a bridge
 1# Create a local variable for the output toolbox
 2ot = impact.gui.output_toolbox
 3
 4# Clear the output toolbox
 5ot.clear()
 6
 7# Create a local variable for the active drawing
 8ad = impact.active_drawing
 9
10# Check that there is an active drawing
11if not ad.isNone():
12
13    # Create a local variable for the active block
14    ab = ad.active_layer.active_block
15
16    # Create a local variable for the entity to edit
17    entity = ab.entities.item(1)
18
19    # Check to see if the entity is geometric meaning the entity will
20    # have a Bridges collection
21    if entity.geometric:
22
23        # Create a local variable for the entity bridges
24        bridges = entity.bridges
25
26        # Ensure there are some bridges for the entity
27        if bridges.count > 0:
28
29            # Remove the first bridge
30            bridges.remove(bridges.item(1))
31
32        else:
33
34            # Display a message in the output toolbox
35            ot.add("This entity has no bridges")
36
37else:
38
39    # Display a message in the output toolbox
40    impact.gui.output_toolbox.add("unable to continue: no active drawing")