Iterate over the sculpt tree, show the basic stats - square, volume.
Iterate over the sculpt tree, show the basic stats - square, volume
1
2import coat
3
4
5class OneLine :
6 def __init__(self):
7 self.name = ""
8 self.Square = 0
9 self.Volume = 0
10
11 def __init__(self, el) :
12 self.name = el.name()
13 self.Square = el.Volume().getSquare()
14 self.Volume = el.Volume().getVolume()
15
16 def ui(self):
17 return [
18 "[3]",
19 "name,'!name'",
20 "Square,'!Square'",
21 "Volume,'!Volume'"
22 ]
23
24
25class Stats:
26 def __init__(self):
27 self.lines = []
28
29 def Calculate(self):
30
32
33 def walker(el):
34
35 line = OneLine(el)
36 if el.isSculptObject() : self.lines.append(line)
37 print(line.name, line.Square, line.Volume)
38 return False
39
40 r.iterateVisibleSubtree(walker)
41 print(self.lines)
42
43
44 def ui(self):
45 return [
46
47 "[3]",
48
49 "#*Name",
50 "#*Square",
51 "#*Volume",
52 "---",
53 "lines",
54 "---"
55 ]
56
57stats = Stats()
58
59stats.Calculate()
SceneElement sculptRoot()
get the root of all sculpt objects
Definition coat.py:2687