question

joey avatar image
0 Likes"
joey asked Patrick Zweekhorst commented

Can set the appearance of the item on the truck?

Hello everyone. I want to know if I can change the appearance of the items on the truck?

This is the current position of the item on the truck.

But I want the items on the truck to be put in this way.

Thank you.

FlexSim 19.0.4
taskexecuter
5.png (93.5 KiB)
7.png (45.0 KiB)
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

1 Answer

Aaron C avatar image
1 Like"
Aaron C answered Patrick Zweekhorst commented

I did this a while ago when I first started using FlexSim, so there may be a better way to do this, but if you put this code in your truck's OnLoad trigger and set the 4 global variables on the left as follows, it will work for you, after you tweak the values to make it fit YOUR truck, of course.

Global Variables:
lastItem: Type = treenode, value = null
itemNumber: Type = integer, value = 1
lastItem2:Type = treenode, value = null
itemNumber2: Type = integer, value = 1


truckload.jpg (497.4 KiB)
· 6
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Mischa Spelt avatar image Mischa Spelt commented ·

Nice solution, but can I recommend to use labels instead of global variables here? You will run into problems if you need a second truck in the model. Instead of writing "lastItem" just write "current.lastItem" everywhere, to give the truck a local set of values.

1 Like 1 ·
Aaron C avatar image Aaron C Mischa Spelt commented ·

100% agree! And exactly to your point (I missed this when pulling this file up), I only use lastItem2 and itemNumber2 in this script because this IS a second truck in that model haha. So yeah @joey , definitely take @Mischa Spelt's advice and use labels instead of global variables!

0 Likes 0 ·
joey avatar image joey Mischa Spelt commented ·

HI @Mischa Spelt @Aaron C Thank you for a good idea, but I don't understand. I set the value in OnLoad trigge, but it's not successful or I'm wrong. Please also give me more advice. Thank you in advance for help.

0 Likes 0 ·
Patrick Zweekhorst avatar image Patrick Zweekhorst joey commented ·

Hi @joey ,

Since you didn't upload your model I am not sure what goes wrong in your case. But I have made an example model (see attachment) that uses label values on the truck. I have added a reset trigger and a on load trigger to the truck. So if you copy this it should work for your truck as well (you might need to change the default values I use in de onReset trigger, since you truck will be different.

If it is not clear, of if you want to know what goes wrong in your model please let me know.

0 Likes 0 ·
loadtruck.fsm (144.1 KiB)
Show more comments