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 symbol_insert is not None:
28 impact.gui.output_toolbox.add("successfully inserted symbol '" + str(symbol_name) + "'")
29
30 # create some local variables for the ScaleX, ScaleY, Retain and
31 # Inserts options
32 scale_x_value = 2
33 scale_y_value = 4
34 retain = 0
35 inserts = 1
36
37 # ensure only the symbol insert is selected
38 ab.select_none()
39 symbol_insert.selected = 1
40
41 # scale the symbol insert
42 ab.scale_asymmetricd(scale_x_value, scale_y_value, position_x, position_y, retain, inserts)
43
44 else:
45 impact.gui.output_toolbox.add("failed to insert symbol '" + str(symbol_name) + "'")