Skip to end of metadata
Go to start of metadata


Description

This object is created automatically whenever an Operations Segment or Request Segment is selected to begin or executed. It holds the actual production information that is used for traceability such as material consumed or created, personnel and equipment used. How the object is used is dependent upon how the process segment was defined in terms of what materials are consumed or created, where this operation can run and who can run it.

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


Object Creation

The following script functions can be used to create this type of object...

The following object methods can be used to create this type of object...

ISA-95 Object Model Inter-Relationships



Use

The following script functions can be used to return this type of object...

The following object methods can be used to return this type of object...


 Click here to see script 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)


Core Properties

These properties are accessible 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.

Name

ScriptingDescription
Begin.Date.TimeBeginDateTimeThe date and time the operation started. This setting is set when the operation is started, and it will be automatically set to the date and time of the Ignition server.
End Date TimeEndDateTimeThe date and time the operation ended. This setting is set when the operation is ended, and it will be automatically set to the date and time of the Ignition server.
Operation.Segment.Reference.TypeOperationSegmentRefTypeThis setting is automatically set and should not be changed. It will either be set to Operations Segment or Request Segment depending on how the operation was started. If the operation was scheduled prior to being run, then it will equal Request Segment, otherwise it will equal Operations Segment.
Operation.Segment.Reference.UUIDOperationSegmentRefUUIDThis setting is automatically set and should not be changed. It refers to the UUID of the Operations Segment or Request Segment, depending on how the operation was started. If the operation was scheduled prior to being run, then it will equal the UUID of the Request Segment it is based on, otherwise it will equal the UUID of the Operations Segment it is based on.
Operations.Response.Reference.UUIDOperationsResponseRefUUIDThis setting is automatically set and should not be changed. It refers to the UUID of the Operations Response this Response Segment is based on.
Running StateRunningState

This is set by the system and should be changed. The possible values and their meaning is as follows:

Options

Idle - Segment is not in use.

Running - Segment is currently being used.

Complete - Segment has completed and is used in the transition from RUNNING to IDLE.

Action Needed - Some rectifiable error has occured, immediate action should be taken.

Faulted - An unrecoverable error has occurred in the segment.


This object inherits the AbstractMESObject properties...

 Click here to expand...

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 its 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')



Complex Properties

A response segment uses complex property objects to hold information about the resources that were or are being used by the operation. These complex properties are automatically created whenever an operation is started or through scripting with the AbstractMESObject.createComplexProperty() function.

Property ObjectDescription

Response Material Property

Any material lots that were consumed or created during the operation can be accessed through this object..

Response Equipment Property

The equipment that was used during the operation can be accessed through this object..

Response Supplemental Equipment Property

Mobile equipment or die sets etc. used during this operation can be accessed through this object.

Response Personnel Property

Personnel associated with this operation can be accessed through this object.

Response Production Settings Property

Actual Production settings containing rate information used by the OEE module to calculate operational performance can be accessed through this object.
Response Trigger Segment Begin PropertyThis property holds information about what triggered the start of the operation.
Response Trigger Segment End PropertyThis property holds information about what caused the operation to end.


Object Functions

This object provides the following functions:

 abort()

IMPORTANT

Only use this function if you want to delete all history of this run happening.

Description

Abort the segment. This will do an abrupt abort of the segments . The system will view this run as if it never happened. The operation the segment is running under and all other segments running under the operation will remain active.

Notice

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.

For normal operations use the end segment, which will be accurately recorded in the database.

Syntax

abort()

  • Parameters

None

  • Returns

Nothing

  • Scope

All

 addSublot
Description

Usually, when production details are maintained for serialized items moving through production as groups, sublots are used. In cases where each item moves independently through production, then just material lots can be used for each serialized item.

Sublots may be added to a MaterialLot object that has been created by an active response segment. The different versions of the addSublot() function provide overloaded methods to do this. Sublots are represented by MaterialSublot objects which corresponds to the ISA-95 Material Sublot objects. MaterialSublot objects must be children of a MaterialLot object.

Notice

In order for material sublots to be added, the Enable Sublots setting of the segment material property must be set to true.

 addSublot(materialPropertyName, sublotName)
Syntax

addSublot(materialPropertyName, sublotName)

  • Parameters

String materialPropertyName - The name of the material property item as defined for the segment.

String sublotName - The name of the sublot which is usually the serial number of the item.

  • Returns

MESMaterialSublot - A new MESMaterialSublot object.

  • Scope

All

Code Examples
Code Snippet
#Create a new segment
seg = system.mes.createSegment('Load Assembly Tray', '[global]\\Dressings Inc\\California\\Assembly\\PS Assembly', False)
 
#Assign the material resources
seg.setMaterial('Housing', 'Housing', 'Assembly Tray 8')
 
#Begin the segment
seg.begin()
 
#Because the reference to the segment is different than the one at the Ignition gateway after begin was executed, refresh it.
seg = system.mes.getActiveSegment('[global]\\Dressings Inc\\California\\Assembly\\PS Assembly', 'Load Assembly Tray')
 
#Create new sublots
seg.addSublot('Housing', 'SN 1234')
seg.addSublot('Housing', 'SN 2345')

seg.update()
 addSublot(materialPropertyName, sublotName, customProperties)
Description

This version of the addSublot script function functions the same as the  addSublot(materialPropertyName, sublotName) script function above with the added support to assign new custom properties to the new material sublot at the same time.

Syntax

addSublot(materialPropertyName, sublotName, customProperties)

  • Parameters

String materialPropertyName - The name of the material property item as defined for the segment.

String sublotName - The name of the sublot which is usually the serial number of the item.

PyDictionary customProperties - A PyDictionary containing either name value pairs or complete custom property definitions. See Custom Properties for more information.

  • Returns

MESMaterialSublot - A new MESMaterialSublot object.

  • Scope

All

Code Examples
Code Snippet
#Create a new segment
seg = system.mes.createSegment('Load Assembly Tray', '[global]\\Dressings Inc\\California\\Assembly\\PS Assembly', False)
 
#Assign the material resources
seg.setMaterial('Housing', 'Housing', 'Assembly Tray 8')
 
#Begin the segment
seg.begin()
 
#Because the reference to the segment is different than the one at the Ignition gateway after begin was executed, refresh it.
seg = system.mes.getActiveSegment('[global]\\Dressings Inc\\California\\Assembly\\PS Assembly', 'Load Assembly Tray')
 
#Create new sublot
#Add custom properties
#Custom property definition format: {custom_property_name: [ignition_data_type, value, description, units, production_visible, required} 
cp = {'Width' : ['Int4', 1020, 'Width of housing', 'mm', True, True], 'Height' : ['Int4', 800, 'Height of housing', 'mm', True, True]}
seg.addSublot('Housing', 'SN 1234', cp)
 
