1
$\begingroup$

I have some selected vertices that forms a loop,This loop may be disconnected or connected to other faces: Example

I want to check if it is disconnected or not using python.

$\endgroup$
2
$\begingroup$

enter image description here This will do the trick in your case:

import bpy, bmesh

bm = bmesh.from_edit_mesh( bpy.context.object.data )

selectedVerts = set( [ v.index for v in bm.verts if v.select ] )

bpy.ops.mesh.select_all( action = 'DESELECT' )
bpy.ops.mesh.select_non_manifold()

nonManifoldVerts = set( [ v.index for v in bm.verts if v.select ] )

commonVerts = selectedVerts.intersection( nonManifoldVerts )

bpy.ops.mesh.select_all( action = 'DESELECT' )
for i in selectedVerts: bm.verts[i].select = True
bm.select_flush( True )

msg = "Not connected" if commonVerts else "Connected"
print( msg )

EDITED:

This will now work with any loop that is completely manifold (i.e doesn't have any non-manifold edge/vert)

$\endgroup$
  • 1
    $\begingroup$ Well,I don't expect the user to always use a quad object,Is there is anyway it can be done universally? There is an operation for blender called select non manifold which select all disconnected vertices,You think we can use it to see if it is or not? $\endgroup$ – Omar Emara Jun 28 '16 at 15:07
  • $\begingroup$ Yeah that angle works better, updated the script. $\endgroup$ – TLousky Jun 28 '16 at 15:20

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.