Python scripting - Event operators

CENPyOlpEvent_EventComputeOperator

 

The object of the CENPyOlpEvent_EventComputeOperator class is passed to the PostCompute callback as a parameter.

It can be used to obtain the required operators within the scope of the PostCompute callback in the %EVENT_NAME%.py script file, located in the folder of the plugin.

[Example]

 

def PostCompute(eco):

 

 

Methods

 

GetAttribGetter(): CENPyOlpAttribGetter

 

o

return

Object of CENPyOlpAttribGetter class

 

[Example]

   attribGetter = eco.GetAttribGetter()

 


 

GetLoggerOperator(): CENPyOlpLogOperator

 

o

return

Object of CENPyOlpLogOperator class.

 

[Example]

   logger = eco.GetLoggerOperator()

 


 

CreateMatrix(): CENPyOlpMatrix

 

o

return

Object of CENPyOlpMatrix class

 

[Example]

   mat = eco.CreateMatrix()

 


 

CreatePoint(x: float, y: float, z: float): CENPyOlpPoint

 

o

x

x coordinate in meters

 

o

y

y coordinate in meters

 

o

z

z coordinate in meters

 

o

return

Object of CENPyOlpPoint class

 

[Example]

   point = eco.CreatePoint(0.0, 0.5, 1.0)

 


 

CreateVector(x: float, y: float, z: float): CENPyOlpVector

 

o

x

x coordinate in meters

 

o

y

y coordinate in meters

 

o

z

z coordinate in meters

 

o

return

Object of CENPyOlpVector class

 

[Example]

   vector = eco.CreateVector(1.0, 0.0, 1.0)

 


 

GetRefTpElement(): CENPyOlpTpElement

 

o

return

Object of CENPyOlpTpElement class

 

Returns the reference toolpath element of the event

 

[Example]

   refTP = eco.GetRefTpElement()

 


 

MoveLin(target: CENPyOlpMatrix): CENPyOlpTpElement

 

o

target

Target matrix as object of CENPyOlpMatrix class

 

o

return

linear toolpath element. Object of CENPyOlpTpElement class

 

Adds a move lin element at the end 

 

[Example]

   tp = eco.MoveLin(destinationMat)

 


 

MoveCir(target: CENPyOlpMatrix, via: CENPyOlpMatrix): CENPyOlpTpElement

 

o

target

Target matrix as object of CENPyOlpMatrix class

 

o

via

"via" point as object of CENPyOlpMatrix class

 

o

return

Object of CENPyOlpTpElement class

 

Adds a circular move element at the end 

 

[Example]

   tp = eco.MoveCir(destinationMat, viaMat)

 


 

MoveCir(target: CENPyOlpMatrix, radius: float, direction: int): CENPyOlpTpElement

 

o

target

Target matrix as object of CENPyOlpMatrix class

 

o

radius

circle radius

 

o

direction

direction of circle ([-1] = clockwise  or [1] = counter clockwise)

 

o

return

Object of CENPyOlpTpElement class

 

Adds a circular move element at the end 

Uses vector tangent current toolpath element and vector current toolpath element to target toolpath element for plane of circle 

if vectors are co-linear use target as endpoint and middle of current to target as via point

 

[Example]

   tp = eco.MoveCir(destinationMat, 0.1, -1)

 


 

MoveCir(angle: float, radius: float): CENPyOlpTpElement

 

o

angle

opening angle of circle

 

o

radius

circle radius

 

o

return

Object of CENPyOlpTpElement class

 

Adds a circular move element at the end 

 

[Example]

   tp = eco.MoveCir(angle, radius)

 


 

MoveTangentCir(start: CENPyOlpMatrix, end: CENPyOlpMatrix, tangentTo: UseTangentOf): CENPyOlpTpElement

 

o

start

start point matrix of the move circular

 

o

end

end point matrix of the move circ

 

o

tangentTo

tangent to start or end : UseTangentOf::Start, UseTangentOf::End

 

o

return

Object of CENPyOlpTpElement class

 

Adds a circular move element tangential to a matrix

 

[Example]

   tp = eco.MoveTangentCir(startMat, endMat, USETANGENTOFSTART)

 


 

MovePTP(target: CENPyOlpMatrix): CENPyOlpTpElement

 

o

target

Target matrix of the move. Object of CENPyOlpMatrix class

 

o

return

PTP toolpath element added

 

