Type: BCS.IBaseManagerTable
Table manager. This type of manager contains a table of object (the .net type of this table is System.Collection.Hashtable).
Properties
BaseProject
- Description: Gets the project
- Type: IBaseProject
- Access: Read
Count
- Description: Get number of objects
- Type: Int32
- Access: Read
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
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)
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
Objects
- Description: Gets the list of objects
- Type: ObservableCollection`1
- Access: Read
- Example:
This example shows how to loop through every object of the manager
count = Project.Colors.Count;
for(i=0; i<count; i++)
{
print(Project.Colors.Objects[i].Name);
}
print("USING INDEXERS:")
for(i=0; i<count; i++)
{
// a better practive to access an object is by using indexers:
print(Project.Colors[i])
}
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
Methods
Add(BCS.IBaseObject)
Adds an object in the manager. The object has to be of the correct type.
- Parameters:
- value: Object to add
CountByType(System.String)
Gets the number of object of a particular type
- Parameters:
- typeName: the typename of object. Example: ‘Conveyor’ or ‘Diverter’
- Returns:
- Returns the number of object of this type
- Example:
This examples shows how to get the number of conveyor in the system.
// get number of conveyor
count = Project.Equipment.CountByType("Conveyor");
// this will print the number of conveyor in the output console.
print(count)
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
Get(System.String)
Gets an object by its name. A better way to access an object is by using indexer. See example.
- Parameters:
- id: Name of the object to find
- Returns:
- Returns the object. Will return null if the object is not found.
- Example:
This example shows how to find an object by its name. This example is using the 'Get' method but also shows how to use indexer operator.
myManager = Project.Colors;
myColor = myManager.Get("Sym3 Red");
// using the indexer. It is shorter but executes the same code behind the scene.
myColor = myManager["Sym3 Red"];
GetById(System.Guid)
Gets an object by its unique ID. A better way to access an object is by using indexer. See example.
- Parameters:
- id: Unique ID of the object to find
- Returns:
- Returns the object. Will return null if the object is not found.
- Example:
This example shows how to find an object by its id. This example is using the 'GetById' method but also shows how to use indexer operator.
id = ... // lets say we have an Id
myManager = Project.Colors;
myColor = myManager.GetById(id);
// using the indexer. It is shorter but executes the same code behind the scene.
myColor = myManager[id];
GetByType(System.String,System.String)
Gets the object of a particular type
- Parameters:
- typeName: the typename of object. Example: ‘Conveyor’ or ‘Diverter’
- name: the name of object. Example: ‘Conveyor1’ or ‘Diverter1’
- Returns:
- Returns the object of this type
- Example:
This examples shows how to get the conveyor in the system.
// get Conveyor1
conv = Project.Equipment.GetByType("Conveyor", "Conveyor1");
// this will print the Conveyor1 in the output console.
print(conv)
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
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"];
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.
New(System.String)
Create a new object of a specified type name and loading. The type name must exist.
- Parameters:
- typeName: Typename of the object. See example
- Returns:
- The newly created object. Returns null if an error occrued.
- Example:
This example shows how to create some equipment
// creates a conveyor
c1 = Project.Equipment.New("Conveyor")
c1.Name = "MyConveyor1";
// creates a diverter
d1 = Project.Equipment.New("Diverter")
d1.Name = "MyDiverter1";
New(System.String,System.Boolean)
Create a new object of a specified type name and loading. The type name must exist.
- Parameters:
- typeName: Typename of the object. See example
- loading: loading is false by default to generate new name
- Returns:
- The newly created object. Returns null if an error occrued.
- Example:
This example shows how to create some equipment
// creates a conveyor
c1 = Project.Equipment.New("Conveyor",true)
c1.Name = "MyConveyor1";
// creates a diverter
d1 = Project.Equipment.New("Diverter")
d1.Name = "MyDiverter1";
New(System.String,System.Double,System.Double,System.Double,System.Boolean)
Create a new object of a specified type name position(x y z) and loading. The type name must exist.
- Parameters:
- typeName: Typename of the object. See example
- x: x position of the object. See example
- y: y position of the object. See example
- z: z position of the object. See example
- loading: loading is false by default to generate new name
- Returns:
- The newly created object. Returns null if an error occrued.
- Example:
This example shows how to create some equipment
// creates a conveyor
c1 = Project.Equipment.New("Conveyor",1.0,2.1.3.0,true)
c1.Name = "MyConveyor1";
Remove(BCS.IBaseObject)
Removes an object from the manager
- Parameters:
- value: Object to remove
RemoveAll
Remove all objects from the manager. The manager will be empty after execution.
RemoveMultiple(System.Collections.ICollection)
Removes an collection of object from the manager
- Parameters:
- value: The collection of object to remove
RemoveSilentlyBecauseSomethingIsNotRight(BCS.IBaseObject)
Removes an object from the manager without calling events
- Parameters:
- value: Object to remove
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;
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