Skip to end of metadata
Go to start of metadata

Description

This object is created behind the scenes anytime a Operations Definition or a Operations Request is selected to begin. It hold some base information about the operation whereas most production information is stored with the Response Segment. It can also be created from script and used to begin segments from script, but it cannot be created from the components provided with the Track and Trace Module. For this reason, there is no component that can be used to change the properties listed for the Operations Response object.

The Operations Response is derived from the MESAbstractObject and inherits all the exposed properties, methods and events for that object.

ISA-95 Object Model Inter-Relationships



Object Creation

This object is created at run time when an Operation is executed. The Operations Response is based on a reference object. The two options to base this reference off of are, the Operations Definition and Operations Request.

The following scripting functions can also be used to create or return this type of object.

Script Examples

 The following code snippets are a couple of examples of how to get an instance of a MESOperationsResponse.

Code Snippet
#Get the currently running operation for specified equipment
eqPath = '[global]\Dressings Inc\California\Raw Materials\Unload Station 1'
oper = system.mes.getCurrentOperation(eqPath)
Code Snippet
#Create new operation for specified equipment
eqPath = '[global]\Dressings Inc\California\Raw Materials\Unload Station 1'
oper = system.mes.createOperation('Receive Steel')




Object Properties

These properties are accessible through the MES Object Editor component and with the provided object functions, but not directly as obj.properties. Property values can be accessed and changed for an object by using the getPropertyValue() and setPropertyValue() method.


Setting NameScriptingR/WDescription
Enable Update EventEnableUpdateEventRead/WriteWhen this setting is set to true, the UpdateProgress event for the Response Segments associated with this Operations Definition will be executed at the interval set in the Update Event Interval. The UpdateProgress event is defined in the Ignition Designer in the MES Events section.
Update Event IntervalUpdateEventIntervalRead/WriteThis setting defined the frequency (in seconds) to execute the UpdateProgress event.
Begin Date TimeBeginDateTimeRead/WriteThe date and time the operation started. This setting is set when the operation is started, and it will automatically be set to the date and time of the Ignition server.
End Date TimeEndDateTimeRead/WriteThe date and time the operation ended. This setting is set when the operation is ended, and it will automatically be set to the date and time of the Ignition server.
Operation Reference TypeOperationRefTypeRead/WriteThis setting is automatically set and should not be changed. It will either be set to Operations Definition or Operations Request depending on how the operation was started. If the operation was scheduled prior to being run, then it will equal Operations Request, otherwise it will equal Operations Definition.
Operation Reference UUIDOperationRefUUIDRead/WriteThis setting is automatically set and should not be changed. It refers to the UUID of the Operations Definition or Operations Request, depending on how the operation was started. If the operation was scheduled prior to being run, then it will equal the UUID of the Operations Request it is based on, otherwise it will equal the UUID of the Operations Definition it is based on.

This object inherits the AbstractMESObject properties...

The base AbstractMESObject object provides core properties that are common to all MES objects. The values of the core properties are accessed using the getPropertyValue() and setPropertyValue() functions of the AbstractMESObject object.




Core Properties

 Name
Type
Description
Nameread, write

This is the name of the MES object. This name is used when referencing the object. It must be a unique name meaning that no other MES object of it's type can have the same name.

Naming Characters Allowed

Names must begin with a letter, digit or underscore. Subsequent characters may also include spaces and dashes. The following characters are not allowed:

ObjectCharacters not allowed
Production Equipment. ? ! # % ^ * ~ [ ] { } + = ` \, @ & ( ) < >
MES Person. ? ! # % ^ * ~ [ ] { } + = ` \/ " $ | < >
All other MES Objects. ? ! # % ^ * ~ [ ] { } + = ` \/ " $ | ,

UUIDread-onlyThis will contain the Universally Unique Identifier for each instance of a MES object.
Enabledread, writeThis property will be set to true when the MES object is active and usable. When MES objects are deleted they are still retained in the database and the Enabled setting is set to false. This is done to maintain past traceability information.
Descriptionread, writeAn optional setting to give more details for a MES object.


Code Examples
Read Object UUID Snippet
#Get MES object UUID example:
mesObject = system.mes.loadMESObject("Vinegar", "MaterialClass")
print mesObject.getPropertyValue('UUID')
Set Object Name Snippet
#Set MES object name example:
mesObject = system.mes.loadMESObject("Vinegar", "MaterialClass")
mesObject.setPropertyValue('Name', 'MyNewObjectName')



Object Functions

This object provides the following functions:

Note

This helper function should NOT be used in normal operations because the tracking data will not be validated or in many cases accurately recorded in the database.

Description

Abort the operation. This will do an abrupt abort of all segments currently running under the operation before aborting the operation.

Syntax

abort()


  • Parameters

 None

  • Returns

Nothing

  • Scope

All

Code Examples
Code Snippet
#Get the MES object link of Unload Station 1
eqPath = '[global]\Dressings Inc\California\Raw Materials\Unload Station 1'

#Get the current operation running at the equipment path
oper = system.mes.getCurrentOperation(eqPath)

#Abort the operation
oper.abort()
Description

Begin the operation which will allow segments to begin. Multiple operations can be running at an equipment item at a time, and multiple segments can run under an operation.

Syntax

begin()

  • Parameters

None

  • Returns

MESOperationsResponse operResponse - The operation response object is returned.

  • Scope

All

Code Examples
Code Snippet
eqPath = '[global]\Dressings Inc\California\Raw Materials\Unload Station 1'

#Get a new operation to be run at the specified equipment path
oper = system.mes.createOperation('Receive Steel', eqPath)

#Begin the operation
oper = oper.begin()
Description

Create a new segment to run under the operation. After calling this script function, the segment will not be running until required resources and custom properties are assigned begin is called. Operations can contain one or more segments and the name of the segment to create is passed in the segmentName parameter.

Syntax

createSegment(segmentName)

  • Parameters

String segmentName - The name of the segment to create.

  • Returns

A new MESResponseSegment object that can be used to assign resources and custom properties.

  • Scope

All

Code Examples
Code Snippet
eqPath = '[global]\Dressings Inc\California\Raw Materials\Unload Station 1'

#Create and begin a new operation at the specified equipment path
oper = system.mes.createOperation('Receive Steel', eqPath)
oper.begin()
 
#Create new segment
seg = oper.createSegment('Inspect Steel')

#Assign material resources....
#Assign personnel resources....
#Assign supplemental resources....
#Assign custom properties....

#Begin segment
seg.begin()
Description

Create a new segment to run under the operation. After calling this script function, the segment will not be running until required resources and custom properties are assigned begin is called. Operations can contain one or more segments and the name of the segment to create is passed in the segmentName parameter.

Syntax

createSegment(segmentName, autoAssignOptions)

  • Parameters

String segmentName - The name of the segment to create.

Boolean autoAssignOptions - If true, automatically assign material, lot and person options. Otherwise, they have to be set prior to beginning the segment.

  • Returns

A new MESResponseSegment object that can be used to assign resources and custom properties.

  • Scope

All

Code Examples
Code Snippet
eqPath = '[global]\Dressings Inc\California\Raw Materials\Unload Station 1'

#Create and begin a new operation at the specified equipment path
oper = system.mes.createOperation('Receive Steel', eqPath)
oper.begin()
 
#Create new segment
seg = oper.createSegment('Inspect Steel', True)

#Assign material resources....
#Assign personnel resources....
#Assign supplemental resources....
#Assign custom properties....

#Begin segment
seg.begin()
Description

End the operation. Before an operation can be ended all segments must be ended first.

Syntax

end()

  • Parameters

None

  • Returns

MESOperationsResponse seg - The ended segment is returned.

  • Scope

All

Code Examples
Code Snippet
eqPath = '[global]\Dressings Inc\California\Raw Materials\Unload Station 1'

