MoveA example (Python)

MoveA 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 a local variable for the position option
16    position = None
17    try:
18        position = impact.creator.vector(50,50)
19    except Exception as exc:
20        pass
21    impact.gui.output_toolbox.add(f"Failed to create object via impact.creator.vector(): {exc}")
22
23    # move to the specified position
24    ab.move_a(position)
25
26    # create a line
27    ab.lined(100, 0)
28
29    # change the position
30    position.X = 250
31    position.Y = 250
32
33    # move to the specified position
34    ab.move_a(position)
35
36    # create a line
37    ab.lined(0, 100)