Scaling a line

Scaling a line
 1# this example creates a line in the active block and scales it
 2
 3# check there is an active drawing
 4if impact.active_drawing.isNone():
 5
 6    # display a message in the output toolbox
 7    impact.gui.output_toolbox.add("Unable to continue: there is no active drawing")
 8
 9else:
10
11    # create a local variable for the active block
12    ab = impact.active_drawing.active_layer.active_block
13
14    # move to a position in the active block
15    ab.move_ad(-50, 0)
16
17    # create a line
18    line1 = ab.line_ad(50, 0)
19
20    # check the line was created
21    if line1 is not None:
22
23        # create some local variables for the Value, Origin, Retain and NumCopies
24        # options
25        scale_value = 2
26        origin = line1.get_along(0.5)
27        retain = 0
28        num_copies = 1
29
30        # select only the line created earlier
31        ab.select_none()
32        line1.selected = 1
33
34        # scale the line
35        ab.scale(scale_value, origin, retain, num_copies)