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