Show / Hide Table of Contents

Class CameraCollection

A collection of Camera objects.

Inheritance
object
CameraCollection
Namespace: ABB.Robotics.RobotStudio.Stations
Assembly: ABB.Robotics.RobotStudio.Stations.dll
Syntax
public class CameraCollection
Examples

Camera Collection.

Project.UndoContext.BeginUndoStep("CameraProperties");
try
{
Station station = Station.ActiveStation;
            // Create a Camera.
            Camera myCam = new Camera();

            // Set the camera to look at a specific point.
            myCam.LookAt = new Vector3(0, 0, 0);

            // Set the camera to view from a specific point.
            myCam.LookFrom = new Vector3(10, 10, 10);

            // Fix the camera to this point.
            myCam.LockRotate = 0.0;
            myCam.LockTranslate = 0.0;
            myCam.LockZoom = 0.0;

            // Add it to the stations camera collection.
            station.Cameras.Add(myCam);

            // Sync the current view to the camera view.
            GraphicControl.ActiveGraphicControl.SyncCamera(myCam, true, 0);

            // Use the camera as the true camera.
            // This make sure that the constraints on the movement kicks in.
            GraphicControl.ActiveGraphicControl.Camera = myCam;

            // Unlock the view (negative values removes the locks).
            myCam.LockRotate = -1.0;
            myCam.LockTranslate = -1.0;
            myCam.LockZoom = -1.0;

            // Create a solid box to follow.
            Part myPart = new Part();
            station.GraphicComponents.Add(myPart);
            Body box = Body.CreateSolidBox(new Matrix4(Vector3.XVector, 0.0), new Vector3(0.1, 0.1, 0.1));
            myPart.Bodies.Add(box);

            // Keep the direction in which the view of the box fixed.
            myCam.FollowBehavior = FollowObjectBehavior.FixDirection;

            // Follow the box.
            myCam.FollowObject = myPart;

            // Move the part in the GUI.
            // Observe how the part moves relative the floor,
            // but how the camera follows the part.
        }
        catch
        {
            Project.UndoContext.CancelUndoStep(CancelUndoStepType.Rollback);
            throw;
        }
        finally
        {
            Project.UndoContext.EndUndoStep();
        }</code></pre>

Properties

View Source

Count

Declaration
public virtual int Count { get; }
Property Value
Type Description
int
View Source

IsSynchronized

Declaration
public virtual bool IsSynchronized { get; }
Property Value
Type Description
bool
View Source

this[int]

Declaration
public Camera this[int index] { get; }
Parameters
Type Name Description
int index
Property Value
Type Description
Camera
View Source

Parent

Declaration
public ProjectObject Parent { get; }
Property Value
Type Description
ProjectObject
View Source

SyncRoot

Declaration
public virtual object SyncRoot { get; }
Property Value
Type Description
object

Methods

View Source

Add(Camera)

Adds a Camera to the collection.

Declaration
public void Add(Camera camera)
Parameters
Type Name Description
Camera camera

The Camera to add to the collection.

Examples

Add Camera.

