0
$\begingroup$

I want to call select_linked_pick from my script so that it behaves as if you had pressed L with the cursor hovering over part of a mesh. Problem is when I try to call it from script it doesn't appear that anything happens.

def execute(self, context):
    bpy.ops.mesh.select_linked_pick()

There is no output in the console, what am I doing wrong here?

$\endgroup$
  • $\begingroup$ I am using this to linked select : bpy.ops.mesh.select_linked_pick(deselect=False, delimit={'SEAM'}, index=vertex.index) . Index value depends on that: if it is a vertex : just index of it. if it is an edge: total vertex number + index of edge. if it is a face: total vertex number + total edge number + index of face $\endgroup$ – Alperen Üretmen May 20 '17 at 18:40
  • $\begingroup$ Thanks for the reply, still don't understand though; Running your code as is returns an error: name 'vertex' is undefined. How do I find the index of the vertex under the cursor? $\endgroup$ – TryinToLearn May 20 '17 at 22:36
1
$\begingroup$

Managed to solve this issue by simply using different operators to get the same result:

    loc = event.mouse_region_x, event.mouse_region_y

    bpy.ops.view3d.select(location=loc)
    bpy.ops.mesh.select_linked()

Found from this answer by CoDEmanX.

Seemed a lot simpler in the end than trying to retrieve the right indexes for everything to use select_linked_pick...

$\endgroup$
  • 1
    $\begingroup$ I'm glad that you found a solution, I think that will help me a lot also, thank you:) $\endgroup$ – Alperen Üretmen May 21 '17 at 20:29

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.