Get length of entities example

Get length of entities example
 1# this example displays the length of all entities in the active block
 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    # create local variable for the length and Recurse option
15    length = 0
16    recurse = 1
17
18    # get the length of entities in the active block
19    length = ab.get_length_of_entities(recurse)
20
21    # display the result in the output toolbox
22    impact.gui.output_toolbox.add("Length: " + str(length))