When a component creator is triggered to create a new dynamic components, the former can access the component API to modify the parameters of the dynamic component during simulation runtime. This can be achieved by creating parameters in the creator that will match the parameters in the dynamic component, then accessing these through a Python script. The code that performs this is as follows:
from vcScript import *
def OnRun():
comp = getComponent()
creator = comp.findBehaviour("ComponentCreator")
conv = comp.findBehaviour("One-WayPath")
#this is used as a dummy counter
counter = 0
while counter <comp.CreatorLimit:
delay(creator.Interval)
#the system will delay the creation of new components,
#as long as there is a component in the path
while conv.ComponentCount >0:
delay(creator.Interval)
#a component is created
ccomp = creator.create()
#A small delay to ensure that the component is already in the 3Dworld
delay(0.1)
#Simply match the parameters of the dynamic component to those of the creator
ccomp.getProperty("ProductSizeX").Value = comp.getProperty("ProductSizeX").Value
ccomp.getProperty("ProductSizeY").Value = comp.getProperty("ProductSizeY").Value
ccomp.getProperty("ProductCountX").Value = comp.getProperty("ProductCountX").Value
ccomp.getProperty("ProductCountY").Value = comp.getProperty("ProductCountY").Value
ccomp.getProperty("PalletSizeX").Value = comp.getProperty("PalletSizeX").Value
ccomp.getProperty("PalletSizeY").Value = comp.getProperty("PalletSizeY").Value
Simply the code matches the dynamic component parameters with those of the component creator. This is useful when a pallet is parametric, and the same pallet is loaded in different layouts with different size.