question

Simone F avatar image
0 Likes"
Simone F asked Simone F commented

Clear the model using a script

Hi,

is it possible concurrently destroy/delete all the objects from the library currently in the model using a script?

FlexSim 20.2.3
flexsim 20.2.3scriptdestroy object
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

Jason Lightfoot avatar image
0 Likes"
Jason Lightfoot answered Simone F commented
for (int n=content(model());n>1;n--) {
    destroyobject(rank(model(),n));
}
· 3
5 |100000

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

Simone F avatar image Simone F commented ·

Hi, thank you for the answer! The script work but doesn't delete the AGV path (all the object under AGVNetwork). There is a solution for this problem?

0 Likes 0 ·
Jason Lightfoot avatar image Jason Lightfoot ♦♦ Simone F commented ·

So you don't want to use "New Model" ? I can only assume you have some usercommands or process flows defined that you want to keep.

for (int n=content(model());n>1;n--) {
    treenode o=rank(model(),n);
    if (o.name=="AGVNetwork")
        while (content(o))
            destroyobject(o.first);
    else
        destroyobject(o);
}


0 Likes 0 ·
Simone F avatar image Simone F Jason Lightfoot ♦♦ commented ·

I create all the objects through the process flow reading some values from tables. I want to create a loop where I create the warehouse, make the simulation, save the results, destroy the objects, modify the values and restart a new simulation (all in automatic). So i need to clear the model but i can't just open a new model. However everything works fine now. Thank you so much for your time!

0 Likes 0 ·