Dynamo renaming elements out of order

So I created a script that would read the elevation values of levels, do proper rounding to two decimal places, then spit the information back into the name parameter.
Worked like a champ.
Then the need for mechanical is to have a level with PIPE HOST LEVEL as a suffix to a level at 0.00.
Figured it would be easy, I used a filter by boolean mask, and sent a level with 0.00 to the IN output, and all others to the OUT output.

But when I bring them together (combined the lists and flattened it), and I feel like I’m missing something easy here, it seems to name the wrong levels with the wrong values. The values are correct, but it seems to shuffle the values in one order, then assign them to levels in a different order, they are mismatched.
Anyone able to tell me what I am missing here?

Thanks in advance!

Hi, do you only want a suffix for your level name at elevation 0.00

Sincerely
christian.stan

Yes… Now this won’t even be an issue in Struct/Arch/Elec… Mech(Process) and HVAC/Plumbing will be using a 0 level.
I just stripped out my “adding a suffix” from my script and it renames all levels properly again, it’s something with merging lists apparently.

Unless I try to tack on this feature at the end versus trying to split and merge in the middle.

Hi @MRoble33 ,

Could you maybe share what you have now? Hard to see what the exact issue is without seeing your graph and exact names. Could you also explain again what you’re exactly trying to do? Are you trying to add a suffix to just the 0.0 elevation or are you trying to group elements per level?

I even have nodes grouped to explain each step of how I accomplished this.
I’ve tried to split the value up with an Equal node between the blue and the pink, but it lead to two trains of script, and it gave me the same result. So I went back to this.

What I attempted to do this morning was in between the darker green and the last node, I used a “starts with” node, to find the EL 0.00, then create a list from the two lists, flatten in then send it into the last node, and that was no bueno.

What you see here works 100%, minus the Suffix on EL 0.00 addition.

an exemple


cordially
christian.stan

Just an FYI: If you zoom all the way in and use the camera tool (top right) the image is always HD and contains all the node names as well.

And instead of the name of the level, you can also use the level’s actual elevation value.

I got it to add Pipe Hose Level to a level… my issue I’m having is when I merge the “0.00 Level” list and suffix, with the “everything else” list and it will send the wrong data to the wrong levels…

Say I have 5 levels, it’ll give 0, 5,10,15,20… It’ll name Level 20 10, name level 10 0.00 PIPE HOST LEVEL, it’ll name 0 15… it like shuffles my output before doling it out to the parameters.

I got all the prefix and suffix work figured out, it was relatively easy. Merging lists into one list and making it send the right data to the right elements is my issue.

you can also use the level’s actual elevation value.

That’s what I did, it reads the ACTUAL elevation, and before converting it to string, I do the rounding to two decimals because I found when you convert it to string, it adds 6 decimals places, and you can no longer round it. So I rounded it as a number, then when it converts it goes to 6 decimals, but it’s four 0’s, so it’s a matter of chopping off four 0’s now. Then I added a prefix of "EL " to all of them then spit it back into the parameter “Name”.

Me trying to peel out a 0.00 level, adding a suffix, then merging it back in is my issue now.

with a if


cordially
christian.stan

2 Likes

The elevation is already a number, a double/float to be precise. So there is no need to convert it to a string to then convert it back again. FYI: You can use Object.Type to see the type of the data.

2 Likes

This is awesome… I have so much to learn regarding formulas in code blocks, and mere capabilities in code blocks.

1 Like

Thank you!

At the time, it seemed like a required step. I’m all about streamlining the script!

OH!! So we wanted to control the rounding. We wanted .08, .17, etc… And in some cases we wanted it rounded down, some up, and the natural behavior was giving us some undesired numbers. And this method gave us all the numbers they wanted to see.
To shed some light on how I arrived at that

1 Like