Export a database item¶
Export a database item¶
1# This example finds a database item by its code and exports it without opening it
2
3ot = impact.gui.output_toolbox
4ot.clear()
5
6database_item_code = "0123456"
7settings_name = "Adobe AI/PDF"
8format = ipFileFormat.ffAdobePDF
9destination = r"d:\\export.pdf"
10
11# Find the database item
12database_item = impact.active_database.find_item_by_code(ipDrawingType.dtProject, database_item_code)
13if database_item.isNone():
14 ot.add("Unable to find a database item with code " + str(database_item_code))
15else:
16
17 # Find the master tool settings for the export operation
18 mts = impact.active_database.find_master_tool_setting(settings_name, ipMasterSettingType.mstImportExport)
19 if mts.isNone():
20 ot.add("Unable to find settings with name " + str(settings_name))
21 else:
22
23 # Export the item
24 if database_item.export(destination, mts, format):
25 ot.add("Item exported successfully")
26 else:
27 ot.add("Item export failed")