Moved example¶
Moved example¶
1# this example moves by a specified offset then creates a line, moves by the
2# specified offset again and creates another line
3
4# check there is an active drawing
5if impact.active_drawing.isNone():
6
7 # display a message in the output toolbox
8 impact.gui.output_toolbox.add("Unable to continue: there is no active drawing")
9
10else:
11
12 # create a local variable for the active block
13 ab = impact.active_drawing.active_layer.active_block
14
15 # create local variables for the offset
16 offset_x = 50
17 offset_y = 50
18
19 # move by the specified offset
20 ab.moved(offset_x, offset_y)
21
22 # create a line
23 ab.lined(100, 0)
24
25 # move by the specified offset
26 ab.moved(offset_x, offset_y)
27
28 # create a line
29 ab.lined(0, 100)
30