Calculate entity lengths within a text entity

Calculate entity lengths within a text entity
 1# Within a text entity, it's better to use just "impact.active_drawing"
 2# rather than "impact.active_drawing", especially when you're
 3# making a border plot
 4lay = impact.active_drawing.active_layer
 5
 6# This is the object which does all the work
 7enquire = lay.root_block.enquire_lengths
 8
 9enquire.palette_types = ipPaletteType.ptCut
10enquire.entity_types = [ipEntityType.etLine, ipEntityType.etInsert]
11enquire.recurse = True
12enquire.selected_entities_only = False
13enquire.visible_entities_only = False
14
15# This is where the calculations are done
16enquire.perform()
17
18# use the Convertor object for formatting the result nicely
19conv = impact.system.convertor
20
21# the Result variable is always used to generate the text to be displayed
22Result = conv.length_as_string(enquire.length)
23