0
$\begingroup$

Sorry if the question is asked before, but I tried using the examples I found on StackExchange and it still didn't give me the right mesh.

I am trying to create a tube that has a shape of cylinder at the tip and a tapered cylinder at bottom, so I decided to use bmesh.ops.create_cone to create both and combine them by removing the doubled vertices and the extra faces (in hindsight, I probably should've created circles and connected the edge loops, but back then I thought it'd be easier this way).

I managed to delete the doubled vertices using bmesh.ops.remove_doubles; and when I deleted the face in the middle using bmesh.ops.delete, it seemed to have worked. But afterwards I tried to increase the mesh size (to prepare it for curve modifier), I realised no edge loops in a significant part in the middle of the tube. I know it is due to the face deleting, as the edge loops seemed fine if I commented out the face deleting part. Could someone please show me where I did wrong? The code for face deleting is as follows, and I am also attaching my file.

    # find the face in the middle and remove it 
    ##############  PROBLEM HERE  ##############                    
    link_ff = []
    
    for vert in bm.verts[:]:
        vert_f = vert.link_faces[:]
        if len(vert_f) == 5:
            link_ff += vert_f
            
    mid_face = Counter(link_ff).most_common(1)[0][0]
    
    print(mid_face)
    
    bmesh.ops.delete(bm,
                     geom=[mid_face],
                     context='FACES_ONLY')
    ##############  ############  ############## 

EDIT: after sleeping on it, I figured out what went wrong. The problem was not the face-deleting but the subsequent edge-subdiving. I forgot to exclude the circumferential edges belonging to the deleted face so they also got subdivided. I am not sure if it is okay for me to delete this post so I will just leave it here.

$\endgroup$

Your Answer

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

Browse other questions tagged or ask your own question.