Text Tag 3D - VB Script - Justification

Hi, I’d like to have text orient to the viewport camera and came across a script by David Rutten that did this exactly:
Text Tag 3D oriented to camera
However, the VB script has this text left-justified and would ideally want this centre-justified.
Can someone help to add/edit the code to allow for this?
Thank you in advance.

Does this need to be in VB?

Below is a solution with a line of python:


text_oriented_to_camera.gh (7.3 KB)

Replace this lines

Dim tag As New Rhino.Display.Text3d(text, textPlane, textSize)
pipeline.Draw3dText(tag, Color.Black)

By this

Dim tag As New Rhino.Display.Text3d(text)
pipeline.Draw3dText(text, Color.Black, textPlane, textSize, "Ariel", False, False, 1, 3)

1 Like

Brilliant! Thank you. I prefer a Python node as I know my way around it better.
I measure the distance between the points and the camera origin plane, and use that to factor the Text size S, to keep a constant height of text as one zooms in and out (something the original VB script did).
Thank you, again!

1 Like

At that point you could also use dots.

This is great, I understand the parameters and the order. Thank you!

Hi Martin, can you elaborate on this point? I saw [Dot Display] but I don’t think you mean this…

Text Dots can be created with Elefront

Text Dots are in front of geometry and their size does’t change based on zoom level.
Elefront dots, dimensions or texts can be baked efficiently with attributes, which is a big plus when you’re working with lots of geometry.

text_oriented_to_camera_elefront_textdots.gh (15.2 KB)

You call use the pipeline.DrawDot() method:


Edit: Here’s a quick GHPython example (adding to this old example):

200401_GHPython_DrawViewportWires_03.gh (16.4 KB)