Hi. If I wanted to write an elevation or an offset of a device (security or power), like card reader or a jbox, into a ‘mounted at’ parameter (in inches format), how do you go about doing that?
Depends on what values you are trying to read out.
If you are looking for the bottom / center / top of device, then you can build it inot the family and control the elevation from the parameter.
But, I guess your family doesn’t work that way…probably you are hosting it to a linked model…possibly face-based. Depending on what value you want from the element, there are a number of different ways to accomplish this. I assume your family is centered on the origin planes in the family, so you can use the get.location node to get this point in the project.
If you need the absolute elevation relative to “0” then get.locatiion will give you a point, and you can extract the z-value from there. If you are looking for the elevation relative to the finished floor levels (for example) then it takes a few steps. (I’ll try to describe it…I don’t have revit or dynamo open at the moment.)
After you’ve collected the origins, you could compare the z-value of that point with all levels in the project.
- Get all levels
- Filter by “is building storey”
- Sort by key (Levels / Elevations)
Then you can compare the elevations using the >= node (you want to do all points compared to all levels, so I believe the levels has to be @L1. The list length for each point should be equal to the list length of the level list.)
After that, cout true @L2, send the results of the count to a code-block with “x-1” and get item at index. In this case, the list of indexes will be your list of sorted levels or your sorted keys. Since you just want your sorted keys, you can just subtract the z-value from the items you are grabbing from the list to obtain your elevation relative to that level.