Get position of the toolpath element.
[Example]
program = Operator.GetActiveProgram()
tpes = program.GetTpElements()
teachHandler = Operator.GetTeachHandler()
olpPosition = teachHandler.GetTpElementPosition(tpes[0], POSRELATION_LOCALTPELEMENT)
|
|
Toolpath element object
|
|
|
Type of the position relation represented as enum PosRelation
|
|
|
Index of the base frame to be used for position representation. The default value is the index of an active base frame
|
|
|
Object of the CENPyOlpPosition class
|
Get position of the toolpath element.
[Example]
program = Operator.GetActiveProgram()
tpes = program.GetTpElements()
teachHandler = Operator.GetTeachHandler()
olpPosition = teachHandler.GetTpElementPosition(tpes[0], POSRELATION_BASEFRAME) #Index of an active base frame used
or
olpPosition = teachHandler.GetTpElementPosition(tpes[0], POSRELATION_BASEFRAME, 1)
|
|
Olp position to take current values from and that holds the reference toolpath element
|
|
|
True if modification was successful, False otherwise
|
Apply the current position values to the reference toolpath element. Only an active program is allowed to be modified.
[Example]
olpPosition = teachHandler.GetTpElementPosition(tpElement, POSRELATION_LOCALTPELEMENT)
olpPosition.TranslatePosition(0, 0, 0.05, POSRELATION_WORKPIECEROOT)
successful = teachHandler.ModifyTpElement(olpPosition)
if not successful:
logging.LogError("Failed to modify TPE!")
|
|
Olp position to take current values from and that holds the reference toolpath element
|
|
|
Motion type of the toolpath element to be created
|
|
|
IInsert position in relation to the reference toolpath element
|
|
|
Newly created object of the CENPyOlpTpElement class. None, if failed to insert the new toolpath element
|
Insert a new toolpath element. Currently, only PTP and LIN motion types can be inserted and only an active program is allowed to be modified.
An active toolpath elements should have target type of TARGETTYPE_CARTESIAN, otherwise the insertion will fail.
[Example]
olpPosition = teachHandler.GetTpElementPosition(tpElement, POSRELATION_LOCALTPELEMENT)
olpPosition.TranslatePosition(0, 0, 0.01, POSRELATION_LOCALTPELEMENT)
newTpe = teachHandler.InsertNewTpElement(olpPosition, MOTIONTYPE_PTP, TPINSERTPOS_INSERTBEFORE)
if not newTpe:
logging.LogError("Failed to insert new TPE!")
|
|
Toolpath element to remove
|
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.
[Example]
teachHandler = Operator.GetTeachHandler()
program = Operator.GetActiveProgram()
tpElements = program.GetTpElements()
for tpe in tpElements:
teachHandler.RemoveTpElement(tpe)
|
|
Toolpath element object
|
|
|
New name to set
|
Set the name of the toolpath element. The Teach Flag for Name will be set.
[Example]
teachHandler = Operator.GetTeachHandler()
program = Operator.GetActiveProgram()
tpElements = program.GetTpElements()
for counter, tpe in enumerate(tpElements, 1):
if counter == 3:
teachHandler.SetTpElementName(tpe, "NewName")
|
|
Toolpath element object
|
|
|
New motion type to set
|
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.
[Example]
teachHandler = Operator.GetTeachHandler()
program = Operator.GetActiveProgram()
tpElements = program.GetTpElements()
for counter, tpe in enumerate(tpElements, 1):
if counter == 3:
teachHandler.SetTpElementMotionType(tpe, MOTIONTYPE_LIN)
|
|
Toolpath element object
|
|
|
New target type to set
|
Sets the new target type of the underlying toolpath element. The Teach Flag for TargetType will be set.
[Example]
teachHandler = Operator.GetTeachHandler()
program = Operator.GetActiveProgram()
tpElements = program.GetTpElements()
for counter, tpe in enumerate(tpElements, 1):
if counter == 3:
teachHandler.SetTpElementTargetType(tpe, TARGETTYPE_CARTESIAN)
|
|
Toolpath element object
|
|
|
New config behavior to set
|
Sets the config behavior for the given toolpath elements. The Teach Flag for Config will be set.
[Example]
teachHandler = Operator.GetTeachHandler()
program = Operator.GetActiveProgram()
tpElements = program.GetTpElements()
for counter, tpe in enumerate(tpElements, 1):
if counter == 3:
teachHandler.SetTpElementConfigBehavior(tpe, CONFIGBEHAVIOR_INHERIT)
|
|
Toolpath element object
|
|
|
New turn behavior to set
|
Sets the turn behavior for the given toolpath elements. The Teach Flag for Turn will be set.
[Example]
teachHandler = Operator.GetTeachHandler()
program = Operator.GetActiveProgram()
tpElements = program.GetTpElements()
for counter, tpe in enumerate(tpElements, 1):
if counter == 3:
teachHandler.SetTpElementTurnBehavior(tpe, TURNBEHAVIOR_INHERIT)
|
|
Reference toolpath element
|
|
|
True if removal was successful, False otherwise
|
Removes all teach flags and resets the toolpath element properties to their initial values.
[Example]
teachFlags = tpElement.GetTeachFlags()
if teachFlags & TEACHFLAGS_TURNBEHAVIOUR and teachFlags & TEACHFLAGS_CONFIGBEHAVIOR:
successful = teachHandler.RemoveTeachFlags(tpElement)
if successful:
logging.LogInfo(f"All teach flags were removed successfully.")
|
|
Reference toolpath element
|
|
|
Bitmask of TeachFlags
|
|
|
True if removal was successful, False otherwise
|
Removes the specified teach flags and resets their properties to the initial values.
[Example 1]
teachFlags = tpElement.GetTeachFlags()
if teachFlags & TEACHFLAGS_NAME:
successful = teachHandler.RemoveTeachFlags(tpElement, TEACHFLAGS_NAME)
if successful:
logging.LogInfo(f"Name teach flag was removed successfully.")
[Example 2]
teachFlags = tpElement.GetTeachFlags()
if teachFlags & TEACHFLAGS_TARGETTYPE and teachFlags & TEACHFLAGS_MOTIONTYPE:
teachHandler.RemoveTeachFlags(tpElement, TEACHFLAGS_TARGETTYPE | TEACHFLAGS_MOTIONTYPE | TEACHFLAGS_CONFIGBEHAVIOR | TEACHFLAGS_TURNBEHAVIOUR | TEACHFLAGS_JOINTS | TEACHFLAGS_EXTERNALJOINTS)
|