Python display with gh

Hello, I fail to remember how to display a simple vector with python in grasshopper :sweat_smile: ?
So what’s wrong with this code ?
nothing appear in my viewport where it’s supposed to be :confused:

import ghpythonlib.components as gh
import Rhino.Geometry as r

vol,centr = gh.Volume(x)

a = gh.VectorDisplay(r.Point3d(0,0,0),centr)

Here my tinny bug linked in the gh file.
thx for any help.

import rhinoscriptsyntax as rs
import Rhino.Geometry as rh
import ghpythonlib.components as gh
import math

ab1,ab2 = gh.Volume(x)
ab1 = math.floor(ab1)
ab3 = “Volume= “+str(ab1/100)+” Units”
a = gh.TextTag(ab2,ab3,[255,255,255])
b = ab1
c = ab2

Simple (26.4 KB)

even if the textTag is not linked to the output nothing is displayed in my viewport … :face_with_raised_eyebrow:


Have you ever managed to display this (even in Rhino 5?)

I rarely use the ghpythonlib. But I’m pretty sure that when using display components within the python editor the display pipeline gets overridden.


I thx for your answer, I use rh6 and I’m not used with the ghlib, i will wait and see a probable answer from @piac, beyond that the ghpythonlib is designed to be be user friendly and there what is happening is not intuitive at all (for me) so may be we are going to see more trough this in few hours.

Hi @julz

ghpythonlib is a library that allows to use Grasshopper geometry functionality as a simple functions.

This is intuitively also its limitation: only components that act as pure functions work. If they work for other side effects or purposes (like looping, in Galapagos, or like the Timer, for expiring, or Vector/Text display, for displaying things without returning anything) there will be no useful way to use them.

When available they will actually run, but they run in their own Cluster and nothing will appear.
I personally would suggest to use this functionality to simplify big definitions, or create reusable functions. I would just use normal components for vector display or text tag.



Giulio Piacentino
for Robert McNeel & Associates

One option I’ve been using since forever in GHPython is the CustomDisplay class. It’s pretty basic and comes with its own issues, but is generally quite functional for a lot of things. I’ve written some helper functions I can share to work around some of the issues, if need be.

1 Like

Every things is think for a specific use, and there no real need to go further following my need thx @piac for your quick feed back AndersDeleuran thx anyway.

1 Like

Hi @AndersDeleuran,

I would happily take a look to those “helper functions” edit: if still they are available


They sure are:

Edit: Just realised I didn’t actually demonstrate how to implement those functions: (8.1 KB)


@piac, could you please elaborate this part? I would like to know what is happening “behind the curtains”.

buah, this is much less struggle than implementing displaypipeline overrides and all that stuff…

Thanks @AndersDeleuran!

1 Like

It clearly is more limited and also has its quirks. But indeed much simpler :relieved:


sure, but this covers lots of simple use cases! thank for sharing

1 Like

Yes, but it’s really an implementation detail, and therefore it’s subject to change. Right now, slightly simplifying, a normal component is placed in a special solution that is not presented in the UI, it’s assigned values and the solution is solved. Then the results are harvested and given as function results. In addition there are some considerations for threading, for Grasshopper DataTrees and for performance in the mix.

Oh, so kinda creating a .gh file in the memory containing the desired component with the available inputs as a binary stream then save it and serialize the output and deserialize it inside the script?

That’s hacky.

Ahahah, no.

Then is it reusing the way clusters are created?