Description example (Python)

Description example (Python)
 1# this example displays the description of the active block in the output
 2# toolbox then modifies the description and displays it again
 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    # display the description in the output toolbox
16    impact.gui.output_toolbox.add(ab.description)
17
18    # set the description
19    ab.description = "New block description"
20
21    # display the description in the output toolbox
22    impact.gui.output_toolbox.add(ab.description)