Adds a point to point move element at the end

 

[Example]

   tp = eco.MovePTP(destinationMat)

 


 

 

SkipPath(length: float, includeStartAndEnd: bool)

 

o

length

The lenght to be skipped

 

o

includeStartAndEnd

Flag determining whether or not to include start and end point

 

Skips the toolpath elements for a given length

 

[Example]

   eco.SkipPath(10, False)

 


 

GetInitialPathMatrixByLength(length: float): CENPyOlpMatrix

 

o

length

Length of the path after which the element should appear. Units: meters.

 

o

return

Matrix at given length, outputs warning "CENPyOlpMatrix::CENPyOlpMatrix, argument is nullptr" if could not be calculated

 

Gets initial path matrix of toolpath element at given length

Remark: When at given length no toolpath element exists temporary one is created (deleted after usage immediately)

 

[Example]

   initMat = eco.GetToolpathElementByLength(0.1)

 


 

GetRefToolpathElementPosition(): CENPyOlpMatrix

 

o

return

The element at given length, nullptr if there is none

 

Determines the base frame position of the reference element of an event. 

 

[Example]

   posMat = eco.GetRefToolpathElementPosition()

 


 

GetCurrentToolFrameIndex(): int

 

 

o

return

Returns the index of the current tool frame for a specific toolpath element, defined on the operation level, or -1 if active tool is not set

 

GetCurrentToolframeIndex() with lowercase "frame" can also be used.

 

[Example]

   currentToolFrameIndex = eco.GetCurrentToolFrameIndex()

 


 

GetCurrentToolResourceName(): string

 

o

return

the resource name of the current tool

 

Returns the resource name of the current tool.

 

[Example]

   resourceToolName = eco.GetCurrentToolResourceName()

 


 

GetCurrentBaseFrameIndex(): int

 

 

o

return

Returns the index of the current base frame for a specific toolpath element, defined on the operation level, or -1 if active tool is not set

 

GetCurrentBaseframeIndex() with lowercase "frame" can also be used.

 

[Example]

   currentBaseFrameIndex = eco.GetCurrentBaseFrameIndex()

 


 

GetCurrentToolFrameMatrix(): CENPyOlpMatrix

 

 

o

return

Returns the matrix of the current tool frame for a specific toolpath element, defined on the operation level

 

GetCurrentToolframeMatrix() with lowercase "frame" can also be used.

 

[Example]

   currentToolFrameMatrix = eco.GetCurrentToolFrameMatrix()

 


 

GetCurrentBaseFrameMatrix(): CENPyOlpMatrix

 

 

o

return

Returns the matrix of the current base frame for a specific toolpath element, defined on the operation level

 

GetCurrentBaseframeMatrix() with lowercase "frame" can also be used.

 

[Example]

   currentBaseFrameMatrix = eco.GetCurrentBaseFrameMatrix()

 


 

GetController(): CENPyOlpController

 

o

return

The Controller object

 

Returns current Controller

 

[Example]

   controller = eco.GetController()

 


 

GetEventOperator(): CENPyOlpEventOperator

 

o

return

Object of CENPyOlpEventOperator class.

 

[Example]

def PostCompute(eco):

   eventOperator = eco.GetEventOperator()

 


 

SetTechnologyRequestId(element: CENPyOlpTpElement, techRequestId: int)

 

o

element

Object of CENPyOlpTpElement class.

 

o

techRequestId

Integer value to identify this toolpath element in event rules.

 

[Example]

def PostCompute(eco):

   eventOperator = eco.SetTechnologyRequestId(CENPyOlpTpElement, INT_ID)

 

Default TechRequestIds used in Approach, LeadIn, LeadOut and Retract.

 


 

GetTpElementPosition(tpElement: CENPyOlpTpElement, posRelation: PosRelation): CENPyOlpPosition

 

o

tpElement

Toolpath element object

 

o

posRelation

Type of the position relation represented as enum PosRelation

 

o

return

Object of the CENPyOlpPosition class

 

Get position of the toolpath element.

 

[Example]

   refTpe = eco.GetRefTpElement()

   olpPosition = eco.GetTpElementPosition(refTpe, POSRELATION_LOCALTPELEMENT)

 


 

GetTpElementPosition(tpElement: CENPyOlpTpElement, posRelation: PosRelation, baseFrameIndex: int): CENPyOlpPosition

 

