Skip to end of metadata
Go to start of metadata

Description

An Operations Segment is a task that can performed in a manufacturing facility. It is always derived from a Process Segment and the properties and resources (material, personnel and equipment) of the process segment are copied over to the operations segment.

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

Linking Operation Segments within an Operations Definition

Operations Segments may be linked to an Operations Definition using the Segment Dependency Property object of the Operations Segment.  The dependency object can be used to provide links between all segments within an Operations Definition. The MES Object Editor can be used to create the links for you on the Operations Segment, not the Operations Definition. Links can also be created through scripting.

 Click here to expand...

Description

All Operations Definition objects have one or more operations segment objects. The Segment Dependency Property object holds information about the segments associated with the Operations Definition object. In the MES Object Editor component, this dependency is shown as the operations segments below the definition object.

This object is not derived from the MESAbstractObject. Instead it derives from AbstractMESComplexProperty object and inherits all its functions and properties.


 

Object Creation

This object is created automatically when an Operations Definition and Operations Segment are created during saving of a Process Segment in the MES Object Editor

The following object function returns this type of object:

 

 Click here to see script example...
opDefName = 'PC-005-Nuts Unlimited:Folsom:Packaging:Packaging Line 1'
mesObject = system.mes.loadMESObject(opDefName, 'OperationsDefinition')
list = mesObject.getComplexPropertyTypeNames()
print "Listing all the ComplexPropertyTypes for object - ", mesObject.getName()
for i in range(list.size()):
    complexPropType = list.get(i)
    print '- ', complexPropType
print ' '
prodList = mesObject.getComplexPropertyItemNames('SegmentDependency')
for item in prodList:
	print 'SegmentDependencyName = ',item
	opSegDependency = mesObject.getComplexProperty('SegmentDependency', item)
	print opSegDependency
>>> 
Listing all the ComplexPropertyTypes for object -  PC-005-Nuts Unlimited:Folsom:Packaging:Packaging Line 1
-  SegmentDependency
-  TriggerOperBegin
 
SegmentDependencyName =  Changeover Dependency
{SegmentRef=Operations Segment, PC-005-Nuts Unlimited:Folsom:Packaging:Packaging Line 1_CO, SegmentRefUUID=c0483833-08b5-4ac6-a3c5-e094fc0a5637, SegmentRefType=OperationsSegment, SegmentDependencyType=null, SegmentDependencyFactor=null, SegmentDependencyFactorUnits=null}
SegmentDependencyName =  Production Dependency
{SegmentRef=Operations Segment, PC-005-Nuts Unlimited:Folsom:Packaging:Packaging Line 1, SegmentRefUUID=c6cc681f-5dca-4eb6-84ea-e1a29dee26e1, SegmentRefType=OperationsSegment, SegmentDependencyType=null, SegmentDependencyFactor=null, SegmentDependencyFactorUnits=null}
>>>  

 

Use

No scripting function or component use this object directly.


 

Object Properties

See AbstractMESComplexProperty for details about accessing values using script.

Setting NameScriptingDescription
Segment_Dependency NameSegmentDependencyThis is the name to use when referencing this Segment Dependency property. Operations Definitions may have multiple Segment resources and this is a unique name displayed to the operator, shown in analysis and reports, and also internally used to reference the property.
Segment ReferenceSegmentRefThe reference to the Process Segment or Operations Segment that this segment dependency is linked to.
Segment Dependency Type

SegmentDependencyType

Currently this is here for reference and is included to align with the ISA-95 standard and will become significant in the next phase of the Track and Trace Module.
Segment Dependency FactorSegmentDependencyFactorCurrently this is here for reference and is included to align with the ISA-95 standard and will become significant in the next phase of the Track and Trace Module.
Segment.Dependency.Factor.UnitsSegmentDependencyFactorUnitsUnits for the Segment Dependency Factor setting.

 

Object Functions

This object provides the following functions:

Info

Segment references can be set in one of two ways:

  1. Passing an object link to the method setSegmentRef(ref)

  2. Using a uuid and type with setSegmentRefUUID(refUUID) and setSegmentRefType(refType)


 getDependencyFactor()
Description

 Get the dependency factor.

