CrossBeltSorter: UnsubscribeOnBeltBlocking
Called to unsubscribe the previously created belt blocking event
Function
bool UnsubscribeOnBeltBlocking(blockHandle: integer);
Parameters
Name | Type | Description |
---|---|---|
blockHandle | Integer | The handle which belt block to be remove. |
Return Value
The value will be true if remove block successfully.
Example
var cbs;
var handle1;
var handle2;
var count = 0;
var count1 = 0;
function OnSimulationStart() {
cbs = GetComponentByNameAndType("CrossBeltSorter1", "Cross Belt Sorter");
handle1 = cbs.SubscribeOnBeltBlocking(OnBeltBlockingCallBack_Position1, 5.6);
handle2 = cbs.SubscribeOnBeltUnblocking(OnBeltUnblockingCallBack_Position1, 5.6);
}
function OnBeltBlockingCallBack_Position1(sender, beltIndex, product) {
if(product != null) count++;
if(count == 8) UnsubscribeBlocking(handle1);
}
function OnBeltUnblockingCallBack_Position1(sender, beltIndex, product) {
if(product != null) count1++;
if(count1 == 12) UnsubscribeUnblocking(handle2);
}
function UnsubscribeBlocking(handle) {
cbs.UnsubscribeOnBeltBlocking(handle);
}
function UnsubscribeUnblocking(handle) {
cbs.UnsubscribeOnBeltUnblocking(handle);
}