#Get the currently running operation running at the specified equipment path
oper = system.mes.getCurrentOperation(eqPath)

#End the operation
oper = oper.end()
Description

Get the active segment MES object from a operation by the name of the segment. Because more than one segment can be running under an operation, the segmentName parameter specifies which one to return.

Syntax

getActiveSegment(segmentName)

  • Parameters

String segmentName - The name of the segment.

  • Returns

The MESResponseSegment object that can be updated to reflect lot, material, personnel, supplemental equipment or custom properties changes.

  • Scope

All

Code Examples
Code Snippet
eqPath = '[global]\Dressings Inc\California\Raw Materials\Unload Station 1'
 
#Get the current operation being run at the equipment
oper = system.mes.getCurrentOperation(eqPath)
 
#Get the Inspect Steel segment running under the operation
seg = oper.getActiveSegment('Inspect Steel')
 
#End the segment
seg.end()
Description

Return the name of currently active segment for the operation. If there are no active segments or more than one active segment, then an exception will be thrown.

Syntax

getActiveSegmentName()

  • Parameters

None

  • Returns

The name of the currently active segment.

  • Scope

All

Code Examples
Code Snippet
eqPath = '[global]\Dressings Inc\California\Raw Materials\Unload Station 1'
 
#Get the current operation being run at the equipment
oper = system.mes.getCurrentOperation(eqPath)
 
#Get the active segment running under the operation
segName = oper.getActiveSegmentName()
seg = oper.getActiveSegment(segName)
 
#End the segment
seg.end()
Description

Return names of all active segments for an operation. Operations can be running multiple segments at any time and this script function is used to get the names of them.

Syntax

getActiveSegmentNames()

  • Parameters

None

  • Returns

An array of the names of all active segments for the operation.

  • Scope

All

Code Examples
Code Snippet
#Get the operation currently being run at Unload Station 1
eqPath = '[global]\Dressings Inc\California\Raw Materials\Unload Station 1'
oper = system.mes.getCurrentOperation(eqPath)
operName = oper.getName()

#Get the names of active segments for the operation
if oper == None:
	print 'No active segments found for "%s"' % eqPath	
else:
	try:
		segNames = oper.getActiveSegmentNames()
		for name in segNames:
	    	print name

	except:
		print 'There are no active segments for "%s "' % operName
Output
Unload Steel

Inspect Steel
Description

Gets the Material Lots related to this Operations Response.

Syntax

getActualMaterialLots(lotUseCase)


  • Parameters

 String lotUseCase - The lot's use-type. Valid uses are: 'In', 'Out', 'Consumable', 'By-product', and '(Unknown)'.

  • Returns

 MESList<MESObjectLink> matLotLinks - A list of MESObjectLinks that each have a reference to an MESMaterialLot object.

  • Scope

All

Description

Gets the Personnel related to this Operations Response.

Syntax

getActualPersonnel()


  • Parameters

None

  • Returns

 MESList<MESObjectLink> personLinks - A list of MESObjectLinks that each have a reference to a person object.

  • Scope

All

Description

Gets the Supplemental Equipment related to this Operations Response.

Syntax

getActualSupplementalEquipment()


  • Parameters

None

  • Returns

 MESList<MESObjectLink> supEqpLinks - A list of MESObjectLinks that each have a reference to a supplemental equipment object.

  • Scope

All

Description

Return a list of all available segments that can be run for the operation. Both currently running and not running segments will be returned.

Syntax

getAvailableSegmentNames()

  • Parameters

None

  • Returns

An array of the names of all available segments for the operation.

Code Examples
Code Snippet
#Get the operation currently being run at Unload Station 1
eqPath = '[global]\Dressings Inc\California\Raw Materials\Unload Station 1'
oper = system.mes.getCurrentOperation(eqPath)
 
#Get the names of available segments for the operation
segNames = oper.getAvailableSegmentNames()
for name in segNames:
    print name
Output
Unload Steel
Inspect Steel
Store in Inventory
Description

Return a link to the equipment MES object associated with the operation.

Syntax

getEquipmentLink()

  • Parameters

None

  • Returns

MES Object Link object containing details of the equipment that is associated with the operation.

  • Scope

All

Code Examples
Code Snippet
#Get the operation currently being run at Unload Station 1
eqPath = '[global]\Dressings Inc\California\Raw Materials\Unload Station 1'
oper = system.mes.getCurrentOperation(eqPath)

#Get the MES object link of where the operation is running 
eqLink = oper.getEquipmentLink()

#Print the UUID and the type of equipment
print eqLink.getMESObjectUUID()
print eqLink.getMESObjectType()

#Get the full MES object for the equipment
eqObj = eqLink.getMESObject()
print eqObj.getName()
Output
508ebebc-8f19-4521-b018-a3e177028981
Response Line
Unload Station 1
Description

Return the production count for the operations response. The Track Production By setting must be set to a valid material reference.

Syntax

getProductionCount()

  • Parameters

None

  • Returns

Double - Returns the production count as a double (Float8).

  • Scope

All

Code Examples
Code Snippet
#Get the production count for the operation currently being run at Unload Station 1
eqPath = '[global]\Dressings Inc\California\Raw Materials\Unload Station 1'
oper = system.mes.getCurrentOperation(eqPath)
prodCount = oper.getProductionCount()
print prodCount
Output
430.0
Description

Gets the Response Segments related to this Operations Response.

Syntax

getResponseSegments()


  • Parameters

 None

  • Returns

 MESList<MESObjectLink> rspSegLinks - A list of MESObjectLinks that each have a reference to an MESResponseSegment object.

  • Scope

All

Description

Return a link to the work order MES object associated with the operation.

Syntax

getWorkOrderLink()


  • Parameters

None

  • Returns

MESObjectLink object containing details of the work order that is associated with the operation.

  • Scope

All

Code Examples
Code Snippet
eqPath = '[global]\Enterprise\San Marcos\MP Rotator\MP Rotator 1'
oper = system.mes.getCurrentOperation(eqPath)
#Get work order link
print oper.getWorkOrderLink()
Output
(type: Work Order,  uuid: 2e906f1e-1736-4e02-8586-6b7e4e7e17fc)
Description

Set the equipment that the operation is associated with by the link to the equipment.

Notice

Using this method is not the preferred method of assigning the equipment of where an operation is to run. Instead, use the system.mes.createOperation script function that will set the equipment based on the equipment path.

Syntax

setEquipmentLink(equipmentLink)

  • Parameters

A MES Object Link object containing details of the equipment to associate with the operation.

  • Returns

Nothing

  • Scope

All

Code Examples
Non Preferred Method
#Get the MES object link of Unload Station 1
eqPath = '[global]\Dressings Inc\California\Raw Materials\Unload Station 1'
eqLink = system.mes.getMESObjectLinkByEquipmentPath(eqPath)

#Create a new operation from a operation definition object
operDef = system.mes.loadMESObject('Receive Steel', 'OperationsDefinition')
oper = system.mes.createOperation(operDef)

#Set the equipment where the new operation is to run.
oper.setEquipmentLink(eqLink)
Preferred Method
#Get the MES object link of Unload Station 1
eqPath = '[global]\Dressings Inc\California\Raw Materials\Unload Station 1'

#Create a new operation using the equipment path
oper = system.mes.createOperation('Receive Steel', eqPath)
Description

Sets a link to the work order MES object associated with the operation.

Syntax

setWorkOrderLink(woLink)


  • Parameters

MESObjectLink woLink - The object link containing details of the work order that is associated with the operation.

  • Returns

Nothing

  • Scope

All

Code Examples
Code Snippet
eqPath = '[global]\Enterprise\San Marcos\MP Rotator\MP Rotator 1'
#Get current operation
oper = system.mes.getCurrentOperation(eqPath) 

#Get the work order link
woLink=system.mes.getMESObjectLinkByName('WorkOrder', 'New Work Order')
 
