CameraCollection Class |
Namespace: ABB.Robotics.RobotStudio.Stations
public class CameraCollection : ICollection, IEnumerable, IEnumerable<Camera>
The CameraCollection type exposes the following members.
Name | Description | |
---|---|---|
Add |
Adds a Camera to the collection.
| |
Contains | ||
CopyTo(Array, Int32) | ||
CopyTo(Camera, Int32) | ||
Equals | (Inherited from Object.) | |
Finalize | (Inherited from Object.) | |
GetEnumerator | ||
GetHashCode | (Inherited from Object.) | |
GetType | (Inherited from Object.) | |
MemberwiseClone | (Inherited from Object.) | |
Remove |
Removes a Camera from the collection .
| |
ToArray | ||
ToString | (Inherited from Object.) |
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(); }