---
title: "Derive Operations Segment 3.0"
id: "derive-operations-segment-3-0"
project: "Knowledge Base"
url: "https://docs.sepasoft.com/articles/knowledge-base/derive-operations-segment-3-0"
updated: 2026-07-23T18:08:34Z
---

# Derive Operations Segment 3\.0

## Overview

Operations segment can be derived from the process segment through scripting. The scripting functions and properties associated with this derivation are described below.

### Applies To and Version Info

This feature applies to Track and Trace module and is available in all versions.

## Scripting

Code

```
itemNo = 1
 
#Load the process segment to base the operations segments on
ps = system.mes.loadMESObject('Unload', '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 a new name
newName = 'Unload %04d' % itemNo
os.setPropertyValue('Name', newName)
 
#Set the equipment for the operation segment
eqPath = '[global]\Enterprise\Site\Area\Unload Station 1'
eqLink = system.mes.getMESObjectLinkByEquipmentPath(eqPath)
eqProp = os.getComplexProperty('Equipment', 0)
eqProp.setEquipmentRef(eqLink)
 
#Set the same equipment to store the material at as where it is being run
matProp = os.getComplexProperty('Material', 0)
eqProp.setEquipmentRefType(eqLink.getMESObjectType().getName)
eqProp.setEquipmentRefUUID(eqLink.getMESObjectUUID())
 
#Create a new operations definition
od = system.mes.createMESObject('OperationsDefinition')
 
#Set the name using the same name as the operations segment
od.setPropertyValue('Name', newName)
 
#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)
```


## References

[Operations Segment](/articles/user-manual/Operations-Segment)

[Operations Definition](/articles/user-manual/Operations-Definition)

[Process Segment](/articles/user-manual/Process-Segment)

## Keywords

Operation Segment from Process Segment