vcDataContainer
General purpose Python wrapper for data such as event arguments. The available Properties are different depending on each use case.
Examples
Example. Custom transport controller to handle "Work" statements
from vcScript import * global events events = [] comp = getComponent() def my_work(data_cont_): # gets an event when "Work" statement gets executed # store the "Work" data to "events" global list global events data = ["Work", data_cont_] events.append(data) trigger.signal(True) def OnRun(): # simulation starts global events while True: # waits until "events" global list has content condition(lambda: events) event = events.pop(0) if event[0] == "Work": data_cont = event[1] # read data_cont (vcDataContainer) work_id = data_cont.RequestId work_time = data_cont.ProcessTime resource_mtx = data_cont.ResourcePositionMatrix #move_resource(resource_mtx) # not implemented delay(work_time) tc.workDone(work_id) # initialize variables tc = comp.findBehaviour("TransportController") tc.OnBeginWorkEx = my_work trigger = comp.findBehaviour('Trigger') |