How to? Embed Z coordinate usertext in a block

Hello All,

I’m trying to make a dynamic block to reports the Z coordinate of the insertion point (using it to annotate the level of building items above the Cplane or world) this is helping me as I’m designing some roof slopes.

My attempt is below, is not actually helping:
1- Create a point
2- Create Text, Assign a Field for Point coordinates (Z only)
3- Setting it as a block, and I got the #### below:

I’m sure the above happen because the GUID of the point changes as I embed it in a block.

4- Editing the block, Re-Assign the Text Field to the new GUID, This works like below:

5- Closing the block Editor, the Field reporting 0 all the time.

My understanding of the block world space is completely different from the Model’s World space, that’s why I can’t measure the location of a point that is embedded in a block in relation to it’s position in the model.
How can I do this? I can do it in grasshopper but I’m just trying to make a standard block that I can use in my day to day studies.

Hi Tay -

There is no good way to do this in Rhino, no. I’ve added this example to RH-55283 - Working with text field syntax is awkward

What you can do, is create the curve geometry and add a text object. Then use ConvertTextToBlockAttribute to make that text object a block instance attribute. That will result in something like this:

%<UserText("block", "Use fx", "", "Z")>%

If you then turn the curves and that text object into a block, when placing an instance, you’ll be prompted for information. You’ll then have to navigate through the fx user text interface to find the PointCoordinate text field, set the options, pick a point, and place the block instance. Not very productive.

FWIW, there’s a test command - TestMatchAnnotationFields but that only works on text objects; not blocks nor groups…

1 Like

Thank you @wim Much appreciated.
This forces me to learn more things to solve my problem, I’ll try making a script that tracks the value of block insertion point. and If I make it I’ll update this post to a new solution.

Thanks again.


For now I’m going to use this python script, it seems working more like _EvaluatePt but without the x,y coordinates.

import rhinoscriptsyntax as rs
mypoint = rs.GetPoint(“Enter your point location”,None, False)
pz = round(mypoint[2],2)
print pz
mark = str(“”)
if pz > 0:
mark = str(“+”)
zval = mark + str(pz)
zdot = rs.AddTextDot(zval, mypoint)