![]() | ViewCamera Class |
The ViewCamera class defines a camera which can be used together with a visible view.
Always supply a properly orthogonalized camera up vector when rotating the camera.

Namespace: Tekla.Structures.Model.UI
Assembly: Tekla.Structures.Model (in Tekla.Structures.Model.dll) Version: 2024.0.0+a110b435391768740483e3032720a566518c9a63

The ViewCamera type exposes the following members.

Name | Description | |
---|---|---|
![]() | ViewCamera | Instantiates a new view camera instance with zero length vectors. |

Name | Description | |
---|---|---|
![]() | DirectionVector | The camera direction (controls the camera pan and tilt). |
![]() | FieldOfView | The camera field of view as an angle (degrees) in the perspective view. |
![]() | Location | The camera location in global coordinates (XYZ). |
![]() | UpVector | The camera up vector (controls the camera roll). |
![]() | View | The view where the camera belongs to. |
![]() | ZoomFactor | The camera zoom factor (meter/pixel) in the orthogonal view. |

Name | Description | |
---|---|---|
![]() | Modify | Updates the camera to the application view. |
![]() | Select | Updates the camera parameters from the application view. |

The following example shows how the ViewCamera class can be used:
using System; using Tekla.Structures.Model.UI; using Tekla.Structures.Geometry3d; public class ViewCameraExample { public void ViewCameraExample1() { ModelViewEnumerator ViewEnum = ViewHandler.GetVisibleViews(); ViewEnum.MoveNext(); View CurrentView = ViewEnum.Current; ViewCamera Camera = new ViewCamera(); // Set the view to the camera Camera.View = CurrentView; if(CurrentView.IsVisible() && CurrentView.IsPerspectiveViewProjection()) { // Query camera settings from the application Camera.Select(); // Tilt the camera Vector DirectionVector = Camera.DirectionVector; Vector UpVector = Camera.UpVector; Vector CrossVector = DirectionVector.Cross(UpVector); Matrix RotationMatrix = new Matrix(); RotationMatrix = MatrixFactory.Rotate(Math.PI/20.0, CrossVector); Tekla.Structures.Geometry3d.Point RotPoint = RotationMatrix * (Tekla.Structures.Geometry3d.Point)Camera.DirectionVector; DirectionVector = new Vector(RotPoint); DirectionVector.Normalize(); Camera.DirectionVector = DirectionVector; // Orthogonalize the camera UpVector UpVector = CrossVector.Cross(DirectionVector); UpVector.Normalize(); Camera.UpVector = UpVector; // Modify the camera settings in the application Camera.Modify(); } } }
