Hi all!
I working on this script in order to change the Revit family name and rearrange them according to the number of families that are tagged as “not in use”.
Everything works pretty well, but I would like to enhance the last part of the script. As in the jpg “capture2”, I need to subtract 1, 2, 3, etc times according to the range that I set up “capture3”. In this case:
if 4 < list < 7, 1 should be subtracted from the list inside that range;
if 7 < list < 9, 2 should be subtracted from the list inside that range;
if list > 9, 3 should be subtracted from the list;
and so on…
This works good, but If I have 20 family types that are not being used, then I need to add 20 more nodes in order to go through the list and search for items within the range and then subtract.
I would like to know if there is an approach that could be applied to this script in order to make it “automatic” and not being necessary to add more nodes “manually”.
This is a snippet of design code from a script I was working on for evaluating occupancy loads for spaces surrounding bathrooms to determine the number of fixtures required by code. In general, I try to use design script over python, but that’s just me. You will need to adapt it for your purpose, but you can see the basic:
What I tried to do with the python script was indeed something very similar. Its a simple IF statement based on the elements within one list, affecting the items on the other list.
The difference in the logic is that I pretend not to specify any number(or item) because it varies according to the families that are not being used. That’s why I preferred to make the inputs for the if statement as “the first, second, third, etc item in the list” rather than 0, 40, 70, 100 (as in your example, if I understood well).
I am beginner on scripting and programming. I just made some basic python tutorials and came up with this.