#Create second sublot with different custom property values
cp = {'Width' : ['Int4', 1025, 'Width of housing', 'mm', True, True], 'Height' : ['Int4', 790, 'Height of housing', 'mm', True, True]}
seg.addSublot('Housing', 'SN 2345', cp)

seg.update()

 addSublots(materialPropertyName, countToAdd)
Description

These script functions are used to add multiple sublots to active segments and the different versions provide various methods to do so. Sublots are represented by MESMaterialSublot objects which corresponds to the ISA-95 Material Sublot objects. MESMaterialSublot objects must be children of a MESMaterialLot object, event though the lot information may not be needed. Usually, when production details are maintained for serialized items moving through production as groups, sublots are used. In cases where each item moves independently through production, then just material lots can be used for each serialized item.

Notice

In order for material sublots to be added, the Enable Sublots setting of the segment material property must be set to true.

Description

This version of the addSublots script function is used to create a specified quantity of new material sublots. For each sublot object created, the CreateSerialNumber event of the MaterialSublot object will be executed and a serial number will automatically be assigned. This serial number, which is the name of the MaterialSublot object, can be changed prior updating the segment.

Syntax

addSublots(materialPropertyName, countToAdd)

  • Parameters

String materialPropertyName - The name of the material property item as defined for the segment.

Integer countToAdd - The number of sub lots to add.

  • Returns

List<MESMaterialSublot> - A list of new MESMaterialSublot objects. The size of the list will match the countToAdd parameter.

  • Scope

All

Code Examples
Code Snippet
#Create a new segment
seg = system.mes.createSegment('Load Assembly Tray', '[global]\\Dressings Inc\\California\\Assembly\\PS Assembly', False)
 
#Assign the material resources
seg.setMaterial('Housing', 'Housing', 'Assembly Tray 8')
 
#Begin the segment
seg.begin()
 
#Because the reference to the segment is different than the one at the Ignition gateway after begin was executed, refresh it.
seg = system.mes.getActiveSegment('[global]\\Dressings Inc\\California\\Assembly\\PS Assembly', 'Load Assembly Tray')
 
#Create new sublots
sublotList = seg.addSublots('Housing', 5)
for index in range(sublotList.size()):
 
	#Print the automatically generated serial number
	print sublotList.get(index).getName()

seg.update()
 begin()
Description

Begin the segment (record the including material, equipment, personnel, for the current process).

Syntax

begin()

  • Parameters

None

  • Returns

MESResponseSegment seg - Returns the updated segment object.

  • Scope

All

Code Examples
Code Snippet
eqPath = '[global]\\Dressings Inc\\California\\Raw Materials\\Unload Station 1'
 
##Create a new Response Segment at the specified equipment path.
##Note that this creates an Operations Response in the background.
seg = system.mes.createSegment(eqPath, 'Inspect Steel', 0)
 
#Assign material resources....
#Assign personnel resources....
#Assign supplemental resources....
#Assign custom properties....
 
##Begin segment
seg = seg.begin()
 begin(bypassInventoryCheck)
Description

Begin the segment. Provides option to skip checking materials before beginning the segment.

Syntax

begin(bypassInventoryCheck)

  • Parameters

boolean bypassInventoryCheck - Set to True if you want to skip checking of materials before the begin segment and False otherwise.

  • Returns

MESResponseSegment seg - Returns the updated segment.

  • Scope

All

 begin(date)
Description

Begin the segment at a specified date.

Syntax

begin(date)

  • Parameters

Date date - The date to begin the segment.

  • Returns

MESResponseSegment seg - Returns the updated segment object.

  • Scope

All

Code Examples
Code Snippet
eqPath = '[global]\\Your Enterprise\\New Site\\Receiving\\Milk Unloading'
matLocation = '[global]\\Your Enterprise\\New Site\\Receiving\\Receiving Tanks\\Whole Milk Tank 2'
seg = system.mes.createSegment('Test Date Operation', eqPath, True)
seg.setMaterial('Material In', 'Whole Milk', matLocation, 'Lot 23', 200.0)

## ... must set any other required segment properties before begin is called ...
##  Begins the segment and sets all properties to the given date and time instead of the current date time
from java.util import Calendar
cal = Calendar.getInstance()
## set date to Dec 4, 2016 1:35pm 
## Jan=0...Dec=11
cal.set(2016, 11, 4, 13, 35, 00)
dateTime = cal.getTime()

seg = seg.begin(dateTime)
 begin(date, bypassInventoryCheck)
Description

Begin the segment at a specified date. Provides option to skip checking of materials before beginning the segment.

Syntax

begin(date, bypassInventoryCheck)

  • Parameters

Date date - The date to begin operation.

boolean bypassInventoryCheck - Set to True if you want to skip checking of materials before the begin operation and False otherwise.

  • Returns

MESResponseSegment seg - Returns the updated segment.

  • Scope

All

 changeLot(lotPropertyName)
Description

Changes the lot to a new lot property.

Syntax

changeLot(lotPropertyName)


  • Parameters

String lotPropertyName - Name of the lot property to be changed.

  • Returns

MESResponseMaterialProperty newLotProp - The new lot property.

  • Scope

All

Code Examples
Code Snippet
 
Output
 
 end()
Description

End an active segment.

Syntax

end()

  • Parameters

None

  • Returns

MESResponseSegment seg - The ended segment object is returned.

  • 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=seg.end()
 endWait()
Description

End an active segment. Will not return control to the calling script until the segment has ended (if segment doesn't end within 15 seconds, an exception will be returned).

Syntax

endWait()

  • Parameters

None

  • Returns

MESResponseSegment seg - The ended segment object is returned.

  • 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. Will not return control to the calling script until the segment has ended.
seg=seg.endWait()
 end(date)
Description

End an active segment at a specified date.

Syntax

end(date)

  • Parameters

Date date - The date to end the segment.

  • Returns

MESResponseSegment seg - The ended segment object is returned.

  • 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)
 
#Sets all properties to the given date and time instead of the current date and time 
from java.util import Calendar
cal = Calendar.getInstance()
# set date to Dec 4, 2016 1:35pm
cal.set(2016, 11, 4, 13, 35, 05)## Jan=0...Dec=11
dateTime = cal.getTime()

#End the segment
seg = seg.end(dateTime)
 endWait(date)
Description

End an active segment at a specified date. Will not return control to the calling script until the segment has ended (if segment doesn't end within 15 seconds, an exception will be returned).

Syntax

endWait(date)

  • Parameters

Date date - The date to end the segment.

  • Returns

MESResponseSegment seg - The ended segment object is returned.

  • 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)
 
