Filter elements in view within the crop view

I have a simple script that filters elements from a linked model in multiple floor plans. I would like to consider the crop view when filtering these elements, therefore not retrieving elements outside of the crop view.

This is what I have at the moment in Revit 2021:

I would appreciate some help!

Hi @Filla96 welcome to the forum,

You have certainly picked a challenge for yourself and members of the forum.

The constructing of a filtered element collector of a view is limited to the current document - see forum post here Collecting linked elements in view without knowing linked file instance?

You could also look here on The Building Coder Retrieving Elements Visible in View and here 5.1. Custom Exporter

1 Like

@Mike.Buttery thank you for the response!

I’ve just realized my question wasn’t precise at all, sorry for that. In this case I’m trying to filter elements from the linked model in views from my current model (in my case these views will always exist both in the linked model and in the current model)

I do not have any rooms in my current model, only in the linked model, and I’m able to get those elements.
image

Considering that, is it possible to filter these elements within the crop view of the floor plans in my current model?

1 Like

Heya,

It is a tricky thing to explain :slight_smile:

Your example is, as you say, retrieving link elements from a link doc using a link view. But you want a FEC using the link doc and the current doc view. That’s the problem. There is no way to use the current doc view for a link doc.

From memory, I got round this by constructing a solid using the extents of the link elements (as a bounding box would be axis aligned). Then I used a solid intersect to check whether the elements were inside.

I hope that helps,

Mark

3 Likes

Hello,
you can try with this example (assuming the cropbox is rectangular, if not, it is necessary to use solid intersection process as @Mark.Ackerley mentioned)

4 Likes

@c.poupin that worked perfectly.

Thank you all for the incredible fast responses and helpfullness!

1 Like

for information with Revit 2024+ if you have a linked view, you can use directly this method

2 Likes