Custom Preview Display in Python(Grasshopper)



I’m writing a custom component(grasshopper) in python and I would like to display the geometry(lines) in different colours. I know it can be done but I don’t know where to start (maybe Rhino.Display.CustomDisplay) but I am not sure. I have searched in the grasshopper forum and had no luck.

Any ideas?



(Dale Fugier) #2

If you want to participate in viewport drawing, override the following methods on GH_Component:


Does this help?


Hello Dale,

thanks for your reply. To be honest, I wouldn’t know where to start. I was hoping that someone could make a very simple example(just with a line segment or a point) and I could try and take it from there.

I’m not sure if this post might be related. Dynamic Drawing of Lines Based on Chosen Points

Also found this thread: but most of the links are redirected to the old Rhino.Python forum.

I’ll keep trying, and see if I can figure it out.

  • M

(Steve Baer) #4

@piac, do you have any suggestions for this?

(Giulio Piacentino) #5

Hi @Miguel

Just to make sure I understand the issue properly: are you writing a script in the Python scripting component and trying to change its behavior?

Can you tell me the goal of this?
Is it specifically to change the default appearance of the preview? Or do you also want to show other behaviors later?



Hi Giulio,

I just want to change the default preview colour. I’m writing a components for network analysis, similar to space syntax. and I would like to visualise the result with a gradient of colours.



Hi Everyone,

@AndersDeleuran answered my question over at the grasshopper forum.

I’ll upload his answer here just in case the link breaks in the future.


Miguel KB)