Point Coordinates to string

Hi

I’m creating a folder with 3D views in dynamo, and then naming them as shown below. (pic_8.png for example)
coords

I would like to add the camera point coordinates to the name to know where the picture was taken exact, but I can’t find what I need to add to this script to get that result. The result I am looking for would look something like “pic_8_x15000y7000z1700” for example. All the camera points are known in my dynamo script, maybe linking them is an option, but I haven’t figured it out.

Thanks

You can use the format() method for a string to achieve this. Here’s an example:

image

Assuming you have either a Designscript Point or a Revit XYZ, the above code is valid for a single instance as each of those object type have X, Y, and Z properties.

Thanks for the quick reply!

I tried your solution, but I think there is an extra problem because (I think) my input is a list of points and not a single point. Given error: Warning: IronPythonEvaluator.EvaluateIronPythonScript operation failed.
Traceback (most recent call last):
File “”, line 19, in
AttributeError: ‘list’ object has no attribute ‘X’

This is how I have put in in the scipt:
coords

And this is how the input of the given coords looks like in the watch block (z coords not visible on watch on 1 screenshot)
pts

Yes, this will have to be modified to work with a list of points. My above example is only for a single point. So, whereas this is valid:

Point.X

This is not:

[Point, Point, Point].X

this is the non-python version

1 Like

And how would I have to write that? I’m not that familiar with coding in general…

x{ptx}y{pty}z{ptz}’.format(ptx=pt(i).X, pty=pt(i).Y,ptz=pt(i).Z) does not seem to work, x{ptx}y{pty}z{ptz}’.format(ptx=pt.X(i), pty=pt.Y(i),ptz=pt.Z(i)) neither…

I tried your solution, but somehow it gives this error: File “”, line 19, in
TypeError: list is not callable
.
This is how I did it:
pts
with the input pt this output from the codeblock:
code

Thanks for the reply :slight_smile:

I’m not quite with you

you could achieve what you want either with Python, or with standard nodes
Probably best to go for one or the other, not both

pt[i] and not pt(i) - square brackets for index
this is a function call in python : function(arguments_passed_to_the function)

2 Likes

Thanks all, it works now how I wanted it!