Export Item Specific Layers¶
Export Item Specific Layers¶
1ot = impact.gui.output_toolbox
2db = impact.active_database
3
4database_item_name = "Beer Case"
5settings_name = "Adobe PDF Export"
6
7ot.clear()
8
9database_item = impact.active_database.find_item_by_name(ipDrawingType.dtProject, database_item_name)
10if database_item.isNone():
11 ot.add("Unable to find a database item with name " + str(database_item_name))
12
13else:
14 ms = db.find_master_tool_setting(settings_name, ipMasterSettingType.mstImportExport)
15
16 # Check that the settings were found
17 if ms is not None:
18 options = impact.creator.export_options()
19
20 options.path_or_file_name = "d:\test2.pdf"
21 options.settings = ms
22 options.file_format = ipFileFormat.ffAdobePDF
23 options.layers.add("LayerA", ipFaceOrientation.foDie)
24 options.layers.add("LayerA", ipFaceOrientation.foPrint)
25 options.layers.add("3D View", ipFaceOrientation.foAsIs)
26
27 # Perform the file export
28 if database_item.export2(options):
29 ot.add("File exported successfully")
30 else:
31 ot.add("File exported failed")
32
33 else:
34 ot.add("Unable to locate settings '" + str(settings_name) + "'")
35
36