Free Roller Conveyor

Properties

Name Type Description
ProductCount Integer Gets the number of products currently on the free roller conveyor
PreviousConnection Connection Gets previous connection object
Products Array of Product Gets an array of products that are currently on the free roller conveyor
PESensors Array of PE Sensor Gets an array of PESensors that are on the free roller conveyor
Length Number Gets/Sets the length of the free roller conveyor
RollersColor String New in V7.6 Gets/Sets the name of the color of the rollers
BaseColor String New in V7.6. Gets/Sets the name of the color of the base
LeftSidePanelColor String New in V7.6. Gets/Sets the name of the color of the left side panel rollers
RightSidePanelColor String New in V7.6. Gets/Sets the name of the color of the right side panel rollers
RollersVisible Boolean New in V7.6. Gets/Sets the visibility of the surface
BaseVisible Boolean New in V7.6. Gets/Sets the visibility of the base
LeftSidePanelVisible Boolean New in V7.6. Gets/Sets the visibility of the left side panel
RightSidePanelVisible Boolean New in V7.6. Gets/Sets the visibility of the right side panel

Events

OnProductAdded

Invoked when a product is added to the free roller conveyor

Note: This event does not support multiple subscription. Previous subscription will be lost if subscribe twice.

Callback Signature

void xxxxxxxxxxxxxxxxx(sender: object, product: Product);

 

Name Type Description
sender Object The object associated with the changed property
product Product The added product

OnProductRemoved

Invoked when a product is removed from the free roller conveyor

Note: This event does not support multiple subscription. Previous subscription will be lost if subscribe twice.

Callback Signature

void xxxxxxxxxxxxxxxxx(sender: object, product: Product);

 

Name Type Description
sender Object The object associated with the changed property
product Product The removed product

   

Example script:

var oConv = GetComponentByNameAndType("FreeRollerConveyor1", "Free Roller Conveyor");

function onAdded1(sender, product) {   // will be called when products are added to the FRC

    LogDebug("Added " + sender.Name);
    LogDebug("Added " + product.Name);
}

function onRemoved1(sender, product) {  // will be called when products are removed from the FRC

    LogDebug("removed " + sender.Name);
    LogDebug("removed " + product.Name);
}

function OnSimulationStart() {
			
    LogDebug("OnSimulationStart called");
    Subscribe("OnProductAdded", "FreeRollerConveyor1", "onAdded1");
    Subscribe("OnProductRemoved", "FreeRollerConveyor1", "onRemoved1");
}

Functions

Array GetProductInArea(start: double, end: double)

Called to get an array of 'Product' objects within the specified range along the free roller conveyor

Name Type Description
start Double The start distance of the area to check in the units chosen when the project was created (metres or feet)
end Double The end distance of the range to check in the units chosen when the project was created (metres or feet)

Return value - An Array object that contains product object references, the return value may also be null if no product is found

Example script:

var ps = oConv.GetProductInArea(0,1);

for (var i = 0; i < ps.length; ++i) {
	
    LogDebug("area 0 - 1 products : " + i + " " + ps[i].Name);
}

void SetPreviousConnection(previous: object, distance: double)

Called to set the previous transporter

Name Type Description
previous object The free roller conveyor to set as the target, if target is 'None' set object to 0
distance Double The connection distance in the units chosen when the project was created (metres or feet)

Return value - None

 

The connections set using SetPreviousConnection are evaluated when product is placed on the free roller conveyor. Any product on the free roller conveyor when the connections are changed will use the old connections.

   

Example script:

var oConv = GetComponentByNameAndType("FreeRollerConveyor1", "Free Roller Conveyor");
var oConv2 = GetComponentByNameAndType("Conveyor1", "Conveyor");

function OnSimulationStart() {

    LogDebug("OnSimulationStart called");
    oConv.SetPreviousConnection(oConv2, 0);
}

blockageHandle CreateBlockage(distance: double, blockagehandle: integer)

Called to set a blockage on the free roller conveyor at the specified distance from the beginning of the free roller conveyor with an optionally specified handle. The handle returned is the blockage handle to reference this blockage. If a handle was specified it will be the same handle returned.

Name Type Description
distance Double The distance of the blockage from the beginning of the free roller conveyor in the units chosen when the project was created (metres or feet)
blockage handle Integer Optional. If not specified, returns a new handle otherwise returns the handle specified

Return value - blockagehandle

 

By calling CreateBlockage with the same handle the blockage can be moved to a new distance.

 

Using a Product object as the blockage handle can be used to create a blockage linked to a product.

void RemoveBlockage(blockageHandle: integer)

Called to remove a previously created blockage on the free roller conveyor

Name Type Description
blockageHandle Integer The handle for the blockage to remove

Return value - Void

 

No error is produced if RemoveBlockage is called with a non-existent Blockage handle.

A Blockage can only be removed by specifying its handle.

 

Example script:

var oBlockConv;
var oConv = GetComponentByNameAndType("FreeRollerConveyor1", "Free Roller Conveyor");

function OnSimulationStart() {
 
    LogDebug("OnSimulationStart called");
    oBlockConv = oConv.CreateBlockage(1);
    SetTimerEx(1234, 5000, "ClearBlockage", null);
    MoveProduct(CreateProduct(), "Conveyor1", 0);
}

function ClearBlockage(timerid, object) {
 
    LogDebug("Products=" + oConv.ProductCount );
    oConv.RemoveBlockage(oBlockConv);
}
>