Donate Now Goal amount for this year: 3000 USD, Received: 1207 USD (40%)

Results 1 to 9 of 9
Like Tree1Likes
  • 1 Post By Bjorn_K

Thread: Get elements of catgory by family name.

  1. #1
    Member
    Join Date
    April 10, 2014
    Posts
    73
    Current Local Time
    12:17 PM

    Get elements of catgory by family name.

    I have some families in a category. In Dynamo, I want to filter them by family name. I have category => All Elements of Category. I have the name string that I can plug into a Boolean mask, but how do I get the family names out of the elements for filtering? I know that this has been done,. Can anybody point the way?

  2. #2
    Forum Addict elton williams's Avatar
    Join Date
    December 7, 2010
    Location
    Gold Coast
    Posts
    2,602
    Current Local Time
    02:17 AM
    Run the element name value through an == or 'contains' node to return true and false values. This then connects to the mask input on the filterbybool node. Connect the list of elements to the list input, which will return 2 lists. 'In' will be a true values, 'out will be all false.
    Hope that kinds makes sense as I'm not near a computer atm.
    Last edited by elton williams; March 11th, 2019 at 09:43 AM.

  3. #3
    Member Bjorn_K's Avatar
    Join Date
    April 8, 2011
    Location
    Rotterdam, Netherlands
    Posts
    313
    Current Local Time
    06:17 PM
    1. You cannot feed a Name String into a Boolean Filter, that needs a list of Booleans, so you need to evaluate your list of names first. (Edit: Like Elton said above me)

    2. Be more precise with what you're asking, do you need to filter the Families, or do you mean the placed Instances, and you do that by their Family Name.

    Get elements of catgory by family name.-instance_type_fam_filter.png

    PS: it's ofc possible to do it shorter then this example, you can try using GetParameterValueByName and use the names "Type" of "Family".

    PS2: And if you're only after the Instances of 1 Family Type, this is easier:
    Get elements of catgory by family name.-2019-03-11_1043.png
    Last edited by Bjorn_K; March 11th, 2019 at 09:44 AM.

  4. #4
    Moderator Robin Deurloo's Avatar
    Join Date
    July 7, 2011
    Location
    Rotterdam, Holland
    Posts
    1,169
    Current Local Time
    06:17 PM
    mmm, I might have misunderstood the question
    Attached Thumbnails Attached Thumbnails Get elements of catgory by family name.-capture.jpg  
    Last edited by Robin Deurloo; March 11th, 2019 at 09:42 AM.

  5. #5
    Member
    Join Date
    April 10, 2014
    Posts
    73
    Current Local Time
    12:17 PM
    Bjorn_K, this worked! I successfully loaded parameters into three of my four families.
    Now, I have a related problem. One of the families has more instances than I want to address in Revit, so I have to filter out the unwanted instances. I have a parameter called CLASS OF PARENT. It has values: AD, AS, AQ and (empty). I want to select the empties, presumably by selecting the out of the Boolean filter. So, I need to get the parameters from the elements, select the single parameter CLASS OF PARENT and filter the elements by the strings AD, etc. I think I could cascade the Booleans or use an OR node. Attached is my failed attempt. Can you shed some light?
    Thanks.
    Attached Thumbnails Attached Thumbnails Get elements of catgory by family name.-dynamo-filter-out-ad-etc..jpg  

  6. #6
    Member Bjorn_K's Avatar
    Join Date
    April 8, 2011
    Location
    Rotterdam, Netherlands
    Posts
    313
    Current Local Time
    06:17 PM
    There is a connection issue in your screenshot. You're trying to filter the elements coming out of your first Filter Node with a Boolean Mask made from the Names of the values of the ORIGINAL list. That is never going to work correctly.

    For the CLASS OF PARENT Parameter, just use GetParameterValueByName, you're asking the elements for the Name of their parameter atm, not the value.

    The practical answer to your question, just filter on string.contains "A" and get the False Results, those should be your Empties.

  7. #7
    Member
    Join Date
    April 10, 2014
    Posts
    73
    Current Local Time
    12:17 PM
    Hi Bjorn. This worked with Dynamo errors that I resolved by eliminating mismatches in the data. It runs clean, but wrong! The serial order of the data family instances, acquired by the method you've suggested, does not match the order from the Excel sheet so, when merged back together, the values go into the wrong instances. The order of the entries from the Excel sheet matches the order of the instances as they occur in Revit. I tested this by taking a unique ID parameter (not the guid, with which I'm not yet familiar) from Revit, passing it through the extraction to Excel, back into this Dynamo graph and back into a family parameter I called "CHECK ID". You can see those values as GO 101, IL 116, etc. They load nicely into CHECK ID, but in the wrong order in a Revit schedule that shows the original ID and the CHECK ID. Also, the family types, as seen in the bottom right Watch, don't match the
    of types of GO 101, etc., as they occur in the
    model, i.e., IL 116 is not 600 x 600 x 150. Is there another way to get the family instances in order? Can I do something with the guid's?
    Attached Thumbnails Attached Thumbnails Get elements of catgory by family name.-dynamo-wrong-order.jpg  

  8. #8
    Member Bjorn_K's Avatar
    Join Date
    April 8, 2011
    Location
    Rotterdam, Netherlands
    Posts
    313
    Current Local Time
    06:17 PM
    You can try sorting both list by the same kind of property (SortByKey/SortByFunction) so the lists align in Dynamo and the data gets transferred into the right element.

    Alternately you can use Dictionaries, so you can call the properties of an element by a Key Value (maybe the Revit ID, maybe an equipment number you guys use?). I really like using dictionaries and would suggest you look into them. If you get "dirty" data into a sorted list, all the values under the wrong element will probably get shifted, while with Dictionaries only the dirty element gets effected by the mismatch. Dictionaries are native Dynamo since 2.0, in 1.3 you need either a package (I think both Archi-lab and Rhythm had Dictionary Nodes?) or write them in Design Script in a Code Block.

    JohnP (@60secondRevit) did a short video explaining the Dictionary concept a while back: https://www.youtube.com/watch?v=wSR-6nDymu0
    Last edited by Bjorn_K; March 19th, 2019 at 11:00 AM. Reason: Typo
    elton williams likes this.

  9.    #9
    Member
    Join Date
    April 10, 2014
    Posts
    73
    Current Local Time
    12:17 PM
    Thanks, Bjorn and TwiceRoadsFool. In the interest of helping others as I was helped, I'm posting this reply into two threads that were helpful to me.
    It turns out, by brutal experience, that outside data can only be pushed into families by the same rules as working in Revit - the child gets the data by association from the parent. If you try to do it directly, you get the deadly "read-only" error. You pull your hair out and your wife wonders why you don't come to bed any more.
    I have a child family that is hosted in several parent families. The child has independent data, derived from the parents, and needs calculated results that I do via Excel (because I know Excel). The child gets the results from whichever parent family hosts it. The problem turned out to be that the identities of the child families don't occur in the same order as the parent families that host them. Dynamo retrieves the values from Revit in this order (the little green numbers in the list view of types which, if you click them, magically transport you to the element in Revit). Putting the data back into different families - the parents - results in the wrong data getting back to the children.
    I made a shared parameter called Sort Index in parents and child and associated it. From a schedule, I manually entered a sequence of values into Sort Index in the parents, which the child picked up, so the instances of the child shared the same sort index values as their parents.
    In my graph From Revit to Excel via Dynamo, I pulled the data from the child family, sorted it by the Sort Index (using SortByFunction as suggested by Bjorn), then sent the indexed data into Excel. ObjectIdentity is a great way to gather the threads so I don't have to reconnect a bunch if I make a change.
    In Excal, two workbooks are needed. One workbook receives the Dynamo data, which is destructive if "overwrite" is selected", blowing up the formulas that read the data if it's in the same workbook. The other worksheet reads the first and does the calculations, with several "reporting" sheets to provide the data to the respective parents. A column in Excel kept track of the Sort Index values.
    After Excel performed the calculations, my other graph, From Excel to Revit via Dynamo, pulled the data from each reporting sheet in Excel, which is already in sorted order. The instances of the parents coming out of Revit are sorted by the Sort Index, then the Excel data is pushed into each parent. For verification, the Sort Index value from Excel is pushed into another shared and associated parameter called Sort Index Check. The child gets the calculated values and the check value from its parent. I made a schedule of the Sort Index and Sort Index Check for the child family and, voila, they all line up.
    My hat goes off to the people around the world that monitor the forums and help people like me. I'm strong in my own field, but need your knowledge, freely given, to move my own efforts forward. Thank you.



Similar Threads

  1. Displace family elements
    By Jaime in forum Architecture and General Revit Questions
    Replies: 8
    Last Post: July 6th, 2018, 06:59 PM
  2. Elements w/in family not at proper elevation?
    By doni49 in forum Structure - Family Creation
    Replies: 8
    Last Post: April 12th, 2017, 08:58 PM
  3. Orthogonal elements in adaptive family
    By stonesfcr in forum Architecture - Family Creation
    Replies: 3
    Last Post: December 8th, 2016, 07:29 PM
  4. Dimension family elements in project
    By byk3bep in forum Architecture and General Revit Questions
    Replies: 6
    Last Post: February 12th, 2015, 09:40 AM
  5. constrained elements in family
    By mona miller in forum Architecture and General Revit Questions
    Replies: 2
    Last Post: July 20th, 2014, 09:55 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •