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:

(Marios Tsiliakos) #4


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.

(Giulio Piacentino) #6

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

Python rhinoscript AddText() not working

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.


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.