Python scripting OLP - Objects

CENPyOlpMatrix

Previous  Chapter  Next

 

Methods

 

Translate(x: float, y: float, z: float, withinLocalSystem: bool)

 

o

x

x coordinate

 

o

y

y coordinate

 

o

z

z coordinate

 

o

withinLocalSystem

the referring to local system (True), (False) for global

Translate the matrix.

 

[Example]   

   myMat.Translate(0, 1, 2, False)

 


 

RotateX(angle: float)

 

o

angle

rotate angle (Degrees)

 

Rotate around x axis.

 

[Example]

   myMat.RotateX(90)

 


 

RotateY(angle: float)

 

o

angle

rotate angle (Degrees)

 

Rotate around y axis.

 

[Example]

   myMat.RotateY(-180)

 


 

RotateZ(angle: float)

 

o

angle

rotate angle (Degrees)

 

Rotate around z axis.

 

[Example]

   myMat.RotateZ(60)

 


 

Rotate (angle: float, axis: CENPyOlpVector)

 

o

angle

angle in degrees to rotate

 

o

axis

axis to rotate around

 

Rotate around given axis.

 

[Example]

def PostInitManufacturingGeometry(TechMfGeoInitOperator):

   logOperator = TechMfGeoInitOperator.GetLoggerOperator()

   currentProcessGeometryOperator = TechMfGeoInitOperator.GetCurrentProcessGeometryOperator()   

   myMat = currentProcessGeometryOperator.GetRegshapeCenter()  

   logOperator.LogDebug(str(myMat.GetRotation()))

   rotAxis = CENPyOlpVector(0, 0, 1)

   myMat.Rotate(90, rotAxis)

   logOperator.LogDebug(str(myMat.GetRotation())) 

 


 

GetPosition(): CENPyOlpPoint

 

o

return

CENPyOlpPoint object that contains current location

 

Get position of matrix as a point.

 

[Example]

matPosition = myMat.GetPosition()

 


 

GetXDirection(): CENPyOlpVector

 

o

return

CENPyOlpVector object that contains direction X vector

 

Get x direction as vector.

 

[Example]

directionX = myMat.GetXDirection()

 


 

GetYDirection(): CENPyOlpVector

 

o

return

CENPyOlpVector object that contains direction Y vector

 

Get y direction as vector.

 

[Example]

directionY = myMat.GetYDirection()

 


 

GetZDirection(): CENPyOlpVector

 

o

return

CENPyOlpVector object that contains direction Z vector

 

Get z direction as vector.

 

[Example]

directionZ = myMat.GetZDirection()

 


Transform(pyPointToTransfor: CENPyOlpPoint): CENPyOlpPoint

 

o

pyPointToTransfor

CENPyOlpPoint point to transform

 

o

return

CENPyOlpPoint object that contains transformed point

 

Transform a point with this matrix.

 

[Example]

transformedPoint = myMat.Transform(pyPoint)

 


GetRotation(inDegrees: bool): tuple

 

o

return

tuple(angleX, angleY, angleZ)

 

o

inDegrees

Flag that determines whether to return angles in radians or degrees. Default: radians (when nothing or False is specified)

 

Get rotation X, Y, Z angles of this matrix as tuple. Rotation angles are in radians by default and in degrees if input parameter True is specified.

 

[Example]

logOperator.LogDebug("RX, RY, RZ angles in radians: " + str(matrix.GetRotation()))

logOperator.LogDebug("RX, RY, RZ angles in degrees: " + str(matrix.GetRotation(True)))

 


 

Inverse(): CENPyOlpMatrix

 

o

return

CENPyOlpMatrix object that contains inverted matrix

 

Invert the matrix.

 

[Example]

invMax = myMat.Inverse()

 


 

Multiply(pyLeftMatrix: CENPyOlpMatrix, pyRightMatrix: CENPyOlpMatrix): EVENTRULENAME

 

 

o

pyLeftMatrix

CENPyOlpMatrix object that contains input of left matrix

 

o

pyRightMatrix

CENPyOlpMatrix object that contains input of right matrix

 

o

return

CENPyOlpMatrix object that contains resulting matrix

 

Multiply two matrices.

 

[Example]

resMax = myMat.Multiply(myMatL, myMatR)

 


 

SetRotation(firstAxis: CENPyOlpVector, secondAxis: CENPyOlpVector, axesPair: RotationAxes)

 

 

o

firstAxis

CENPyOlpVector object that contains the first rotation vector (corresponding to the first letter of the RotationAxes).

 

o

pyRightMatrix

CENPyOlpVector object that contains the second rotation vector (corresponding to the second letter of the RotationAxes).

 

o

axesPair

ROTATIONAXES_XY, ROTATIONAXES_YZ or ROTATIONAXES_ZX which is an

Integer value that determines which axes the first and second vectors are (see RotationAxes).

 

  Sets the rotational part of the matrix as determined by the two input vectors.

  The input vectors are assumed to be orthogonal and normalized.

 

 

[Example]

myMat.SetRotation(Axis1, Axis2, ROTATIONAXES_YZ)

 


SetRotation(xAxis: CENPyOlpVector, yAxis: CENPyOlpVector, zAxis: CENPyOlpVector)

 

 

o

xAxis

CENPyOlpVector object that contains the vector for the X axis.

 

o

yAxis

CENPyOlpVector object that contains the vector for the Y axis.

 

o

zAxis

CENPyOlpVector object that contains the vector for the Z axis.

 

Sets the rotational part of the matrix as determined by three input vectors.

 The input vectors are assumed to be orthogonal and normalized.

 

[Example]

myMat.SetRotation(Axis1, Axis2, ROTATIONAXES_YZ)

 


 

GetDistance(otherMatrix: CENPyOlpMatrix): float

 

 

o

otherMatrix

CENPyOlpMatrix object that contains another matrix

 

o

return

The distance to another matrix

 

Returns the distance between this matrix and the given matrix.

 

[Example]

distance = myMat.GetDistance(toolMatrix)

 


 

IsValid(): bool

 

 

o

return

True if object is associated with valid OLP matrix, false if not

 

[Example]

toolFrameMatrix = olpController.GetActiveToolFrameMatrix()

if toolFrameMatrix.IsValid():

   logging.LogInfo("ToolFrameMatrix is valid!")

else:

   logging.LogInfo("ToolFrameMatrix is invalid!")

 


 


Previous
Previous page
Chapter
Chapter page
Next
Next page