I’ve been searching a lot for this and haven’t found anything that would fit my needs. I have a list of 13,663 items and each one of them represents a level from the project as strings (and, yes, there are lots of intentional duplicates because each item indicates the level in which a clash was found). The project itself has 28 views(24 FloorPlanViews).
What I need is a way to convert the first list (the one with 13,663 strings) to actual FloorPlanViews. I’ve tried to use “Elements.FilterByName” but the output is a filtered list based on the 28 items list (actual Views). I want the output to be a list of 13,663 View Elements.
First of all, that is a lot of views! You could try using something like “IndexOf” in combination with “List.GetItemAtIndex”, but most likely it will choke with such a long list. I strongly suggest you try creating a dictionary instead.
In the below example I generate a list of random view names, then I use the “Get All Views” node from the archi-lab.net package to get all the views from my project. In the python node, I create a dictionary with the view names as keys and the elements as values. Finally I extract the appropriate element for each random string:
With a dictionary, I manage to convert the 14k strings into elements in just a few seconds.
Thanks for your fast help and, yes, it’s a lot of views! I’ve tried your solution and I got stuck at the Python Code with a warning. What might be wrong?
Thanks, it is working perfectly! I have one last question: I need the output list from your Python Code to be the input on the FamilyInstance.ByPointInView node but I’ve noticed that it expects a single string, not a list. Is there a way to make it accept lists? My intent is to place 13,663 instances of a family type on 13,663 different points and views. That’s why I have a list of 13,663 view variations based on 28 actual views.
I changed the Python Code inside the “FamilyInstance.ByPointInView” a bit to accept a list of views and got it working. I attached the file if someone else ever needs it too in the future.
Great! I’m glad you made it work. “List.Combine” might have been another option for placing the families on different views. How long did it take to create all of the family instances?
Well, there’s a lot of things that is happening before it creates the family instances and the whole thing takes about 15 minutes to finish. These are are the things it does:
Gets clash data from an Excel file with XYZ, Clash Number,Disciplines affected by the clash and all elevations (for each 13,663 clash from the specific project we are working right now);
Parses the XYZ to a Point and correct its location based on the Survey Point <> Project Base Point
Then it places a “Sphere” family with two parameters fed up by the above Excel;
As I want a 2D (Detail Component) element to be on top of every element on floor plan views, it parses all absolute elevations to their respective levels and then (with your help!) to actual views
Then it places all Detail Components on all views.