Skip to content

Instantly share code, notes, and snippets.

Created April 20, 2014 18:03
Show Gist options
  • Save anonymous/11120697 to your computer and use it in GitHub Desktop.
Save anonymous/11120697 to your computer and use it in GitHub Desktop.
test
edges_to_polys
- input
- for every edge in edges
- find all vertices that are connected to the verts of this edge.
- pile all found verts into edges.
- assume an edge will have at most 2 faces associated with it.
```
import bpy
obj = bpy.context.active_object
edges = obj.data.edges
verts = obj.data.vertices
def verts_from_edge(i):
return edges[i].vertices[:]
def connected_edge_idxs_from_vert(i):
return [e.index for e in edges if i in e.vertices[:]]
def verts_attached_to_vert(i):
idxs = connected_edge_idxs_from_vert(i)
m = [verts_from_edge(vi) for vi in idxs]
return [(e2 if e1==i else e1) for e1, e2 in m]
k = connected_edge_idxs_from_vert(66)
print(k)
k2 = verts_attached_to_vert(66)
print(k2)
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment