vcComponentCreator
vcComponentCreator uses a component as a template for creating other components.
Inherits: vcBehaviour, vcFlow, vcContainer
Properties
Name | Type | Access | Description |
BlockingOptimization | Boolean | RW | Turns on/off the optimization of creator when making new components, thereby improving simulation performance.
If True, the creator will not check for capacity rather listen for event. The creator is informed, for example by component or capacity controller, when there is capacity to make a new component. |
Interval | Real | RW | Defines the interval (in seconds) for creating components. |
Limit | Integer | RW | Defines the maximum number of components that can be created by creator during a simulation. |
Part | String | RW | Defines the URI or VCID of template component. |
PartPooling | Boolean | RW | Turns on/off the reuse of components made by the creator, thereby improving simulation performance.
If True, dynamic components removed during simulation are recirculated to make new components, thereby reducing memory allocation. Caution: Be careful when recirculating components that were modified during simulation, for example a change in node material. |
TemplateComponent | vcComponent | RW | Defines the template used by creator to create new components during a simulation.
Either this property or Part can be used to define the template component of creator. |
Methods
Name | Return Type | Parameters | Description |
create | vcComponent |
[Boolean wait] |
Creates a new component from template, and then returns the new component.
An optional wait argument can be given to use BlockingOptimization. If True, the creator waits for capacity before trying to make a component. If creation fails, returns None. Generally, this occurs when the template is undefined or because of capacity issues. Tip: Set the Limit property to zero in order to disable the internal logic of the creator. |
Examples
Example. Set creation interval and limit
from vcScript import * app = getApplication() comp = app.findComponent("Feeder Template") creator = comp.findBehaviour("ComponentCreator") creator.Interval = 20 creator.Limit = 99999 |
Example. Print created products and their details during simulation
from vcScript import * comp = getComponent() creator = comp.findBehaviour("ComponentCreator") def OnStart(): creator.Interval = 3 creator.Limit = 0 def OnRun(): while True: part = creator.create() # returns None if creation fails (e.g. if path is blocked) #test if part creation was successful #then print name and height of created component if part: # test if part creation was successful print part.Name, part.BoundDiagonal.Z*2 delay(creator.Interval) |