Syntax

getDependencyFactor()


  • Parameters

 None

  • Returns

 Double factor - The dependency factor.

  • Scope

All

 getDependencyType()
Description

 Get the type of dependency.

Syntax

getDependencyType()


  • Parameters

 None

  • Returns

 String type - The type of dependency.

  • Scope

All

 getFactorUnits()
Description

 Get the units of dependency factor.

Syntax

getFactorUnits()


  • Parameters

 None

  • Returns

 String type - The units of dependency factor.

  • Scope

All

 getSegmentRef()
Description

 Get reference to the segment.

Syntax

getSegmentRef()


  • Parameters

 None

  • Returns

 MESObjectLink ref - Reference to the segment.

  • Scope

All

 getSegmentRefType()
Description

 Get reference type to the segment.

Syntax

getSegmentRefType()


  • Parameters

 None

  • Returns

 String refType - Reference type to the segment.

  • Scope

All

 getSegmentRefUUID()
Description

 Get reference uuid to the segment.

Syntax

getSegmentRefUUID()


  • Parameters

 None

  • Returns

 String refUUID - Reference uuid to the segment.

  • Scope

All

 setDependencyFactor(factor)
Description

 Set the dependency factor.

Syntax

setDependencyFactor(factor)


  • Parameters

 Double factor - The dependency factor.

  • Returns

Nothing

  • Scope

All

 setDependencyType(type)
Description

 Set the type of dependency.

Syntax

setDependencyType(type)


  • Parameters

 String type - The type of dependency.

  • Returns

 Nothing

  • Scope

All

 setFactorUnits(units)
Description

Set the units of dependency factor.

Syntax

setFactorUnits(units)


  • Parameters

 String type - The units of dependency factor.

  • Returns

 Nothing

  • Scope

All

 setSegmentRef(ref)
Description

 Set reference to the segment.

Syntax

setSegmentRef(ref)


  • Parameters

 MESObjectLink ref - Reference to the segment.

  • Returns

 Nothing

  • Scope

All

 setSegmentRefType(refType)
Description

 Set reference type to the segment.

Syntax

setSegmentRefType(refType)


  • Parameters

String refType - Reference type to the segment.

  • Returns

 Nothing

  • Scope

All

 setSegmentRefUUID(refUUID)
Description

 Set reference uuid to the segment.

Syntax

setSegmentRefUUID(refUUID)


  • Parameters

String refUUID - Reference uuid to the segment.

  • Returns

Nothing

  • Scope

All



 Object Creation

Operations Segments can be created using the MES Object Editor component and also with scripting functions. When updating a Process or Operations Segment using the MES Object Editor component, the user will be asked if they want to update the dependencies of any derived Operations Segments. If they answer yes, the changes will be pushed to all Process Segments or Operations Segments that were derived from the modified Process Segment.

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

Script Example

 Click here to expand...
#Load the process segment to base the operations segment on
psName = 'Unload Nuts'
ps = system.mes.loadMESObject(psName, 'ProcessSegment')
    
#Derive a new operation segment from the process segment
os = system.mes.deriveMESObject(ps, 'OperationsSegment', True)
    
#Set where it was derived from
os.setPropertyValue('DerivedFromRefType', 'ProcessSegment')
os.setPropertyValue('DerivedFromRefUUID', ps.getUUID())
    
#Set the name
os.setPropertyValue('Name', psName)
       
#Create a new operations definition
od = system.mes.createMESObject('OperationsDefinition')
#Set the name using the same name as the operations segment
od.setPropertyValue('Name', psName)
    
#Create a new segment dependency complex property in the operations definition that points to the operations segment
depProp = od.createComplexProperty('SegmentDependency', ps.getName())
depProp.setSegmentRefType('OperationsSegment')
depProp.setSegmentRefUUID(os.getUUID())
    
#Create a new begin trigger complex property in the operation segment
begTrig = os.createComplexProperty('TriggerSegBegin', 'DefaultBeginTrigger')
begTrig.setPrecedingRefType('OperationsDefinition')
begTrig.setPrecedingRefUUID(od.getUUID())
begTrig.setMode('At Operation Begin')
begTrig.setDefault(True)
    