#Sets all properties to the given date and time instead of the current date and time 
from java.util import Calendar
cal = Calendar.getInstance()
# set date to Dec 4, 2016 1:35pm
cal.set(2016, 11, 4, 13, 35, 00)## Jan=0...Dec=11
dateTime = cal.getTime()

#End the segment. Will not return control to the calling script until the segment has ended.
seg = seg.endWait(dateTime)
 execute()
Description

Execute a segment. For situations where a production task or event is happening at once, with no distinct begin and end times, the execute script function will begin and end a segment in one step. After the execute script function is called on a segment, the segment will be left in the inactive state and no further updates can be made.

Syntax

execute()

  • Parameters

None

  • Returns

Nothing

  • Scope

All

 execute(date)
Description

Execute a segment at a specific time in the past. For situations where a production task or event happens in the past and needs to be recorded as one transaction without distinct begin and end times, this version of the execute script function will begin and end a segment in one step. After the execute script function is called on a segment, the segment will be left in the inactive state and no further updates may be made.

Syntax

execute(date)

  • Parameters

Date date - The date (in the past) to apply to the response segment as the timestamp for execution.

  • Returns

Nothing

  • Scope

All

 getAvailableMaterialLots(materialPropertyName, equipmentPathFilter)
Description

Gets the material lots which are currently available.

Syntax

getAvailableMaterialLots(materialPropertyName, equipmentPathFilter)


  • Parameters

String materialPropertyName - The name of the material property item as defined for the segment.

String equipmentPathFilter - Equipment path to filter results.

  • Returns

MESList<MESObjectLink> - A list of MESObjectLink containing lot number or lot sequence number of available material lots.

  • Scope

All


Code Examples
Code Snippet
eqPath = '[global]\\Nuts Unlimited\\Folsom\\Receiving\\Nut Unloading'
   
#Create an operation
oper = system.mes.createOperation('Unload Nuts', eqPath)
oper.begin()

#Create a segment   
seg = oper.createSegment('Unload Nuts')
seg.setMaterial('Received Nuts', 'Bulk Almonds', '[global]\\Nuts Unlimited\\Folsom\\Receiving\\Nut Storage Silos\\Almond Silo')

#Gets the available material lots
availLot = seg.getAvailableMaterialLots('Received Nuts', '[global]\\Nuts Unlimited\\Folsom\\Receiving\\Nut Storage Silos\\Almond Silo')

#Returns the lot number of the available material lot
for ndx in range(availLot.size()):
    
        availLotNumber = availLot.get(ndx)

print availLotNumber
Output
OperationsResponse (3b7d2e8d-ca90-4e8f-9682-c364fd2ec991, Unload Nuts, 0 parents, 0 children, 0 custom properties, 1 complex properties)
A 2234
 getEquipmentLink()
Description

Return the link to the equipment MES object associated with the segment. This will be the same equipment that is associated with the operation that the segment is running under.

Syntax

getEquipmentLink()

  • Parameters

None

  • Returns

A MES Object Link object containing details of the equipment that is associated with the 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)

#Get the MES object link of where the operation is running 
eqLink = seg.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
 getEquipmentProperty()
Description

Return the complex property of the equipment MES object associated with the segment. This will be the same equipment that is associated with the operation that the segment is running under.

Syntax

getEquipmentProperty()


  • Parameters

 None

  • Returns

 The MESEquipmentProperty representing the equipment.

  • Scope

All

 getLot(lotPropertyName)
Description

Returns the response material object corresponding to the given name parameter.

Syntax

getLot(lotPropertyName)

  • Parameters

String lotPropertyName - The property associated with the lot to return for.

  • Returns

MESResponseMaterialProperty - The name of the response material object corresponding to the given lotPropertyName parameter.

  • Scope

All

Code Examples
Code Snippet
path = '[global]\\Enterprise\\Site 1\\Area 1\\Line 1'
seg = system.mes.getActiveSegment(path, 'Test Segment')
lot = seg.getLot('Material Out')
print lot.getQuantity()
Result

ResponseSegment (62772673-fddc-4b01-9437-23a8ff1248a8, Test Segment, 0 parents, 0 children, 0 custom properties, 7 complex properties)
50.0

 getMaterialLot(materialPropertyName)
Description

Return the material lot MES object associated the specified material property of a segment. Material lots is represented by MESMaterialLot objects and correspond to ISA-95 Material Lot objects. MESMaterialLot objects are automatically created by the Sepasoft MES system when segments are began, updated, executed or ended. In cases where additional information is attached to the material lot, this script function provides an easy method of getting the actual MESMaterialLot object.

Syntax

getMaterialLot(materialPropertyName)

  • Parameters

String materialPropertyName - The name of the material property item as defined for the segment.

  • Returns

A MESMaterialLot object that is associated with the specified material property for segment.

  • Scope

All

Code Examples
Code Snippet
"""
Execute segment and save the response segment that it returns
Retrieve the created lot from the response segment 
Set lot status to active
Save changes to lot 
"""
response = segment.execute()
	
material_lot = response.getMaterialLot('name_of_material_property_item')
material_lot.setPropertyValue('LotStatus','Active')
system.mes.saveMESObject(material_lot)
 getPerson(personnelPropertyName)
Description

Return the person MES object associated with the specified personnel property of a segment. People is represented by MESPerson objects and correspond to ISA-95 Person objects. The MESResponsePerson object isolates changes made to a MESPerson object and production history. In cases where additional information is attached the the person, this script function provides an easy method of getting the actual MESResponsePerson object.

Syntax

getPerson(personnelPropertyName)

  • Parameters

String personnelPropertyName - The name of the personnel property item as defined for the segment.

  • Returns

A MESResponsePerson object that is associated with the specified personnel property for 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)
 
#Get the material lot object associated with the Housing material property of the segment
person = seg.getPerson('Inspector')
 
#Add custom properties to the person object
#Custom property definition format: {custom_property_name: [ignition_data_type, value, description, units, production_visible, required} 
cp = {'Backup' : True}
person.setCustomPropertyValues(cp)
 
#Remember to save the material lot object
system.mes.saveMESObject(person)
 getProductionSettingsProperty(equipmentPath)
Description

Returns the production settings property.

Syntax

getProductionSettingsProperty(equipmentPath)


  • Parameters

String equipmentPath - The path of equipment to return the production settings for.

  • Returns

 MESResponseProductionSettingsProperty productionSettings - The production settings corresponding to the specified equipment path.

  • Scope

All

Code Examples
Code Snippet
eqPath = '[global]\\Enterprise\\Site\\Area\\Line 4'
operSeg = system.mes.loadMESObject('Basil-Enterprise:Site:Area:Line 4', 'OperationsSegment')

