[Bf-python] Most efficient way to copy faces
joe
joeedh at gmail.com
Tue May 26 05:39:01 CEST 2009
You put the faces into one big list, then you feed that to
mesh.faces.extend(). Not sure how you handle UVs and the like though,
it's kindof a pain, I think.
Joe
On Sun, May 24, 2009 at 12:41 PM, <lynx.abraxas at freenet.de> wrote:
> Hello,
>
>
>
> Next question: What is the most efficient way to copy faces from another mesh?
> I have now the verts that lie within an ellipsoid and now I'd like to copy the
> faces that belong to these verts. I'm doing it currently like this:
>
>
>
> if len(vin.verts) > 2: # we need at least one face => three verts minimum
> #find inside faces in potato to copy
> for i in range(0, len(potmesh.faces)): #check all potato faces
> nvi= 0
> f= []
> for j in range(0, len(potmesh.faces[i].verts)): #if all verts of a face
> for k in vin.verts: #are in the list of the inside verts
> if k.co == potmesh.faces[i].verts[j].co:
> #if k in potmesh.faces[i].verts:#this does not work! why?
> nvi+= 1
> f.append(k)#create face with vin.verts indices!
> if nvi == len(potmesh.faces[i].verts): #if all verts of a potato face are in the inside verts list
> vin.faces.extend(f) #add it to the list of insede faces
> elif nvi > len(potmesh.faces[i].verts):
> print "Potato mesh contains double verts!"
> #vin.faces.extend(f) #only possible for 2 to 4 verts!
> #else:
> # print "Face not completly inside ellipsoid."
>
>
> This is taking a long time for my big "potato" (3 million verts, 1 million
> faces). Is there a better way to do this?
>
> Many thanks for any help or hints
> Lynx
>
>
> _______________________________________________
> Bf-python mailing list
> Bf-python at blender.org
> http://lists.blender.org/mailman/listinfo/bf-python
>
More information about the Bf-python
mailing list