Get all element in active view with code block

Apologies in advance if this has been covered in a previous thread, but searched and couldn’t find anything.
I have been messing with code blocks more and more for doing certain task rather than having several different nodes. May be a moot thing, but I like experimenting and it makes my graphs less garbled. I actually think my graphs run quicker, but I haven’t tested. Anyway, the last line in the code block below pulls all elements of the inputted category that are in the entire model. Is there a way to have it pull all of the elements just in the active view? I am getting the active view from lines 1 & 2, but not sure how to implement into line 4 or if that’s even possible. Thanks in advance!

Hi,
this is not what you are looking for but is close

cordially
christian.stan

1 Like

Start by solving it with nodes. That will tell you what’s possible and how you should structure your logic. Then it’s a simple conversion to DesignScript.

I did try that, but the node to code didn’t work with the All elements of Category in Active View node.

Then it doesn’t have a DesignScript equivalent.

2 Likes

You can always switch to python and use a FilteredElementCollector.

1 Like

Yeah that’s what I was hoping not to be the case.
Thanks for the input.

Yeah, I’m not looking to isolate the elements, but you did help with giving example of getting the active view down to one line of code. Didn’t even cross my mind.
Thanks for the input!

1 Like

@Nick_Boyts @christian.stan

Actually found this from a thread someone else created after I set the solution to this one. :rofl:

2 Likes