Complex Property Functions

Sepasoft MES Module Suite

AbstractMESComplexProperty Functions

The AbstractMESComplexProperty object functions:


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)

Description

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"

Syntax

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

Code Examples
Code Snippet
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 object
obj = system.mes.loadMESObject('Box''MaterialDef')
  
#Add Type custom property directly to the MES object
obj.addCustomProperty('Type''String')
  
#Add Dimension custom property directly to the MES object
obj.addCustomProperty('Dimension''String''Dimension of box', '', TrueFalse)
  
#Add Width custom property to the previous Dimension custom property and assign a value
obj.addCustomProperty('Dimension''Width''Int4''Width of box''in'TrueFalse'24')
  
#Add Height custom property to the previous Dimension custom property and assign a value
obj.addCustomProperty('Dimension''Height''Int4''Height of box''in'TrueFalse'12')
  
#Type custom property was never assigned a value so None is returned
print obj.getPropertyValue('Type')
  
#Remember to save the MES object
system.mes.saveMESObject(obj)
  
#Width and Height custom properties were assigned values
print obj.getPropertyValue('Dimension.Width')
print obj.getPropertyValue('Dimension.Height')
Output
None
24
12
 

addCustomProperty(name, dataTypeName, description, units, productionVisible, required)

Description

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"

Syntax

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

Code Examples
Code Snippet
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 object
obj = system.mes.loadMESObject('Box''MaterialDef')
  
#Add Type custom property directly to the MES object
obj.addCustomProperty('Type''String')
  
#Add Dimension custom property directly to the MES object
obj.addCustomProperty('Dimension''String''Dimension of box', '', TrueFalse)
  
#Add Width custom property to the previous Dimension custom property and assign a value
obj.addCustomProperty('Dimension''Width''Int4''Width of box''in'TrueFalse'24')
  
#Add Height custom property to the previous Dimension custom property and assign a value
obj.addCustomProperty('Dimension''Height''Int4''Height of box''in'TrueFalse'12')
  
#Type custom property was never assigned a value so None is returned
print obj.getPropertyValue('Type')
  
#Remember to save the MES object
system.mes.saveMESObject(obj)
  
#Width and Height custom properties were assigned values
print obj.getPropertyValue('Dimension.Width')
print obj.getPropertyValue('Dimension.Height')
Output
None
24
12
 

addCustomProperty(propertyPath, name, dataTypeName, description, units, productionVisible, required)

Description

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"

Syntax

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

Code Examples
Code Snippet
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 object
obj = system.mes.loadMESObject('Box''MaterialDef')
  
#Add Type custom property directly to the MES object
obj.addCustomProperty('Type''String')
  
#Add Dimension custom property directly to the MES object
obj.addCustomProperty('Dimension''String''Dimension of box', '', TrueFalse)
  
#Add custom property by specifying the property path
obj.addCustomProperty('Kind''Dimension''String''Dimension of box', '', TrueFalse)
#Add Width custom property to the previous Dimension custom property and assign a value
obj.addCustomProperty('Dimension''Width''Int4''Width of box''in'TrueFalse'24')
  
#Add Height custom property to the previous Dimension custom property and assign a value
obj.addCustomProperty('Dimension''Height''Int4''Height of box''in'TrueFalse'12')
  
#Type custom property was never assigned a value so None is returned
print obj.getPropertyValue('Type')
  
#Remember to save the MES object
system.mes.saveMESObject(obj)
  
#Width and Height custom properties were assigned values
print obj.getPropertyValue('Dimension.Width')
print obj.getPropertyValue('Dimension.Height')
Output
None
24
12
 

addCustomProperty(name, dataTypeName)

Description

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"

Syntax

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

Code Examples
Code Snippet
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 object
obj = system.mes.loadMESObject('Box''MaterialDef')
  
#Add Type custom property directly to the MES object
obj.addCustomProperty('Type''String')
  
#Add Dimension custom property directly to the MES object
obj.addCustomProperty('Dimension''String''Dimension of box', '', TrueFalse)
  
