Creating Document Groups¶
Creating Document Groups¶
1ot = impact.gui.output_toolbox
2db = impact.active_database
3
4
5def create_or_update_group(name, def_extensions, allow_all_extensions):
6 group = groups.item(name)
7
8 if group.isNone():
9 group = groups.add(name)
10
11 if not group.isNone():
12 group.default_extensions = def_extensions
13 group.allow_all_extensions = allow_all_extensions
14 group.do_update()
15
16 ot.add("Successfully created or updated Group '" + str(name) + "'")
17
18 else:
19 ot.add("Failed to create or update Group '" + str(name) + "'")
20
21
22ot.clear()
23
24docs = db.documents
25
26if docs.isNone():
27 ot.add("No document support in the database")
28else:
29 ot.add("Document support is enabled in this database")
30
31 settings = db.settings.document_settings
32
33 groups = settings.groups
34
35 ot.add("Document Groups (Before): " + str(groups.count))
36
37 create_or_update_group("CAD Documents", "ipd;dwg;dxf", True)
38 create_or_update_group("Graphics Files", "jpg;jpeg;png;bmp;ai;pdf", True)
39
40 ot.add("Document Groups (After): " + str(groups.count))