[Bf-python] efficient way to remove faces and edges from a mesh with python?
wim van hoydonck
tuinbels at hotmail.com
Tue Mar 23 14:09:48 CET 2004
Hi all,
I need to remove all faces and edges from a large mesh with python (see
example
script below). But it seems to be extremely time-inefficient for large
meshes. I
thought the time would increase linearly with the number of faces that has
to be
removed, instead the time needed increases exponentially.
The little table below shows some results for a UV-sphere.
The last one even gave a negative time?
I hope somebody can tell me what I do wrong, or give a better solution for
this
problem.
Kind regards,
Wim Van Hoydonck
-----------------------------------------------------------
number of faces(approx) time [sec]
256 0.01
1024 0.04
4020 0.86
6872 3.5
9572 8.1
38512 141.4
154592 -2033.847
------------------------------------------------------------
import Blender
from Blender import Object
import time
m = Object.GetSelected()[0].getData()
idx = []
for i in range(len(m.faces)):
idx.append(i)
idx.reverse()
start = time.clock()
for i in idx:
fa = m.faces[i]
m.faces.remove(fa)
end = time.clock()
print end - start
m.update()
_________________________________________________________________
Ben jij klaar voor De Vuilbek? http://devuilbek.msn.be/start.php Nu op JIM
en MSN
More information about the Bf-python
mailing list