rspSeg = system.mes.createSegment(operSeg, eqPath)
print type(rspSeg)
prop = rspSeg.getProductionSettingsProperty(eqPath)
print prop.getOEERate()

 getSubLot(materialPropertyName, sublotName)
Description

Get an existing sublot that is associated with a segment. Sublots are represented by MESMaterialSublot objects and correspond to the ISA-95 Material Sublot objects.

Syntax

getSublot(materialPropertyName, sublotName)

  • Parameters

String materialPropertyName - The name of the material property item as defined for the segment.

String sublotName - The name of an existing sublot to return.

  • Returns

MESMaterialSublot - The MESMaterialSublot object.

  • 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)
 
#Get the sublot with serial number SN1823
sublot = seg.getSublot('Housing', 'SN1823')
 
#Do something with the sublot
sublot.setPropertyValue('Width', '1002')
 
#Don't forget to save the changes to the sublot
system.mes.saveMESObject(sublot)
 getSupplementalEquipment(supplementalEquipmentPropertyName)
Description

Return the supplemental equipment MES object associated with the specified supplemental equipment property of a segment. Supplemental equipment is represented by MESEquipment objects and correspond to ISA-95 Equipment objects. The MESResponseEquipment object isolates changes made to a MESEquipment object and production history. In cases where additional information is attached to the supplemental, this script function provides an easy method of getting the actual MESResponseEquipment object.

Syntax

getSupplementalEquipment(supplementalEquipmentPropertyName)

  • Parameters

String supplementalEquipmentPropertyName - The name of the supplemental equipment property item as defined for the segment.

  • Returns

MESResponseEquipment - A MESResponseEquipment object that is associated with the specified supplemental equipment property for 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)
 
#Get the supplemental equipment object with property name "Die" as configured for the segment
supEq = seg.getSupplementalEquipment('Die')
 
#Add custom properties to the supplemental equipment object
#Custom property definition format: {custom_property_name: [ignition_data_type, value, description, units, production_visible, required} 
cp = {'Wear' : 12}
supEq.setCustomPropertyValues(cp)
 
#Remember to save the material lot object
system.mes.saveMESObject(supEq)
 removeSublot(materialPropertyName, sublotName)
Description

Remove an existing sublot that is associated with a segment. Sublots are represented by MESMaterialSublot objects and correspond to the ISA-95 Material Sublot objects.

Syntax

removeSublot(materialPropertyName, sublotName)

  • Parameters

String materialPropertyName - The name of the material property item as defined for the segment.

String sublotName - The name of an existing sublot to remove.

  • Returns

The MESMaterialSublot object that was removed.

  • 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)
 
#Remove the sublot with serial number SN1823
seg.removeSublot('Housing', 'SN1823')
 renameSublot(materialPropertyName, existingSublotName, newSublotName)
Description

Rename an existing sublot that is associated with a segment. Sublots are represented by MESMaterialSublot objects and correspond to the ISA-95 Material Sublot objects.

Syntax

renameSublot(materialPropertyName, existingSublotName, newSublotName)

  • Parameters

String materialPropertyName - The name of the material property item as defined for the segment.

String existingSublotName - The existing name of the sublot, which is usually the serial number of the item, to rename.

String newSublotName - The new name for the sublot.

  • Returns

The MESMaterialSublot object that was renamed.

  • 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)
 
#Change the sublot serial number from SN9823 to SN1823
seg.renameSublot('Housing', 'SN9823', 'SN1823')

 setMaterial(materialPropertyName, quantity)
Description

These script functions are used to set the material resources for a segment. There are different versions depending on if a lot is being referenced, a new lot is being created, etc. These script functions can be used before or after the begin script function is called on the segment. If they are used for an active segment, then they will update the material resources information. This is common when changing to a different lot of material or other material related information during a production run.

Existing Lot

 setMaterial(materialPropertyName, quantity)
Description

This version of the setMaterial script function is used for setting just the quantity for a material reference belonging to a segment. If the lot or material have already been assigned, then this provides a method to update the quantity.

Syntax

setMaterial(materialPropertyName, quantity)

  • Parameters

String materialPropertyName - The name of the material property item as defined for the segment.

Double quantity - The quantity of material.

  • Returns

Nothing

  • 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....
seg.setMaterial('In Steel Type', 1045)
  
#Begin segment
seg.begin()
 setMaterial(materialPropertyName, lotNumber)
Description

This version of the setMaterial script function is used for setting the lot number for a material reference belonging to a segment. The material lot must already exist for the lot number at the equipment location as defined in the material reference. If the lot has already been assigned, then this provides a method to change the lot.

Syntax

setMaterial(materialPropertyName, lotNumber)

  • Parameters

String materialPropertyName - The name of the material property item as defined for the segment.

String lotNumber - The lot number that must match the name of an existing MESMaterialLot object.

  • Returns

Nothing

  • 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....
seg.setMaterial('In Steel Type', 'SL1285')
  
#Begin segment
seg.begin()
 setMaterial(materialPropertyName, lotNumber, quantity)
Description

This version of the setMaterial script function is used for setting the lot number and quantity for a material reference belonging to a segment. The material lot must already exist for the lot number at the equipment location as defined in the material reference. If the lot has already been assigned, then this provides a method to change the lot and update the quantity at the same time.

Syntax

setMaterial(materialPropertyName, lotNumber, quantity)

  • Parameters

String materialPropertyName - The name of the material property item as defined for the segment.

String lotNumber - The lot number that must match the name of an existing MESMaterialLot object.

Double quantity - The quantity of material.

  • Returns

Nothing

  • 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....
seg.setMaterial('In Steel Type', 'SL1285', 1000.0)
  
#Begin segment
seg.begin()
 setMaterial(materialPropertyName, lotNumber, lotSequenceNumber, quantity)
Description

This version of the setMaterial script function is used for setting the lot number with a lot sequence number and quantity for a material reference belonging to a segment. The material lot and lot sequence number combination must already exist for the lot number at the equipment location as defined in the material reference. If the lot has already been assigned, then this provides a method to change the lot and update the quantity at the same time.

Material lots are represented by MESMaterialLot objects which corresponds to the ISA-95 Material Lot objects. Because more that one MESMaterialLot object can existing for a given lot number, each one is assigned a unique lot sequence number making it unique. Normally this is not required provided that only one lot number (MESMaterialLot object) exists at an equipment locations. If more than one MESMaterialLot object with the same lot number exists at an equipment location, then the lot sequence number can be used to specify which one to use. If more than one do exist and the lot sequence number is not specified, then the one used is determined by the Lot Handling Mode the equipment location is configured for.

Syntax

setMaterial(materialPropertyName, lotNumber, lotSequenceNumber, quantity)

  • Parameters

String materialPropertyName - The name of the material property item as defined for the segment.

