I want to write a script, the goal is to find a Token object (has been created) in the model, then transfer its length to string, and return it, how can I do.
I want to write a script, the goal is to find a Token object (has been created) in the model, then transfer its length to string, and return it, how can I do.
Hi @laijunyi1996,
It's hard to know how to help without looking at your model. To receive a more accurate solution, please post your model or a sample model that demonstrates your question.
Proprietary models can be posted as a private question visible only to FlexSim U.S. support staff. You can also contact your local FlexSim distributor for phone or email help.
Thanks.
I hope my model works like this
queue1: inventory
queue2: waiting line
branch: generate demand(random number of box)
first, operator1 take 10 groups of boxes from queue1 into queue2, then flexsim send the demand quantities of each branch to python , then python calculate the best transport route (VRP problem), the drivers transport box along given route.
so I want to achieve that flexsim can collect the quantites of each demand , then spell them in to a string, then send it to python. this requires that flexsim locates these tokens (GroupOfItems1234), return its quantites in script.
If you have a token for each box/item then you can create a pointer to the token that created it (or was created by an item event). For example in the Create Objects activity you can add the pointer like this:
Using the pointer you can then get the unique id from the item reference using:
Token mytoken=item.token; int myid=mytoken.id
or
item.token.as(Token).id
This way the token has a label 'item' and the item has a label 'token' so they can find each other without you having to search through all the tokens.
14 People are following this question.
FlexSim can help you understand and improve any system or process. Transform your existing data into accurate predictions.
FlexSim is a fully 3D simulation software environment. FlexSim can be used to simulate any process in any industry.
FlexSim®, FlexSim Healthcare™, Problem Solved.®, the FlexSim logo, the FlexSim X-mark, and the FlexSim Healthcare logo with stylized Caduceus mark are trademarks of FlexSim Software Products, Inc. All rights reserved.
Privacy | Do not sell or share my personal information | Cookie preferences | Report noncompliance | Terms of use | Legal | © Autodesk Inc. All rights reserved