Type: BCS.Sym3.ICamera
Camera
Properties
Angle
- Description: Gets or sets the angle of the camera
- Type: Double
- Access: Read and Write
BaseProject
- Description: Gets the project
- Type: IBaseProject
- Access: Read
BlockRotation
- Description: Gets or sets a boolean to enable/disable block rotation
- Type: Boolean
- Access: Read and Write
BlockTranslation
- Description: Gets or sets a boolean to enable/disable block translation
- Type: Boolean
- Access: Read and Write
BlockZoom
- Description: Gets or sets a boolean to enable/disable block zoom
- Type: Boolean
- Access: Read and Write
DisplayTypeName
- Description: Gets the display name of the type name of the object. It returns the english display name of the type name.
- Type: String
- Access: Read
Distance
- Description: Gets or sets the distance of the camera
- Type: Double
- Access: Read and Write
Id
- Description: Gets the globally unique identifier (GUID) id of the object. This unique identifier is generated once at the object creation. This id will be kept unique for the entire life of the object, event after saving/loading the project.
- Type: Guid
- Access: Read and Write
- Example:
This example shows how to get the id of an object in a string format. The following script will output a string like 'b3122ae0-dcf7-43b6-b17c-5381afaca5cb'
strid = Project.Colors.Get("myColor").Id.ToString();
print(strid)
Layers
- Description: Gets a list of layer ids
- Type: List`1
- Access: Read
Menu
- Description: Get or sets menu
- Type: IResourceMenu
- Access: Read and Write
- Example:
This example shows you how to set the menu
// set a menu to camera
Project.Cameras["Camera1"].Menu = Project.Menus["Menu1"]
Name
- Description: Gets or sets the name of the object. All objects of the same type have a unique name.
- Type: String
- Access: Read and Write
- Example:
This example shows how to get and set the name of an object.
// get the color name
colorname = Project.Colors.Get("myColor").Name;
// set the color name
Project.Colors.Get("myColor").Name = "myNewName";
NameSuffix
- Description: The project explorer will display this after the Name of this object.
- Type: String
- Access: Read
OrthoInTopViewOnly
- Description: Get or sets whether only use ortho projection in top view
- Type: Boolean
- Access: Read and Write
Projection
- Description: Gets or sets projection type of the camera
- Type: ProjectionType
- Access: Read and Write
- Example:
This example shows you how to set the projection type
// set a camera to be orthogonal
Project.Cameras["Camera1"].Projection = BCS.Sym3.ProjectionType.Orthogonal;
// set a camera to be perspective
Project.Cameras["Camera1"].Projection = BCS.Sym3.ProjectionType.Perspective;
RotateX
- Description: Gets or sets the rotate on X axis of the camera
- Type: Double
- Access: Read and Write
RotateY
- Description: Gets or sets the rotate on Y axis of the camera
- Type: Double
- Access: Read and Write
RotateZ
- Description: Gets or sets the rotate on Z axis of the camera
- Type: Double
- Access: Read and Write
ScaleX
- Description: Gets or sets the scale on X axis of the camera
- Type: Double
- Access: Read and Write
ScaleY
- Description: Gets or sets the scale on Y axis of the camera
- Type: Double
- Access: Read and Write
ScaleZ
- Description: Gets or sets the scale on Z axis of the camera
- Type: Double
- Access: Read and Write
Target
- Description: Gets a target object of the camera
- Type: String
- Access: Read and Write
Transforms
- Description: Gets the list of layer transform
- Type: ObservableCollection`1
- Access: Read
TranslateX
- Description: Gets or sets the translate on X axis of the camera
- Type: Double
- Access: Read and Write
TranslateY
- Description: Gets or sets the translate on Y axis of the camera
- Type: Double
- Access: Read and Write
TranslateZ
- Description: Gets or sets the translate on Z axis of the camera
- Type: Double
- Access: Read and Write
TypeName
- Description: Gets the typename of the object. A type name doesn’t contain any space characters.
- Type: String
- Access: Read
UserPropertyInstances
- Description: Gets a list of all the instances of user properties.
- Type: ObservableCollection`1
- Access: Read
ViewData
- Description: Gets or sets view data
- Type: IView3DData
- Access: Read and Write
Methods
ForceRename(System.String,System.Boolean)
Rename the object.
- Parameters:
- value: The new name.
- fireChangingEvent: If false, no change event will fire. In
particular, this disables the check for duplicate names, which can be
costly as it has to check every equipment. The caller is responsible
for ensuring that
value
is a unique name, or Bad Things will happen.
FromXmlString(BCS.IToolXmlToObjectHelper)
Init object from IToolXmlToObjectHelper. All properties found in the RootElement of IToolXmlToObjectHelper will be set with the value in the rootElement
- Parameters:
- xmlHelperObj: xmlHelperObj IToolXmlToObjectHelper
FromXmlString(System.String)
Init object from xml. All properties found in the xml will be set with the value in the xml file
- Parameters:
- xmlText: Xml string
FromXmlString(System.Xml.Linq.XElement)
Init object from root element. All properties found in the XElement will be set with the value in the XElement
- Parameters:
- objXml: objXml XElement
GetCopyPasteXml
Converts the object into an XML string including overrides for for copy/paste functionality
- Returns:
- the string that contains xml version of the object for copy/paste
GetLayerTransform(BCS.Sym3.ILayer)
Get layer transform for a layer
- Parameters:
- layer: Layer
- Returns:
- Layer Transformation infos. Null is not found
- Example:
This example shows you how to get layer transform for a layer
var cam = Project.Cameras["Camera1"];
var layer = Project.Layers["Layer1"];
cam.GetLayerTransform(layer);
GetUserPropertyInstance(System.String)
Gets the user property instance of the specified name
- Parameters:
- userPropertyName: The user property name.
- Returns:
- Returns the user property instance object. If not found, the methods returns null.
- Example:
This example shows how to set the value of a user property by using this method
cc1 = Project.Equipment.Get("CC1");
// get the value of a user property using the method
userPropertyInstance = cc1.GetUserPropertyInstance("UserProperty1");
if(userPropertyInstance != null) {
userPropertyInstance.Value = 3;
}
GetUserPropertyValue(System.String)
Gets the value of a user property. A better way to get the value of a user property is to use the indexer operator [], see example. Instead of using the method ‘GetUserPropertyInstance’ and then access the ‘Value’ property of the returned value, this method simplifies the way we get the value of a user property.
- Parameters:
- userPropertyName: The name of the user property to set.
- Returns:
- Returns null if user property is not found. Otherwise returns the value of the user property.
- Example:
This example shows how to get the value of a user property using this method and also by using the indexer
cc1 = Project.Equipment.Get("CC1");
// get the value of a user property using the method
val = cc1.GetUserPropertyValue("UserProperty1");
// get the value of a user property using the indexer operator
val = cc1["UserProperty1"];
HideAllLayers
Hide all layers
- Example:
This example shows you how to hide all layers
var cam = Project.Cameras["Camera1"];
cam.HideAllLayers();
IsUserProperty(System.String)
Indicates if the object contains a user property with the name you specify
- Parameters:
- userPropertyName: user property name
- Returns:
- Returns true if the object contains a user property with the name you specified in parameter.
SetUserPropertyValue(System.String,System.Object)
Sets the value of a user property. A better way to set the value of a user property is to use the indexer operator [], see example. Instead of using the method ‘GetUserPropertyInstance’ and then access the ‘Value’ property of the returned value, this method simplifies the way we set the value of a user property.
- Parameters:
- userPropertyName: The name of the user property to set.
- value: If the user property is not found, this methods does nothing.
- Example:
This example shows how to set the value of a user property using this method and also by using the indexer
cc1 = Project.Equipment.Get("CC1");
// set the value of a user property using the method
cc1.SetUserPropertyValue("UserProperty1", 3);
// set the value of a user property using the indexer operator
cc1["UserProperty1"] = 3;
ShowAllLayers
Show all layers
- Example:
This example shows you how to show all layers
var cam = Project.Cameras["Camera1"];
cam.ShowAllLayers();
ShowHideLayer(System.String,System.Boolean)
Show/Hide a layer
- Parameters:
- layerName:
- visible:
- Example:
This example shows you how to show a hide layer
var cam = Project.Cameras["Camera1"];
cam.ShowHideLayer("Layer1", true);
ShowOnlyLayer(System.String)
Show only this layer
- Parameters:
- layerName:
- Example:
This example shows you how to show a layer
var cam = Project.Cameras["Camera1"];
cam.ShowOnlyLayer("Layer1");
ToCSVString(System.Char)
Returns the object in a CSV string.
- Returns:
- A string that contains properties of the object in a CSV format.
ToXmlString
Converts the object in an xml string
- Returns:
- the string that contains xml version of the object
Examples:
//******************************************************************************
// HOW TO : Cameras
//******************************************************************************
//------------------------------------------------------------------------------
// How to create
//------------------------------------------------------------------------------
// create a new entity
var newEntity = Project.Cameras.New()
print("A new entity has been created with default name: " + newEntity.Name)
// create a new entity with a specific name
var newEntity2 = Project.Cameras.New("MyCamera")
print("A new entity has been created: " + newEntity2.Name)
//------------------------------------------------------------------------------
// How to access entity
//------------------------------------------------------------------------------
// get by name using method 'Get'
var entity1 = Project.Cameras.Get("Sym3 Red")
print("Get entity by name: " + entity1.Name)
// get by name using operator []
var entity2 = Project.Cameras["Sym3 Red"]
print("Get entity by name: " + entity2.Name)
// get by index:
var entity3 = Project.Cameras[1]
print("Get entity by index: " + entity3.Name)
//------------------------------------------------------------------------------
// How to loop
//------------------------------------------------------------------------------
var entities = Project.Cameras.Objects;
for (var i = 0; i < Project.Cameras.Count; i++) {
print(entities[i].Name);
}
//------------------------------------------------------------------------------
// How to delete
//------------------------------------------------------------------------------
// remove entity
Project.Cameras.Remove(newEntity)
//------------------------------------------------------------------------------
// How to edit
//------------------------------------------------------------------------------
var camera = Project.Cameras.New("MyCameraToEdit")
// change properties:
camera.Name = "MyCameraToEditModified";
// projection can be one of the following value:
camera.Projection = BCS.Sym3.ProjectionType.Perspective;
camera.Projection = BCS.Sym3.ProjectionType.Orthogonal;
// loop through layer transform:
var transforms = camera.Transforms;
for(var i=0; i<transforms.Count; i++) {
var t = transforms[i];
}
// edit a layer transform
var t = camera.Transforms[0];
t.Visible = true;
t.LayerName = "my new name";
t.LayerId = 1;
t.RotationCentreX = 1;
t.RotationCentreY = 1;
t.RotationCentreZ = 1;
t.XOffset = 1;
t.YOffset = 1;
t.ZOffset = 1;
t.DirectionOffset = 1;
t.TiltOffset = 1;
t.RollOffset = 1;
t.ScaleX = 1;
t.ScaleY = 1;
t.ScaleZ = 1;
// loop through layer ids:
var layerIds = camera.Layers;
for(var i=0; i<layerIds.Count; i++) {
print(layerIds[i]);
}
// edit camera view data:
camera.ViewData.RotateX = 1;
camera.ViewData.RotateY = 1;
camera.ViewData.RotateZ = 1;
camera.ViewData.Angle = 1;
camera.ViewData.ScaleX = 1;
camera.ViewData.ScaleY = 1;
camera.ViewData.ScaleZ = 1;
camera.ViewData.TranslateX = 1;
camera.ViewData.TranslateY = 1;
camera.ViewData.TranslateZ = 1;
camera.ViewData.Distance = 1;