Donate Now Goal amount for this year: 2500 USD, Received: 1627 USD (65%)

Results 1 to 10 of 10
Like Tree4Likes
  • 1 Post By Ning Zhou
  • 1 Post By Ning Zhou
  • 1 Post By amoursol
  • 1 Post By Ning Zhou

Thread: key-values

  1. #1
    Senior Member Ning Zhou's Avatar
    Join Date
    July 20, 2011
    Posts
    850
    Current Local Time
    04:22 AM

    key-values

    any easy way to process 2 lists into 1 key-values list just like dictionary in C#?
    list 1 is like {a, b, a, c, b, a}
    list 2 is like {1, 2, 3, 4, 5, 6}
    result list is like {{a, 1, 3, 6}, {b, 2, 5}, {c,4}}

    edit: or result list like {{a, b, c}, {1, 3, 6}, {2, 5}, {4}}
    Last edited by Ning Zhou; January 25th, 2017 at 06:43 AM.

  2. #2
    Senior Member amoursol's Avatar
    Join Date
    November 21, 2012
    Location
    London, United Kingdom
    Posts
    612
    Current Local Time
    12:22 PM
    Hello Ning,

    There are a couple of Dictionary nodes created. Showcased as below:

    Attached Thumbnails Attached Thumbnails key-values-revitforumquery_dictionary.jpg  

  3. #3
    Senior Member Ning Zhou's Avatar
    Join Date
    July 20, 2011
    Posts
    850
    Current Local Time
    04:22 AM
    thanks Sol.
    see attached image for the desired results, perhaps OOTB List.Map can solve this issue, isn't it? i'm not quite familiar w/ that OOTB node, maybe Python Script is the only way out?
    Attached Thumbnails Attached Thumbnails key-values-capture.jpg  

  4. #4
    Senior Member Ning Zhou's Avatar
    Join Date
    July 20, 2011
    Posts
    850
    Current Local Time
    04:22 AM
    managed to get one of the desired results, still try to figure out another one, using OOTB nodes only
    Attached Thumbnails Attached Thumbnails key-values-x.png  
    amoursol likes this.

  5. #5
    Senior Member Ning Zhou's Avatar
    Join Date
    July 20, 2011
    Posts
    850
    Current Local Time
    04:22 AM
    managed to get another desired result using python script, must be a way to use OOTB node only like List.Map, anyone?
    Attached Thumbnails Attached Thumbnails key-values-xx.png  

  6. #6
    Senior Member amoursol's Avatar
    Join Date
    November 21, 2012
    Location
    London, United Kingdom
    Posts
    612
    Current Local Time
    12:22 PM
    If you can use Python, feel free too! I would simply do my method with an 'Add Item to Front' as you have done.

  7. #7
    Senior Member Ning Zhou's Avatar
    Join Date
    July 20, 2011
    Posts
    850
    Current Local Time
    04:22 AM
    last try:

    seems the very simple question, just "merge" 2 list using OOTB nodes only, code block node is OK, but cannot use python script node, anyone?
    Attached Thumbnails Attached Thumbnails key-values-xxx.png  

  8. #8
    Senior Member Ning Zhou's Avatar
    Join Date
    July 20, 2011
    Posts
    850
    Current Local Time
    04:22 AM
    just figured out thanks to Sol and Marcello.
    Attached Thumbnails Attached Thumbnails key-values-xxxx.png  
    amoursol likes this.

  9. #9
    Senior Member amoursol's Avatar
    Join Date
    November 21, 2012
    Location
    London, United Kingdom
    Posts
    612
    Current Local Time
    12:22 PM
    This way is faster!

    What it's doing is as follows: List.AddItemToFront is taking the item at Level 1 (3x objects), and adding those objects in to the listat Level. So the 3x objects from the unique keys slot in at the correct tier structure.
    Attached Thumbnails Attached Thumbnails key-values-revitforumquery_listatlevel.jpg  
    Last edited by amoursol; February 9th, 2017 at 09:15 AM. Reason: Explanation
    Ning Zhou likes this.

  10. #10
    Senior Member Ning Zhou's Avatar
    Join Date
    July 20, 2011
    Posts
    850
    Current Local Time
    04:22 AM
    list level option is absolutely beautiful! no need to figure out List.Map anymore for sure, again, Less Is More!
    amoursol likes this.

Similar Threads

  1. Schedule - multiply two values
    By sharkmullet in forum Architecture and General Revit Questions
    Replies: 7
    Last Post: August 20th, 2013, 08:36 PM
  2. Pushing SP & Values into RFAs
    By kirklyncox in forum Architecture and General Revit Questions
    Replies: 1
    Last Post: December 12th, 2012, 06:02 PM
  3. calculating values
    By paudiesf in forum Architecture and General Revit Questions
    Replies: 10
    Last Post: May 29th, 2012, 12:32 PM
  4. Schedule values need to be rounded up. Can I do this?
    By DMapes in forum Architecture and General Revit Questions
    Replies: 9
    Last Post: May 2nd, 2012, 06:33 PM
  5. Parameter values
    By bangobeat in forum Out There
    Replies: 0
    Last Post: October 26th, 2011, 12:27 AM

Posting Permissions

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