String lotNumber - The lot number that must match the name of an existing MESMaterialLot object.

Integer lotSequenceNumber - The lot sequence number of the desired existing MESMaterialLot object. If it is less than zero, then the lot holding the maximum value is returned and if the same lot number is used for multiple segments, each lot with the same lot number will be assigned a different lot sequence number. It could be obtained by using getLotSequence() script function. For more details see MES Lot Quantity Summary Item.

Double quantity - The quantity of material.

  • Returns

Nothing

  • 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')
 
#Get the lot sequence number.
equipLotSummary = system.mes.getLotInventoryByEquipment('[global]\\My Enterprise\\California\\Storage\\Vinegar Tanks\\Vinegar Tank 1')
for lotSummary in equipLotSummary:
    lotSeq = lotSummary.getLotSequence()
   
#Assign material resources....
seg.setMaterial('In Steel Type', 'SL1285', lotSeq, 1000.0)
   
#Begin segment
seg.begin()
 setMaterial(materialPropertyName, lotNumber, lotSequenceNumber, quantity, customProperties)
Description

This version of the setMaterial script function functions the same as the setMaterial(materialPropertyName, lotNumber, lotSequenceNumber, quantity) script function above with the added support to assign custom properties for the material resource reference at the same time.

Syntax

setMaterial(materialPropertyName, lotNumber, lotSequenceNumber, quantity, customProperties)


  • Parameters

String materialPropertyName - The name of the material property item as defined for the segment.

String lotNumber - The lot number that must match the name of an existing MESMaterialLot object.

Integer lotSequenceNumber - The lot sequence number of the desired existing MESMaterialLot object. If it is less than zero, then the lot holding the maximum value is returned and if the same lot number is used for multiple segments, each lot with the same lot number will be assigned a different lot sequence number.  It could be obtained by using getLotSequence() script function. For more details see MES Lot Quantity Summary Item .

Double quantity - The quantity of material.

PyDictionary customProperties - A PyDictionary containing either name value pairs or complete custom property definitions. See Custom Properties for more information. 

  • Returns

Nothing

  • 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')
 
#Get the lot sequence number
equipLotSummary = system.mes.getLotInventoryByEquipment('[global]\\My Enterprise\\California\\Storage\\Vinegar Tanks\\Vinegar Tank 1')
for lotSummary in equipLotSummary:
    lotSeq = lotSummary.getLotSequence()
   
#Assign material resources....
#Assign values to existing custom properties
cp = {'Thickness' : 5.5}
seg.setMaterial('In Steel Type', 'SL1285', lotSeq, 1000.0, cp)
   
#Begin segment
seg.begin()
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')
 
#Get the lot sequence number
equipLotSummary = system.mes.getLotInventoryByEquipment('[global]\\My Enterprise\\California\\Storage\\Vinegar Tanks\\Vinegar Tank 1')
for lotSummary in equipLotSummary:
    lotSeq = lotSummary.getLotSequence()
   
#Assign material resources....
#Add custom properties
#Custom property definition format: {custom_property_name: [ignition_data_type, value, description, units, production_visible, required} 
cp = {'Thickness' : ['Float8', 5.5, 'Thickness of steel', '1/1000th', True, True]}
seg.setMaterial('In Steel Type', 'SL1285', lotSeq, 1000.0, cp)
   
#Begin segment
seg.begin()

Non-existent Lot

 setMaterial(materialPropertyName, materialName, equipmentPath, quantity)
Description

This version of the setMaterial script function is used for setting the material name and location equipment to use the material from, or place the material at for a material reference belonging to a segment. For cases when a material lot does already exist, this script function is used and allows for updating the quantity at the same time. With this version of the setMaterial script function, the lot number is automatically generated in the CreateLotNumber event of the MESMaterialLot object.

