Concatenation of X, Y coordinates of room points

Hello everyone,
I am new to Dynamo and I’m looking for some help.

I want to create a Dynamo script that allows me to collect the X and Y coordinates of the different points of a “room” object and store them in a shared parameter.
For each point of the room, I want the script to provide the data in the form of x, y so that I can concatenate them.

Example:
I have a room with 4 corners: Point 1, 2, 3, and 4.
I want to store the following information in a shared parameter of the room:
x1, y1 ; x2, y2 ; x3, y3 ; x4, y4

To concatenate you need to convert to a string, as numbers don’t join that way. You’ll also need it as a string to write to the Revit parameter.

The easy way to do this is with a code block - try "" + x + ", " + y ; in a code block. The ‘+’ action in design script will join strings with other objects. In this case the string of "" (an empty string) with the X value, then the string of ", " (a comma and a space) and then the Y value into one.

Thank you for your feedback, Jacob.
Once my list is in a String, which Nodes should I use to properly concatenate the X and Y values of each point?

Sorry - edited things to make it clearer. Use a code block (double click) with the script of "" + x + ", " + y ;

Thanks!
The first step is done. I got a good result. The first value for X is paired with the first value for Y.
Can you explain to me what to do next to get the result on the same line: x1, y1; x2, y2; x3, y3 …?

String.Join node should get you started with that.

Thanks again, Jacob!
I still have two issues:

  • As you can see in the image, when my point is in Double, the separator is ".", but when I convert it to a String, it changes to ",". I would like to keep the "." separator. Do you know how to fix this?

  • I’m using SetParametersByName to pass the value to the shared parameter of the part, but it’s not working properly. One part has no coordinates, and the other part has the coordinates of the wrong part.

My Dynamo file :
VD_Spaces_SetCoordinates [InProgress_v2].dyn (19.8 KB)

This has to do with your regional settings in windows - these are system wide and control if you have a . or a , as the units separator in your windows calculator as an example. Sadly there is no ‘easy’ control for altering this in Dynamo so you’ll have to take some extra steps in your graph unless you want to get into custom scripting.

First use a pair of String.FromObject nodes to convert the X and Y values to strings. Then use a String.Replace node to change the , characters to . characters. Then wire those into the code block as you did before.

1 Like