I am new to Python. I would like to know how to know if I have a component present in my buffer.
What I would like to do is to have a boolean signal, if I have a part in my buffer, the signal becomes true, otherwise it is false. Like this, I can trigger some action in process nodes with the get or wait signal. I create a boolean signal in the behavior of my buffer and connected it to a new python script where I want to code my program.
If anyone can help me with this it would be greatly appreciated.
Thank you!
Thank you so much, it worked perfectly! Do you know how I can know if it is a part of type 1 or 2? I put in the product properties PartType. If I have a fixture of type 1 available in my buffer 1 and a part of type 1 available in buffer2 I can proceed with an assembly.
I figure I can have one signal per part type, so I could set the respective signal to True in a switch case. However, I wonder how to fetch the property if there is a part of typeXYZ in the buffer.
Is there a way to know how many parts of a specific part type are in the buffer? Because for now, my script PythonScript_2 Of the Warehouse_Process_Shelf (the yellow buffer) doesn’t work.
My other problem is that the operator performs the assembly tasks only once. Instead of continuing to assemble as long as there are parts in the buffers. I put Wait Signals in the processExecutors of the Assembly1 and Assembly2, yet looking at the signals, we can see that the SignalPart1 is at False statement, so it’s normal that Otto doesn’t do an assembly, but the SignalPart2 is at True statement, so he should do an assembly.
For your first problem, to determine how many parts of a specific type;
in pseudo code you could say:
part1counter = 0
part2counter = 0
for component in shelf.Components:
if component.ProductType == part 1:
part1counter += 1
if component.ProductType == part 2:
part2counter += 1
print(part1counter, part2counter)
For the second problem, I suppose this has to do with the waitsignal statements in your assembly process nodes. If the property ‘waittrigger’ is on on your waitsignal statements, try turning them all off