Enlighten me: Why different lists of properties for the same element?

revit
dynamo

#1

EDIT:
My entire thesis was wrong! Please ignore all the steps I placed below and jump to the answer/last post.

Dynamo Experts,

So, I don’t really need help to do what I’m doing- I’ve figured that out. However, in trying to understand Dynamo and its interaction with Revit more deeply I’ve come up with the following question.

Background: Working in Revit 2015 and Dynamo 0.9.1.4062.
First I’m selecting all TextNote elements of a particular type in the Revit project. To choose which Text Type to filter by, I’m using the SpringNodes List.DropDown node.
So, I was going through the process of:

  1. Creating the list of TextNote types
  2. Extracting the list of names of all the TextNote types
  3. Selecting the TextNote type name using SpringNodes
  4. using the returned value (a string) to compare to the list of individual TextNote type names
  5. create a mask to filter out the family element itself from the list of all TextNote types
  6. extracting the family name (a string) to compare to the list of individual TextNote elements
    Then I realized- why do that? I’ve already got the string I need at step 3!

So, I rewired the SpringNode dropdown output directly to my == node that I used to create the BoolMask to filter out only the TextNote elements of the selected type. And to my surprise, the list of data returned by Element.Parameters for the returned TextNote changed!

Now, I realize that Returning the Family Name of the filtered element list creates a list with a single String value in it, whereas the SpringNode dropdown returns a single String. But if I compare the list of returned elements, it’s identical. If I look at (as an example) the first item of each list, it returns the same element. But using the Element.Parameters node to display the parameters for the same element, the list of Parameters is different!

So, can anyone explain why? (I’ve attached both the image of the script and the dyn file.)

Thanks,
Joe

ViewTypeTest.dyn (13.3 KB)


#2

Hi @Joe.Charpentier

I think if you understand what’s the difference between “All Elements of Category” and “All elements of Type” that will get you started.

  • All Elements of Category - To Get all elements of the specified category from the model.

  • All Elements of Type - To get all elements in the active document of a given type.

BTW what is your end goal?


#3

Hi Kulkul,

Thank you for responding! I wrote some lengthy answers to your questions/comments below, but in the interest of saving time for anyone skimming this thread, the real question is:
Why does Element.Parameters return 2 different lists of parameters for the same element? I’m sure there is some nuance of the way Dynamo works that I’m missing. I suspect it has to do with the fact that for one path, the filter mask is generated from a List with a String value in it, and the other mask is generated from a String value only. But:

  • I am filtering the same list
  • The list of True/False for the BoolMask appears identical
  • The resulting Filtered list appears identical
  • The individual elements that are part of the list appear identical (and are, in fact, recognized as identical by the “Equals” node.)

In the end, the fact that the Parameter lists are in a different order doesn’t really matter. If I want a certain parameter, I can select it by name. (It would only matter if I was for some reason relying on the parameter list to be in a certain order.)

But it is different. And I don’t understand why. And it’s bugging me. :rage:
Somebody must understand why!
(and again, to be perfectly clear- it probably doesn’t matter!)

Even lengthier response below:

I believe that my end goal is irrelevant to the question, but if it helps, I am coming up with a list of all the views that host text of a particular type. I’ve actually been successful at doing that, and either path shown above works, because once I get the list of TextNote elements of a particular style, extracting that data is easy. If you think it would help, I could post that script as well.

I also understand the difference between getting all elements of a Category and all elements of a Type. In this case, getting all elements of category “TextNotes” returns a list of each Text element in the project. That list could be parsed into a list of the Types of TextNotes. However, that would only list the Types of Text elements actually created in the project. It would not create a list that includes unplaced TextNote Types. To do that, I used the “Element Types” node and chose “TextNoteType” which, combined with “All Elements of Type” to create a list of all TextNote types, even the unplaced ones.

One interesting thing to note (but again, probably irrelevant to this particular question) is that for a TextNote element, Type and Family appear to be interchangeable for TextNote styles. You can see this by connecting the Family.Name and FamilyType.Name nodes to a list of text elements or text styles.


#4

Does this happens in other projects?
Could you provide us with some sample files?


#5

Correct me if I’m wrong but I believe the parameters are actually fetched as a dictionary and then represented as a list to the user.

Lists use indexes to figure out what values you want, be it the 5th, 100th location of the array, etc.
Whereas dictionaries uses keys instead. It associates the keys to the values just as lists associate indexes to values.

>>List = [Banana, Berries, Apple]
>>Print ( List [ 0 ] )
Banana

>>Dict = {Favorite:Banana, Hated:Berries, Tolerated:Apple}
>>Print ( Dict [ Hated ] )
Berries

Dictionaries are unordred by default and will come out randomly when asked to be shown as a list. Their order actually seem to be determined by their hash location in memory at the time. This post is very informative on the subject if know a bit of programing.


#6

This is it!
You don’t have to jump through all the hoops I went through to get a different list from Element.Parameters. If you take the exact same element from the exact same node and hook up multiple Element.Parameters nodes to it- you will get a different list every time!

You learn something new every day…

Thank you, slepagetrudeau!