The material name must match the name of an existing MESMaterialDef object which corresponds to the ISA-95 Material Definition object. The equipment path must match a valid line, line cell, line cell group or storage unit defined in the production model. (If Supplemental Equipment is used for the lot location, use the Supplemental Equipment item's name rather than an equipment path.) See Custom Properties for more information.

Syntax

setMaterial(materialPropertyName, materialName, equipmentPath, quantity)


  • Parameters

String materialPropertyName - The name of the material property item as defined for the segment.

String materialName - The material name that must match an existing MESMaterialDef object.

String equipmentPath - The equipment path that must match the path to equipment defined in the production model. If Supplemental Equipment is used for the lot location, use the Supplemental Equipment item's name rather than the equipment path.

Double quantity - The quantity of material.

  • Returns

Nothing

  • 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('Unload Steel')
  
#Assign material resources....
seg.setMaterial('In Steel Type', 'Pre-inspected Hardened Steel', 'Inspection Staging', 1000.0)
  
#Begin segment
seg.execute()
 setMaterial(materialPropertyName, materialName, equipmentPath, quantity, customProperties)
Description

This version of the setMaterial script function functions the same as the setMaterial(materialPropertyName, materialName, equipmentPath, quantity) script function above with the added support to assign custom properties for the material resource reference at the same time.

Syntax

setMaterial(materialPropertyName, materialName, equipmentPath, quantity, customProperties)


  • Parameters

String materialPropertyName - The name of the material property item as defined for the segment.

String materialName - The material name that must match an existing MESMaterialDef object.

String equipmentPath - The equipment path that must match the path to equipment defined in the production model. If Supplemental Equipment is used for the lot location, use the Supplemental Equipment item's name rather than the equipment path.

Double quantity - The quantity of material.

PyDictionary customProperties - A PyDictionary containing either name value pairs or complete custom property definitions. See the custom properties for more information.

  • Returns

Nothing

  • 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('Unload Steel')
  
#Assign material resources....
#Assign values to existing custom properties
cp = {'Thickness' : 5.5}
seg.setMaterial('In Steel Type', 'Pre-inspected Hardened Steel', 'Inspection Staging', 1000.0, cp)
  
#Begin segment
seg.execute()
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('Unload Steel')
  
#Assign material resources....
#Assign values to existing custom properties
#Add custom properties
#Custom property definition format: {custom_property_name: [ignition_data_type, value, description, units, production_visible, required} 
cp = {'Thickness' : ['Float8', 5.5, 'Thickness of steel', '1/1000th', True, True]}
seg.setMaterial('In Steel Type', 'Pre-inspected Hardened Steel', 'Inspection Staging', 1000.0, cp)
  
#Begin segment
seg.execute()
 setMaterial(materialPropertyName, materialName, equipmentPath, manualLotNumber, quantity)
Description

This version of the setMaterial script function is used for setting the material name and location equipment to use the material from, or place the material at for a material reference belonging to a segment. For cases when a material lot doesn't already exist, this script function is used and allows for naming the new lot and updating the quantity at the same time. Instead of automatically generating a new lot number, the system with use the manual lot number provided in the manualLotNumber parameter.

The material name must match the name of an existing MESMaterialDef object which corresponds to the ISA-95 Material Definition object. The equipment path must match a valid line, line cell, line cell group or storage unit defined in the production model. See the custom properties for more information.

Syntax

setMaterial(materialPropertyName, materialName, equipmentPath, manualLotNumber, quantity)

  • Parameters

String materialPropertyName - The name of the material property item as defined for the segment.

String materialName - The material name that must match an existing MESMaterialDef object.

String equipmentPath - The equipment path that must match the path to equipment defined in the production model. If Supplemental Equipment is used for the lot location, use the Supplemental Equipment item's name rather than the equipment path.

String manualLotNumber - The lot number to name to the new MESMaterialLot object

Double quantity - The quantity of material.

  • Returns

Nothing

  • 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('Unload Steel')
  
#Assign material resources....
seg.setMaterial('In Steel Type', 'Pre-inspected Hardened Steel', 'Inspection Staging', 'SL8923', 1000.0)
  
#Begin segment
seg.execute()
 setMaterial(materialPropertyName, materialName, equipmentPath, manualLotNumber, quantity, customProperties)
Description

This version of the setMaterial script function functions the same as the setMaterial(materialPropertyName, materialName, equipmentPath, manualLotNumber, quantity) script function above with the added support to assign custom properties for the material resource reference at the same time.

Syntax

setMaterial(materialPropertyName, materialName, equipmentPath, manualLotNumber, quantity, customProperties)


  • Parameters

String materialPropertyName - The name of the material property item as defined for the segment.

String materialName - The material name that must match an existing MESMaterialDef object.

String equipmentPath - The equipment path that must match the path to equipment defined in the production model. If Supplemental Equipment is used for the lot location, use the Supplemental Equipment item's name rather than the equipment path.

String manualLotNumber - The lot number to name to the new MESMaterialLot object

Double quantity - The quantity of material.

PyDictionary customProperties - A PyDictionary containing either name value pairs or complete custom property definitionsSee the custom properties for more information.

  • Returns

Nothing

  • 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('Unload Steel')
  
#Assign material resources....
#Assign values to existing custom properties
cp = {'Thickness' : 5.5}
seg.setMaterial('In Steel Type', 'Pre-inspected Hardened Steel', 'Inspection Staging', 'SL8923', 1000.0, cp)
  
#Begin segment
seg.execute()
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('Unload Steel')
  
#Assign material resources....
#Add custom properties
#Custom property definition format: {custom_property_name: [ignition_data_type, value, description, units, production_visible, required} 
cp = {'Thickness' : ['Float8', 5.5, 'Thickness of steel', '1/1000th', True, True]}
seg.setMaterial('In Steel Type', 'Pre-inspected Hardened Steel', 'Inspection Staging', 'SL8923', 1000.0, cp)
  
#Begin segment
seg.execute()

 setMaterialByPassChecks(baseName, lotNumber)

Overview

Description

Sets the lot for the segment's material reference bypassing inventory checks. 

Click here to read the Knowledge base article for bypassing inventory checks.

Info

The Lot Availability Status must be set to "Available" which means this script function is for an active segment object.

Method Options

Syntax

setMaterialByPassChecks(baseName, lotNumber)


  • Parameters

String baseName - The base name for the complex property.

String lotNumber - The lot number that must match the name of an existing MESMaterialLot object.

  • Returns

 Nothing

  • Scope

All

Syntax

setMaterialBypassChecks(baseName, lotSequenceNumber, lotNumber)


  • Parameters

String baseName - The base name for the complex property.

String lotSequenceNumber - The lot sequence number corresponding to the material lot object. If it is less than zero, then the lot holding the maximum value is returned and if the same lot number is used for multiple segments, each lot with the same lot number will be assigned a different lot sequence number.

String lotNumber - The lot number that must match the name of an existing MESMaterialLot object.

  • Returns

 Nothing

  • Scope

All

Syntax

setMaterialBypassChecks(baseName, lotNumber, quantity)

  • Parameters

String baseName - The base name for the complex property.

String lotNumber - The lot number that must match the name of an existing MESMaterialLot object.

Double quantity - The quantity of material.

  • Returns

 Nothing

  • Scope

All

Syntax

setMaterialBypassChecks(baseName, lotNumber, lotSequenceNumber, quantity)


  • Parameters

String baseName - The base name for the complex property.

String lotNumber - The lot number that must match the name of an existing MESMaterialLot object.

String lotSequenceNumber - The lot sequence number corresponding to the material lot object. If it is less than zero, then the lot holding the maximum value is returned and if the same lot number is used for multiple segments, each lot with the same lot number will be assigned a different lot sequence number.

Double quantity - The quantity of material.

  • Returns

 Nothing

  • Scope

All

Syntax

setMaterialBypassChecks(baseName, lotNumber, lotSequenceNumber, quantity, customProperties)


  • Parameters

String baseName - The base name for the complex property.

String lotNumber - The lot number that must match the name of an existing MESMaterialLot object.

String lotSequenceNumber - The lot sequence number corresponding to the material lot object. If it is less than zero, then the lot holding the maximum value is returned and if the same lot number is used for multiple segments, each lot with the same lot number will be assigned a different lot sequence number.

Double quantity - The quantity of material.

PyDictionary customProperties - A PyDictionary containing either name value pairs or complete custom property definitions. See Custom Properties for more information. 

  • Returns

 Nothing

  • Scope

All

 setPersonnel(personnelPropertyName, personName)
Description

These script functions are used to set the personnel resources for a segment. There are different versions detailed below. These script functions can be used before or after begin script function is called on the segment. If they are used for an active segment, then they will update the personnel resources information. This is common when changing to different personnel during a production run.

Syntax

setPersonnel(personnelPropertyName, personName)

  • Parameters

String personnelPropertyName - The name of the personnel property item as defined for the segment.

String personName - The name of the person. The name of the person is derived from the last and first name from the Ignition user list.

  • Returns

Nothing

  • 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 peronnel resources....
seg.setPersonnel('Inspector', 'Smith, Sue')
 
#Begin segment
seg.begin()
 setSupplementalEquipment(supplementalEquipmentPropertyName, equipmentName, customProperties)
Description

This version of the setSupplementalEquipment script function functions the same as the setSupplementalEquipment(supplementalEquipmentPropertyName, equipmentName) script function above with the added support to assign custom properties for the supplemental equipment resource reference at the same time.

Syntax

setSupplementalEquipment(supplementalEquipmentPropertyName, equipmentName, customProperties)

  • Parameters

String supplementalEquipmentPropertyName - The name of the supplemental equipment property item as defined for the segment.

String equipmentName - The name of the supplemental equipment.

PyDictionary customProperties - A PyDictionary containing either name value pairs or complete custom property definitions. See Custom Properties for more information.

  • Returns

Nothing

  • Scope

All

Code Examples
Code Snippet
eqPath = '[global]\\ABC Inc\\California\\Pressing\\Press 1'
 
#Create and begin a new operation at the specified equipment path
oper = system.mes.createOperation('Press Door', eqPath)
oper.begin()
 
#Create new segment
seg = oper.createSegment('Press Door')
 
#Assign supplemental equipment resources....
#Add custom properties
#Custom property definition format: {custom_property_name: [ignition_data_type, value, description, units, production_visible, required}  
cp = {'Wear mm' : ['Int4', 10, 'Amount of wear', 'mm', True, True]}
seg.setSupplementalEquipment('Press Die', 'LH Door Die 129', cp)
 
#Begin segment
seg.begin()
Code Snippet
eqPath = '[global]\\ABC Inc\\California\\Pressing\\Press 1'
 
#Create and begin a new operation at the specified equipment path
oper = system.mes.createOperation('Press Door', eqPath)
oper.begin()
 
#Create new segment
seg = oper.createSegment('Press Door')
 
#Assign supplemental equipment resources....
#Set existing custom properties
cp = {'Wear mm' : 11}
seg.setSupplementalEquipment('Press Die', 'LH Door Die 129', cp)
 
#Begin segment
seg.begin()
 update()
Description

Update an active segment. If material, personnel, supplemental equipment resources or custom properties change during a production task, then the update script function is used to commit the changes. For resources, these changes are time stamped and save for the segment. This allows for an accurate history of multiple lots, personnel and supplemental equipment that were used during a production task.

If after updating the MES Object you wish to view the changes or make further changes with the .update() function, you should load the object again to ensure that you get the updated object.

Syntax

update()

  • Parameters

None

  • Returns

MESResponseSegment seg - Returns the updated 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)
 
