MoveAd example (Python)¶
MoveAd example (Python)¶
1# this example moves to a specified position then creates a line, moves to
2# another position 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 position
16 positionX = 50
17 positionY = 50
18
19 # move to the specified position
20 ab.move_ad(positionX, positionY)
21
22 # create a line
23 ab.lined(100, 0)
24
25 # change the position
26 positionX = 250
27 positionY = 250
28
29 # move to the specified position
30 ab.move_ad(positionX, positionY)
31
32 # create a line
33 ab.lined(0, 100)