Updating Dynamic Text (Python)

Updating Dynamic Text (Python)
 1# This example updates all dynamic text entities in the active layer.
 2
 3# Create a local variable for the output toolbox
 4ot = impact.gui.output_toolbox
 5
 6# Clear the output toolbox
 7ot.clear()
 8
 9# Create a local variable for the active drawing
10ad = impact.active_drawing
11
12# Check that there is an active drawing
13if not ad.isNone():
14
15    # Recalculate all text entities in the active layer
16    ad.active_layer.recalculate_text_entities()  # Display a success message
17    ot.add("Successfully updated text entities")
18
19else:
20
21    # Display a message in the output toolbox
22    ot.add("Unable to continue: no active drawing")