rs.WindowPick is incredibly slow vs Rhino.WindowPick = instant

I’m rewriting our rhinoscript in python and I stumbled upon this.

import rhinoscriptsyntax as rs

AllPD = rs.WindowPick((-140,-190,0),(99999,-99999,0), None, False, False)

Dunno, I can’t see this here. I don’t know where the “Resolving curve endpoints…” message on the command line is coming from - Rhino is trying to figure something out, but I don’t know what. Do you have any plug-ins loaded that might be trying to do something? Or maybe it’s file related - does it do this with any file? Something special in your block instances?

To test I created a file with 1089 block instances, 3267 curves, 1089 Leaders, 1089 angular dimensions, 1089 linear dimensions, 1089 radius dimensions. V6 rs.WindowPick takes about 0.125 seconds to get them all. Funny, V7 takes slightly longer here at around 0.175 sec. No command line messages in the process except for the print statement.

Here’s the test file and the code I used to test: (516.6 KB)

import rhinoscriptsyntax as rs
import time

AllPD = rs.WindowPick((0,0,0),(700,700,0), None, False, False)
print "{} objects found.  Elapsed time={} sec".format(len(AllPD),et)

Edit - if I enlarge the window it does take a bit longer:

AllPD = rs.WindowPick((-9999,-9999,0),(9999,9999,0), None, False, False)

takes about 0.3 seconds.

Edit 2:
VB Rhinoscript is still faster than the Python equivalent though - about 3.5 times as fast in my test file with an average of about 0.035 sec for the first example… And making the window larger doesn’t seem to slow it down significantly as the Python equivalent, 0.043 seconds vs 0.3 so over 7 times faster.

Option Explicit

Call Main()
Sub Main()
	Dim st, AllPD, et
	st = Timer
	AllPD = Rhino.WindowPick(Array(-9999, -9999, 0), Array(9999, 9999, 0), , False, False)
	et = Cstr(Round(Timer - st, 3))
	Call Rhino.Print("Found " & Cstr(Ubound(AllPD) + 1) & " objects.  Elapsed time=" & et)
End Sub

Spreadsheet tester_.3dm (8.1 MB)

Here’s the file I run it in if you wanna take a look.

Everything I run is stock except appearance.

Happens in every file.


I imagine the extra time it takes is partially because of the “Resolving curve endpoints” messages being printed to the command line… I had to play with it for awhile to find what elements are causing this behavior. I found the culprit - but I have no idea why it actually is doing that.

If you ungroup everything then use _FindText to find all instances of “Cut Face Side Down” and hide them, there are no more command line messages and WindowPick runs in about 1/5 of the time here.

Looking further, it seems that the font is causing the problem, if I change all the instances of that from Lucida Handwriting to Arial, there no more messages either…

@dale, @lowell ?

1 Like

That is very peculiar that a font causes it. Also, the text you have in Arial is actually supposed to be “ISOCPEUR” which does NOT make WindowPick do weird curve calculations.

What version of Rhino are you guys using?
I don’t see any command line messages with 6.27

Current public RC (6.26.20126.12201, 05-May-20)

I don’t know what’s going on.
I installed 6.26.20126.12201, 05-May-20 and ran the script above on Spreadsheet tester_.3dm and saw no commandline echo.

Successfully read file “C:\Users\Lowell\Desktop\Spreadsheet tester_.3dm”
Command: RunPythonScript
81 objects found. Elapsed time=0.072 sec

Rhino 6 SR26 2020-5-5 (Rhino 6, 6.26.20126.12201, Git hash:master @ 6ae0a13b2720e46ba01aad8d1e99a9471bf59ccf)
License type: Educational, build 2020-05-05
License details: Cloud Zoo. In use by: 123 ()

Windows 10.0 SR0.0 or greater (Physical RAM: 16Gb)
Machine name: 123

Non-hybrid graphics.
Primary display and OpenGL: NVIDIA GeForce GTX 1080 (NVidia) Memory: 8GB, Driver date: 4-3-2020 (M-D-Y). OpenGL Ver: 4.6.0 NVIDIA 445.87

Secondary graphics devices.
Intel® HD Graphics 4600 (Intel) Memory: 1GB, Driver date: 3-8-2017 (M-D-Y).

OpenGL Settings
Safe mode: Off
Use accelerated hardware modes: On
Redraw scene when viewports are exposed: On

Anti-alias mode: None
Mip Map Filtering: Linear
Anisotropic Filtering Mode: Height

Vendor Name: NVIDIA Corporation
Render version: 4.6
Shading Language: 4.60 NVIDIA
Driver Date: 4-3-2020
Driver Version:
Maximum Texture size: 32768 x 32768
Z-Buffer depth: 24 bits
Maximum Viewport size: 32768 x 32768
Total Video Memory: 8 GB

Rhino plugins
C:\Program Files\Rhino 6\Plug-ins\Commands.rhp “Commands” 6.26.20126.12201
C:\Program Files\Rhino 6\Plug-ins\WebBrowser.rhp “WebBrowser”
C:\Program Files\Rhino 6\Plug-ins\rdk.rhp “Renderer Development Kit”
C:\Program Files\Rhino 6\Plug-ins\RhinoScript.rhp “RhinoScript”
C:\Program Files\Rhino 6\Plug-ins\RPC.rhp “RPC”
C:\Program Files\Rhino 6\Plug-ins\IdleProcessor.rhp “IdleProcessor”
C:\Program Files\Rhino 6\Plug-ins\RhinoRender.rhp “Rhino Render”
C:\Program Files\Rhino 6\Plug-ins\rdk_etoui.rhp “RDK_EtoUI” 6.26.20126.12201
C:\Program Files\Rhino 6\Plug-ins\rdk_ui.rhp “Renderer Development Kit UI”
C:\Program Files\Rhino 6\Plug-ins\NamedSnapshots.rhp “Snapshots”
C:\Program Files\Rhino 6\Plug-ins\Alerter.rhp “Alerter”
C:\Program Files\Rhino 6\Plug-ins\RhinoCycles.rhp “RhinoCycles” 6.26.20126.12201
C:\Program Files\Rhino 6\Plug-ins\Toolbars\Toolbars.rhp “Toolbars” 6.26.20126.12201
C:\Program Files\Rhino 6\Plug-ins\3dxrhino.rhp “3Dconnexion 3D Mouse”
C:\Program Files\Rhino 6\Plug-ins\Displacement.rhp “Displacement”
C:\Program Files\Rhino 6\Plug-ins\Calc.rhp “Calc”

Do you have Lucida Handwriting (in yellow) font on your PC?

Hi @lowell ,

Make sure you use some coordinates that include the whole range of the drawing like

AllPD = rs.WindowPick((-2000,-1200,0),(2600,0,0), None, False, False)

and make sure you have Lucida Handwriting installed as a font so that it is not substituted by something else.

Thanks, I didn’t have the window big enough to get everything.
I can repeat it now.
Unfortunately it’s more tangled up than I hoped, but I’ll take a closer look pretty soon.

RH-58420 is fixed in the latest WIP