#Make changes to material resources....
#Make changes personnel resources....
#Make changes supplemental resources....

#Commit the changes
seg = seg.update()
 

This object inherits the AbstractMESObject functions...

 Click here to expand...

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. ? ! # % ^ * ~ [ ] { } + = ` \/ " $ | ,

Artifact Object Functions

Artifact Names

Artifact Names are always stored using lower case letters, even if upper-case letters are supplied by the user.

 createArtifact(artifactName, serializableValue)
Description

Create a new MES Artifact property named by artifactName on an existing MES Object, with a provided primitive, Pythonic or Java serializable object as the serializableValue (including strings, integer/real/float/double numbers and Boolean). The new MES Artifact is 'versioned' so each save creates a new version of the artifact (one additional row in the DB per version saved).

Files are also 'serializable' (Artifacts serialize the file as an array of bytes. Add "from java.io import File" to script and use File (fileName) where fileName contains the path to the file, with filename and extension. Refer to the Java Class File page).

Syntax

createArtifact(artifactName, serializableValue)


  • Parameters

String artifactName - the name of the 'versioned' MES Artifact to create. Name will be stored using lower-case letters.

Serializable serializableValue - Any primitive, Pythonic or Java serializable object (including strings, integer/real/float/double numbers and Boolean)Files are also 'serializable'.

  • Returns

MESArtifactProperty - A reference to the newly-created Artifact property.

  • Scope

All

Code Examples
Code Snippet
# Create a new 'versioned' MES Artifact object called 'my artifact' 
#    on the Material Definition 'Test Material' and set the value 
#    of the new Artifact to the string "Hello World".
obj = system.mes.loadMESObject('Test Material', 'MaterialDef')
obj.createArtifact('my artifact', 'Hello World')
obj.save()

Each subsequent .save() creates a new Artifact value entry in the database for the current Artifact value (along with a new timestamp).


 createArtifact(artifactName, serializableValue, versioned)
Description

Create a new MES Artifact property named by artifactName on an existing MES Object, with a provided primitive, Pythonic or Java serializable object as the serializableValue (including strings, integer/real/float/double numbers and Boolean). 

Files are also 'serializable' (Artifacts serialize the file as an array of bytes. Add "from java.io import File" to script and use File (fileName) where fileName contains the path to the file, with filename and extension. Refer to the Java Class File page).

If versioned=FALSE, only one artifact with the version 0 is created and each save overwrites the previous value. If versioned=TRUE, then the artifact is saved with its timestamp, such that each save creates a new version of the artifact (one additional row in the DB per version saved).

Syntax

createArtifact(artifactName, serializableValue, versioned)


  • Parameters

String artifactName - the name of the Artifact to create. Name will be stored using lower-case letters.

