MoveA example¶
MoveA example¶
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 a local variable for the position option
16 position = impact.creator.vector(50,50)
17
18 # move to the specified position
19 ab.move_a(position)
20
21 # create a line
22 ab.lined(100, 0)
23
24 # change the position
25 position.x = 250
26 position.y = 250
27
28 # move to the specified position
29 ab.move_a(position)
30
31 # create a line
32 ab.lined(0, 100)
33