Class CameraCollection
A collection of Camera objects.
Inheritance
CameraCollection
Assembly: ABB.Robotics.RobotStudio.Stations.dll
Syntax
public class CameraCollection : ICollection, IEnumerable<Camera>, IEnumerable
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();
}
Properties
Count
Declaration
public virtual int Count { get; }
Property Value
IsSynchronized
Declaration
public virtual bool IsSynchronized { get; }
Property Value
Item[Int32]
Declaration
public Camera this[int index] { get; }
Parameters
Type |
Name |
Description |
Int32 |
index |
|
Property Value
Parent
Declaration
public ProjectObject Parent { get; }
Property Value
SyncRoot
Declaration
public virtual object SyncRoot { get; }
Property Value
Methods
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();
}
Contains(Camera)
Declaration
public bool Contains(Camera obj)
Parameters
Type |
Name |
Description |
Camera |
obj |
|
Returns
CopyTo(Camera[], Int32)
Declaration
public void CopyTo(Camera[] array, int index)
Parameters
CopyTo(Array, Int32)
Declaration
public virtual void CopyTo(Array array, int index)
Parameters
GetEnumerator()
Declaration
public virtual IEnumerator GetEnumerator()
Returns
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();
}
ToArray()
Declaration
public Camera[] ToArray()
Returns