Automated Lasso Selection sometimes fails


Hi everyone,
I wrote a Rhino Python script which creates a Lasso selection from a List in Python.
Here is the Function:

def lassoselection (ptlst):
    for i in range(0,len(ptlst)):
        if i == 0:
            cmd = "_Lasso "
            cmd = cmd+str(ptlst[i][0])+","+str(ptlst[i][1])+","+str(ptlst[i][2])+ " "
        elif i == len(ptlst)-1:
            cmd = cmd+str(ptlst[i][0])+","+str(ptlst[i][1])+","+str(ptlst[i][2])
            cmd = (cmd + " _Enter")
            cmd = cmd+str(ptlst[i][0])+","+str(ptlst[i][1])+","+str(ptlst[i][2])+ " "

My code to run the function is:
Where the value of lmeshmoved[meshboundaryVert[0][0]][0] is -225.577453613.

ptlist = [[-165,90,0], [-120,11,0], [-165,-50,0]]
newEdge1 = copy.copy(ptlist[len(ptlist)-1])
newEdge1 [0] = lmeshmoved[meshboundaryVert[0][0]][0] -25
newEdge2 = copy.copy(ptlist[0])
newEdge2 [0] = lmeshmoved[meshboundaryVert[0][0]][0] -25


Here are example pictures:

This automated Selection especially fails after leaving rhino open but not working for a while.
Is this a known bug? Has anyone any idea? It fails with a probability of about 20 %.
Thanks a lot. This is a great Forum, I have learned a lot here, now I am newly registered.


Hi Benjamin,

i have no idea why the above script fails but would suggest to not script the _Lasso command and pass the points to the command line.

Below is a quick example to perform a lasso selection using 3d points which limits the selection to object grips. Note that this is, like the _Lasso command, view based. Make sure to turn on object grips before using it. (885 Bytes)

FindByWindowRegion.3dm (47.5 KB)



Hi clement,
thanks for your answer. Your scripting skills seem to be way better than mine. I am still practising. I found the reason why my lasso selection is affected: It is the position of the mouse!!! Whenever I move the mouse into the Rhino view window the automated selection is affected. If I leave the mouse on the command window in the top part of Rhino I get a good selection. I will try the same for your script tomorrow.
Thank you very much!