private bool SetPerspectiveView(View3D bcfView, PerspectiveCamera camera) { var result = false; try { var zoom = camera.FieldOfView; var direction = RevitUtils.GetRevitXYZ(camera.CameraDirection); var upVector = RevitUtils.GetRevitXYZ(camera.CameraUpVector); var viewPoint = RevitUtils.GetRevitXYZ(camera.CameraViewPoint); var orientation = RevitUtils.ConvertBasePoint(ActiveDoc, viewPoint, direction, upVector, true); using (var trans = new Transaction(ActiveDoc)) { trans.Start("Set Orientation"); try { if (bcfView.CanResetCameraTarget()) { bcfView.ResetCameraTarget(); } bcfView.SetOrientation(orientation); if (bcfView.get_Parameter(BuiltInParameter.VIEWER_BOUND_ACTIVE_FAR).HasValue) { var m_farClip = bcfView.get_Parameter(BuiltInParameter.VIEWER_BOUND_ACTIVE_FAR); m_farClip.Set(0); } bcfView.CropBoxActive = true; bcfView.CropBoxVisible = true; trans.Commit(); } catch (Exception) { trans.RollBack(); } } result = true; } catch (Exception) { // ignored } return(result); }