AutoSelect example

AutoSelect example
 1# this example sets the AutoSelect property to False, creates a line then sets
 2# the AutoSelect property True and then creates two more lines
 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    # set AutoSelect to False
16    ab.auto_select = False
17
18    # move to the origin of the active block
19    ab.move_ad(0, 0)
20
21    # create a line
22    ab.line_ad(100, 100)
23
24    # set AutoSelect to True
25    ab.auto_select = True
26
27    # create a line
28    ab.line_ad(200, 200)
29
30    # create a line
31    ab.line_ad(300, 300)