0
$\begingroup$

I want to render some selected face using program. But i don't know the indexes of the faces that i want to render. Is there a good method to output the indexes of selected faces to a file? Thanks so much.

$\endgroup$

1 Answer 1

1
$\begingroup$

You can do this using Python:

import bpy

obj = bpy.context.active_object

with open('/PATHTOFILE/selected_faces.txt', 'w') as file:
    for f in obj.data.polygons:
        if f.select:
            file.write(f'{f.index} ')

Run it in Text Editor. Paste it into new text file and press run (button with play icon) :

enter image description here

$\endgroup$
3
  • $\begingroup$ Thanks so much for your answer. But could you please explain where to run these script? $\endgroup$
    – Francis
    Jan 31 at 11:30
  • $\begingroup$ In text editor. Paste it into new text file and run (button with play icon) $\endgroup$
    – Crantisz
    Jan 31 at 12:10
  • $\begingroup$ It's awesome. Thank you for your detailed perfect solution. $\endgroup$
    – Francis
    Feb 1 at 12:07

You must log in to answer this question.

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