I am needing some help.
I have 2 lists.
-Groups
-Floors
I have ran a script (prior to this one) that assigns each group with an instance version and each item in the group with the same instance version. I am needing to grab the floor for each instance and pull the area to send to a parameter of that group.
I’ve got the lists and compared them and if an item in the group list exists in the floor list then grab the floor area. The issue I’m having though is that the lists are not coming out as expected.
At the end of the day this is my goal:
I have a group with a property A1-1, a floor with property A1-1, and I want to sent that floor area to the group.
Here is an image and the file.
Thanks,
-Ian
Floor areas - Fill in Group parametersGross.script.test.dyn (54.0 KB)
Make a dictionary: property name returns associated group. Then you can just provide the individual floor properties to get the groups with the same value.
I have a script that does something similar. They way i went was.
- Get all the (Model) Groups(s). Filter out the unwanted one if needed
- Get the Group Members (there is a custom node for that)
- Filter out the needed Floors
- Calculate the Area
- Send the value to the (Model) Group(s)
1 Like
So I kept plugging away at it (and didn’t see the notifications) and went back and thought about how I would get these lists in Revit and came up with a solution.
-For both lists I filtered by Group Instance Parameter
-For the Floors I sorted by Group Type
-For both I grouped by key and then grabbed the first item to narrow down the list
-For both I sorted the list
-For the floors I got the area
-I used the UI Messenger node to create an if statement comparing the list lengths
-If they are the same then you click okay and run the script.
The only change I had to make in the model for this to work was change my Unit Group naming by adding a ‘0’ in front of the single digit numbers so they sorted correctly.
There is still room for improvement, but this is better than my previous working script. Before it was dependent on the user to make sure the groups and the floors had similar naming. Now using the script that itemizes the groups and group elements I can use that and the user only has to make sure the group name is correct.
Next on the list is factoring in if there is a 2nd floor to the unit. Currently the way I am handling it, given my time crunch, is to enlarge the first level floor in the Unit farm. I’m assuming I can look in the group and see if there are 2 floors and then have Revit add them together? Not sure on that workflow yet.
Thanks for the feedback.