Can't sort/group Familyinstance.GetHost

#1

I wan’t to list all the windows there are hosted in the roof, but can’t find a way to sort the Element.Host+ or Familyinstance.GetHost, and when i use Object.Type it shows UnknownElement how can i solve this or is there a better way to list windows there is hosted in the roof?

#2

As far as I know, in programming when you compare two objects for equality, it will return false. The reason for this is that they are different instances of a class, and by logic, they are different hahaha (hope you get it)

A solution to that, is to convert the elements to string and check for equality in those strings.

1 Like
#3

Get the category of the element instead of the type. :slight_smile:

#4

Thanks I will try that =)

#5

You may also want to try the Element.Type node rather than Object.Type, and it’s usually better to use the Object A =Object B equality node if comparing anything other then string values.

#6

So actually @architectcoding has the best explanation here. Because you are trying to compare two objects that are different instances of a class, in programming concepts they would also have different references, and hence return false. In your specific case the issue is even more apparent than that. Notice that you are comparing an object of class Revit.Elements.Wall to a Wall Type of type Autodesk.Revit.DB.Wall. The difference is clear. They are actually two different classes, so comparing them for equality will return false, unless you can use a custom Equiality Comparer, but that’s a topic for a different day.

One potential quick solution is to get the Category from an object and compare that to Walls Category like so:

2 Likes