Skip to content

Commit f8bc5e7

Browse files
authored
Create totalItems.py
1 parent 22db63e commit f8bc5e7

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

Script Examples/totalItems.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
root = doc.Models[0].RootItem
2+
3+
total = 0
4+
5+
def getTotal(x):
6+
if x.DisplayName == "Body":
7+
return 1
8+
return sum(map(getTotal, x.Children))
9+
10+
for c in root.Children:
11+
t = getTotal(c)
12+
total += t
13+
print c.DisplayName, " | ", t
14+
15+
print "Total items: ", total

0 commit comments

Comments
 (0)