mesh-editing-and-bmeshlisted
Install: claude install-skill TMHSDigital/Blender-Developer-Tools
# Mesh Editing and bmesh
## Trigger
Use this skill when the user:
- Wants to create, modify, or read mesh geometry from Python
- Mentions `bmesh`, `mesh.vertices`, `foreach_set`, `from_pydata`, `evaluated_get`
- Has a script that's slow and uses `bpy.ops.mesh.*` in a loop
- Needs the mesh after modifiers (subdivision surface, mirror, geometry nodes) have been applied
- Asks why their bmesh script crashes on the second run
## Three layers, three use cases
There are three ways to touch mesh data and each is right in a specific situation.
### Layer 1: `bpy.data.meshes` and direct vertex/edge/face access
For creating new meshes from scratch or reading static geometry:
```python
import bpy
mesh = bpy.data.meshes.new("MyMesh")
verts = [(0, 0, 0), (1, 0, 0), (1, 1, 0), (0, 1, 0)]
faces = [(0, 1, 2, 3)]
mesh.from_pydata(verts, [], faces)
mesh.update()
obj = bpy.data.objects.new("MyObject", mesh)
bpy.context.scene.collection.objects.link(obj)
```
Use this layer when:
- You're constructing a mesh from a list of vertices and faces.
- You're reading vertex coordinates, normals, or face indices from an existing static mesh.
- You're doing one-shot bulk operations.
### Layer 2: `bmesh` for editable mesh structure
For surgical edits (extrude, subdivide, dissolve, build n-gons by walking edges) where you need a real edit-mode-style data structure:
```python
import bmesh
bm = bmesh.new()
try:
bm.from_mesh(mesh)
for v in bm.verts:
v.co.z += 0.1
bm.to_mesh(