Sepasoft MES Module Suite
AbstractMESComplexProperty Functions
The AbstractMESComplexProperty object functions:
- MES Naming Convention
- addCustomProperty( name, dataTypeName, description, units, productionVisible, required, value)
- addCustomProperty(name, dataTypeName, description, units, productionVisible, required)
- addCustomProperty(propertyPath, name, dataTypeName, description, units, productionVisible, required)
- addCustomProperty(name, dataTypeName)
- addCustomProperty(propertyPath, name, dataTypeName)
- getAllCustomProperties()
- getBaseName()
- getName()
- getValue(valueName)
- logRenameChangeEvent(String oldName, String changeNote)
- setName(String name, String changeNote)
- setValue(valueName, value)
MES Naming Convention
| MES Object | Character that are Not Allowed | Exception |
|---|---|---|
| Production Equipment | . ? ! # % ^ * ~ [ ] { } + = ` \ @ & ( ) < >, | |
| MES Person | . ? ! # % ^ * ~ [ ] { } + = ` \/ " $ | < > | |
| All Other MES Objects | . ? ! # % ^ * ~ [ ] { } + = ` \/ " $ | , | |
Machine Recipe Name | Follows the same convention as All Other MES Objects | Full-stop period . is allowed as of 3.81.10 SP2 |
addCustomProperty(name, dataTypeName, description, units, productionVisible, required, value)
You can add properties to any MES object and resource complex properties, such as material, equipment, personnel, etc.
Use the methods below to add custom properties. Add a custom property directly to a MES object by not specifying a path to the parent property. To add a custom property as a child of an existing custom property or to a complex property, the parent path is used to specify the parent.
Each level of the path is separated with a period. This allows for names to be duplicated provided the path is unique. For example, it is possible for a MES object to have custom properties "Dimension 1.Width" and "Dimension 2.Width"
addCustomProperty(name, dataTypeName, description, units, productionVisible, required, value)
- Parameters
String name - The name of the custom property to add.
String dataTypeName - The name of the Ignition data type to make the new custom property.
String description - The description of the custom property.
String units - The units of the new custom property. This is just for reference.
Boolean productionVisible - The default is false. If True, show the custom property in various components. If False, it will be hidden and can be used to store values behind the scenes.
Boolean required - If True, a value must be assigned to the custom property before and segment is ended.
String value - The value to assign to the custom property after it has been added.
- Returns
Nothing
- Scope
All
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | #Load a MES objectobj = system.mes.loadMESObject('Box', 'MaterialDef') #Add Type custom property directly to the MES objectobj.addCustomProperty('Type', 'String') #Add Dimension custom property directly to the MES objectobj.addCustomProperty('Dimension', 'String', 'Dimension of box', '', True, False) #Add Width custom property to the previous Dimension custom property and assign a valueobj.addCustomProperty('Dimension', 'Width', 'Int4', 'Width of box', 'in', True, False, '24') #Add Height custom property to the previous Dimension custom property and assign a valueobj.addCustomProperty('Dimension', 'Height', 'Int4', 'Height of box', 'in', True, False, '12') #Type custom property was never assigned a value so None is returnedprint obj.getPropertyValue('Type') #Remember to save the MES objectsystem.mes.saveMESObject(obj) #Width and Height custom properties were assigned valuesprint obj.getPropertyValue('Dimension.Width')print obj.getPropertyValue('Dimension.Height') |
None2412 |
addCustomProperty(name, dataTypeName, description, units, productionVisible, required)
Custom properties can be added to MES objects or even complex properties (such as a material, equipment or personnel reference) of an MES object. The Complex Property Functions method can be used to add a custom property directly to a MES object by not specifying a path to the parent property. To add a custom property as a child of an existing custom property or to a complex property, the parent path is used to specify the parent.
Each level of the path is separated with a period. This allows for names to be duplicated provided the path is unique. For example, it is possible for a MES object to have custom properties "Dimension 1.Width" and "Dimension 2.Width"
addCustomProperty(name, dataTypeName, description, units, productionVisible, required)
- Parameters
String name - The name of the custom property to add.
String dataTypeName - The name of the Ignition data type to make the new custom property.
String description - The description of the custom property.
String units - The units of the new custom property. This is just for reference.
boolean productionVisible - The default is false. If True, show the custom property in various components. If False, it will be hidden and can be used to store values behind the scenes.
boolean required - If True, a value must be assigned to the custom property before and segment is ended.
- Returns
Nothing
- Scope
All
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | #Load a MES objectobj = system.mes.loadMESObject('Box', 'MaterialDef') #Add Type custom property directly to the MES objectobj.addCustomProperty('Type', 'String') #Add Dimension custom property directly to the MES objectobj.addCustomProperty('Dimension', 'String', 'Dimension of box', '', True, False) #Add Width custom property to the previous Dimension custom property and assign a valueobj.addCustomProperty('Dimension', 'Width', 'Int4', 'Width of box', 'in', True, False, '24') #Add Height custom property to the previous Dimension custom property and assign a valueobj.addCustomProperty('Dimension', 'Height', 'Int4', 'Height of box', 'in', True, False, '12') #Type custom property was never assigned a value so None is returnedprint obj.getPropertyValue('Type') #Remember to save the MES objectsystem.mes.saveMESObject(obj) #Width and Height custom properties were assigned valuesprint obj.getPropertyValue('Dimension.Width')print obj.getPropertyValue('Dimension.Height') |
None2412 |
addCustomProperty(propertyPath, name, dataTypeName, description, units, productionVisible, required)
Custom properties can be added to MES objects or even complex properties (such as a material, equipment or personnel reference) of an MES object. The Complex Property Functions method can be used to add a custom property directly to a MES object by not specifying a path to the parent property. To add a custom property as a child of an existing custom property or to a complex property, the property path is used to specify the property.
Each level of the path is separated with a period. This allows for names to be duplicated provided the path is unique. For example, it is possible for a MES object to have custom properties "Dimension 1.Width" and "Dimension 2.Width"
addCustomProperty(propertyPath, name, dataTypeName, description, units, productionVisible, required)
- Parameters
String propertyPath - The name or property path of the custom property.
String name - The name of the custom property to add.
String dataTypeName - The name of the Ignition data type to make the new custom property.
String description - The description of the custom property.
String units - The units of the new custom property. This is just for reference.
Boolean productionVisible - The default is false. If True, show the custom property in various components. If False, it will be hidden and can be used to store values behind the scenes.
Boolean required - If True, a value must be assigned to the custom property before and segment is ended.
- Returns
Nothing
- Scope
All
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | #Load a MES objectobj = system.mes.loadMESObject('Box', 'MaterialDef') #Add Type custom property directly to the MES objectobj.addCustomProperty('Type', 'String') #Add Dimension custom property directly to the MES objectobj.addCustomProperty('Dimension', 'String', 'Dimension of box', '', True, False) #Add custom property by specifying the property pathobj.addCustomProperty('Kind', 'Dimension', 'String', 'Dimension of box', '', True, False)#Add Width custom property to the previous Dimension custom property and assign a valueobj.addCustomProperty('Dimension', 'Width', 'Int4', 'Width of box', 'in', True, False, '24') #Add Height custom property to the previous Dimension custom property and assign a valueobj.addCustomProperty('Dimension', 'Height', 'Int4', 'Height of box', 'in', True, False, '12') #Type custom property was never assigned a value so None is returnedprint obj.getPropertyValue('Type') #Remember to save the MES objectsystem.mes.saveMESObject(obj) #Width and Height custom properties were assigned valuesprint obj.getPropertyValue('Dimension.Width')print obj.getPropertyValue('Dimension.Height') |
None2412 |
addCustomProperty(name, dataTypeName)
Custom properties can be added to MES objects or even complex properties (such as a material, equipment or personnel reference) of an MES object. The Complex Property Functions method can be used to add a custom property directly to a MES object by not specifying a path to the parent property. To add a custom property as a child of an existing custom property or to a complex property, the property path is used to specify the property.
Each level of the path is separated with a period. This allows for names to be duplicated provided the path is unique. For example, it is possible for a MES object to have custom properties "Dimension 1.Width" and "Dimension 2.Width"
addCustomProperty(name, dataTypeName)
- Parameters
String name - The name of the custom property to add.
String dataTypeName - The name of the Ignition data type to make the new custom property.
- Returns
Nothing
- Scope
All
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | #Load a MES objectobj = system.mes.loadMESObject('Box', 'MaterialDef') #Add Type custom property directly to the MES objectobj.addCustomProperty('Type', 'String') #Add Dimension custom property directly to the MES objectobj.addCustomProperty('Dimension', 'String', 'Dimension of box', '', True, False) #Add Width custom property to the previous Dimension custom property and assign a valueobj.addCustomProperty('Dimension', 'Width', 'Int4', 'Width of box', 'in', True, False, '24') #Add Height custom property to the previous Dimension custom property and assign a valueobj.addCustomProperty('Dimension', 'Height', 'Int4', 'Height of box', 'in', True, False, '12') #Type custom property was never assigned a value so None is returnedprint obj.getPropertyValue('Type') #Remember to save the MES objectsystem.mes.saveMESObject(obj) #Width and Height custom properties were assigned valuesprint obj.getPropertyValue('Dimension.Width')print obj.getPropertyValue('Dimension.Height') |
None2412 |
addCustomProperty(propertyPath, name, dataTypeName)
Custom properties can be added to MES objects or even complex properties (such as a material, equipment or personnel reference) of an MES object. The Complex Property Functions method can be used to add a custom property directly to a MES object by not specifying a path to the parent property. To add a custom property as a child of an existing custom property or to a complex property, the property path is used to specify the property.
Each level of the path is separated with a period. This allows for names to be duplicated provided the path is unique. For example, it is possible for a MES object to have custom properties "Dimension 1.Width" and "Dimension 2.Width"
addCustomProperty(propertyPath, name, dataTypeName)
- Parameters
String propertyPath - The name or property path of the custom property.
String name - The name of the custom property to add.
String dataTypeName - The name of the Ignition data type to make the new custom property.
- Returns
Nothing
- Scope
All
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | #Load a MES objectobj = system.mes.loadMESObject('Box', 'MaterialDef') #Add Type custom property directly to the MES objectobj.addCustomProperty('Type', 'String') #Add custom property with property path parameterobj.addCustomProperty('Kind', 'Type', 'String')#Add Dimension custom property directly to the MES objectobj.addCustomProperty('Dimension', 'String', 'Dimension of box', '', True, False) #Add Width custom property to the previous Dimension custom property and assign a valueobj.addCustomProperty('Dimension', 'Width', 'Int4', 'Width of box', 'in', True, False, '24') #Add Height custom property to the previous Dimension custom property and assign a valueobj.addCustomProperty('Dimension', 'Height', 'Int4', 'Height of box', 'in', True, False, '12') #Type custom property was never assigned a value so None is returnedprint obj.getPropertyValue('Type') #Remember to save the MES objectsystem.mes.saveMESObject(obj) #Width and Height custom properties were assigned valuesprint obj.getPropertyValue('Dimension.Width')print obj.getPropertyValue('Dimension.Height') |
None2412 |
getAllCustomProperties()
Returns all the custom properties.
getAllCustomProperties()
- Parameters
None
- Returns
List<MESCustomProperty> - The list of custom properties.
- Scope
All
1 2 | matDef = system.mes.loadMESObject('Cane Sugar', 'MaterialDef')matDef.getAllCustomProperties() |
getBaseName()
Complex properties that use extended naming have an associated base name and a number following it. This is used with Lot Reference Property that the Response Segment uses. Each time a lot reference is created it is named the base name with an extension added to it.
For example:
If balsamic vinegar is being unloaded and the tank it is being stored in fills up before the truck is fully unloaded. When it is switched to another storage tank a new lot reference is created. If the name of the material reference in the Process Segment is named Vinegar, then the first lot reference is named Vinegar-1 for the first storage tank and the second is Vinegar-2 for the second storage tank.
Get the base name for the complex property.
getBaseName()
- Parameters
None
- Returns
String baseName - The base name for the complex property.
- Scope
All
1 2 3 4 5 | #This code snippet prints the base name for the specific property.seg = system.mes.createMESObject('ProcessSegment')#Create a new material reference complex propertymaterialProp = seg.createComplexProperty('Material', 'Vinegar')print materialProp.getBaseName() |
Vinegar |
getName()
Complex properties that use extended naming have an associated base name and a number following it. This is used with Lot Reference Property that the Response Segment uses. Each time a lot reference is created it is named the base name with an extension added to it.
For example:
If balsamic vinegar is being unloaded and the tank it is being stored in fills up before the truck is fully unloaded. When it is switched to another storage tank a new lot reference is created. If the name of the material reference in the Process Segment is named Vinegar, then the first lot reference is named Vinegar-1 for the first storage tank and the second is Vinegar-2 for the second storage tank.
Get the name for the complex property.
getName()
- Parameters
None
- Returns
String - The name for the complex property.
- Scope
All
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | seg = system.mes.createSegment('Receive Steel', '\\Enterprise\Site\Area\Unload Station 1', True)seg.setMaterial('Steel In', '84000', '\\Enterprise\Site\Receiving\Steel\QC Holding', 'Lot 84000-1', 100.0)cnt = seg.getComplexPropertyCount('ResponseMaterial')for ndx in range(0, cnt): prop = seg.getComplexProperty('ResponseMaterial', ndx) print prop.getName()seg.begin()seg = system.mes.getActiveSegment('Enterprise\Site\Area\Unload Station 1', 'Receive Steel')seg.setMaterial('Steel In', '84001', '\\Enterprise\Site\Receiving\Steel\QC Holding', 'Lot 84001-1', 100.0)seg.update()seg = system.mes.getActiveSegment('Enterprise\Site\Area\Unload Station 1', 'Receive Steel')cnt = seg.getComplexPropertyCount('ResponseMaterial')for ndx in range(0, cnt): prop = seg.getComplexProperty('ResponseMaterial', ndx) print prop.getName() |
Steel In-1Steel In-2 |
Get the parent property for this complex property.
getParentProperty(propertyName)
- Parameters
String propertyName - The name of complex property to return the parent property for.
- Returns
AbstractMESProperty - The parent property of the specified complex property.
- Scope
All
1 2 | matDef = system.mes.loadMESObject('Cane Sugar', 'MaterialDef')matDef.getParentProperty('Width') |
getValue(valueName)
Returns the value for the specific property.
getValue(valueName)
- Parameters
String valueName - The name of the value to return.
- Returns
String - The value as an object, or returns null if the property is not found (does not throw an error).
- Scope
All
1 2 3 4 5 | #This code snippet prints the value for the specific property.seg = system.mes.createMESObject('ProcessSegment')#Create a new material reference complex propertymaterialProp = seg.createComplexProperty('Material', 'Vinegar')print materialProp.getValue('MaterialProductionSelectable') |
True |
logRenameChangeEvent(String oldName, String changeNote)
The 'changeNote' allows you to attach any arbitrary message to the change so that it appears in the Change Log table.
logRenameChangeEvent(String oldName, String changeNote)
- Parameters
String oldName
String changeNote
- Scope
All
setName(String name, String changeNote)
Attaches any arbitrary message to the change so that it appears in the Change Log table.
setName(String name, String changeNote)
- Parameters
String String name - The 'changeNote' allows you to attach any arbitrary message to the change so that it appears in the Change Log table.
- Returns
nothing
- Scope
All
setValue(valueName, value)
Set the value for the specified value name.
setValue(valueName, value)
- Parameters
String valueName - The name of the value to set.
String value - The new value.
- Returns
boolean - True if the property has been set successfully and False otherwise (does not thrown an error if property does not exist or is of a different type).
- Scope
All
1 2 3 4 5 6 7 8 9 10 11 | #Exampleseg = system.mes.createMESObject('ProcessSegment')#Create a new material reference complex propertymaterialProp = seg.createComplexProperty('Material', 'Vinegar')materialProp.setValue('MaterialRatePeriod', 'Sec')materialProp.setValue('MaterialRate', '74')#Just to make sure the value is reset.print materialProp.getValue('MaterialRatePeriod') ##Save the segment to manifest the changes.system.mes.saveMESObject(seg) |
Sec |
Sepasoft MES Module Suite