Updating Database Palettes (Python)

Updating Database Palettes (Python)
 1# This example updates database palettes 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 palettes in the active drawing
16    ad.update_drawing_items(ipDrawingUpdate.duPalettes)
17
18    # Display a success message
19    ot.add("Successfully updated palettes from the palette database")
20
21else:
22
23    # Display a message in the output toolbox
24    ot.add("Unable to continue: no active drawing")