Issue recognizing categories

Hi,

I’m having some issues in Dynamo. I’m trying to create a script, that recognizes if any of the categories “Areas”, “Rooms” or “Spaces” are present in the model. In my current Revit model, only the category “Rooms” are present. The idea was to use == to check if the list of categories in the model, matches any of the specified categories, but the node returns “false”. Any idea how to solve this?


Note: I have also tried using list.contains, but I get the same result.

Try to see if you are comparing text to text with Object.Identity before the == node

Are you looking to check if there’s any elements present of those categories? If this is the case, then you need an All elements of category node in there as well.

You will also likely need some cross product lacing on your ==, since you want to check all items from the two lists between each other.

Edit: Another good advice: share a dummy Revit/Dyn file. Will make it much faster to get help :wink:

Thanks for your answer. I have tried to lace to Object.Identity before the == node. However, it seems to just give me the same output as list.flatten, so I’m not quite sure what to conclude based on that.

Hi Martin,

Thanks for your respond!

I am actually just looking to check if the category is present (at the moment at least :slight_smile: ).

I am not quite sure what you mean by cross product lacing. I took a look on the list.CartesianProduct, but I dont understand how this node could help compare the two lists (if this was that node you were talking about).

I am a new user, so unfortunatetly I cant attach .dyn files :sob:

Hi again,

These categories will only be active in the document, if there’s any elements present, so why not just check for elements? If the end goal is to check if the category it present, then I think you are overcomplicating this by diving into the cross check:

Regarding getting the cross product of the == node:

Right now your lacing is set to shortest, which will match the lists like so:

Thus the node yields all false results.

By setting the lacing to cross product, each item in list 1 will be tested against all items in list 2:

After this you can extract the trues from the nested lists.

I hope this makes sense. This is something that is also explaned pretty thoroughly in the Dynamo Primer, so if you haven’t read it already, I’d advice you go plow through it :slight_smile:

Edit: http://primer.dynamobim.org/en/

Hi Martin,

Thanks for your response, that was really helpful!

I suspected it was pretty simple and so it was :smiley: I will take a look at the Dynamo Primer.