Working With Indexes

Hey everyone, I’ve come up with an issue in a script I’m working on and I need some help.

I have two lists of heights (ceilings, lights). But they are not read in the same order (i.e. index 0 may be a light at 8’, but in the list of light heights, index 0 may be a ceiling at 12’.) I’d like to set the light heights to match it’s corresponding light heights.

Is there a way to point list item to a certain index of another list?

@robertsb2010, can you shed some light on what the overall script is doing here? You could try a list.mapbykey or similar function but it may be the case that there are much better ways to solve this, such as sorting by room, getting the host for each light, or using a raybounce to find the ceiling above each fixture.

1 Like

From what i can tell you are not reading the information from the samesource.

You get all the lights then
1 - You get the Host Height
2 - You get the Light Height

That way your list are in the proper order since each index is from the same source.

If you can’t do that you need to find commonground between each element to “match” them

THat is assuming i understood your problem :slight_smile:

1 Like

@jacob.small I believe you helped me out on another thread so you may recognize this. I feel like I have all the info I need, just need it to match the right stuff. I have ceiling height, ceiling location(space), and terminal height, but want the terminal height to be equal to is corresponding ceiling height.

Get Element from Link.dyn (21.2 KB)

You are right in that you have all the data you need. But your data is scrambled based on how you have collected it, creating a situation where now it is difficult to know which data should be paired.

A few quick questions (and some explaination as to why I ask) could help sort this out:

Are the terminals hosted to the ceilings? (If so you can group the terminals by their host, get the elevation of each host, and set the elevation accordingly)

Do the space heights match the ceiling heights? (If so you can group the terminals by space, get the space’s height, and set the elevation accordingly)

If neither of those are true, you can set the terminals elevation to something very low across the board - say 6’, and then use a raybounce method to get the first ceiling above each light, and set the elevation by the distance from the low point to the ceiling point.

  1. They are NOT hosted to the ceilings. I shy away from hosted elements for the most part.

  2. They do NOT match, although, I have started a script that will force this to be true. (I’m at the same point where I have scrambled info and am unsure how to re-organize it correctly.)

If I could force the space heights to match the ceiling heights, then I could use that method for any element with an elevation. and vice-versa.

I would reccomend using the raybounce method then - this will ensure your terminals align to the ceiling in all cases - even if it’s sloped, oddlyshaped, or a soffit. :slight_smile:

The raybounce node doesn’t seem to be working with a linked ceiling. I think that’s the big issue with what I’m trying to do is that the info comes from a linked revit file.

Update: I’m not sure if this is the right direction, but I was able to run the raybounce command to find my air terminals and group them with a space. I haven’t been able to do the same for ceilings.

UPDATE #2: I was able to get the ‘raybounce’ command to read rooms from the link and find which air terminals are in which room. The next step I think would be to find the ceiling heights, and set the air terminals ‘offset’ accordingly. Any advice is appreciated. Thanks.Get Element from Link.dyn (32.4 KB)