"Scaffold Poke" Bmesh script.
Of the selected quad faces, bisect all vertical edges, then poke the face.
Result on defaults: Cube and UV Sphere
Similarly to
https://blender.stackexchange.com/a/118497/15543
select faces in edit mode run script,
of those faces reduce to only quads.
Find all the connected edges aligned with the Z axis, and bisect them
Any selected face now with 6 verts is "scaffold poked" by poking the ngon
Test script.
import bpy
import bmesh
from mathutils import Vector
context = bpy.context
ob = context.edit_object
me = ob.data
bm = bmesh.from_edit_mesh(me)
axis = Vector((0, 0, 1))
faces = [f for f in bm.faces if f.select and len(f.verts) == 4]
def aligned(e):
d = (e.verts[1].co - e.verts[0].co).normalized()
return abs(d.dot(axis)) > 0.5
bmesh.ops.bisect_edges(bm,
edges=[e for e in bm.edges
if any(f.select for f in e.link_faces)
and aligned(e)
],
cuts=1,
)
# poke
bmesh.ops.poke(
bm,
faces=[f for f in faces if len(f.verts) == 6],
)
bmesh.update_edit_mesh(me)
or alternatively instead of poking
Add a new vert at face center
List the faces edges, remove face and make tris from edge verts + center verts.
Replace from #poke
# poke
for f in faces:
if len(f.edges) != 6:
f.select_set(False)
continue
v = bm.verts.new(f.calc_center_median())
v.normal = f.normal
edges = f.edges[:]
bm.faces.remove(f)
for e in edges:
f = bm.faces.new([v] + e.verts[:])
f.select_set(True)
bm.normal_update()
bmesh.update_edit_mesh(me)