system.mes.createMESObject

Sepasoft MES Module Suite

system.mes.createMESObject(mesObjectTypeName)

Returns a new instance of an MES object based on the mesObjectType parameter.

Syntax

system.mes.createMESObject(mesObjectTypeName)

  • Parameters

String MESObjectTypeName - The MES object type to base the new instance. This can be one of MES object types defined in MESObjectTypes. See MES Object Type Name for information.

  • Returns

A new instance of the MES object type specified in the mesObjectTypeName parameter.

  • Scope

All

Python
#In the example below, a new MaterialClass MES object is created.
#After it is created, the name is set then a custom property is added to it and then it is saved.
matClass = system.mes.createMESObject('MaterialClass')
##Typically, we recommend adding a parent (e.g. obj.addParent(parentObject)) before setting the name.
matClass.setPropertyValue('Name', 'Turkey')
matClass.addCustomProperty('Weight', 'Float8', 'Weight of the turkey', 'Lbs', True, True)
system.mes.saveMESObject(matClass)


Python
##Create the mes object, in this case, a Line.
obj = system.mes.createMESObject('Line')
##Load a Parent Object, in this case, an Area.
eqPath = 'Enterprise\\Site\\Area'
parent = system.mes.loadMESObjectByEquipmentPath(eqPath)
##Add the parent, Area, to the Line
obj.addParent(parent)
##Set the name of the line:
obj.setPropertyValue('Name', 'Test Line 1')
##Save the object
system.mes.saveMESObject(obj)

Sepasoft MES Module Suite