AdvancedTransporter_PickAtom , picking up several atoms

All topics on coding 4Dscript in Enterprise Dynamics.
Post Reply
Pirkule
Posts: 9
Joined: Sunday 16 February, 2014 - 10:58

AdvancedTransporter_PickAtom , picking up several atoms

Post by Pirkule »

Hi,

Does anyone know how to use 4DScritp: AdvancedTransporter_PickAtom to pick up more than just one atom inside from other atom?

I need to modify 4Dscritp:
AdvancedTransporter_PickAtom(Atombyname([Transporter], model), Atombyname([Queue2], model), First(in(2,c)))
so that i can pick up the whole content of atom Queue2 and not just the first atom inside it.
Can this be done?

If i change the First(in(2,c)) for example to Content(Atombyname([Queue2], model) my transporter ends up picking the Queue2 atom itself and not its content.

Regards,
Mikko
Attachments
Advanced_transporter_pickup.mod
(84.36 KiB) Downloaded 302 times
Nick
Posts: 48
Joined: Saturday 15 February, 2014 - 01:52

Re: AdvancedTransporter_PickAtom , picking up several atoms

Post by Nick »

Hi Mikko,

Loop until there is no atom in the queue anymore (or until a certain max).
In other words, use the first(c) statement multiple times.

Regards, Nick
Pirkule
Posts: 9
Joined: Sunday 16 February, 2014 - 10:58

Re: AdvancedTransporter_PickAtom , picking up several atoms

Post by Pirkule »

Hi Nick,

I tried to use code

Code: Select all

if(
   content(c)=2,
   Do(
    CloseOutput(in(1, c)),
    Label([BatchSize],i) := content(c),
    LoopUntil(
      Content(c) = 0,
      AdvancedTransporter_PickAtom(Atombyname([Transporter], model), Atombyname([Queue], model), First(c))) 
   )
)
in my queue's trigger on entry.
What it should do as soon as second atom enters the queue is to close output of previous atom so that no more atoms can enter the queue, set label BatchSize to the current content of queue and call the transporter to pick up whole content of queue.
Now for some reason my Ed program crashes everytime the content of queue is about to reach 2.
Do you have any idea what is cousing this behaviour?
Is there something wrong with my code?

thanks in advance,
Regards, Mikko
Attachments
Advanced_transporter_pickup2.mod
(84.51 KiB) Downloaded 294 times
Thor
Posts: 12
Joined: Thursday 16 January, 2014 - 15:16

Re: AdvancedTransporter_PickAtom , picking up several atoms

Post by Thor »

Hi Mikko,

I believe the loopuntil will crash the program as it keeps calling the advanced transporter requesting pick-up of the product(s). What I did to solve a similar problem is to check for more products to load in the on entry trigger of the AD or on exit of the atom that contains your product. The latter would look someting like this:

On Exit of the atom that contains your product(s):
If(
content(c) > 0,
AdvancedTransporter_PickAtom(Atombyname([Transporter], model), Atombyname([Queue], model), First(c))
)

You will of course need to delete the loopuntil in the entry trigger (but keep the AD_PickAtom command). This way the first pick-up will be triggered on entry and subsequent pick-ups on exit of the queue.

br
Thorsten
Post Reply