-
Notifications
You must be signed in to change notification settings - Fork 1
/
z0.py
41 lines (30 loc) · 985 Bytes
/
z0.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import c4d
def main():
doc.StartUndo()
selection = doc.GetSelection()
i = 0
for item in selection:
doc.AddUndo(c4d.UNDOTYPE_CHANGE,item)
bs = op.GetPointS()
sel = bs.GetAll(op.GetPointCount())
np = []
zPos = 0
zList = []
for index, selected in enumerate(sel):
if selected:
v = item.GetPoint(index)
zList.append(v.z)
zPos = (min(zList)+max(zList))/2.0
for index, selected in enumerate(sel):
if not selected:
np.append(item.GetPoint(index))
else:
v = item.GetPoint(index)
np.append(c4d.Vector(v.x,v.y,zPos))
item.SetAllPoints(np)
item.CreatePhongNormals()
c4d.CallCommand(14039)
c4d.EventAdd(c4d.EVENT_ENQUEUE_REDRAW)
doc.EndUndo()
if __name__=='__main__':
main()