#Set the work order link
oper.setWorkOrderLink(woLink)

This object inherits the AbstractMESObject functions.

Naming Characters Allowed

Names must begin with a letter, digit or underscore. Subsequent characters may also include spaces and dashes. The following characters are not allowed:

ObjectCharacters not allowed
Production Equipment. ? ! # % ^ * ~ [ ] { } + = ` \, @ & ( ) < >
MES Person. ? ! # % ^ * ~ [ ] { } + = ` \/ " $ | < >
All other MES Objects. ? ! # % ^ * ~ [ ] { } + = ` \/ " $ | ,

Description

Add a MES object as a child to another MES object. MES objects can have children and parents. Depending on the type of MES object determines the types of children or parents that can be added. For example, a material class (MESMaterialClass) object can have material definitions (MESMaterialDef) as children, but material definitions objects cannot have material class objects as children.

Note

When a child is added to an MES object, then a parent reference will be added to the child behind the scenes. Likewise, when a parent is added to a child, a child reference will be added to the parent behind the scenes. This insures if integrity of relationships are maintained.

Syntax

addChild(mesObject)


  • Parameters

AbstractMESObject mesObject - An instance to an MES object. An AbstractMESObject object is just the generic form of an MES object when the specific type is unknown.

  • Returns

Nothing

  • Scope

All

Code Examples
Code Snippet
#Get the Screws material class object
matCls = system.mes.loadMESObject('Screws', 'MaterialClass')
 
#Get the 10-32 NC Screw material definition object
matDef = system.mes.loadMESObject('10-32 NC Screw', 'MaterialDef')
 
#Add the 10-32 NC Screw material definition object as a child to the Screws material class object
matCls.addChild(matDef)
 
#Save the changes
system.mes.saveMESObject(matCls)
Description

Add a MES object link as a child to another MES object. MES objects can have children and parents. Depending on the type of MES object determines the types of children or parents that can be added. For example, a material class (MESMaterialClass) object can have material definitions (MESMaterialDef) as children, but material definitions objects cannot have material class objects as children.

Note

When a child is added to an MES object, then a parent reference will be added to the child behind the scenes. Likewise, when a parent is added to a child, a child reference will be added to the parent behind the scenes. This insures if integrity of relationships are maintained.

Syntax

addChild(mesObject)


  • Parameters

MES Object Link mesObjectLink - A link to an MES object. A MES Object Link holds identification information to a MES object. This is very efficient when displaying MES objects in a list and all the MES object details are not needed.

  • Returns

Nothing

  • Scope

All

Code Examples
Code Snippet
#Get the Storage Tanks equipment class object
eqCls = system.mes.loadMESObject('Storage Tanks', 'EquipmentClass')
 
#Get the Tank 1A equipment object from the equipment path
eq = system.mes.getMESObjectLinkByEquipmentPath('[global]\Dressings Inc\California\Raw Materials\Tank Farm\Tank 1A')
 
#Add the 10-32 NC Screw material definition object as a child to the Screws material class object
eqCls.addChild(eq)
 
#Save the changes
system.mes.saveMESObject(eqCls)
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 Object 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, value)


  • Parameters

String name - Name of the custom property to add.

String dataTypeName - Name of the Ignition data type to make the new custom property. Options: Int1, Int2, Int4, Int8, Float4, Float8, Boolean, String, DateTime, DataSet, Text, Int1Array, Int2Array, Int4Array, Int8Array, Float4Array, Float8Array, BooleanArray, StringArray, DateTimeArray.

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. Note that this value is cast to a string, even if the custom property is not a string.

  • Returns

Nothing

  • Scope

All

Code Examples
Code Snippet
#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', '', True, False)
 
#Add Width custom property to the previous Dimension custom property and assign a value
obj.addCustomProperty('Dimension', 'Width', 'Int4', 'Width of box', 'in', True, False, '24')
 
