Component Feeder triggered by boolean signal

I want to create a Component/ Product Feeder, which is triggered by a bool signal and not time based. Which function / Code I am supposed to use in a Python Script to enable the Component/ProductCreator?

Answered in a necro’d thread

Please continue with any further questions here.

Hey Lefa,
thanks for the fast reply. Your Code worked out.
I’ve added one line in the code, so that the signal can produce more products and not only one to the beginning.

from vcScript import *

comp = getComponent()
creator = comp.findBehaviour('ComponentCreator')
signal = comp.findBehaviour('BooleanSignal')

def OnSignal( signal ):
  if signal.Name == 'BooleanSignal' and signal.Value == True:
    creator.Limit = 1
    creator.create() #to create a componant again and again

def OnRun():
  creator.Limit = 0

so thanks and best regards

Now I’ve got another question…
I’ve changed my ComponentCreator to a ProductCreator, so I can use a random distribution by creating products.
But the ProductCreator doesn’t have a method “create()” like the ComponentCreator. Are ther any other options instead of using create()?
Thanks :slight_smile:

Hey Philip,

I haven’t actually… retested this but I’m “fairly” sure that creator.create() is redundant piece of code. The internal side of the creator behaviour should already get toggled off with the limit being either 0 or on when it is larger than 0

I might be completely wrong though.