Dynamic Updates while in Windows form - Python


I’m looking to create a script which colorizes a curve based on distance to a camera. For this, I’m using a Windows Form to select the colors, and need to freely navigate in the Rhino Viewport while the windows form is open. This navigation will update the color, and since the camera is moving during this navigation, the Python script needs to be looping as well to change the color of the curve.

The python script attached is currently not looping while the Windows form is open. The script works once the colors are selected and the form is closed. How does one allow the Python script to loop, while the form is open, and while navigating in Rhino?

curvePoint.py (3.7 KB)


For me the script doesn’t dynamically update the color based on camera position. But from what you’re asking I’d say just show the form non-modally. So instead of of using the ShowSemiModal() method, just use f.Show()



The change in color should happen when you close the form, zoom to selected an zoom in and out. But nevermind that, it’s just an example script.

The Show helps, so thanks for sending. For anyone else interested, keeping the form on top requires this line:

myTopForm.TopMost = True