Created
July 6, 2022 15:01
-
-
Save CGArtPython/0353134fd626c896ea2bfb494dc9b96e to your computer and use it in GitHub Desktop.
Blender Python script to deselect faces using thier index
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# give Python access to Blender's mesh manipulation functionality | |
import bmesh | |
# give Python access to Blender's functionality | |
import bpy | |
# add cube | |
bpy.ops.mesh.primitive_cube_add() | |
obj = bpy.context.active_object | |
# enable edit mode | |
bpy.ops.object.editmode_toggle() | |
# create a BMesh object to manipulate geometry data (must be done in edit mode) | |
bm = bmesh.from_edit_mesh(obj.data) | |
# make sure we can use the square brackets to access faces | |
bm.faces.ensure_lookup_table() | |
# deselect face with index 0 | |
bm.faces[0].select = False | |
# deselect face with index 1 | |
bm.faces[1].select = False | |
# deselect face with index 2 | |
bm.faces[2].select = False | |
# disable edit mode | |
# bpy.ops.object.editmode_toggle() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment