Move example

Move 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 a local variable for the Offset option
16    offset = impact.creator.vector(50,50)
17
18    # move by the specified offset
19    ab.move(offset)
20
21    # create a line
22    ab.lined(100, 0)
23
24    # move by the specified offset
25    ab.move(offset)
26
27    # create a line
28    ab.lined(0, 100)