0
$\begingroup$

Here is my bisect plane command, which does infact produce new verticies along the bisected plane (Blender 2.90):

print('Nverts0',len(bm.verts), len([v for v in bm.verts if v.is_valid]))
bmesh.ops.bisect_plane(bm, geom=bm.edges, dist=0.0001, plane_co=point, use_snap_center=False, clear_outer=True, clear_inner=False) 
print('Nverts1',len(bm.verts), len([v for v in bm.verts if v.is_valid]))

However, niether the clear_outer nor clear_inner option has an effect on the geometry or on how many vertices are there are (the printouts). And the v.is_valid flags aren't set false either. Why aren't clear_outer and clear_inner working?

$\endgroup$
0

1 Answer 1

1
$\begingroup$

Set the normal

The default values of cutting plane coordinate and normal are (0, 0, 0). A zero length normal is invalid and quite likely does nothing.

Test script

Here is a minimal working example of a script, adds a cube, runs the operator with plane coordinate at origin and its normal as the x axis. Recommend setting up a little script like below when asking questions

import bmesh
import bpy
from bpy import context

bpy.ops.mesh.primitive_cube_add()
ob = context.object
me = ob.data
bm = bmesh.new()
bm.from_mesh(me)


print('Nverts0',len(bm.verts), len([v for v in bm.verts if v.is_valid]))
bmesh.ops.bisect_plane(
    bm, 
    geom=bm.edges, 
    dist=0.0001, 
    plane_co=(0, 0, 0), 
    plane_no=(1, 0, 0), 
    use_snap_center=False, 
    clear_outer=True, 
    clear_inner=False,
    ) 
print('Nverts1',len(bm.verts), len([v for v in bm.verts if v.is_valid]))
bm.to_mesh(me)

Result

Nverts0 8 8
Nverts1 12 12

Effectively bisecting all x axis aligned edges, creating 4 ngons with 6 verts. Nothing to clear as faces are not "ripped".

Input geometry

For clear to work on a mesh that has faces, we are going to need to add the faces and verts to the geometry input of the operator. Recommend with geom giving all geometry of a region of interest will make all options work as expected.

    geom=bm.verts[:] + bm.edges[:] + bm.faces[:], 

making this change an running again

Nverts0 8 8
Nverts1 8 8

Has bisected cube, same vert count one less face. The "outer" is cleared, ie all resultant geometry on the input normal's side of cutting plane.

enter image description here

Return Dictionary

Bmesh operators return information in a dictionary.

ret = bmesh.ops.foo.bar(blah)

in the case of bisect plane it has members "geom_cut" the edges and verts of the cut and "geom".

Some Examples of using bmesh bisect plane operator.

Python: Bisect mesh into n parts, without separate 'LOOSE'

using bisect but still failing

Slice up terrain mesh into chunks

How to get part of a mesh with Python API, which requires breaking down some faces?

Cutting a mesh in half

How to extract side-view outline (e.g. top view) of a 3D object to 2D surface?

Transform cylinder to flat plane - cylinder maze map

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .