Updating Dynamic Text (Python)

Updating Dynamic Text (Python)
 1# This example updates all dynamic text entities in the active drawing.
 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 drawing
16    ad.recalculate_text_entities()  # Alternative syntax
17    # ad.update_drawing_items ipDrawingUpdate.duRecalculateText
18
19    # Display a success message
20    ot.add("Successfully updated text entities")
21
22else:
23
24    # Display a message in the output toolbox
25    ot.add("Unable to continue: no active drawing")