Decimal zeros missing (PointCoordinate function)

Hello,

I have a problem with missing zeroes in the text field.

I want to show the points heights in the drawings. I have points and I used <PointCoordinate(“Block”,“Z”)> command to get their height.

The only problem I have is that some points do not show the expected 0 at the end. As shown in the image below, I want it to be 8.10 and 8.00.

I checked annotation styles setting, but that one seems to be ok:

I would be grateful for help with that problem.

Hi S. Urbanski,

I’m seeing this too, we should also be able to directly format the value as well.

@wim might know the solution here. I haven’t gotten either to work as of yet.

i dont understand you you are getting point coordinate from block. can you share the file please?

Here’s the file i’m working with

BlockTextField.3dm (61.6 KB)

PointCoordinate returns a string so you’ll have to cast it to a float first, round it, and then format it to show 2 decimals places. This should work, assuming only 1 axis.

%<‘{:.2f}’.format(round(float(PointCoordinate(“Block”,“Z”)), 1))>%

I added the “Block” trick during a service release of v8. There’s currently no UI for it, but if you create a Point Coordinate object and then replace the object ID with the word Block and then convert the text into a block instance the text field parser will return the blocks transformed location. I hope to get the UI in place for v9. https://mcneel.myjetbrains.com/youtrack/issue/RH-68819

it does not seem to work. i want to ask if its possible to perform some kind of math with it? i want to add 200 + Z for example.

i think this trick could be extended into proper function. it is very useful. i can think of returning volume for solids inside block, areas of closed curve inside block etc.

ok this works:

%<“{:.3f}”.format(200 + float(PointCoordinate(“Block”,“Z”)))>%

it is now possible to use it as elevation annotation

Rhino 7 introduced Python parsing of TextFields as Japhy posted above. There are several ways to lightly extend the returned results based on your needs. Most Math and String functions are supported, but more advanced python execution is ignored. eg no virus potential in a textfield.

Hi Ivan -

The issue with blocks is on the list as RH-55286 Text Field - Cannot select a block to retrieve attributes
-wim

RH-68819 is fixed in Rhino WIP