0
$\begingroup$

I'm trying to understand how python works in blender , I want to select faces in edit mode by the index of for loop to modify each face separately , I tried different ways but I failed

$\endgroup$
  • 1
    $\begingroup$ welcome to Blender on Stack Exchange, you will get more value from a question if you follow the guidelines How To ask $\endgroup$ – Merlin Oct 16 at 13:34
  • $\begingroup$ Yes I searched for the answer , & I was reading the blender Python online documentation , & tested the code $\endgroup$ – Wissam Mo'athen Oct 16 at 20:12
  • $\begingroup$ please read the How to Ask and tour pages to better understand how the site works $\endgroup$ – Merlin Oct 17 at 9:54
0
$\begingroup$
import bpy
import bmesh

# Get the active mesh
obj = bpy.context.edit_object
me = obj.data

# Get a BMesh representation
bm = bmesh.from_edit_mesh(me)

print(len(bm.faces))

bm.faces[0].select=True

for f in bm.faces:
    print("face")

With the Default Cube that prints

6
face
face
face
face
face
face

to the system console.

$\endgroup$
  • $\begingroup$ Thanks that was helpful , but forgive my ignorance in this field because I still beginner in Python , when I add my function to edit the faces it gives error massage , I used a function to give the area of the selected polygon then extrude it corresponding to this value ar = bpy.context.active_object.data.polygons[f].area $\endgroup$ – Wissam Mo'athen Oct 17 at 5:11
  • $\begingroup$ Please post a new question detailing the error message and the code you were using. $\endgroup$ – rob Oct 17 at 9:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.