All Elements Of Category in a Code Block

Does anyone know how to follow up the definition of a codeblock that defines categories, with the codeblock equivalent of All Elements Of Category? For instance:

[Category.ByName(“OST_Walls”);] - [“All Elements Of Category” node]

I can obviously plug this in to the “All Elements Of Category” node, but I’m looking for an all CB way of doing this. Any ideas or thoughts would be appreciated!

1 Like

You can’t do it. DS currently doesn’t support that node!

Bummer. Thank you for the feedback!

As stated above, “All Elements of Category” can’t be used as a function. Tho you can do the next best thing and wrap it inside a custom node. That way you could do something like the below:

3 Likes

Thank you, Dimitar! I’ll take a look at applying this next chance I get.

@Ryan_C I’d have done this :slight_smile:

5 Likes

But what if you need to embed the AEOC node in an imperative block? :smiling_imp:

:laughing:
A solution to this is imperative, eh?

1 Like

Thanks again @Dimitar_Venkov.

2 Likes

deleted by the author

This method worked just fine!

However, I tryed to do it in an if-condition and it did not work.

1 Like

I wrote this quite a while ago. You can actually streamline this further, by using the underlying ZT method ElementQueries.OfCategory (for Dynamo 2+). It should also work in imperative code:

image

15 Likes

Yes, it worked!

Thank you.

1 Like

to get all elements of a category in code block, it works well for me like that, with flexibility with the commas:

c1 = Category.ByName(“Topography”);
ElementQueries.OfCategory(c1);