question

VikSin avatar image
0 Likes"
VikSin asked VikSin commented

Clear flowitems using code

Hello, i have model that consists of different rack objects (Warehouse model) and i am creating user command for deleting all flowitems in the warehouse.
I don't want to use model reset, because on model reset there are some triggers which i don't want to run.

Is there some FlexSim command or way how to achieve it ?

Thank you in advance :)

FlexSim 23.2.0
flexscriptflowitemusercommand
· 1
5 |100000

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

Jeanette F avatar image Jeanette F ♦♦ commented ·

Hi @VikSin, was Joerg Vogel's answer helpful? If so, please click the "Accept" button at the bottom of their answer. Or if you still have questions, add a comment and we'll continue the conversation.

If we haven't heard back from you within 3 business days we'll auto-accept an answer, but you can always comment back to reopen your question.

1 Like 1 ·

1 Answer

·
Joerg Vogel avatar image
1 Like"
Joerg Vogel answered VikSin commented

treenode.subnodes.clear() - a method to destroy subnodes of a container node. Unfortunately you have to call it on every involved rack object. Perhaps you do it with forobjecttreeunder - a command.

· 5
5 |100000

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

VikSin avatar image VikSin commented ·

Thank you Joerg. I was thinking about this solution but also searched for some more universal way. This way I can delete for example all subnodes of the plane object (so all processors, racks etc that are under racks), am I wrong ? (one of the solution would be to put all racks that I want to clear under one group and clear just this group via subnodes.clear()).

However I was thinking if there is some internal command etc ? Because in model reset all flowitems objects are destroyed, so this could be somehow achieved or replicated

0 Likes 0 ·
Jason Lightfoot avatar image Jason Lightfoot ♦ VikSin commented ·
If you are wanting to reset the model like this, it sounds more like you are running a different scenario. Have you considered running scenarios via the experimenter?
0 Likes 0 ·
VikSin avatar image VikSin Jason Lightfoot ♦ commented ·

I am using Flexsim for visualization purpose. On reset model, the data for vizualization are loaded from database. Then I am switching between different views in the model. Each view is made of different flowitems in different slots, so that's why i need to clear warehouse between jumping from one view to another.

1 Like 1 ·
Show more comments

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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