Serializable serializableValue - Any primitive, Pythonic or Java serializable object (including strings, integer/real/float/double numbers and BooleanFiles are also 'serializable'.

Boolean versioned - FALSE means only one artifact is stored and is overwritten on each save. TRUE keeps a versioned copy with timestamp as an additional row in the database on each save.

  • Returns

MESArtifactProperty - A reference to the newly-created Artifact property.

  • Scope

All

Code Examples
Code Snippet
# Create a new 'unversioned' MES Artifact object called 'unversioned artifact' 
#    on the Material Definition 'Test Material' and set the value 
#    of the new Artifact to the string "Hello World".
obj = system.mes.loadMESObject('Test Material', 'MaterialDef')
obj.createArtifact('unversioned artifact', 'Hello World', False)
obj.save()


Each subsequent .save() overwrites the single recorded Artifact value entry in the database with the current Artifact value (but a new timestamp is recorded).

 getArtifactCount()
Description

Returns the number of artifacts that exist for this MES Object.

Syntax

getArtifactCount()


  • Parameters

None

  • Returns

Integer - The number of artifacts that exist for this MES Object.

  • Scope

All

Code Examples
Code Snippet
# Code example
 getAllArtifactNames()
Description

Returns a list with the Name property for all artifacts that exist for this MES Object, as well as for all parent objects.

Syntax

getAllArtifactNames()


  • Parameters

None

  • Returns

List - A Pythonic list with the Name property for all artifacts that exist for this MES Objectas well as for all parent objects. Names have all been previously created with lower-case letters.

  • Scope

All

Code Examples
Code Snippet
# Code example
 getArtifactNames()
Description

Returns a list with the Name property for all artifacts that exist for this MES Object.

Syntax

getArtifactNames()


  • Parameters

None

  • Returns

List - A Pythonic list with the Name property for all artifacts that exist for this MES ObjectNames have all been previously created with lower-case letters.

  • Scope

All

Code Examples
Code Snippet
# Code example
 getArtifactProperty(artifactName)
Description

Returns the MES Artifact Property of the specified Artifact on the MES Object.

Syntax

getArtifactProperty(artifactName)


  • Parameters

String artifactName - The Name of the Artifact on the MES ObjectNames have all been previously created with lower-case letters.

  • Returns

MESArtifactProperty - The MES Artifact Property of the specified Artifact on the MES Object.

  • Scope

All

Code Examples
Code Snippet
# Code example
 getArtifactProperties()
Description

Returns all of the MES Artifact Properties of the specified Artifact on the MES Object.

Syntax

getArtifactProperties()


  • Parameters

None

  • Returns

MESPropertyCollection - All of the MES Artifact Properties of the specified Artifact on the MES Object.

  • Scope

All

Code Examples
Code Snippet
# Code example
 getArtifactValueByName(artifactName)
Description

Returns the value of the Artifact on the MES Object specified by the Artifact's Name.

Syntax

getArtifactValueByName(artifactName)


  • Parameters

String artifactName - The Name of the Artifact on the MES ObjectNames have all been previously created with lower-case letters.

  • Returns

Serializable - The primitive, Pythonic or Java serializable object value stored for the Artifact on the MES ObjectFiles are also 'serializable', so file contents are returned as an array of bytes.

  • Scope

All

Code Examples
Code Snippet
obj = system.mes.loadMESObject('Widget A', 'MaterialDef')
ds = obj.getArtifactValueByName('test data')
print ds ##prints data set.
 getArtifactValueByUUID(artifactUUID)
Description

Returns the value of the Artifact on the MES Object specified by the Artifact's UUID.

Syntax

getArtifactValueByUUID(artifactName)


  • Parameters

String artifactUUID - The UUID of the Artifact on the MES Object.

  • Returns

Serializable - The primitive, Pythonic or Java serializable object value stored for the Artifact on the MES ObjectFiles are also 'serializable', so file contents are returned as an array of bytes.

  • Scope

All

Code Examples
Code Snippet
# Code example
 setArtifactValue(artifactName, serializableValue)
Description

Updates an existing MES Artifact property named by artifactName on an existing MES Object, with a provided primitive, Pythonic or Java serializable object as the serializableValue (including strings, integer/real/float/double numbers and Boolean). 

Files are also 'serializable' (Artifacts serialize the file as an array of bytes. Add "from java.io import File" to script and use File (fileName) where fileName contains the path to the file, with filename and extension. Refer to the Java Class File page).

Syntax

setArtifactValue(artifactName, serializableValue)


  • Parameters

String artifactName - the name of the Artifact to update. Names have all been previously created with lower-case letters.

Serializable serializableValue - Any primitive, Pythonic or Java serializable object (including strings, integer/real/float/double numbers and Boolean)Files are also 'serializable'.

  • Returns

Nothing

  • Scope

All

Code Examples
Code Snippet
# Code example

Object Functions

 addChild(mesObject)
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)
 addChild(mesObjectLink)
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)
 addCustomProperty(name, dataTypeName, description, units, productionVisible, required, value)
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
 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 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
 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 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
 addCustomProperty(parentPath, name, dataTypeName, description, units, productionVisible, required, value)
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
 addCustomProperty(parentPath, 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 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
 addCustomProperty(parentPath, 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 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
 addParent(mesObject)
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)
 addParent(mesObjectLink)
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)

 createComplexProperty(complexPropertyType, name)
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}
 getAllCustomProperties()
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()

 getChildCollection()
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

 getComplexProperty(complexPropertyName, entryName)
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}
 getComplexProperty(complexPropertyName, index)
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}
 getComplexProperty(path)
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}
 getComplexPropertyByKind(path)
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

 getComplexPropertyCount(complexPropertyName)
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
 getComplexPropertyItemNames(complexPropertyName)
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
 getComplexPropertyTypeNames()
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]
 getCoreProperties()
Description

Get the collection of core properties.

Syntax

getCoreProperties()


  • Parameters

None

  • Returns

MESPropertyCollection coreProperties - The collection of core properties.

  • Scope

All

 getCustomProperties()
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()
 getCustomPropertiesFull()
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
 getCustomPropertiesFull(complexPropertyName, entryName)
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
 getCustomPropertyDescription(propertyPath)
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
 getCustomPropertyEnabled(propertyPath)
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
 getCustomPropertyUnits(propertyPath)
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
 getCustomPropertyValues(complexPropertyType, name)
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']
 getInheritedProperties()
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()
 getMESObjectType()
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
 getMESObjectTypeName()
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

 getName()
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

 getParentCollection()
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
 getPropertyValue(propertyPath)
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
 getUUID()
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
 getVersion()
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
 isEnabled()
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
 isModified()
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
 removeChild(mesObject)
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)
 removeComplexProperty(complexPropertyName, entryName)
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
 removeCustomProperty(propertyPath)
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') 
 removeParent(mesObject)
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)
 renameComplexProperty(complexPropertyName, entryName, newEntryName)
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')
 renameCustomProperty(propertyPath, newName)
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]}
 setCustomPropertyDescription(propertyPath, description)
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
 setCustomPropertyEnabled(propertyPath, enable)
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
 setCustomPropertyUnits(propertyPath, units)
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
 setCustomPropertyValues(customProperties)
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}
 setEnabled(enable)
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.

The Enterprise MES Object (your top level in the Production Model) cannot be deleted. It can only be edited.

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}
 setPropertyValue(propertyPath, value)
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.


Event NameDescription
BeforeAutoBegin

The event is fired before the automatic begin of a Response Segment.

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:

event.runDefaultHandler()     

BeforeAutoEnd

The event is fired before the automatic end of a Response Segment.

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:

event.runDefaultHandler()     

BeforeBeginThe event is fired just before a Response Segment object starts.
BeforeEndThe event is fired just before a Response Segment object ends.
BeginTraceThis event is run every time a Response Segment object starts. This event provides a method to perform tasks when a Response Segment begins. Information about the MES object is passed to the event in a MES Script Event object.
EndTraceThis event is run every time a Response Segment object ends. This event provides a method to perform tasks when a Response Segment ends. Information about the MES object is passed to the event in a MES Script Event object.
New

The event is fired when a new instance of an Response Segment object is created.

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:

event.runDefaultHandler()     

SetRecipe

The event is fired when a recipe is set on the Response Segment.

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:

event.runDefaultHandler()     

UpdateProgressThis event is run at an interval defined by the Update Event Interval in the Operations Definition. The Enable Update Event setting must also be set to true. This event provides a method to update production counts or other information associated with an active Response Segment. Information about the MES object is passed to the event in a MES Script Event object.


This object inherits the AbstractMESObject events...

 Click here to expand...

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()