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

Results 1 to 8 of 8
Like Tree4Likes
  • 2 Post By Bjorn_K
  • 1 Post By Bjorn_K
  • 1 Post By cellersick

Thread: Dynamo-like IndexMatch?

  1. #1
    Moderator snowyweston's Avatar
    Join Date
    December 21, 2010
    Location
    C.LONDON
    Posts
    4,382
    Current Local Time
    03:38 AM

    Dynamo-like IndexMatch?

    The GoogleFu is weak with this one - and though sure this has been asked a million times before, I can't seem to find the solutions to my amateurish issue.

    I have, wait for it, lists that I'd like to compare and get values from. Original nah?

    Specifically* relating to Areas, I'd like to:

    1. get the Area Scheme <Name> push-populated into a custom SP into each area - redundant I know, as the ElementID is there, but humans can't read ElementID -and I work with humans.

    2. do the same, but using a property from the Area's respective Level, in particular an SP I've populated with "floor to floor height".

    So far I've been aiming at <Level Name> as the matching property (seems fairly robust enough) - but it's knowing which nodes to use to build:

    "if an element in List A has a parameter value X, and in List B there is an element with a matching parameter value X, then take the parameter value Y of said element from List B and throw it into the parameter value Z of matched elements in list A"

    still stumps me.



    If this were Excel, I'd use Index Match and be done by now. This isn't Excel.

    And yes, I've trawled the web - and re-read the Primer nearly everytime I fire up Dynamo.

    Here's my "effort" so far, trying to stick with OOTB nodes for now...

    EDIT
    To clarify; much as I'd love to get a working solution to this here quandary, I'd rather - if I might be so cheeky - a 'layperson's terms' explanation as to how I should be thinking - since the ability (or lack thereof) to do this kind of thing basically underpins all of my Dynamo-data-delving-desires.

    PS:
    One of things I've noticed about the Dynamo forum, ironically for a forum aimed at a 'visual' programming platform, "solutions" are often presented quite matter-of-factly (and) in code-form (example lists generated in code blocks etc).



    *Specially!?! urgh.
    Attached Files Attached Files
    Last edited by snowyweston; October 22nd, 2017 at 02:50 PM.

  2. #2
    Member Bjorn_K's Avatar
    Join Date
    April 8, 2011
    Location
    Rotterdam, Netherlands
    Posts
    319
    Current Local Time
    04:38 AM
    Hi Snowy,

    With regards to:

    "if an element in List A has a parameter value X, and in List B there is an element with a matching parameter value X, then take the parameter value Y of said element from List B and throw it into the parameter value Z of matched elements in list A"

    If your connection between A and B is a Revit element (in this case a Level) it is a lot easier to use that element (and make sure to get it's element Id) as the "bridge" you're looking for.

    Example:
    Dynamo-like IndexMatch?-element_id_link.png


    Alternatively for other situations it sounds to me like you would like to look into Dictionaries in Dynamo.

    Example:
    Dynamo-like IndexMatch?-dictionary.png

    The code for Dictionaries is also present in Design Script so you can call it through your Code Blocks if you do not want to install Lunchbox.
    Dynamo-like IndexMatch?-code.png
    *Note: not proper syntax, just an FYI.

    I learned the basics of Dictionaries from seeing it mentioned a few times and studying this vid by John Pierson.
    https://youtu.be/XyHeSxqomCQ


    To get back to your question about the way to think. I found out it helped me a lot to not do " I ask the project for List A, I ask the project for List B, and now I have to conjure a smart way to connect the two" but rather " I ask the Project for list A (Revit Elements), I ask the list A for their properties and find X, I connect X to it's Revit Id and query it for B. The result is List A and List B with both the same number of entries and in the correct order, easy to push back again."

    Hope that makes sense.
    Attached Files Attached Files
    snowyweston and amoursol like this.

  3. #3
    Moderator snowyweston's Avatar
    Join Date
    December 21, 2010
    Location
    C.LONDON
    Posts
    4,382
    Current Local Time
    03:38 AM
    Been at this a while now, exhausted, retiring for the day, but will read more another time. Not sure why you got moderated, all's well now. Ta. K

  4. #4
    Member
    Join Date
    September 19, 2015
    Posts
    163
    Current Local Time
    03:38 AM
    I have seen an interesting proposal on list mapping recently that could partially meet your needs:
    https://forum.dynamobim.com/t/list-m...-problem/15765

  5. #5
    Member Bjorn_K's Avatar
    Join Date
    April 8, 2011
    Location
    Rotterdam, Netherlands
    Posts
    319
    Current Local Time
    04:38 AM
    @Yna_Db, that looks like an intresting approach as well indeed. Had to play around with it a little.

    @Snowy, that could look something like this for you:
    Dynamo-like IndexMatch?-list_index_excel.png

    The extracting/pushing back part could be streamlined a bit more, I'm sure.
    amoursol likes this.

  6. #6
    Member
    Join Date
    March 21, 2013
    Location
    Phoenix, AZ
    Posts
    275
    Current Local Time
    07:38 PM
    Quote Originally Posted by snowyweston View Post
    ... a 'layperson's terms' explanation as to how I should be thinking ...
    The marble run / mousetrap / Rube Goldberg machine analogy helped me. You can think of the nodes as 'gates' or nexus points of the marble run, and the wires are the track between them, and your marbles are whatever you're sending through the graph. You can arrange your graph to produce the correct arrangement of marbles for a particular gate function - this gate is expecting 12 marbles, all in a row. Or, this gate is expecting 8 stacks (lists) of 3 marbles (items) each. If there is a mismatch, your marbles end up on the floor and you have to try again. You're trying to affect the shape and flow of the pack of marbles as gravity pulls them down the track. Like Bjorn is showing, you can use combinations of nodes like IndexOf and GetItemAtIndex to query and shape your 'marbles'.

    It really comes down to list handling and lacing most of the time (at least for me); get the right lists in the right shape.
    amoursol likes this.

  7. #7
    Forum Addict josephpeel's Avatar
    Join Date
    May 3, 2012
    Posts
    1,401
    Current Local Time
    04:38 AM
    Quote Originally Posted by snowyweston View Post
    "if an element in List A has a parameter value X, and in List B there is an element with a matching parameter value X, then take the parameter value Y of said element from List B and throw it into the parameter value Z of matched elements in list A"
    So long as your items in List B are unique, you can use "First Index Of" to get matching items, like Index Match.
    For example; Get all elements in "List A" (Areas?)
    Get parameter value by name "X" = "X value List A"
    Get all elements in "List B" (Levels?)"
    Get parameter value by name "X" = "X value List B" (Should be a list of unique items)
    Do "First Index Of" for all items in "X value List A" in "X value List B"
    This should give you a list of Index numbers with the same length as "List A"
    Do "Get Item at Index" with this list and "List B" and it should pick out the levels that correspond to each of the Areas in "List A"
    Get parameter value by name "Y", will give you a list of the values of parameter Y from the level for each Area in "List A"
    Use Set parameter value by name "Z" to put all these values into all the elements in "List A"

  8. #8
    Moderator snowyweston's Avatar
    Join Date
    December 21, 2010
    Location
    C.LONDON
    Posts
    4,382
    Current Local Time
    03:38 AM
    Apologies all, I am reading - thank you - but I've not revisited Dynamo since posting, so will have to get back to you with my 'progress' when I find time.

Similar Threads

  1. Replies: 0
    Last Post: October 20th, 2017, 01:15 PM
  2. Replies: 4
    Last Post: August 2nd, 2017, 02:30 PM
  3. Dynamo
    By leetecture in forum Architecture and General Revit Questions
    Replies: 4
    Last Post: March 30th, 2015, 02:50 PM
  4. Replies: 0
    Last Post: November 19th, 2014, 11:45 AM
  5. Replies: 0
    Last Post: August 26th, 2013, 07:45 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
  •