Asymmetrically scaling a line maintaining bridges

Asymmetrically scaling a line maintaining bridges
 1# this example inserts a symbol and then scales it asymmetrically, also scaling its bridge locations and sizes
 2
 3# check there is an active drawing
 4if impact.active_drawing.isNone():
 5
 6    # display a message in the output toolbox
 7    impact.gui.output_toolbox.add("Unable to continue: there is no active drawing")
 8
 9else:
10
11    # create a local variable for the active block
12    ab = impact.active_drawing.active_layer.active_block
13
14    # create local variables for the Symbol, Position, etc. options
15    symbol_name = "Recycle"
16    position_x = 0
17    position_y = 0
18    scale_value = 1
19    angle = 0
20    mirror_x = 0
21    mirror_y = 0
22
23    # insert the symbol
24    symbol_insert = ab.symbol_insert_ad(symbol_name, position_x, position_y, scale_value, angle, mirror_x, mirror_y)
25
26    # check the symbol was inserted
27    if not symbol_insert.isNone():
28        impact.gui.output_toolbox.add("successfully inserted symbol '" + str(symbol_name) + "'")
29
30        # create some local variables for the ScaleX, ScaleY, Retain, Inserts,
31        # BridgeLocations and BridgeSizes options
32        scale_x_value = 2
33        scale_y_value = 4
34        retain = 0
35        inserts = 1
36        bridge_locations = 1
37        bridge_sizes = 1
38
39        # ensure only the symbol insert is selected
40        ab.select_none()
41        symbol_insert.selected = 1
42
43        # scale the symbol insert - bridge positions and widths are scaled along with the geometry
44        ab.scale_asymmetricd2(scale_x_value, scale_y_value, position_x, position_y, retain, inserts, bridge_locations, bridge_sizes)
45
46    else:
47        impact.gui.output_toolbox.add("failed to insert symbol '" + str(symbol_name) + "'")