Updating Various Items (Python)

Updating Various Items (Python)
 1# This example shows how to update various items 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    # Update all out of date symbols
16    ad.update_drawing_items(ipDrawingUpdate.duSymbols)
17
18    # Update all palettes from the palette database
19    ad.update_drawing_items(ipDrawingUpdate.duPalettes)
20
21    # Update all layers referencing Master impact.drawings
22    ad.update_drawing_items(ipDrawingUpdate.duMasterDrawings)
23
24    # Update all Custom Line Styles
25    ad.update_drawing_items(ipDrawingUpdate.duCustomLineStyles)
26
27    # Recalculate all Dynamic Text
28    ad.update_drawing_items(ipDrawingUpdate.duRecalculateText)
29
30    # Update all direction symbols
31    ad.update_drawing_items(ipDrawingUpdate.duSpecialSymbolDirections)
32
33    # You can update all out of date items in one go
34    ad.update_drawing_items(ipDrawingUpdate.duAll)
35
36    # Display a success message
37    ot.add("Successfully updated all items")
38
39else:
40
41    # Display a message in the output toolbox
42    ot.add("Unable to continue: no active drawing")