#Save the objects as a group
objList = system.mes.object.list.createList()
objList.add(od)
objList.add(os)
system.mes.saveMESObjects(objList)


ISA-95 Object Model Inter-Relationships



Object Properties

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

Name
R/W
Description
EndOperationWhenComplete

Read/Write

If this property is set to True, then the operations automatically ends when segment is complete
SegmentRecipeNameRead/WriteThis is a drop down list of available recipes which can be set to be used on segment start

Impact on Other Segments

The "EndOperationWhenComplete" property will prompt an Operations Response to end when a Response Segment (based on an Operations Segment with this flag set to true) ends. This will impact other segments under the Operations Response by immediately ending them. Please consider all possible Response Segments that may be running during an Operations Response when configuring this property.

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 it's type can have the same name.

Naming Characters Allowed

Names must begin with a letter, digit or underscore. Subsequent characters may also include spaces, dashes, underscores and parentheses. No other special characters are allowed (. , ; : / \ [ ] { } ! @ # $ % ^ & * + = | ‘ “ < > ` ~ ?  etc).

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

An operations segment uses complex property objects to hold information about the resources associated with a task as well as OEE production settings. These complex properties can be added to the process segment using the MES Object Editor component or through scripting with the AbstractMESObject.createComplexProperty() function.

Property ObjectScriptingDescription

Material Resource Property

MaterialAny material lots that may be consumed or created during an operation derived from the process segment are defined here. There is no requirement to create material complex properties e.g. a maintenance process segment, and there is no restriction on how many input, output or consumable materials are defined for a process segment.

Equipment Resource Property

EquipmentA process segment requires one and only one Equipment complex property to be defined. this sets up production control on where this process segment can be executed. If you want to create a process segment that can occur on any piece of equipment e.g. 'Clean Equipment', set the equipment reference to an equipment class that contains all equipment.

Supplemental Equipment Resource Property

SupplementalEquipmentMobile equipment that can be moved around such as bins, containers, die sets etc. cannot be defined in the production model as fixed equipment as defined by ISA-95. The MES Object Editor and scripting functions can be used instead to create Supplemental Equipment. Any supplemental equpiment that may be used by an operation can be defined here.

Personnel Resource Property

PersonnelPersonnel complex properties allow to you add production control to a process segment by defining who can execute this process segment. This complex property is optional and can be left blank. 

Production Settings Property

ProductionSettings

Production settings contain rate information that is used by the OEE module to calculate operational performance.

Known Limitations

Trigger Segment Begin PropertyTriggerSegmentBeginThis property holds information about what will trigger the start of an operation segment.
Trigger Segment End PropertyTriggerSegmentEndThis property holds information about what will cause an operation segment to end.



Object Functions

This object provides the following functions:


 getEquipment()
Description

Return 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

getEquipment()


  • Parameters

 None

  • Returns

 The MES Object representing the equipment.

  • Scope

All

 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

 The MES Object Link representing the equipment.

  • Scope

All

 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

 getPrimaryBeginTrigger()
Description

Return the property that triggers to begin the segment.

Syntax

getPrimaryBeginTrigger()


  • Parameters

 None

  • Returns

TriggerSegmentBeginProperty property - The property that triggers the segment to begin operation.

  • Scope

All

 getPrimaryEndTrigger()
Description

Return the property that triggers to end the segment.

Syntax

getPrimaryEndTrigger()


  • Parameters

 None

  • Returns

TriggerSegmentEndProperty property - The property that triggers the segment to end operation.

  • Scope

All

 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

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

  • Scope

All

Code Examples
Code Snippet
eqPath = '[global]\Enterprise\Site\Area\Line 4\Filler'
seg = system.mes.loadMESObject('Basil-Enterprise:Site:Area:Line 4', 'OperationsSegment')
prop = seg.getProductionSettingsProperty(eqPath)
print prop.getOEERate()


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, dashes, underscores and parentheses. No other special characters are allowed (. , ; : / \ [ ] { } ! @ # $ % ^ & * + = | ‘ “ < > ` ~ ?  etc).

 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.

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 Object Events for more information. 

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

but, no other object events are available.

  • No labels