How to preview Text3d in Rhino

Hi all,

i try to preview a Text3d object in rhino from grasshopper via python so i thought this should work.

import Rhino as rh
import System

T = rh.Display.Text3d('Test')
C = System.Drawing.Color.Black
P = rh.Geometry.Plane.WorldXY
a = rh.Display.DisplayPipeline.Draw3dText(T,C,P)

but i got a error that DisplayPipeline (object?) is expected at first.
When i go to the sdk
nothing is written about DisplayPipeline as input, only text,color,plane.

The help in the grasshopper python editor is mention Draw3dText(self: DisplayPipeline, text: Text3d, color: Color, textPlane: Plane) wahtever this self: DisplayPipeline means.

How can i create self: DisplayPipeline to get a text preview ?.

Thanks in advanced.

Hello Florian,

I haven’t tried this but do the Display examples help? Maybe you need a display conduit instead of a pipeline?


Thanks for help,

but the examples do not help and i guess the main reason are my scripting skills.
This forum post Creating text objects and outputting them as normal Rhino geometry is exactly what i have tried and the python and c# example works exactly the way i want but these scripts are to complicated to me.
It would be cool to understand this created class to preview non grasshopper objects and also preview grasshopper objects without an output maybe in the future.
But my second try succeed with creating a TextEntity object and previewing as surfaces.
Unfortunatly baking text entity take the dimesion style changes not into account.

import Rhino as rh
import scriptcontext as sc

# get dimstyle and change settings
ds = rh.DocObjects.DimensionStyle()

# change text properties ( a lot of options )
ds.Font = rh.DocObjects.Font(F)
ds.TextHeight = H
#ds.TextVerticalAlignment = rh.DocObjects.TextVerticalAlignment.Bottom

# create textentity which is not visible for grasshopper
te = rh.Geometry.TextEntity.Create(T,P,ds,False,0,0)

# create textentitysurface which is visible
# for preview what you get if you bake the text entity
a =  rh.Geometry.TextEntity.CreateSurfaces(te,ds,0,0)

# bake text with same settings like textentity to get rhinotext object
if Bake:
    sc.doc = rh.RhinoDoc.ActiveDoc
    sc.doc = ghdoc

I like to use the simpler CustomDisplay class for rendering geometry and text from GHPython, using these functions to circumvent some of the issues with using this method:


Here are the result of my efforts of creating a datagrid from a tree.
Is super slow ugly coding but anyway maybe someone can use it. (8.5 KB)