#Add Width custom property to the previous Dimension custom property and assign a value
obj.addCustomProperty('Dimension''Width''Int4''Width of box''in'TrueFalse'24')
  
#Add Height custom property to the previous Dimension custom property and assign a value
obj.addCustomProperty('Dimension''Height''Int4''Height of box''in'TrueFalse'12')
  
#Type custom property was never assigned a value so None is returned
print obj.getPropertyValue('Type')
  
#Remember to save the MES object
system.mes.saveMESObject(obj)
  
#Width and Height custom properties were assigned values
print obj.getPropertyValue('Dimension.Width')
print obj.getPropertyValue('Dimension.Height')
Output
None
24
12
 

addCustomProperty(propertyPath, name, dataTypeName)

Description

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"

Syntax

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

Code Examples
Code Snippet
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 object
obj = system.mes.loadMESObject('Box''MaterialDef')
  
#Add Type custom property directly to the MES object
obj.addCustomProperty('Type''String')
  
#Add custom property with property path parameter
obj.addCustomProperty('Kind''Type''String')
#Add Dimension custom property directly to the MES object
obj.addCustomProperty('Dimension''String''Dimension of box', '', TrueFalse)
  
#Add Width custom property to the previous Dimension custom property and assign a value
obj.addCustomProperty('Dimension''Width''Int4''Width of box''in'TrueFalse'24')
  
#Add Height custom property to the previous Dimension custom property and assign a value
obj.addCustomProperty('Dimension''Height''Int4''Height of box''in'TrueFalse'12')
  
#Type custom property was never assigned a value so None is returned
print obj.getPropertyValue('Type')
  
#Remember to save the MES object
system.mes.saveMESObject(obj)
  
#Width and Height custom properties were assigned values
print obj.getPropertyValue('Dimension.Width')
print obj.getPropertyValue('Dimension.Height')
Output
None
24
12
 

getAllCustomProperties()

Description

Returns all the custom properties.

Syntax

getAllCustomProperties()

  • Parameters

None

  • Returns

List<MESCustomProperty> - The list of custom properties.

  • Scope

All

Code Examples
Code Snippet
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.

Description

Get the base name for the complex property.

Syntax

getBaseName()

  • Parameters

None

  • Returns

  String baseName - The base name for the complex property.

  • Scope

All

Code Examples
Code Snippet
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 property
materialProp = seg.createComplexProperty('Material''Vinegar')
print materialProp.getBaseName()
Output
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.

Description

Get the name for the complex property.

Syntax

getName()

  • Parameters

None

  • Returns

 String - The name for the complex property.

  • Scope

All

Code Examples
Code Snippet
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()
Output
Steel In-1
Steel In-2
 
Description

Get the parent property for this complex property.

Syntax

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

Code Examples
Code Snippet
1
2
matDef = system.mes.loadMESObject('Cane Sugar''MaterialDef')
matDef.getParentProperty('Width')

 getValue(valueName)

Description

Returns the value for the specific property.

Syntax

 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

Code Examples
Code Snippet
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 property
materialProp = seg.createComplexProperty('Material''Vinegar')
print materialProp.getValue('MaterialProductionSelectable')
Output
True

 logRenameChangeEvent(String oldName, String changeNote)

Description

The 'changeNote' allows you to attach any arbitrary message to the change so that it appears in the Change Log table.

Syntax

logRenameChangeEvent(String oldName, String changeNote)

  • Parameters

String oldName

String changeNote

  • Scope

All

 

setName(String name, String changeNote)

Description

Attaches any arbitrary message to the change so that it appears in the Change Log table.

Syntax

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)

Description

Set the value for the specified value name.

Syntax

 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

Code Examples
Code Snippet
1
2
3
4
5
6
7
8
9
10
11
#Example
seg = system.mes.createMESObject('ProcessSegment')
#Create a new material reference complex property
materialProp = 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)
Output
Sec

Sepasoft MES Module Suite