Results 1 to 5 of 5

Thread: Sorting Elements by a Chosen Parameter

  1.    #1
    New Member studiosally's Avatar
    Join Date
    May 16, 2019
    Location
    Atlanta, GA
    Posts
    3
    Current Local Time
    03:07 PM

    Not allowed! Not allowed!

    Question Sorting Elements by a Chosen Parameter

    Apologies if this is a silly question, I'm still fairly new at Dynamo. I feel like there has to be a simple answer but I haven't yet been able to find one via Google or these forums.

    My issue is I'm trying to sort a list of elements by a single parameter value - specifically in this case I'm trying to grab all of the Materials out of my project and then sort that list by the Name parameter (see image) so I can use them in Dynamo for another purpose and have them be in the same order as they appear by default in the Material browser (instead of being default sorted by ID I believe).

    I have browsed through several potential solutions online involving SortByFunction or SortByKey but can't quite figure out how to specifically apply them to my situation. I used to use Grasshopper a lot in the past and I remember it being fairly easy to sort a list based on another sort, which seems like it would work well here if it were an option. In general, though, I would also like to know how to sort any list of elements by a particularly chosen parameter as I've run into this general issue before. Thanks!
    Attached Thumbnails Attached Thumbnails image1.PNG  

  2.    #2
    Administrator Twiceroadsfool's Avatar
    Join Date
    December 7, 2010
    Location
    Dallas, TX
    Posts
    10,616
    Current Local Time
    02:07 PM

    Not allowed! Not allowed!
    Heyyyyyy! I know you (i think?)! LOL.

    If you tell us what you want to do with the names (the next part of what you are trying to do) we can probably help. Otherwise you can now do something like Element.Name on the Materials themselves, then compare the two lists (sorted and not sorted), and get the index from the sorted list. Thats a hoopty way, though.

  3.    #3
    New Member studiosally's Avatar
    Join Date
    May 16, 2019
    Location
    Atlanta, GA
    Posts
    3
    Current Local Time
    03:07 PM

    Not allowed! Not allowed!
    Hey Aaron!

    It's part of a material auditing process we're conducting on several models. We are applying every material in the project to a series of material samples, which are just a simple Generic Model Family with a Material instance parameter. The samples are already sorted in Dynamo by their X,Y coordinates so if the materials could be applied in alphabetical order (thus the sorting) then it would be a lot easier to audit them in the correct order.

    What do you mean by comparing the two lists and getting the indices? I learned a lot about lists, indices, and sorting from Grasshopper back in the day but apparently Dynamo just wants to do everything differently.

  4.    #4
    New Member studiosally's Avatar
    Join Date
    May 16, 2019
    Location
    Atlanta, GA
    Posts
    3
    Current Local Time
    03:07 PM

    Not allowed! Not allowed!
    Ah nvmd, I figured it out I think. Was definitely just missing something simple. Needed to pass GetParameterValueByName directly into SortByKey and then use the Sorted List output. Seems to be working now.
    Attached Thumbnails Attached Thumbnails image2.PNG  

  5.    #5
    Administrator Twiceroadsfool's Avatar
    Join Date
    December 7, 2010
    Location
    Dallas, TX
    Posts
    10,616
    Current Local Time
    02:07 PM

    Not allowed! Not allowed!
    Dude. I want to fly over there to give you a high five right now. Seriously. (But i wont, because: money)

Similar Threads

  1. Combined Parameter - Filtering & Sorting
    By MartinGT in forum Architecture and General Revit Questions
    Replies: 9
    Last Post: February 13th, 2019, 01:38 PM
  2. Global parameter for automatic sheet sorting?
    By PatrickGSR94 in forum Architecture and General Revit Questions
    Replies: 4
    Last Post: July 26th, 2017, 04:13 PM
  3. Replies: 0
    Last Post: January 13th, 2016, 03:45 AM
  4. Autodesk University: Classes for AU 2015 have been chosen
    By Autodesk University in forum Blog Feeds
    Replies: 0
    Last Post: July 1st, 2015, 06:15 PM
  5. Sorting schedules using the mark parameter
    By Life Is Good in forum Architecture and General Revit Questions
    Replies: 1
    Last Post: January 23rd, 2013, 04:01 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
  •