# python : creating 4D simplex by connecting all vertices with ever possible triangular face

I'm creating higher dimensional shapes (4+ dimensions) and for a simplex, every vertex is connected so that any 3 vertices you pick form a triangle. this is simple to do with shapes with a low vertex count but the face count grows exponentially as the vertex count goes up to the point that a simplex with only 32 vertices would have 4960 faces.

Doing this by hand would take forever so what I'm looking for is possibly a python code that would make a triangle face between every possible group of 3 vertices in an object.

Alternatively, I don't necessarily need all the internal faces, just the internal and external wireframe, since I'm not using glass refraction, I'm just using transparent faces with gloss. Really I just need the external faces visible and all the lines visible with the wireframe modifier. I tried just making a wireframe model and putting the wireframe modifier and having a separate mesh shrink wrap to it for the external faces, but unfortunately both those modifiers only work based off faces rather than just lines and verts so if there are any work arounds that would fit this method I'm open to hearing that too.

4-simplex or 5 cell

Bmesh Script

Result of running on 9 vert circle, without faces

Test script to run in edit mode.

• removes all edges (and henceforth faces) of mesh
• adds an edge from each vert to every other vert
• if make_faces is True will add a face for each set of 3 vertices

import bpy
import bmesh
from itertools import combinations as combos

make_faces = False

context = bpy.context
ob = context.edit_object
me = ob.data
bm = bmesh.from_edit_mesh(me)
# remove edges and faces
for e in bm.edges:
bm.edges.remove(e)

edges = [bm.edges.new(c) for c in combos(bm.verts, 2)]

if make_faces:
[bm.faces.new(c) for c in combos(bm.verts, 3)]
# str(bm) for total verts edges faces
print(bm)
bmesh.update_edit_mesh(me)