#Add Height custom property to the previous Dimension custom property and assign a value
obj.addCustomProperty('Dimension', 'Height', 'Int4', 'Height of box', 'in', True, False, '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
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 Object 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 - Name of the Ignition data type to make the new custom property. Options: Int1, Int2, Int4, Int8, Float4, Float8, Boolean, String, DateTime, DataSet, Text, Int1Array, Int2Array, Int4Array, Int8Array, Float4Array, Float8Array, BooleanArray, StringArray, DateTimeArray.

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
#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', '', True, False)
 
#Add Width custom property to the previous Dimension custom property and assign a value
obj.addCustomProperty('Dimension', 'Width', 'Int4', 'Width of box', 'in', True, False, '24')
 
#Add Height custom property to the previous Dimension custom property and assign a value
obj.addCustomProperty('Dimension', 'Height', 'Int4', 'Height of box', 'in', True, False, '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
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 Object 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)


  • Parameters

String name - The name of the custom property to add.

String dataTypeName - Name of the Ignition data type to make the new custom property. Options: Int1, Int2, Int4, Int8, Float4, Float8, Boolean, String, DateTime, DataSet, Text, Int1Array, Int2Array, Int4Array, Int8Array, Float4Array, Float8Array, BooleanArray, StringArray, DateTimeArray.

  • Returns

Nothing

  • Scope

All

Code Examples
Code Snippet
#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', '', True, False)
 
#Add Width custom property to the previous Dimension custom property and assign a value
obj.addCustomProperty('Dimension', 'Width', 'Int4', 'Width of box', 'in', True, False, '24')
 
#Add Height custom property to the previous Dimension custom property and assign a value
obj.addCustomProperty('Dimension', 'Height', 'Int4', 'Height of box', 'in', True, False, '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
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 Object 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(parentPath, name, dataTypeName, description, units, productionVisible, required, value)


  • Parameters

String parentPath - The path of the parent to add the custom property to.

String name - The name of the custom property to add.

String dataTypeName - Name of the Ignition data type to make the new custom property. Options: Int1, Int2, Int4, Int8, Float4, Float8, Boolean, String, DateTime, DataSet, Text, Int1Array, Int2Array, Int4Array, Int8Array, Float4Array, Float8Array, BooleanArray, StringArray, DateTimeArray.

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. Note that this value is cast to a string, even if the custom property is not a string.

  • Returns

Nothing

  • Scope

All

Code Examples
Code Snippet
#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', '', True, False)
 
#Add Width custom property to the previous Dimension custom property and assign a value
obj.addCustomProperty('Dimension', 'Width', 'Int4', 'Width of box', 'in', True, False, '24')
 
#Add Height custom property to the previous Dimension custom property and assign a value
obj.addCustomProperty('Dimension', 'Height', 'Int4', 'Height of box', 'in', True, False, '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
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 Object 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(parentPath, name, dataTypeName, description, units, productionVisible, required)


  • Parameters

String parentPath - The path of the parent to add the custom property to.

String name - The name of the custom property to add.

String dataTypeName - Name of the Ignition data type to make the new custom property. Options: Int1, Int2, Int4, Int8, Float4, Float8, Boolean, String, DateTime, DataSet, Text, Int1Array, Int2Array, Int4Array, Int8Array, Float4Array, Float8Array, BooleanArray, StringArray, DateTimeArray.

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
#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', '', True, False)
 
#Add Width custom property to the previous Dimension custom property and assign a value
obj.addCustomProperty('Dimension', 'Width', 'Int4', 'Width of box', 'in', True, False, '24')
 
#Add Height custom property to the previous Dimension custom property and assign a value
obj.addCustomProperty('Dimension', 'Height', 'Int4', 'Height of box', 'in', True, False, '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
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 Object 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(parentPath, name, dataTypeName)


  • Parameters

String parentPath - The path of the parent to add the custom property to.

String name - The name of the custom property to add.

String dataTypeName - Name of the Ignition data type to make the new custom property. Options: Int1, Int2, Int4, Int8, Float4, Float8, Boolean, String, DateTime, DataSet, Text, Int1Array, Int2Array, Int4Array, Int8Array, Float4Array, Float8Array, BooleanArray, StringArray, DateTimeArray.

  • Returns

Nothing

  • Scope

All

Code Examples
Code Snippet
#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', '', True, False)
 
#Add Width custom property to the previous Dimension custom property and assign a value
obj.addCustomProperty('Dimension', 'Width', 'Int4', 'Width of box', 'in', True, False, '24')
 
#Add Height custom property to the previous Dimension custom property and assign a value
obj.addCustomProperty('Dimension', 'Height', 'Int4', 'Height of box', 'in', True, False, '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
Description

Add a MES object as a parent to another MES object. MES objects can have children and parents. Depending on the type of MES object determines the types of children or parents that can be added. For example, a material class (MESMaterialClass) object can have material definitions (MESMaterialDef) as children, but material definitions objects cannot have material class objects as children.

Note

When a child is added to an MES object, then a parent reference will be added to the child behind the scenes. Likewise, when a parent is added to a child, a child reference will be added to the parent behind the scenes. This insures if integrity of relationships are maintained.

Syntax

addParent(mesObject)


  • Parameters

AbstractMESObject mesObject - An instance to an MES object. An AbstractMESObject object is just the generic form of an MES object when the specific type is unknown.

  • Returns

Nothing

  • Scope

All

Code Examples
Code Snippet
#Get the 10-32 NC Screw material definition object
matDef = system.mes.loadMESObject('10-32 NC Screw', 'MaterialDef')

#Get the Screws material class object
matCls = system.mes.loadMESObject('Screws', 'MaterialClass')
 
#Add the Screws material class object as a parent to the 10-32 NC Screw material definition object
matDef.addParent(matCls)
 
#Save the changes
system.mes.saveMESObject(matDef)
Description

Add a MES object link as a parent to another MES object. MES objects can have children and parents. Depending on the type of MES object determines the types of children or parents that can be added. For example, a material class (MESMaterialClass) object can have material definitions (MESMaterialDef) as children, but material definitions objects cannot have material class objects as children.

Note

When a child is added to an MES object, then a parent reference will be added to the child behind the scenes. Likewise, when a parent is added to a child, a child reference will be added to the parent behind the scenes. This insures if integrity of relationships are maintained.

Syntax

addParent(mesObject)


  • Parameters

MES Object Link mesObjectLink - A link to an MES object. A MES Object Link holds identification information to a MES object. This is very efficient when displaying MES objects in a list and all the MES object details are not needed.

  • Returns

Nothing

  • Scope

All

Code Examples
Code Snippet
#Get the Tank 1A equipment object from the equipment path
eq = system.mes.getMESObjectLinkByEquipmentPath('[global]\Dressings Inc\California\Raw Materials\Tank Farm\Tank 1A')

#Get the Storage Tanks equipment class object
eqCls = system.mes.loadMESObject('Storage Tanks', 'EquipmentClass')
  
#Add the Screws material class object to the 10-32 NC Screw material definition object
eq.addChild(eqCls)
 
#Save the changes
system.mes.saveMESObject(eq)

Description

Create a complex property directly to an MES object by not specifying a path to the parent property.

Syntax

createComplexProperty(complexPropertyType, name)


  • Parameters

String complexPropertyType - The type of complex property.

String name - The name of complex property.

  • Returns

The complex property for the specified type (Material Resource Property, Equipment Resource Property, Personnel Resource Property, etc.)

  • Scope

All

Code Examples
Code Snippet
od = system.mes.createMESObject('OperationsDefinition')
 
#Load the process segment to base the operations segments on
ps = system.mes.loadMESObject('Receive Material', 'ProcessSegment')
depProp = od.createComplexProperty('SegmentDependency', ps.getName())
 
#Derive a new operation segment from the process segment
os = system.mes.deriveMESObject(ps, 'OperationsSegment', True)
depProp.setSegmentRefType('OperationsSegment')
depProp.setSegmentRefUUID(os.getUUID())
print depProp
Output
{SegmentRef=Operations Segment, , SegmentRefUUID=cfabeb4a-0b2d-4e43-91a8-1258d8b41e32, SegmentRefType=OperationsSegment, SegmentDependencyType=null, SegmentDependencyFactor=null, SegmentDependencyFactorUnits=null}
Description

Returns all the custom properties for the definition and any class object that the definition is a member of plus the inherited custom properties as a list of MESCustomProperty objects.

Syntax

getAllCustomProperties()


  • Parameters

None

  • Returns

List<MESCustomProperty> - The list of custom properties.

  • Scope

All

Code Examples
Code Snippet
matDef = system.mes.loadMESObject('Cane Sugar', 'MaterialDef')
matDef.getAllCustomProperties()

Description

Get the collection of children for an MES object.

Syntax

getChildCollection()


  • Parameters

None

  • Returns

MESObjectCollection - Returns a collection object containing references to all children of the MES object.

  • Scope

All

Code Examples
Code Snippet
#This example reads and prints the name of all child MES objects that belong to the Vinegar Material Class.
mesObject = system.mes.loadMESObject('Vinegar', 'MaterialClass')
 
if mesObject != None:
    childList = mesObject.getChildCollection().getList()
    for child in childList:
		
		#The child variable is of the MESObjectLink type
        print child.getName()
Output
Balsamic Vinegar
Red Wine Vinegar
White Vinegar

Description

Get the collection of complex properties.

Syntax

getComplexProperty(complexPropertyName, entryName)


  • Parameters

String complexPropertyName - The name for the type of complex property.

String entryName - The name of the complex property entry.

  • Returns

The complex property collection.

  • Scope

All

Code Examples
Code Snippet
seg = system.mes.createMESObject('ProcessSegment')
 
#Create a new material reference complex property
materialProp = seg.createComplexProperty('Material', 'Vinegar')
print seg.getComplexProperty('Material','Vinegar')
Output
{MaterialOptional=false, MaterialProductionSelectable=true, MaterialUse=null, MaterialAutoGenerateLot=false, MaterialRef=, MaterialRefUUID=null, MaterialRefType=null, MaterialEquipmentRef=, MaterialEquipmentRefType=null, MaterialEquipmentRefUUID=null, MaterialEnableSublots=false, MaterialLotNoSource=null, MaterialLotNoSourceLink=null, MaterialQuantitySource=null, MaterialQuantitySourceLink=null, MaterialQuantity=null, MaterialUnits=null, MaterialRatePeriod=null, MaterialRate=null, MaterialCycleTime=0, MaterialFinalLotStatus=null, MaterialAutoLotCompletion=Disabled, MaterialLotDepletionWarning=0, MaterialLotStatusFilter=null}
Description

Get the collection of complex properties.

Syntax

getComplexProperty(complexPropertyName, index)


  • Parameters

String complexPropertyName - The name for the type of complex property.

Integer index - The specified position in this list.

  • Returns

The complex property collection.

  • Scope

All

Code Examples
Code Snippet
seg = system.mes.createMESObject('ProcessSegment')
 
#Create a new material reference complex property
materialProp = seg.createComplexProperty('Material', 'Vinegar')
print seg.getComplexProperty('Material', 0)
Output
{MaterialOptional=false, MaterialProductionSelectable=true, MaterialUse=null, MaterialAutoGenerateLot=false, MaterialRef=, MaterialRefUUID=null, MaterialRefType=null, MaterialEquipmentRef=, MaterialEquipmentRefType=null, MaterialEquipmentRefUUID=null, MaterialEnableSublots=false, MaterialLotNoSource=null, MaterialLotNoSourceLink=null, MaterialQuantitySource=null, MaterialQuantitySourceLink=null, MaterialQuantity=null, MaterialUnits=null, MaterialRatePeriod=null, MaterialRate=null, MaterialCycleTime=0, MaterialFinalLotStatus=null, MaterialAutoLotCompletion=Disabled, MaterialLotDepletionWarning=0, MaterialLotStatusFilter=null}
Description

Get the collection of complex properties.

Syntax

getComplexProperty(path)


  • Parameters

String The path to the MES property to get.

  • Returns

The complex property for the specified path.

  • Scope

All

Code Examples
Code Snippet
seg = system.mes.createMESObject('ProcessSegment')
 
#Create a new material reference complex property
materialProp = seg.createComplexProperty('Material', 'Vinegar')
print seg.getComplexProperty('Material.Vinegar')
Output
{MaterialOptional=false, MaterialProductionSelectable=true, MaterialUse=null, MaterialAutoGenerateLot=false, MaterialRef=, MaterialRefUUID=null, MaterialRefType=null, MaterialEquipmentRef=, MaterialEquipmentRefType=null, MaterialEquipmentRefUUID=null, MaterialEnableSublots=false, MaterialLotNoSource=null, MaterialLotNoSourceLink=null, MaterialQuantitySource=null, MaterialQuantitySourceLink=null, MaterialQuantity=null, MaterialUnits=null, MaterialRatePeriod=null, MaterialRate=null, MaterialCycleTime=0, MaterialFinalLotStatus=null, MaterialAutoLotCompletion=Disabled, MaterialLotDepletionWarning=0, MaterialLotStatusFilter=null}
Description

This method is used to reference properties with various MES object types that have the same property kind and base names.

Options for Kind

  • Material
  • Equipment
  • SupplEquip
  • Personnel

Sample MES property paths:

  • Material.Vinegar.LotNo - where Material is the kind, Vinegar is the base name and LotNo is the property name.
  • Response Material.Vinegar-1.LotNo - where Response Material is the name of the complex property type, Vinegar-1 is the entry name and LotNo is the property name.
Syntax

getComplexPropertyByKind(path)


  • Parameters

String path - The path to the MES property to get. Options for Kind are Material, Equipment, SupplEquip, and Personnel.

  • Returns

AbstractMESProperty - An AbstractMESProperty for the specified path.

  • Scope

All

Description

Get the number of complex properties.

Syntax

getComplexPropertyCount(complexPropertyName)


  • Parameters

String complexPropertyName - The name for the complex property.

  • Returns

Integer count - The size of the complex property collection.

  • Scope

All

Code Examples
Code Snippet
#This code snippet will print the size of complex property with name 'Material'
seg = system.mes.createMESObject('ProcessSegment')
 
#Create a new material reference complex property
materialProp = seg.createComplexProperty('Material', 'White Vinegar')
materialProp = seg.createComplexProperty('Material', 'Balsamic Vinegar')
materialProp = seg.createComplexProperty('Material', 'Red Wine Vinegar')
print seg.getComplexPropertyCount('Material')
Output
3
Description

Gets the list of production item with the specified complex property.

Syntax

getComplexPropertyItemNames(complexPropertyName)


  • Parameters

String complexPropertyName - The name of the complex property.

  • Returns

List<String> itemNameList - The list of production item names with the specified complex property.

  • Scope

All

Code Examples
Code Snippet
segName = 'Mixed Nuts 8oz-Nuts Unlimited:Folsom:Packaging:Packaging Line 1'
mesObject = system.mes.loadMESObject(segName, "OperationsSegment")
prodList = mesObject.getComplexPropertyItemNames('ProductionSettings')
for item in prodList:
    print item, " - ", mesObject.getComplexProperty('ProductionSettings',item).getModeRefProperty().getValue()
Output
Packaging Line 1 - Equipment Mode, Production
Packaging Line 1:Casepacker - Equipment Mode, Production
Packaging Line 1:Checkweigher - Equipment Mode, Production
Packaging Line 1:Filler - Equipment Mode, Production
Packaging Line 1:Palletizer - Equipment Mode, Production
Packaging Line 1:Labeler - Equipment Mode, Disabled
Description

Get the complex properties of a specific type.

Syntax

getComplexPropertyTypeNames()


  • Parameters

None

  • Returns

A list of complex properties that matches the given type.

  • Scope

All

Code Examples
Code Snippet
#This example prints the list of complex properties that matches the type 'Process Segment'.
seg = system.mes.loadMESObject('e9acd913-0ac2-497a-8c41-efa9285bd3ed')
 
#Create a new material reference complex property
materialProp = seg.createComplexProperty('Material', 'Vinegar')
print seg.getComplexPropertyTypeNames()
Output
[Material, Equipment, SupplEquip, Personnel]
Description

Get the collection of core properties.

Syntax

getCoreProperties()


  • Parameters

None

  • Returns

MESPropertyCollection coreProperties - The collection of core properties.

  • Scope

All

Description

Returns all of the custom properties of the definition object as an MESPropertyCollection.

Syntax

getCustomProperties()


  • Parameters

None

  • Returns

MESPropertyCollection - A collection of the names of custom properties as strings.

  • Scope

All

Code Examples
Code Snippet
matDef = system.mes.loadMESObject('Cane Sugar', 'MaterialDef')
print matDef.getCustomProperties()
Description

Return the custom properties for the MES object as a Python dictionary. The Python dictionary will contain custom property path, definition pairs. The definition is a Python list containing the data type, value, description, units, production visible and required settings of the custom property.

Because custom properties can be nested, the path of the custom property is used. 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

getCustomPropertiesFull()

  • Parameters

Nothing

  • Returns

PyDictionary - A Python dictionary containing custom property path (name) definition pairs.

  • Scope

All

Code Examples
Code Snippet
#Get the full custom property definitions for a MES object
cp = obj.getCustomPropertiesFull()
 
#Print the Python dictionary of all custom properties
print cp

#Get the definition for just the Width custom property
widthDef = cp['Dimension.Width']
 
#Print the Python list for the Width custom property definition
print widthDef
 
#Print setting individually for the Width custom property
print widthDef[0]	#Data type
print widthDef[1]	#Value
print widthDef[2]	#Description
print widthDef[3]	#Units
print widthDef[4]	#Production Visible
print widthDef[5]	#Required
Output
{u'Dimension.Width': [u'Int8', u'10', u'Box width', u'in', True, False], u'Dimension': [u'String', u'', u'', u'', True, False], u'Dimension.Height': [u'Int8', u'12', u'Box height', u'in', True, False]}
[u'Int8', u'10', u'Box width', u'in', True, False]
Int8
10
Box width
in
True
False
Description

Return the custom properties for a complex property of a MES object as a Python dictionary. When the complex properties on a MES object (for example, a material reference) have custom properties, this method is used to get them by type and name. The Python dictionary will contain custom property path, definition pairs. The definition is a Python list containing the data type, value, description, units, production visible and required settings of the custom property.

Because custom properties can be nested, the path of the custom property is used. 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

getCustomPropertiesFull(complexPropertyName, entryName)


  • Parameters

String complexPropertyType - The name for the type of complex property.

String name - The name of the complex property entry.

  • Returns

PyDictionary - A Python dictionary containing custom property path (name) definition pairs.

  • Scope

All

Code Examples
Code Snippet
#Load a segment MES object
proSeg = system.mes.loadMESObject('Receive Steel', 'ProcessSegment')
 
#Get the custom property values for the Steel In material reference
cp = proSeg.getCustomPropertiesFull('Material', 'Steel In')
 
#Get the definition for just the Thickness custom property
cpDef = cp['Dimension.Thickness']
 
#Print the Python list for the Thickness custom property definition
print cpDef 
 
#Print setting individually for the Thickness custom property
print cpDef [0]	#Data type
print cpDef [1]	#Value
print cpDef [2]	#Description
print cpDef [3]	#Units
print cpDef [4]	#Production Visible
print cpDef [5]	#Required

Output
[u'Float8', u'100', u'Thickness of steel', u'1/1000th', True, True]
Float8
100
Thickness of steel
1/1000th
True
True
Description

Get the description of the custom property by name or property path.

Syntax

getCustomPropertyDescription(propertyPath)


  • Parameters

String propertyPath - The name or property path of the custom property to get the description for.

  • Returns

String description - The custom property description.

  • Scope

All

Code Examples
Code Snippet
#Load an MES object
obj = system.mes.loadMESObject('Box', 'MaterialDef')
 
#Add a custom property
obj.addCustomProperty('Kind', 'String', 'Kind of box', '', True, True)
 
#Print the current enabled state
print obj.getCustomPropertyDescription('Kind')
Output
Kind of box
Description

Get the enabled state of a custom property. If the enabled state is True then custom property is available. If False, the custom property will not appear in component, be used during production or is not accessible in script.

Syntax

getCustomPropertyEnabled(propertyPath)


  • Parameters

String propertyPath - The name or property path of the custom property to get the enabled state.

  • Returns

boolean The enabled state of the custom property.

  • Scope

All

Code Examples
Code Snippet
#Load an MES object
obj = system.mes.loadMESObject('Box', 'MaterialDef')
 
#Add a custom property
obj.addCustomProperty('Kind', 'String')
 
#Print the current enabled state
print obj.getCustomPropertyEnabled('Kind')

#Disable the custom property named Kind
obj.setCustomPropertyEnabled('Kind', False)

#Print the current enabled state
print obj.getCustomPropertyEnabled('Kind')
Output
True
False
Description

Get the units of the custom property.

Syntax

getCustomPropertyUnits(propertyPath)


  • Parameters

String propertyPath - The name or property path of the custom property to get the description for.

  • Returns

String units - The units of the new custom property.

  • Scope

All

Code Examples
Code Snippet
#Load MES object
obj = system.mes.loadMESObject('Box', 'MaterialDef')
print obj.getCustomPropertyUnits('Kind.Class of Box')
Output
lbs
Description

Return the custom properties for the complex property (resource reference) as a Python dictionary. The Python dictionary will contain custom property path, value pairs. Because custom properties can be nested, the path of the custom property is used. 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.Widith" and "Dimension 2.Width".

For response segments, references to resources are created for each lot, person or supplemental equipment. For example, if a segment is started filling tank 1 and then switches to tank 2, then there will be two complex properties. One that has all the information while tank 1 was selected and a second that has all the information while tank 2 was selected. Custom properties can be added to the complex properties that will be unique for the time each tank was selected. If a pH reading is collected for each tank, then the separate readings can be saved in the appropriate complex property. To specify which complex property to access, extended naming is used. Referring to our sample, if we named the material complex property "Liquid", then the extend name for the first entry is "Liquid-1" and the second entry is "Liquid-2".

Syntax

getCustomPropertyValues(complexPropertyType, name)

  • Parameters

String complexPropertyType - The name for the type of complex property.

String name - The name of the complex property entry.

  • Returns

PyDictionary - A Python dictionary containing custom property path (name) value pairs.

  • Scope

All

Code Examples
Code Snippet
#Get the Storage Tanks equipment class object
proSeg = system.mes.loadMESObject('Receive Steel', 'ProcessSegment')
 
#Get the custom property values for the Steel In material reference
cp = proSeg.getCustomPropertyValues('Material', 'Steel In')
 
#Cycle through and print the custom property values
for path in cp.keys():
	print 'Path: %s = %s' % (path, cp[path])
print
 
#Just access a specific custom property by known path
print 'Dimension 1.Width = %s' % cp['Dimension 1.Width']
Description

Get properties inherited by the MES object. These inherited properties are custom properties on the parent(s) of the object.

Syntax

getInheritedProperties()


  • Parameters

None

  • Returns

MESPropertyCollection - The list of inherited properties.

  • Scope

All

Code Examples
Code Snippet
obj = system.mes.loadMESObject('Cashew Nuts', 'MaterialDef')
print obj.getInheritedProperties()
Description

Get the type of the MES object. This returns an object that represents the MES object type. This object contains other information associated with the type. In most cases only the name of the MES object type is needed and using the getMESObjectTypeName script function is recommended instead.

Syntax

getMESObjectType()


  • Parameters

None

  • Returns

MESObjectType - The type of MES object.

  • Scope

All

Code Examples
Code Snippet
#This example will print the type of MES object.
seg = system.mes.loadMESObject('e9acd913-0ac2-497a-8c41-efa9285bd3ed')
 
#Create a new material reference complex property
materialProp = seg.createComplexProperty('Material', 'Vinegar')
print seg.getMESObjectType()
Output
 Process Segment
Description

Get the name of the MES object type.

Syntax

getMESObjectTypeName()


  • Parameters

None

  • Returns

String - The MES object type name of the MES object. Refer to: MES Object Type Name.

  • Scope

All

Code Examples
Code Snippet
obj = system.mes.loadMESObject('Box', 'MaterialDef')
print obj.getMESObjectTypeName()
Output
Material Definition

Description

Get the name of the MES object. For each type of MES object, the name must be unique. For example, the name of each material definition is unique. In addition, the MES object name must also be unique for various categories of MES object types.

Syntax

getName()


  • Parameters

None

  • Returns

String - MES object name.

  • Scope

All

Info

Below are the categories of MES object types that the names will be unique:

CategoryMES Object Types
EquipmentEquipment, EquipmentClass
Material, PersonnelMaterialDef, MaterialClass, Person, Personnel Class
OperationOperations Definition, OperationSegment
Code Examples
Code Snippet
obj = system.mes.loadMESObject('Box', 'MaterialDef')
print obj.getName()
Output
Box
Code Examples
Code Snippet
#Example
obj = system.mes.loadMESObject('8da06ff8-2922-4e0c-a01a-e7cda6899a0e')
objLink = system.mes.object.link.create(obj)
print objLink.getName()
Output
Vinegar Tank 1

Description

Get the collection of parents for an MES object.

Syntax

getParentCollection()


  • Parameters

None

  • Returns

MESObjectCollection - Returns a collection object containing references to all parents of the MES object.

  • Scope

All

Code Examples
Code Snippet
#This example reads and prints the name of all parent MES objects that belong to Balsamic Vinegar.
mesObject = system.mes.loadMESObject('Balsamic Vinegar', 'MaterialDef')
 
if mesObject != None:
    parentList = mesObject.getParentCollection().getList()
    for parent in parentList:
		
		#The parent variable is of the MESObjectLink type
        print parent.getName()
Output
Vinegar
Description

Get a property value of an MES object by name or path. The property can be a core property, custom property or complex property of the MES object. In the case where custom properties are nested, a path is required to return the correct value.

The type of the value depends on the property being read. If no value is currently assigned to the property, None will be returned.

Syntax

getPropertyValue(propertyPath)


  • Parameters

String propertyPath - The name or path of the property being read.

  • Returns

The value of the property. The type depends on the property being read.

  • Scope

All

Code Examples
Code Snippet
#Load a MES object
obj = system.mes.loadMESObject('Box', 'MaterialDef')
 
#Read and print the Width and Height custom properties that are children of the Dimension custom property.
width = obj.getPropertyValue('Dimension.Width')
height = obj.getPropertyValue('Dimension.Height')
print "Width = %d, Height = %d" % (width, height)
Output
Width = 10, Height = 12
Description

Return the UUID value from the UUID property of the MES object. UUID stands for Universally Unique Identifier and each MES object will have a UUID assigned.

Syntax

getUUID()


  • Parameters

None

  • Returns

String - UUID of the MES object

  • Scope

All

Code Examples
Code Snippet
obj = system.mes.loadMESObject('Box', 'MaterialDef')
print obj.getUUID()
Output
b17159b6-81ce-4057-a5b3-626126079320
Description

Return the version number of the MES object. Not all MES objects have version number. Every time a definition type of MES object is modified, the version number is increased. When new schedules or production is run based on the definition MES object, it is tied the latest version of the definition MES objects.

Syntax

getVersion()


  • Parameters

None

  • Returns

Integer - The version number of this MES object.

  • Scope

All

Code Examples
Code Snippet
obj = system.mes.loadMESObject('Box', 'MaterialDef')
print obj.getVersion()
Output
3
Description

Get the enabled state of the MES object. If an MES object is not enabled, it will not show in any selection list or able to be selected within script. Essentially, the enabled state will change to false when the MES object is deleted. Deleted MES object still reside in the system for history of past production.

Syntax

isEnabled()


  • Parameters

None

  • Returns

boolean - The enabled state of the MES object.

  • Scope

All

Code Examples
Code Snippet
obj = system.mes.loadMESObject('Box', 'MaterialDef')
print obj.isEnabled()
Output
True
Description

If one or more properties of an MES object are changed, then True will be returned.

Syntax

isModified()


  • Parameters

None

  • Returns

boolean - The MES object modified state.

  • Scope

All

Code Examples
Code Snippet
#Load a MES object
obj = system.mes.loadMESObject('Box', 'MaterialDef')
print obj.isModified()
 
#Change a property of it
obj.setPropertyValue('Name', 'Empty Box')
print obj.isModified()
Output
False
True
Description

Remove another MES child object for an MES object.

MES objects can have children and parents. Depending on the type of MES object determines the types of children or parents that can be added. For example, a material class (MESMaterialClass) object can have material definitions (MESMaterialDef) as children, but material definitions objects cannot have material class objects as children.

Note

When a child is removed from an MES object, then the parent reference will be removed from the child behind the scenes. Likewise, when a parent is removed from a child, the child reference will be removed from the parent behind the scenes. This insures if integrity of relationships are maintained.

Syntax

removeChild(mesObject)


  • Parameters

AbstractMESObject mesObject - An instance to an MES object. An AbstractMESObject object is just the generic form of an MES object when the specific type is unknown.

  • Returns

Nothing

  • Scope

All

Code Examples
Code Snippet
#Get the Screws material class object
matCls = system.mes.loadMESObject('Screws', 'MaterialClass')
 
#Get the 10-32 NC Screw material definition object
matDef = system.mes.loadMESObject('10-32 NC Screw', 'MaterialDef')
 
#Remove the 10-32 NC Screw material definition object from the Screws material class object
matCls.removeChild(matDef)
 
#Save the changes
system.mes.saveMESObject(matCls)
Description

Removes an existing complex property.

Syntax

removeComplexProperty(complexPropertyName, entryName)


  • Parameters

String complexPropertyName - The name for the type of complex property.

String entryName - The name of the complex property entry.

  • Returns

Nothing

  • Scope

All

Code Examples
Code Snippet
seg = system.mes.createMESObject('ProcessSegment')
 
#In order to make it more clear, Let us create a complex property named Equipment. 
materialProp = seg.createComplexProperty('Equipment', 'Vinegar Tank1')
 
#This code snippet removed the complex property named 'Equipment'. So that when script function getComplexProperty() is executed it prints None.
removeProp = seg.removeComplexProperty('Equipment', 'Vinegar Tank1')
print seg.getComplexProperty('Equipment', 'Vinegar Tank1')
Output
None
Description

Removes an existing custom property.

Syntax

removeCustomProperty(propertyPath)


  • Parameters

String propertyPath - The path of property to remove.

  • Returns

Nothing

  • Scope

All

Code Examples
Code Snippet
#Load MES object
obj = system.mes.loadMESObject('Box', 'MaterialDef')
obj.removeCustomProperty('Kind.Class of Box') 
Description

Remove another MES parent object for an MES object.

MES objects can have children and parents. Depending on the type of MES object determines the types of children or parents that can be added. For example, a material class (MESMaterialClass) object can have material definitions (MESMaterialDef) as children, but material definitions objects cannot have material class objects as children.

Note

When a child is removed from an MES object, then the parent reference will be removed from the child behind the scenes. Likewise, when a parent is removed from a child, the child reference will be removed from the parent behind the scenes. This insures the integrity of relationships are maintained.

Syntax

removeParent(mesObject)


  • Parameters

AbstractMESObject mesObject - An instance to an MES object. An AbstractMESObject object is just the generic form of an MES object when the specific type is unknown.

  • Returns

Nothing

  • Scope

All

Code Examples
Code Snippet
#Get the 10-32 NC Screw material definition object
matDef = system.mes.loadMESObject('10-32 NC Screw', 'MaterialDef')

#Get the Screws material class object
matCls = system.mes.loadMESObject('Screws', 'MaterialClass')
 
#Remove the Screws material class object from the 10-32 NC Screw material definition object
matDef.removeParent(matCls)
 
#Save the changes
system.mes.saveMESObject(matDef)
Description

Renaming an existing complex property.

Syntax

renameComplexProperty(complexPropertyName, entryName, newEntryName)


  • Parameters

String complexPropertyName - The name for the type of complex property.

String entryName - The name of the complex property entry.

String newEntryName - The new complex property name.

  • Returns

Nothing

  • Scope

All

Code Examples
Code Snippet
seg = system.mes.createMESObject('ProcessSegment')
 
#Creates a complex property with name 'Equipment'
proSeg = seg.createComplexProperty('Equipment', 'Vinegar Tank1')
 
#Changes the name 'Vinegar Tank1' into 'Vinegar Tank2'
renameProp = seg.renameComplexProperty('Equipment', 'Vinegar Tank1', 'Vinegar Tank2')
Description

Rename an existing custom property.

Syntax

renameCustomProperty(propertyPath, newName)


  • Parameters

String propertyPath - The name or property path of the existing custom property to rename.

String newName - New custom property name.

  • Returns

Nothing

  • Scope

All

Code Examples
Code Snippet
#Load an MES object
obj = system.mes.loadMESObject('Box', 'MaterialDef')
 
#Add a custom property named Type
obj.addCustomProperty('Type', 'String')
 
#Remember to save the MES object
#system.mes.saveMESObject(obj)
 
#Print it to see the name of the new custom property
print obj.getCustomPropertiesFull()
 
#Rename the custom property from Type to Kind
obj.renameCustomProperty('Type', 'Kind')
 
#Print it to see the new custom property name
print obj.getCustomPropertiesFull()

#Remember to save the MES object
system.mes.saveMESObject(obj)

Output
{u'Type': [u'String', u'', u'', u'', False, False]}
{u'Kind': [u'String', u'', u'', u'', False, False]}
Description

Set the description of the custom property by name or property path.

Syntax

setCustomPropertyDescription(propertyPath, description)


  • Parameters

String propertyPath - The name or property path of the custom property to get the description for.

String description - The custom property description.

  • Returns

Nothing

  • Scope

All

Code Examples
Code Snippet
#Load an MES object
obj = system.mes.loadMESObject('Box', 'MaterialDef')
 
#Set a new description for Kind
obj.setCustomPropertyDescription('Kind', 'Class of Box')
 
#Prints the current description of the custom property.
print obj.getCustomPropertyDescription('Kind')
Output
Class of Box
Description

Set the enabled state of a custom property. If set to True then custom property is available. If False, the custom property will not appear in component, be used during production or is not accessible in script.

Syntax

setCustomPropertyEnabled(propertyPath, enable)


  • Parameters

String propertyPath - The name or property path of the custom property to set the enabled state.

boolean enable - The enabled state to set the custom property to.

  • Returns

Nothing

  • Scope

All

Code Examples
Code Snippet
#Load an MES object
obj = system.mes.loadMESObject('Box', 'MaterialDef')
 
#Add a custom property
obj.addCustomProperty('Kind', 'String')
 
#Print the current enabled state
print obj.getCustomPropertyEnabled('Kind')

#Disable the custom property named Kind
obj.setCustomPropertyEnabled('Kind', False)

#Print the current enabled state
print obj.getCustomPropertyEnabled('Kind')
Output
True
False
Description

Set the units of the custom property.

Syntax

setCustomPropertyUnits(propertyPath, units)


  • Parameters

String propertyPath - The name or property path of the custom property to get the description for.

String units - The units of the new custom property.

  • Returns

Nothing

  • Scope

All

Code Examples
Code Snippet
#Load MES object
obj = system.mes.loadMESObject('Box', 'MaterialDef')
obj.setCustomPropertyUnits('Kind.Class of Box','lbs')
print obj.getCustomPropertyUnits('Kind.Class of Box')
Output
lbs
Description

This method can be used to set custom properties values or create custom properties of an MES object. The format of the customProperties parameter determines if just custom property values will be assigned or custom properties will be created and values assigned.

Because custom properties can be nested, the path of the custom property is used. 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"

Python dictionary

To just set the custom property values, use a Python dictionary for the customProperties parameter that contains name value pairs.

To create custom properties, use a Python dictionary for the customProperties parameter that contains name definition pairs. The custom property definition is a Python list that contains the settings. The order of the setting must be data type, value, description, units, production visible and required. Optionally, the production visible and required can be left out. If they are left out the default values of production visible = true and required = false will be used.

Syntax

setCustomPropertyValues(customProperties)

  • Parameters

PyDictionary customProperties - A Python dictionary containing custom property path (name) definition pairs.

  • Returns

Nothing

  • Scope

All

Code Examples
Code Snippet
#Load a material lot MES object
obj = system.mes.loadMESObject('0000000031', 'MaterialLot')
 
#Build the definition of the custom properties to add
current_dataType = 'Float8'
current = 3.2
current_desc = 'Test results - current'
current_units = 'Amps'
 
volts_dataType = 'Float8'
volts= 12.0
volts_desc = 'Test results - current'
volts_units = 'Volts'
lotCP = {'Amps' : [current_dataType , current, current_desc , current_units], 'Volts': [volts_dataType , volts, volts_desc, volts_units]}
print lotCP
 
#Add the custom properties to the material lot MES object
obj.setCustomPropertyValues(lotCP)
 
#Remember to save the MES object
system.mes.saveMESObject(obj)
Output
{'Amps': ['Float8', 3.2, 'Test results - current', 'Amps'], 'Volts': ['Float8', 12.0, 'Test results - volts', 'Volts']}
Code Snippet
#Copy custom properties from one MES object to another
#Load a material lot MES object to copy custom properties values from
obj1 = system.mes.loadMESObject('0000000031', 'MaterialLot')
 
#Read the custom properties
cp = obj1.getCustomPropertiesFull()
print cp
 
#Load a material lot MES object to copy custom properties to
obj2 = system.mes.loadMESObject('0000000030', 'MaterialLot')
 
#Add the custom properties
obj2.setCustomPropertyValues(cp)
 
#Change the values of the custom properties
current = 3.4
volts = 11.9
obj2.setPropertyValue('Amps', str(current))
obj2.setPropertyValue('Volts', str(volts))
 
#Remember to save the MES object
system.mes.saveMESObject(obj2)
Output
{u'Amps': [u'Float8', u'3.2', u'Test results - current', u'Amps', True, False], u'Volts': [u'Float8', u'12.0', u'Test results - volts', u'Volts', True, False]}{u'Amps': 3.4, u'Volts': 11.9}
Code Snippet
#Load a response segment MES object
segObj = system.mes.loadMESObject('8163976b-1333-4aa2-9f76-e622ef1b5174')
 
#Build the custom property definitions
weight = 25
length = 152
cp = {'Weight': ['Int4', weight], 'Length': ['Int4', length]}
 
#Add the custom properties to the Pencil material reference
segObj.setCustomPropertyValues('ResponseMaterial', 'Pencil', cp)  

print segObj.getCustomPropertyValues('ResponseMaterial', 'Pencil')
 
#Remember to save the MES object
system.mes.saveMESObject(segObj)
Output
{u'ResponseMaterial.Pencil.Weight': 25, u'ResponseMaterial.Pencil.Length': 152}
Description

Set the enabled state of the MES object. By using this script function with parameter of False will delete the MES object. After setting the enabled state to false, the object must be saved for the changes to take effect. At the time the disabled MES object is saved, the name is also modified. This allows for the name to be reused in the future without naming conflicts.

Syntax

setEnabled(enable)


  • Parameters

boolean enable - The new enabled state to make the MES object.

  • Returns

Nothing

  • Scope

All

Code Examples
Code Snippet
#Disable MES object example
#Load the MES object
obj = system.mes.loadMESObject('Box', 'MaterialDef')
print "Name of enabled MES object: %s" % obj.getName()
 
#Disable the MES object and save it
obj.setEnabled(False)
system.mes.saveMESObject(obj)
Output
Name of enabled MES object: Box
Code Snippet
#Enable MES object example
#Load the disabled MES object
obj = system.mes.loadDisabledMESObject('Box', 'MaterialDef')
print "Name of disabled MES object: %s" % obj.getName()
 
#Disable the MES object and save it
obj.setEnabled(True)
system.mes.saveMESObject(obj)
Output
Name of disabled MES object: Box{9320}
Description

Set a property value of an MES object by name or path. The property can be a core property, custom property or complex property of the MES object. In the case where custom properties are nested, a path is required to set the correct value.

The property value is passed as a String, but is converted to the correct data type for the property.

Syntax

setPropertyValue(propertyPath, value)


  • Parameters

String propertyPath - The name or path of the property being written to.

String value - The value to set the property to.

  • Returns

Nothing

  • Scope

All

Code Examples
Code Snippet
#Load a MES object
obj = system.mes.loadMESObject('Box', 'MaterialDef')
 
#Get and print the values before changing them
width = obj.getPropertyValue('Dimension.Width')
height = obj.getPropertyValue('Dimension.Height')
print "Values before setPropertyValue is called: Width = %d, Height = %d" % (width, height)
 
#Set the properties to new values
width = 14
height = 24
obj.setPropertyValue('Dimension.Width', str(width))
obj.setPropertyValue('Dimension.Height', str(height))
 
#Don't forget to save the MES object after changing property values
system.mes.saveMESObject(obj)

#Get and print the new values of the properties
width = obj.getPropertyValue('Dimension.Width')
height = obj.getPropertyValue('Dimension.Height')
print "Values after setPropertyValue is called: Width = %d, Height = %d" % (width, height)
Output
Values before setPropertyValue is called: Width = 10, Height = 12
Values after setPropertyValue is called: Width = 14, Height = 24
Code Snippet
#Rename MES object example
#Load a MES object
obj = system.mes.loadMESObject('Box', 'MaterialDef')
 
#Get and print the current name of the MES object
#Notice either method can be used to read the Name property
print obj.getName()
print obj.getPropertyValue('Name')
 
#Change the name of the MES object
obj.setPropertyValue('Name', 'Empty Box')

#Don't forget to save the MES object after changing property values
system.mes.saveMESObject(obj)



Object Events

Objects have events associated with them that allow for custom scripts to be added whenever the event occurs. Refer to MES Object Events for more information.

This object inherits the AbstractMESObject events...

Objects have events associated with them that allow for custom scripts to be added whenever the event occurs. Refer to Object Events for more information.

 

'New' Event

This event is run every time a new MES object is created. It can be used to add custom properties or to perform other tasks.

If no script is entered, then the default handler will be executed. To execute the default handler from within the script entered here, add a script line:

Code Snippet
#Add custom property when a new instance of a MaterialDef object is created.
obj = event.getMESObject()
obj.addCustomProperty('Width', 'Int4', 'Part Width', 'mm', True, False)
event.runDefaultHandler()

  • No labels