Skip to content

Instantly share code, notes, and snippets.

@juliomarcos
Created February 6, 2020 21:20
Show Gist options
  • Save juliomarcos/e94e1a88f7bbd856ec77ef542801a1a6 to your computer and use it in GitHub Desktop.
Save juliomarcos/e94e1a88f7bbd856ec77ef542801a1a6 to your computer and use it in GitHub Desktop.
Select the boundary loop adjacent to the faces connected to a top/center vertex
import bpy
addon_keymaps = []
def main(context):
bpy.ops.mesh.select_more()
bpy.ops.mesh.region_to_loop()
class BoundaryFromTopVertice(bpy.types.Operator):
"""Boundary loop from top poked faces vertice"""
bl_idname = "vertex.boundary_from_top_vertice"
bl_label = "Boundary loop from top poked faces vertice"
@classmethod
def poll(cls, context):
return context.active_object is not None
def execute(self, context):
main(context)
return {'FINISHED'}
def register():
wm = bpy.context.window_manager
km = wm.keyconfigs.addon.keymaps.new(name='Window')
kmi = km.keymap_items.new(BoundaryFromTopVertice.bl_idname, 'T', 'PRESS', alt=True)
addon_keymaps.append((km, kmi))
bpy.utils.register_class(BoundaryFromTopVertice)
def unregister():
for km, kmi in addon_keymaps: km.keymap_items.remove(kmi)
addon_keymaps.clear()
bpy.utils.unregister_class(BoundaryFromTopVertice)
if __name__ == "__main__":
register()
# test call
#bpy.ops.object.simple_operator()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment