Opening Items

Opening Items
 1db = impact.active_database
 2
 3impact.gui.output_toolbox.clear()
 4impact.gui.output_toolbox.add("**** Finding Item by Key '59598' ****")
 5
 6db_item = db.find_item_by_key(ipDrawingType.dtProject, 59598)
 7
 8if db_item is not None:
 9    drawing = db_item.open()
10
11    if drawing is None:
12        impact.gui.output_toolbox.add("Error: Unable to open the item '" + str(db_item.reference) + "'")
13    else:
14        impact.gui.output_toolbox.add("Successfully opened the item '" + str(db_item.reference) + "' for modification")
15
16    drawing = db_item.open_copy()
17
18    if drawing is None:
19        impact.gui.output_toolbox.add("Error: Unable to open a copy of the item '" + str(db_item.reference) + "'")
20    else:
21        impact.gui.output_toolbox.add("Successfully opened a copy of the item '" + str(db_item.reference) + "'")
22
23else:
24    impact.gui.output_toolbox.add("Error: Unable to locate the item")
25
26