o

tpElement

Toolpath element object

 

o

posRelation

Type of the position relation represented as enum PosRelation

 

o

baseFrameIndex

Index of the base frame to be used for position representation. The default value is the index of an active base frame

 

o

return

Object of the CENPyOlpPosition class

 

Get position of the toolpath element.

 

[Example]

   refTpe = eco.GetRefTpElement()

   olpPosition = eco.GetTpElementPosition(refTpe, POSRELATION_BASEFRAME) #Index of an active base frame used

or

   olpPosition = eco.GetTpElementPosition(refTpe, POSRELATION_BASEFRAME, 2)

 


 

GetTouchSensingOperator(): CENPyOlpTouchSensingOperator

 

 

o

return

Returns a TouchSensing Operator.

 

Gets a Touch Sensing Operator which contains touch sensing positions.

 

[Example]

   touchSensingOperator = eco.GetTouchSensingOperator()

 


 

GetTechTabFolder(fileName: string, feedbackErrorWhenFileNotFound: bool): string

 

o

fileName

Name of the file with extension or relative path to the file

 

o

feedbackErrorWhenFileNotFound

Activates feedback if no file is found. It is optional parameter and is True by default

 

o

return

Full path to the specified file

Gets the technology table folder path. If the relative path contains a file name with extension then it will return the path to that file.

 

[Example]

   filePath = Operator.GetTechTabFolder("WeldingAttrib.csv")

 


 

IsEventCreatedAutomatically(): bool

 

o

return

True if the Event was created by a rule or by another Event, False if inserted manually.

 

Get if the reference event was created by a rule, another event, or inserted manually.

 

[Example]

   logging.LogInfo(f"Current event was created automatically = {eco.IsEventCreatedAutomatically()}.")

 


 

ExecuteBrushEventCompute(brushNumber: int, gunNumber: int)

 

o

brushNumber

The number of the brush to be set.

 

o

gunNumber

The number of the gun for which the brush should be set. 0 means all guns.

 

Executes everything that needs to be done for the compute of a brush event. That is an event that sets a specific brush number to a specific gun number.

Gun number 0 means all guns.

 

[Example]

   eco.ExecuteBrushEventCompute(2, 5)

 


 

ExecuteBrushEventCompute(brushNumber: int, gunNumber: int, exactStop: bool, triggerRelatedToStart: bool, triggerTime: double, triggerDistance: double)

 

o

brushNumber

The number of the brush to be set.

 

o

gunNumber

The number of the gun for which the brush should be set. 0 means all guns.

 

o

exactStop

Exact stop on event. Default = true.

 

o

triggerRelatedToStart

Trigger delta related to start(true) or end point(false). Default = true.

 

o

triggerTime

Trigger time.

 

o

triggerDistance

Trigger distance.

 

Executes everything that needs to be done for the compute of a brush event. That is an event that sets a specific brush number to a specific gun number.

Gun number 0 means all guns.

 

[Example]

   eco.ExecuteBrushEventCompute(2, 5, false, true, 0.0, 30.0)

 


 

ExecuteGunEventCompute(gunState: bool, gunNumber: int)

 

o

gunState

Whether to turn the gun on or off.

 

o

gunNumber

The number of the gun to be turned on or off. 0 means all guns.

 

Executes everything that needs to be done for the compute of a gun event. That is an event that turns a specific gun number on or off.

Gun number 0 means all guns.

 

[Example]

   eco.ExecuteGunEventCompute(true, 4)

 


 

ExecuteGunEventCompute(gunState: bool, gunNumber: int, exactStop: bool, triggerRelatedToStart: bool, triggerTime: double, triggerDistance: double)

 

o

gunState

Whether to turn the gun on or off.

 

o

gunNumber

The number of the gun to be turned on or off. 0 means all guns.

 

o

exactStop

Exact stop on event. Default = true.

 

o

triggerRelatedToStart

Trigger delta related to start(true) or end point(false). Default = true.

 

o

triggerTime

Trigger time.

 

o

triggerDistance

Trigger distance.

 

Executes everything that needs to be done for the compute of a gun event. That is an event that turns a specific gun number on or off.

Gun number 0 means all guns.

 

[Example]

   eco.ExecuteGunEventCompute(true, 4, false, false, 5.0, 0.0)

 


 


Previous
Page précédente
Chapter
Page principale du chapitre
Next
Page suivante