Asymmetrically scaling a line

Asymmetrically scaling a line
 1# this example inserts a symbol and then scales it asymmetrically
 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, Origin, Retain and
31        # Inserts options
32        scale_x_value = 2
33        scale_y_value = 4
34        origin = impact.creator.vector(position_x,position_y)
35        retain = 0
36        inserts = 1
37
38        # ensure only the symbol insert is selected
39        ab.select_none()
40        symbol_insert.selected = 1
41
42        # scale the symbol insert
43        ab.scale_asymmetric(scale_x_value, scale_y_value, origin, retain, inserts)
44
45    else:
46        impact.gui.output_toolbox.add("failed to insert symbol '" + str(symbol_name) + "'")
47