Teach Handler
Quick Facts
| Property | Value |
|---|---|
| Class | CENPyOlpTeachHandler |
| Module | cenpylib.CENPyOlpTeachHandler |
| Package | cenpylib |
| Release | R2026.1 |
| Methods | 15 |
Quick Start
# Boilerplate Example
teachHandler = ... # obtained from the runtime context
result = teachHandler.GetTpElementPosition(tpElement, 0)Method Index
| Method | Returns | Summary |
|---|---|---|
GetTpElementPosition | CENPyOlpPosition | Get position of the toolpath element. |
GetTpElementPosition | CENPyOlpPosition | Get position of the toolpath element relative to the given base frame, specified by its index. |
ModifyTpElement | bool | Apply the current position values to the reference toolpath element. |
InsertNewTpElement | CENPyOlpTpElement | Insert a new toolpath element. |
RemoveTpElement | — | Remove the given toolpath element. |
SetTpElementName | — | Set the name of the toolpath element. |
SetTpElementMotionType | — | Set the new motion type of the toolpath element. |
SetTpElementTargetType | — | Sets the new target type of the underlying toolpath element. |
SetTpElementConfigBehavior | — | Sets the config behavior for the given toolpath elements. |
SetTpElementTurnBehavior | — | Sets the turn behavior for the given toolpath elements. |
RemoveTeachFlags | bool | Removes all teach flags and resets the toolpath element properties to their initial values. |
RemoveTeachFlags | bool | Removes the specified teach flags and resets their properties to the initial values. |
InsertAuxiliaryOperation | CENPyOlpOperation | Inserts a new auxiliary operation relative to a reference operation. |
InsertAuxiliaryOperation | CENPyOlpOperation | Inserts a new auxiliary operation relative to a reference operation group. |
GetCycleReferenceToolpathElement | CENPyOlpTpElement | Gets the reference toolpath element of a cycle toolpath element. |
Query Methods
GetTpElementPosition
def GetTpElementPosition(tpElement: CENPyOlpTpElement, posRelation: int) -> CENPyOlpPositionGet position of the toolpath element.
Parameters:
| Name | Type | Description |
|---|---|---|
tpElement | CENPyOlpTpElement | Reference toolpath element. |
posRelation | int | Relation of the position. |
Returns: CENPyOlpPosition — Toolpath element position.
GetTpElementPosition
def GetTpElementPosition(tpElement: CENPyOlpTpElement, posRelation: int, baseFrameIndex: int) -> CENPyOlpPositionGet position of the toolpath element relative to the given base frame, specified by its index.
Parameters:
| Name | Type | Description |
|---|---|---|
tpElement | CENPyOlpTpElement | Reference toolpath element. |
posRelation | int | Relation of the position. |
baseFrameIndex | int | Base frame index. |
Returns: CENPyOlpPosition — Toolpath element position.
Mutation Methods
ModifyTpElement
def ModifyTpElement(olpPosition: CENPyOlpPosition) -> boolApply the current position values to the reference toolpath element. Currently, only an active program is allowed to be modified.
Parameters:
| Name | Type | Description |
|---|---|---|
olpPosition | CENPyOlpPosition | Olp position to take current values from and that holds the reference toolpath element. |
Returns: bool — True if modification was successful, False otherwise.
InsertNewTpElement
def InsertNewTpElement(olpPosition: CENPyOlpPosition, motionType: int, insertPosition: int) -> CENPyOlpTpElementInsert a new toolpath element. Currently, only PTP and LIN motion types can be inserted and only an active program is allowed to be modified.
Parameters:
| Name | Type | Description |
|---|---|---|
olpPosition | CENPyOlpPosition | Olp position of the toolpath element to be created. Olp position also contains reference toolpath element. |
motionType | int | Motion type of the toolpath element to be created. |
insertPosition | int | Insert position in relation to the reference toolpath element. |
Returns: CENPyOlpTpElement — Newly created toolpath element. None, if failed to insert the new toolpath element.
RemoveTpElement
def RemoveTpElement(toolpathElement: CENPyOlpTpElement)Remove the given toolpath element. Currently, only an active program is allowed to be modified. Toolpath elements with the process type ProcessInsert, Auxiliary and TeachInsert will be deleted, and all other types will be suppressed.
Parameters:
| Name | Type | Description |
|---|---|---|
toolpathElement | CENPyOlpTpElement | Toolpath element to remove. |
SetTpElementName
def SetTpElementName(tpElement: CENPyOlpTpElement, name: str)Set the name of the toolpath element. The Teach Flag for Name will be set.
Parameters:
| Name | Type | Description |
|---|---|---|
tpElement | CENPyOlpTpElement | Reference toolpath element. |
name | str | New toolpath element name. |
SetTpElementMotionType
def SetTpElementMotionType(tpElement: CENPyOlpTpElement, iMotionType: int)Set the new motion type of the toolpath element. The Teach Flag for MotionType will be set. If the motion type cannot be set because of restrictions, the element will be skipped.
Parameters:
| Name | Type | Description |
|---|---|---|
tpElement | CENPyOlpTpElement | Reference toolpath element. |
iMotionType | int | Motion type to set. |
SetTpElementTargetType
def SetTpElementTargetType(tpElement: CENPyOlpTpElement, iTargetType: int)Sets the new target type of the underlying toolpath element. The Teach Flag for TargetType will be set.
Parameters:
| Name | Type | Description |
|---|---|---|
tpElement | CENPyOlpTpElement | Reference toolpath element. |
iTargetType | int | Target type to set. |
SetTpElementConfigBehavior
def SetTpElementConfigBehavior(tpElement: CENPyOlpTpElement, iConfigBehavior: int)Sets the config behavior for the given toolpath elements. The Teach Flag for Config will be set.
Parameters:
| Name | Type | Description |
|---|---|---|
tpElement | CENPyOlpTpElement | Reference toolpath element. |
iConfigBehavior | int | Config behavior to set. |
SetTpElementTurnBehavior
def SetTpElementTurnBehavior(tpElement: CENPyOlpTpElement, iTurnBehavior: int)Sets the turn behavior for the given toolpath elements. The Teach Flag for Turn will be set.
Parameters:
| Name | Type | Description |
|---|---|---|
tpElement | CENPyOlpTpElement | Reference toolpath element. |
iTurnBehavior | int | Turn behavior to set. |
RemoveTeachFlags
def RemoveTeachFlags(tpElement: CENPyOlpTpElement) -> boolRemoves all teach flags and resets the toolpath element properties to their initial values.
Parameters:
| Name | Type | Description |
|---|---|---|
tpElement | CENPyOlpTpElement | Reference toolpath element. |
Returns: bool — True if successful, otherwise False.
InsertAuxiliaryOperation
def InsertAuxiliaryOperation(targetProgram: CENPyOlpProgram, referenceOperation: CENPyOlpOperation, iInsertPosition: int) -> CENPyOlpOperationInserts a new auxiliary operation into the specified target program relative to a reference operation within the same group.
Parameters:
| Name | Type | Description |
|---|---|---|
targetProgram | CENPyOlpProgram | Target program in which the auxiliary operation will be inserted. |
referenceOperation | CENPyOlpOperation | Reference operation used to determine the insertion location. |
iInsertPosition | int | Insert position in relation to the reference operation. |
Returns: CENPyOlpOperation — Newly created auxiliary operation, or None if insertion failed.
InsertAuxiliaryOperation
def InsertAuxiliaryOperation(targetProgram: CENPyOlpProgram, referenceOperationGroup: CENPyOlpOperationGroup, iInsertPosition: int) -> CENPyOlpOperationInserts a new auxiliary operation into the specified target program relative to a reference operation group, into a new group.
Parameters:
| Name | Type | Description |
|---|---|---|
targetProgram | CENPyOlpProgram | Target program in which the auxiliary operation will be inserted. |
referenceOperationGroup | CENPyOlpOperationGroup | Reference operation group used to determine the insertion location. |
iInsertPosition | int | Insert position in relation to the reference operation group. |
Returns: CENPyOlpOperation — Newly created auxiliary operation, or None if insertion failed.
GetCycleReferenceToolpathElement
def GetCycleReferenceToolpathElement(tpElement: CENPyOlpTpElement) -> CENPyOlpTpElementGets reference toolpath element of a cycle toolpath element.
Parameters:
| Name | Type | Description |
|---|---|---|
tpElement | CENPyOlpTpElement | Cycle toolpath element. |
Returns: CENPyOlpTpElement — Reference toolpath element of a cycle toolpath element, or None.
RemoveTeachFlags
def RemoveTeachFlags(tpElement: CENPyOlpTpElement, teachFlags: int) -> boolRemoves the specified teach flags and resets their properties to the initial values.
Parameters:
| Name | Type | Description |
|---|---|---|
tpElement | CENPyOlpTpElement | Reference toolpath element. |
teachFlags | int | Teach flags to reset. |
Returns: bool — True if successful, otherwise False.
Related Types
Changes in R2026.1.1
Compared to R2026.1:
-
Method count increased from 13 to 15
-
[NEW]
InsertAuxiliaryOperation: New method added -
[NEW]
GetCycleReferenceToolpathElement: New method added
Version Notes
This class is documented as of release R2026.1.1.