0
$\begingroup$

I have a script that returns the 4 vertices of a polygon. How can i delete this polygon?

I've tried using bmesh but need the face index and not vertices.

This is a follow up to this question. See it for more details.

$\endgroup$

1 Answer 1

2
$\begingroup$

v.link_faces gives you all the polys v is used in. So you just need the face common to all the verts.

fs = set(v0.link_faces)
fs.intersection_update(v1.link_faces)
fs.intersection_update(v2.link_faces)
fs.intersection_update(v3.link_faces)

for f in fs:
    bm.faces.remove(f)
$\endgroup$
3
  • $\begingroup$ Thiago: If you want to use this code in the answer to the original question, simply ignore the index argument; replace the try block with the first four lines of this code and use f as the argument to the call to to_delete $\endgroup$ Jan 6, 2022 at 19:39
  • $\begingroup$ I got "AttributeError: 'int' objects has no attribute 'link_faces"... $\endgroup$
    – Thiago M.
    Jan 6, 2022 at 19:54
  • $\begingroup$ are v1, v2, v3, and v4 vertex indices or actual vertices? if they are indices, you need to replace vN in the above with bm.verts[N]. You also need to put bm.verts.ensure_lookup_table() as a line at the start of the code. $\endgroup$ Jan 7, 2022 at 0:46

You must log in to answer this question.

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