Yes, many possibilities do exist! I agree with that That is why I stick to the “module approach” There are a lot of procs/functions in MeshUtils module which implementation you dont need to know but just USE… Me too After their fine tuning of course I use such procs/functions from that module (and other mine 3 listed in my support thread + another 3 NOT listed there) thousand of times during my development work on certain problem. This saves me a lot of time and coding :spin:
MeshUtils module contains many functions like the listed in my previous posting code: They are similar and deal with mesh description and such. For example, the interface to these procs is:
def Make_vie(me):
def Make_vif(me):
def Make_eiv(me):
def Make_fiv(me):
def Make_ekie(me):
def Make_ekif(me): # edge keys (+ ed.index) in faces
def Make_fie_ekif(me,ekif):
def Make_fie(me): # << OK......... ???
def Make_fke(me): # << OK......... ???
def Make_ekf(me):
def Make_eif(me):
def Make_eif_ekif(ekif):
def Make_viv(me):
def Make_fiv_and_vif(me):
def Make_fif_ekif(ekif):
def Make_fif_flat_ekif(ekif,lst_nonPlanarFaces):
def Make_eif_faces(eif):
def Make_vie_set(me,lst):
def Make_viv_set(me,lst):
def Make_eiv_set(me,lst):
I think, those marked with (???) do have some problems. But it seems that it doesnt happend to me to use such a combination The list of combination is incomplete. But covers most cases.
How to read and use these? Letters v,e,f stand for verts,edges,faces; ek - edge key(s); flat means add in result ONLY the flat faces given in the lst_nonPlanarFaces list (comlicated, pls dont touch this issue now); set means to search for results only amongst the selected verts,edges,faces in Edit Mode - otherwise ALL are iterated; finally - the result of each function is ALWAYS a dictionary. For example, Make_vie() says "give me a dict with vert indices and corresponding edges which contain them. The result’s dict structure is {vi:ei} where vi is the i-vertex index (0,1,2…,n-1) of the mesh and ei is the i-edge index (0,1,2…,n-1) of the mesh which contains the said vi. You can easily print the result. For the default cube it is:
{0: [0, 1, 2], 1: [0, 3, 4], 2: [3, 5, 6], 3: [1, 5, 7], 4: [2, 8, 9], 5: [4, 8, 10], 6: [6, 10, 11], 7: [7, 9, 11]}
In the General module I have some general procs that give me the result in a more comprehensive form at the console (or in a file) such as:
vie = 8 elements
======================================================================================
0 - [0, 1, 2]
1 - [0, 3, 4]
2 - [3, 5, 6]
3 - [1, 5, 7]
4 - [2, 8, 9]
5 - [4, 8, 10]
6 - [6, 10, 11]
7 - [7, 9, 11]
======================================================================================
It looks better and more readable, heh
Make_fiv(), for example, will give you faces (indices) and their verts (indices). Make_ekif() - edge keys and their corresponding faces that use them, Make_viv() - verts with their adjacent verts (neighbors) etc… You can try them.
Hope you find this useful
Regards,