cf570342d2
* regions with failed viewId * render stuff in the first found suitable view * use native or fallback conversion depending on the view * better comments * implement conditional conversion * remove comment * comment * unload Root Host converter * fix highlighting the model * inject PlanView converter * specify views in which receive is supported * throw unsupported views in advance * remove redundant check * ViewManager added; View check is moved to the beginning of receive operation (to throw once and not for every object) * simplify and remove unused --------- Co-authored-by: Claire Kuang <kuang.claire@gmail.com>
33 lines
940 B
C#
33 lines
940 B
C#
using Autodesk.Revit.DB;
|
|
|
|
namespace Speckle.Connectors.Revit.HostApp;
|
|
|
|
/// <summary>
|
|
/// Handles Revit Views per Send/Receive, e.g. determines whether the View is supported for specific operation.
|
|
/// </summary>
|
|
public class RevitViewManager
|
|
{
|
|
/// <summary>
|
|
/// Determine if the View is supported for Receive operation. Currently only 3d view or horizontal 2d views are supported.
|
|
/// Views like Section, Elevation, ViewSheet etc. are not supported
|
|
/// </summary>
|
|
public bool IsSupportedReceiveView(View activeView)
|
|
{
|
|
switch (activeView.ViewType)
|
|
{
|
|
case ViewType.ThreeD:
|
|
case ViewType.FloorPlan:
|
|
case ViewType.AreaPlan:
|
|
case ViewType.CeilingPlan:
|
|
return true;
|
|
case ViewType.Detail:
|
|
return IsHorizontalView(activeView);
|
|
|
|
default:
|
|
return false;
|
|
}
|
|
}
|
|
|
|
private bool IsHorizontalView(View activeView) => Math.Abs(activeView.ViewDirection.Z - 1) < 0.00001;
|
|
}
|