Customize Vertical Stacker

Hello, I tried to customize python code of the original vertical stacker, but it isn’t going well.

I would like to make the stacker to stack components flowed from a feeder in vertically and have an AGV to carry the bundle.
Conditions:
・In case of StackSize Value = 1, use it as a normal conveyor with doing anything.
・In case of StackSize Value >=2, stack components same as original function until last components is arrived, but attach last components (N=StackSize) to stack without lifting and convey all of them.
ex) Case of Stacking 3(StackSize=3) numbers of components
First component:lift it and hold it
Second component:lift it and attach it to first components
Third component:attach the stacked components (first and second one) without lifting third
・make AGV recognize to the bottom of the bundle not to top of them

Sample.vcmx (1021.6 KB)