Project.UndoContext.BeginUndoStep("CameraProperties");
try
{
Station station = Station.ActiveStation;
            // Create a Camera.
            Camera myCam = new Camera();

            // Set the camera to look at a specific point.
            myCam.LookAt = new Vector3(0, 0, 0);

            // Set the camera to view from a specific point.
            myCam.LookFrom = new Vector3(10, 10, 10);

            // Fix the camera to this point.
            myCam.LockRotate = 0.0;
            myCam.LockTranslate = 0.0;
            myCam.LockZoom = 0.0;

            // Add it to the stations camera collection.
            station.Cameras.Add(myCam);

            // Sync the current view to the camera view.
            GraphicControl.ActiveGraphicControl.SyncCamera(myCam, true, 0);

            // Use the camera as the true camera.
            // This make sure that the constraints on the movement kicks in.
            GraphicControl.ActiveGraphicControl.Camera = myCam;

            // Unlock the view (negative values removes the locks).
            myCam.LockRotate = -1.0;
            myCam.LockTranslate = -1.0;
            myCam.LockZoom = -1.0;

            // Create a solid box to follow.
            Part myPart = new Part();
            station.GraphicComponents.Add(myPart);
            Body box = Body.CreateSolidBox(new Matrix4(Vector3.XVector, 0.0), new Vector3(0.1, 0.1, 0.1));
            myPart.Bodies.Add(box);

            // Keep the direction in which the view of the box fixed.
            myCam.FollowBehavior = FollowObjectBehavior.FixDirection;

            // Follow the box.
            myCam.FollowObject = myPart;

            // Move the part in the GUI.
            // Observe how the part moves relative the floor,
            // but how the camera follows the part.
        }
        catch
        {
            Project.UndoContext.CancelUndoStep(CancelUndoStepType.Rollback);
            throw;
        }
        finally
        {
            Project.UndoContext.EndUndoStep();
        }</code></pre>
View Source

Contains(Camera)

Declaration
public bool Contains(Camera obj)
Parameters
Type Name Description
Camera obj
Returns
Type Description
bool
View Source

CopyTo(Camera[], int)

Declaration
public void CopyTo(Camera[] array, int index)
Parameters
Type Name Description
Camera[] array
int index
View Source

CopyTo(Array, int)

Declaration
public virtual void CopyTo(Array array, int index)
Parameters
Type Name Description
Array array
int index
View Source

GetEnumerator()

Declaration
public virtual IEnumerator GetEnumerator()
Returns
Type Description
IEnumerator
View Source

Remove(Camera)

Removes a Camera from the collection .

Declaration
public void Remove(Camera camera)
Parameters
Type Name Description
Camera camera

The Camera to remove from the collection.

Examples

Remove Camera.

Project.UndoContext.BeginUndoStep("CameraProperties");
try
{
Station station = Station.ActiveStation;
            // Create a Camera.
            Camera myCam = new Camera();

            // Set the camera to look at a specific point.
            myCam.LookAt = new Vector3(0, 0, 0);

            // Set the camera to view from a specific point.
            myCam.LookFrom = new Vector3(10, 10, 10);

            // Fix the camera to this point.
            myCam.LockRotate = 0.0;
            myCam.LockTranslate = 0.0;
            myCam.LockZoom = 0.0;

            // Add it to the stations camera collection.
            station.Cameras.Add(myCam);

            // Sync the current view to the camera view.
            GraphicControl.ActiveGraphicControl.SyncCamera(myCam, true, 0);

            // Use the camera as the true camera.
            // This make sure that the constraints on the movement kicks in.
            GraphicControl.ActiveGraphicControl.Camera = myCam;

            // Unlock the view (negative values removes the locks).
            myCam.LockRotate = -1.0;
            myCam.LockTranslate = -1.0;
            myCam.LockZoom = -1.0;

            // Create a solid box to follow.
            Part myPart = new Part();
            station.GraphicComponents.Add(myPart);
            Body box = Body.CreateSolidBox(new Matrix4(Vector3.XVector, 0.0), new Vector3(0.1, 0.1, 0.1));
            myPart.Bodies.Add(box);

            // Keep the direction in which the view of the box fixed.
            myCam.FollowBehavior = FollowObjectBehavior.FixDirection;

            // Follow the box.
            myCam.FollowObject = myPart;

            // Move the part in the GUI.
            // Observe how the part moves relative the floor,
            // but how the camera follows the part.
        }
        catch
        {
            Project.UndoContext.CancelUndoStep(CancelUndoStepType.Rollback);
            throw;
        }
        finally
        {
            Project.UndoContext.EndUndoStep();
        }</code></pre>
View Source

ToArray()

Declaration
public Camera[] ToArray()
Returns
Type Description
Camera[]
  • View Source
In this article
Back to top Copyright © 2025 ABB