I'm working on a script to generate building from plane. While having normal plane is rectangle it's quite easy - you're looking for vertices most -/+X, -/+Y, -/+Z, but what if plane is not of regular shape? Is there a nice easy solution within python api in Blender? In fact is there any clever way to detect faces/edges/vertices on border?
Asked
Active
Viewed 864 times
0
-
Hi, did you finish this project? – kraysak Nov 07 '17 at 16:52
-
yes, I did - don't remember though if this issue was used in it – raistlin Nov 09 '17 at 08:57
1 Answers
1
Look for border edges: these will be ones that are only attached to one face. Look at the Mesh class, specifically the edges, faces and vertices attributes. Unfortunately the edges don’t contain a list of what faces they belong to, so you will have to construct such a mapping, e.g.
EdgeFaces = {} # mapping from edge to adjacent faces
for ThisFace in TheMesh.faces :
for ThisEdge in ThisFace.edge_keys :
if not ThisEdge in EdgeFaces :
EdgeFaces[ThisEdge] = []
#end if
EdgeFaces[ThisEdge].append(ThisFace.edge_keys)
#end for
#end for
Then you just look through EdgeFaces for all keys that map to single-element lists.

Lawrence D'Oliveiro
- 2,768
- 1
- 15
- 13