private static (Orthogonal_camera orthogonalCamera, Perspective_camera perspectiveCamera) GetBcfCameraValues( this UIDocument uiDocument) { if (uiDocument.ActiveView is not View3D view3D) { return(null, null); } CameraType cameraType = view3D.IsPerspective ? CameraType.Perspective : CameraType.Orthogonal; Position cameraPosition = uiDocument.GetCameraPosition(view3D.IsPerspective); Vector3 center = cameraPosition.Center.ToMeters(); var cameraViewpoint = new iabi.BCF.APIObjects.V21.Point { X = Convert.ToSingle(center.X), Y = Convert.ToSingle(center.Y), Z = Convert.ToSingle(center.Z) }; var cameraUpVector = new Direction { X = Convert.ToSingle(cameraPosition.Up.X), Y = Convert.ToSingle(cameraPosition.Up.Y), Z = Convert.ToSingle(cameraPosition.Up.Z) }; var cameraDirection = new Direction { X = Convert.ToSingle(cameraPosition.Forward.X * -1), Y = Convert.ToSingle(cameraPosition.Forward.Y * -1), Z = Convert.ToSingle(cameraPosition.Forward.Z * -1) }; Orthogonal_camera ortho = null; Perspective_camera perspective = null; switch (cameraType) { case CameraType.Perspective: perspective = new Perspective_camera { Field_of_view = 45, // revit default value Camera_direction = cameraDirection, Camera_up_vector = cameraUpVector, Camera_view_point = cameraViewpoint }; break; case CameraType.Orthogonal: ortho = new Orthogonal_camera { View_to_world_scale = uiDocument.GetViewBoxHeight(), Camera_direction = cameraDirection, Camera_up_vector = cameraUpVector, Camera_view_point = cameraViewpoint }; break; default: throw new ArgumentOutOfRangeException(nameof(cameraType), cameraType, "invalid camera type"); } return(ortho, perspective); }