1

I ran the following Python script, from the link below, in Blender and it works very well splitting the selected mesh into 4 equal parts. However, I'd like to cut the mesh at specific locations not just in the vertical and horizontal centers of the mesh. Is it possible to modify the script to split a mesh at arbitrary vertical and horizontal locations? If not, is there another way to accomplish this?

How to cut into smaller pieces with Python?

import bpy, bmesh
from bpy import context as C

bpy.ops.object.mode_set(mode='EDIT')

bm = bmesh.from_edit_mesh(C.object.data)

edges = []

for i in range(-10, 10, 2): ret = bmesh.ops.bisect_plane(bm, geom=bm.verts[:]+bm.edges[:]+bm.faces[:], plane_co=(i,0,0), plane_no=(-1,0,0)) bmesh.ops.split_edges(bm, edges=[e for e in ret['geom_cut'] if isinstance(e, bmesh.types.BMEdge)])

for i in range(-10, 10, 2): ret = bmesh.ops.bisect_plane(bm, geom=bm.verts[:]+bm.edges[:]+bm.faces[:], plane_co=(0,i,0), plane_no=(0,1,0)) bmesh.ops.split_edges(bm, edges=[e for e in ret['geom_cut'] if isinstance(e, bmesh.types.BMEdge)])

bmesh.update_edit_mesh(C.object.data)

bpy.ops.mesh.separate(type='LOOSE') bpy.ops.object.mode_set(mode='OBJECT')

Epsilon
  • 143
  • 4
  • Can you be more specific. Like give an example of coordinates where you want to split the mesh and into how many parts? or provide an illustration of what exact split you want to accomplish. Your question currently needs more focus. – Harry McKenzie Mar 07 '23 at 07:34

0 Answers0