Scaling a line (Python)

Scaling a line (Python)
 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 not line1.isNone():
22
23        # create some local variables for the Value, OriginX, OriginY, Retain and
24        # NumCopies options
25        scaleValue = 2
26        originX = 0
27        originY = 0
28        retain = 0
29        numCopies = 1
30
31        # select only the line created earlier
32        ab.select_none()
33        line1.selected = 1
34
35        # scale the line
36        ab.scaled(scaleValue, originX, originY, retain, numCopies)