API Reference

Detailed and full API reference helps you master Tekla development

This is the most recent version of Tekla Open API.
For older versions, please visit Tekla Warehouse.

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.
Inheritance Hierarchy

Namespace:  Tekla.Structures.Model.UI
Assembly:  Tekla.Structures.Model (in Tekla.Structures.Model.dll) Version: 2020.0.0.0 (2020.0.55582.0)
public class ViewCamera

The ViewCamera type exposes the following members.

  Name Description
Public method ViewCamera
Instantiates a new view camera instance with zero length vectors.
  Name Description
Public property DirectionVector
The camera direction (controls the camera pan and tilt).
Public property FieldOfView
The camera field of view as an angle (degrees) in the perspective view.
Public property Location
The camera location in global coordinates (XYZ).
Public property UpVector
The camera up vector (controls the camera roll).
Public property View
The view where the camera belongs to.
Public property ZoomFactor
The camera zoom factor (meter/pixel) in the orthogonal view.
  Name Description
Public method Modify
Updates the camera to the application view.
Public method 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();
        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

            // 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);
            Camera.DirectionVector = DirectionVector; 

            // Orthogonalize the camera UpVector
            UpVector = CrossVector.Cross(DirectionVector);
            Camera.UpVector = UpVector;

            // Modify the camera settings in the application
See Also