Announcement

Collapse
No announcement yet.

Dynamo-like IndexMatch?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    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. :hide:

    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
    Last edited by snowyweston; October 22, 2017, 02:50 PM.

    #2
    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:
    Click image for larger version

Name:	Element_Id_link.png
Views:	1
Size:	222.3 KB
ID:	395202


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

    Example:
    Click image for larger version

Name:	Dictionary.PNG
Views:	1
Size:	777.7 KB
ID:	395203

    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.
    Click image for larger version

Name:	Code.PNG
Views:	1
Size:	114.9 KB
ID:	395204
    *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.



    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

    Comment


      #3
      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

      Comment


        #4
        I have seen an interesting proposal on list mapping recently that could partially meet your needs:
        I am having a problem with List.Map and I’m unsure why. I have 56 piles within my model each having an individual Mark. I also have an Excel file which contains additional data which I am trying to assign to various Shared parameters already setup within the project. The naming convention of the Mark within the Revit model is also slightly different than that of the Excel spreadsheet. With the Excel spreadsheet being the correct format. I have successfully changed the format and the List.Map re...

        Comment


          #5
          @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:
          Click image for larger version

Name:	List_Index_Excel.png
Views:	1
Size:	417.2 KB
ID:	395206

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

          Comment


            #6
            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.
            Chris Ellersick

            Comment


              #7
              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"
              "One must imagine Sisyphus happy." Albert Camus - "The innovator has for enemies all those who have done well under the old conditions, and lukewarm defenders in those who may ​do well under the new." Nicolo Machiavelli -"Things that are too complex are not useful, Things that are useful are simple." Mikhail Kalashnikov

              Comment


                #8
                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.

                Comment

                Related Topics

                Collapse

                Working...
                X