Document Custom Columns¶
Document Custom Columns¶
1ot = impact.gui.output_toolbox
2db = impact.active_database
3
4ot.clear()
5
6d = impact.active_drawing
7
8if (not d is None):
9 docs = d.database_item.documents
10
11 if docs is None:
12 ot.add("No project document support in the database")
13 else:
14 ot.add("Project document support is enabled in this database")
15
16 count = docs.count
17 ot.add(str(count) + " documents for '" + d.full_name + "' currently in the database")
18
19 ot.add("Iterate using Item property")
20 for i in range(1, count + 1):
21 doc = docs.item(i)
22 ot.add("Document: '" + doc.name + "', impact.creator: " + str(doc.added_by.login_id) + ", Size: " + str(doc.size) + " bytes")
23
24 values = doc.values
25
26 for j in range(1, values.field_count + 1):
27 ot.add("Column: " + str(values.field_name(j)) + " Value:'" + str(values.load(values.field_name(j))) + "'")
28
29 if i == 1:
30 values.save("DC_PRINTER", "My Printer")
31 values.do_update()
32
33 ot.add("Iterate using for each")
34 for doc in docs:
35 ot.add("Document: '" + doc.name + "', impact.creator: " + str(doc.added_by.login_id) + ", Size: " + str(doc.size) + " bytes")
36
37 values = doc.values
38
39 for j in range(1, values.field_count + 1):
40 ot.add("Column: " + str(values.field_name(j)) + " Value:'" + str(values.load(values.field_name(j))) + "'")
41else:
42 ot.add("No active project")
43
44