Basicshape: GoToPosition

This function moves the basic shape to the specified xyz coordinate, the specified xyz speeds,callbackfunction is called,CallbackInterval is interval time after callback function is called,intOffsetArray is the time callback function is called when equipment reaches its destinaiton,xyz Ac is the acceleration of specific coordinates and xyz Dec is the deceleration of specific coordinates

Function

void GoToPosition(x, y, z, xSpeed, ySpeed, zSpeed);

void GoToPosition(x, y, z, xSpeed, ySpeed, zSpeed, xAcc, xDec, yAcc, yDec, zAcc, zDec);

void GoToPosition(x, y, z, xSpeed, ySpeed, zSpeed,CallbackFunction);

void GoToPosition(x, y, z, xSpeed, ySpeed, zSpeed,CallbackFunction, xAcc, xDec, yAcc, yDec, zAcc, zDec);

void GoToPosition(x, y, z, xSpeed, ySpeed, zSpeed,CallbackFunction, CallbackInterval);

void GoToPosition(x, y, z, xSpeed, ySpeed, zSpeed,CallbackFunction, CallbackInterval, xAcc, xDec, yAcc, yDec, zAcc, zDec);

void GoToPosition(x, y, z, xSpeed, ySpeed, zSpeed,CallbackFunction, intOffsetArray);

void GoToPosition(x, y, z, xSpeed, ySpeed, zSpeed,CallbackFunction, intOffsetArray, xAcc, xDec, yAcc, yDec, zAcc, zDec);

Parameters

Name Type Description
x Number The X coordinate of the target position
y Number The Y coordinate of the target position
z Number The Z coordinate of the target position
xSpeed Number The speed along the X axis
ySpeed Number The speed along the Y axis
zSpeed Number The speed along the Z axis
CallbackFunction Number Callback function will be called
CallbackInterval Number Interval in milliseconds when callback function is called
intOffsetArray Array Array of integer values in milliseconds. The callback function is called when equipment reaches any of those offset.
xAcc Number Acceleration of X axis
xDec Number Deceleration of X axis
yAcc Number Acceleration of Y axis
yDec Number Deceleration of Y axis
zAcc Number Acceleration of Z axis
zDec Number Deceleration of Z axis

Return Value

None

Example

function OnSimulationStart()
{
    InitAnimation();
    StartAnimation(); 
}

function InitAnimation()
{
    //-- get basic shapes
    _basicShape1 = GetComponentByNameAndType("BasicShape1", "Basic Shape");
    _basicShape1.X = 0.0
    _basicShape1.Y = 0.0

    _basicShape2 = GetComponentByNameAndType("BasicShape2", "Basic Shape");
    _basicShape2.X = 2.0
    _basicShape2.Y = 0.0

    _basicShape3 = GetComponentByNameAndType("BasicShape3", "Basic Shape");
    _basicShape3.X = 4.0
    _basicShape3.Y = 0.0

    _basicShape4 = GetComponentByNameAndType("BasicShape4", "Basic Shape");
    _basicShape4.X = 6.0
    _basicShape4.Y = 0.0

    _basicShape5 = GetComponentByNameAndType("BasicShape5", "Basic Shape");
    _basicShape5.X = 8.0
    _basicShape5.Y = 0.0

    _basicShape6 = GetComponentByNameAndType("BasicShape6", "Basic Shape");
    _basicShape6.X = 10.0
    _basicShape6.Y = 0.0

    _basicShape7 = GetComponentByNameAndType("BasicShape7", "Basic Shape");
    _basicShape7.X = 12.0
    _basicShape7.Y = 0.0

    _basicShape8 = GetComponentByNameAndType("BasicShape8", "Basic Shape");
    _basicShape8.X = 14.0
    _basicShape8.Y = 0.0
}

function StartAnimation()
{
    SubscribeToEvent("OnArrivePosition", _basicShape7.Name, "Basic Shape", "OnArrivePosition_callbackFromEvent");
    Move();
}

function OnArrivePosition_callback( sender, x, y, z)
{
    LogDebug("-> OnArrivePosition_callback " + sender.Name + " Arrived x=" + x + " y=" + y + " z=" + z)
}

function OnArrivePosition_callbackFormEvent( sender, x, y, z)
{
    LogDebug("-> OnArrivePosition_callbackFormEvent " + sender.Name + " Arrived x=" + x + " y=" + y + " z=" + z)
}

function Move()
{
    //-- Default
    _basicShape1.GoToPosition(0, 0, 5, 0, 0, 1);

    //-- Default with Acceleration deceleration
    _basicShape2.GoToPosition(2, 0, 5, 0, 0, 1, 0, 0, 0, 0, 0.5, 0.5); 

    //-- With callback
    _basicShape3.GoToPosition(4, 0, 5, 0, 0, 1, OnArrivePosition_callback);

    //-- With callback and Acceleration deceleration
    _basicShape4.GoToPosition(6, 0, 5, 0, 0, 1, OnArrivePosition_callback, 0, 0, 0, 0, 0.5, 0.5); 

    //-- with callback, interval
    _basicShape5.GoToPosition(8, 0, 5, 0, 0, 1, OnArrivePosition_callback, 500);

    //-- With callback ,interval and Acceleration deceleration
    _basicShape6.GoToPosition(10, 0, 5, 0, 0, 1, OnArrivePosition_callback, 500, 0, 0, 0, 0, 0.5, 0.5);

    //-- With callback, offset
    _basicShape7.GoToPosition(12, 0, 5, 0, 0, 1, OnArrivePosition_callback, [3000,2000,1000,500]);

    //-- With callback, offset and acceleration deceleration
    _basicShape8.GoToPosition(14, 0, 5, 0, 0, 1, OnArrivePosition_callback, [3000,2000,1000,500], 0, 0, 0, 0, 0.5, 0.5); 
}