Conveyor: CreateBlockage

Called to set a blockage on the Conveyor at the specified distance from the beginning of the 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.

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.

Function

blockagehandle CreateBlockage(distance: double, blockagehandle: integer)

Parameters

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

Return Value

A handle value that will be used to remove the blockage.

Example

var oBlockConv;
var oConv = GetComponentByNameAndType("Conveyor1", "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);
}