Control Product Creator with boolean signal


I use a Product Creator to have a random distribution of three different product dropping vertical into a container. I would like to be able to use a sensor signal to pause product creation when the container is full (because the products drop, i cannot use the outpath capacity of the creator). In my py script i have tried to change distribution mode to “0” (single) on signal change and back to “3” (distribution). But even though i can see on the properties panel of the Product Creator, that the script is changing the mode, and i have changed the maximum number of single products to 0, the creator keeps running thus overfilling my container.

Is there an alternative way/method for controlling the Product Creator?

Hello rasmussen,

maybe you can stop/start the creation of products in the OnRun Event by evaluating the sensor signal in the python script.

Something like this:

while True:
if sensorSignal.Value == True:
triggerCondition(lambda: getTrigger() == sensorSignal and sensorSignal.Value == False)
part = creator.create()

This won’t work (at least in 4.2.2) because the product creator behaviour doesn’t have a create method like the component creator.

Thank you @Max for the suggestion. As @TSy points out the “create” method is not present in the ProductCreator and i get “NameError: Attribute or method ‘create’ not found.” error. This is why i tried to modify its property “FeedMode” as a workaround, but i suppose modifying properties does not apply until model is restarted. I did try the “update” method to see if this would change the feed mode on the run, but it did not.

Sorry I misread. I thought it was a component creator!

What the op described sounds like a process. Some alt-ways to consider.

Hamburger - Use a Component Creator and try using the converter component in the eCat for making the components products.

Hotdog - Don’t use a Product Creator. Instead use a Process Executor to make the products according to the needed process.

Layout - Product Creator OnSignal.vcmx (339.6 KB)

Popcorn - Don’t use a Product Creator. Instead use a Process Executor and make a custom statement. A little tedious, and try to avoid scripting. For Hotdog, I used a script to set a property value because there is no requirement statement that can read a signal value. Sure, I could use a WaitSignal task, but that would mean by process is always running.

Fried Pickel - Play around with the Limit property of the creator in a script. Not a fan of this, and it is error prone.