Sunday, September 14, 2014

Practical Dynamo - Excel Linking 2: Keeping Track of Your Families

There is an advantage to living in a small city/country with a disproportionately large contingent of ADSK employees: I have great access to the development team!

In my last blog post, I pointed out how the list of values for the selected families were not in alphabetical order:


This was because the instances were sorted in order according the GUID:


Without taking the GUID into account, it was impossible to map data from excel back to the appropriate family instance.  If i sorted the data in Excel, I would end up with results like this one:


Not quite hitting the mark in terms of "Data Integrity".  What i needed was a way to export the data, taking the GUID into account, and then be able to map values to the right object on the return trip.

I got in touch with my friends Sharad and Ritesh at ADSK in Singapore and told them about my problem.  These guys love both a challenge and customer feedback; its a match made in heaven because i am a man with problems.

Explaining my dilemma to them, they knew exactly how to solve it and we developed these 2 scripts.

THE OUTPUT:

I included the UniqueID into the index stack:

Making my excel spreadsheet look like this:

THE INPUT:
Now when i bring the data back from Excel, there is the index for my elements included.  The order of the GUIDs will inherently match the order of the lists for the other data indices.

What the boys at ADSK told me about was a command ElementSelector.ByUniqueID.  They made me create a code block like you see above and then plug that into SetParameterByName node.  Now DYNAMO will pick my instances by name and in the correct sorted order.

And I am whole again!


The ElementSelector.ByUniqueID is a "hidden command" apparently.  It was in the user menu previously, but the team took it out because they couldn't think of a scenario where it would be useful!  BIMTroublemaker to the rescue!

This whole process makes me happy like ordering from the secret menu at In & Out!












10 comments:

  1. Great post..but i can't get the in script to work.
    The last field (Element.SetParameterByName) has an error.
    Dereferencing a non-pointer
    What am I doing wrong?

    https://www.dropbox.com/s/s4bjax1q14eeczr/Knipsel.PNG?dl=0

    ReplyDelete
  2. Sorry found my first error....missed the d of UnigeuId
    But now i got the error; No parameter found by that name

    https://www.dropbox.com/s/r9l159bhv39hl71/Knipsel2.PNG?dl=0

    ReplyDelete
  3. Solved...removed the string and reapplied it..now it works

    ReplyDelete
  4. Persistence matters in the BIM game! Good Going Arno!

    ReplyDelete
  5. I had that same "parameter does not exist" error when I ran through the original post. Same solution, remove the string and then reapply it.

    Also jealous of that obnoxious burger! Did you get that in Singapore?

    ReplyDelete
  6. Great stuff. I'd also like to highlight that the "hidden command" codeblock:"ElementSelector.ByUniqueId" is case-sensitive

    ReplyDelete
  7. This comment has been removed by the author.

    ReplyDelete
  8. Nice and sweet CodeBlock!

    Got the work done and save a lot of time!!

    Thanks TroubleMaker! Actually Solver!! :)

    ReplyDelete
  9. THANKS FOR SHARING SUCH A AMAZING WORK
    NICE WORK
    Bim consulting UK

    ReplyDelete
  10. thank u for helping us with this post for any services click belowBIM Implementation

    ReplyDelete