0
$\begingroup$

I need to cut an edge into equal parts via script.
Using the standart subdivide is out of question because i will need more then 100 cuts (und using subdivide several times to achieve this is not possible with certain numbers.. e.g. prime numbers).
bmesh.ops.subdivide_edges has no max for the number of cuts but i have problems finding out how to use it only with selected edges. (I am only able to use it an all edges at once) The only workaround i coul imagine would be to extrude a vertex many times (i am not sure if floating point precision would become an issue tho). I feel lost (and the 100 cut cap of subdivide feels a bit like a bad joke).

Hope somebody can help.

$\endgroup$
1
$\begingroup$

I assume you are doing edit operations

Make sure you are using bmesh.from_edit _mesh to get the selected edge information. When doing from_mesh all edges will be selected.

bm = bmesh.from_edit_mesh(my_mesh)
selected_edges = [edge for edge in bm.edges if edge.select]
bmesh.ops.subdivide_edges(bm, edges=selected_edges, cuts=100)
bmesh.update_edit_mesh(my_mesh)

Note that .faces has an .active helper property what does this for faces. A similar API for edges is not available, hence you need to use the list comprehension.

$\endgroup$
  • $\begingroup$ Thx, that does work... :) $\endgroup$ – CoD Feb 5 '18 at 13:44

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.