Text Formula for Z height?

Hey there,

I have an annotation dot for which I would like the text to contain the Z position of the dot. Is this possible?


Hi Adam,

Run the following script and pick up the annotation dot you want to change:

import rhinoscriptsyntax as rs

id = rs.GetObject("Pick annotation text dot")
if rs.IsTextDot(id):
    oldText =  rs.TextDotText(id)
    zCoor = rs.TextDotPoint(id)[2]
    newText = oldText + " %0.2f" % zCoor
    rs.TextDotText(id, newText)

It will add the z coordinate value to your present annotation text dot.

If I misunderstood you, and you want your annotation text to have only the z coordinate value, then just replace the next-to-last row with this:

newText = "%0.2f" % zCoor

OK, i forgot to mention Something ^^ I need the Text to update dynamically, just like a Dimension text. Silly me…

I do not think I understand you.
You have a points, and then you add an annotation dot text to those points.
What you would like to do is to move those initial points - and to force an annotation dot text to follow their z coordinate as well?

exactly. Is there a way to accomplish it?

Drop the attached button to your Rhino 5 workspace:
textTag.rui (6.1 KB)
Right-click on “annoZ” button, will allow you to create an annotation dot text objects for selected points.
After you do this, you can move the initial points as you wish. Each time you want to update the label values, just left-click on the same button.

Left-click will always update only those annotations you created using the right mouse button. Not other ones (created by using some other scripts or Rhino’s “Dot” command).