Skip to content

Commit d3f54e8

Browse files
added view type check
1 parent a7c76f7 commit d3f54e8

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Revit_Core_Engine/Query/LinkedElementsInView.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,12 @@ public static IEnumerable<ElementId> LinkedElementsInView(this View view, RevitL
4343
if (view == null || linkInstance == null)
4444
return null;
4545

46+
if (!(view is ViewPlan || view is View3D || view is ViewSection))
47+
{
48+
BH.Engine.Base.Compute.RecordWarning("Cannot get linked elements because provided view is not a ViewPlan, View3D, or ViewSection.");
49+
return new List<ElementId>();
50+
}
51+
4652
Document linkDoc = linkInstance.GetLinkDocument();
4753
Solid viewSolid = view.TransformedViewSolid(linkInstance);
4854
ElementIntersectsSolidFilter solidFilter = new ElementIntersectsSolidFilter(viewSolid);

0 commit comments

Comments
 (0)