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