
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
I'm a programmer at Inreal Technologies and were developing Enscape 3D, a rendering plugin for Revit.
Currently we are working on speeding up the switching between two 3D views. Right now we just recreate the scene to render but this is obviously very slow.
So I came up with the following code to find out which elements were added, removed and modified when you switch from one view (the start view) to another view (the target view). The idea behind the code is, that we want to know all elements which got cut by the start view's section box or will get cut by the target view section box. For those elements the geometry has to be updated.
The problem now is that it misses a ceiling in the Advanced Sample Project when I switch from the default 3D view to "03 - Floor Public - Day Rendering" view. See attached screenshot. What am I missing? I have to say that I'm relatively new to the filtering API so any help is appreciated.
Thanks in advance
public static DiffUpdateElementIds Calculate(View3D startView, View3D targetView) { var diffElements = new DiffUpdateElementIds(); //... here added and removed elements are calculated (with exclude filter). This works just fine if (startView.IsSectionBoxActive || targetView.IsSectionBoxActive) { ElementFilter intersectFilterStart = null; ElementFilter intersectFilterTarget = null; if (startView.IsSectionBoxActive) { Logger.getINSTANCE(Logger.LogFile.EnscapeRevitPlugin).info("start View has SectionBox"); intersectFilterStart = new BoundingBoxIntersectsFilter(new Outline(startView.GetSectionBox().Min, startView.GetSectionBox().Max)); } if (targetView.IsSectionBoxActive) { Logger.getINSTANCE(Logger.LogFile.EnscapeRevitPlugin).info("target View has SectionBox"); intersectFilterTarget = new BoundingBoxIntersectsFilter(new Outline(targetView.GetSectionBox().Min, targetView.GetSectionBox().Max)); } ElementFilter intersectFilter; if (intersectFilterStart != null && intersectFilterTarget == null) { intersectFilter = intersectFilterStart; } else if (intersectFilterStart == null && intersectFilterTarget != null) { intersectFilter = intersectFilterTarget; } else { intersectFilter = new LogicalOrFilter(intersectFilterStart, intersectFilterTarget); } var cutElementsStartView = new FilteredElementCollector(startView.Document, startView.Id).WherePasses(intersectFilter); var cutElementsTargetView = new FilteredElementCollector(targetView.Document, targetView.Id).WherePasses(intersectFilter); diffElements.ModifiedElements = cutElementsStartView.UnionWith(cutElementsTargetView).ToElementIds(); } return diffElements; }
Solved! Go to Solution.