ATTENTIONThis FlexSim Community Forum is read-only. Please post any new questions, ideas, or discussions to our new community (we call it Answers) at https://answers.flexsim.com/. Our new Question & Answer site brings a modern, mobile-friendly interface and more focus on getting answers quickly. There are a few differences between how our new Q&A community works vs. a classic, threaded-conversation-style forum like the one below, so be sure to read our Answers Best Practices. |
flexsim.com |
#1
|
|||
|
|||
Clear model layout
Hi all,
I am creating a function that builds up a model using information from a global table. But everytime I run it, I first need to delete all the objects in the model view. So I need a function with which I can delete all the objects in the model view, but I don't know where to find this? Anyone got an idea? Thanks! Ben |
#3
|
|||
|
|||
Hi Steven,
That doesn't really work for me. applicationcommand("newmodel"); opens a completely new model, but than also all global tables, user commands etc.. disappear.. I just want the objects in my model layout to be deleted, but maintain everything else. I found a function that might work: selectAll(); deleteselected(); This deletes all the objects, but I am afraid it might also delete some other vital functionalities. What do you think about this? Thanks, Ben |
#4
|
||||
|
||||
Those commands will probably work for what you are trying to do, but if you want to have more precise control over what is happening, you could use destroyobject() within a while() loop:
Code:
while(content(model()) > 1) destroyobject(last(model())); Code:
while(content(model()) > 2) destroyobject(last(model())); |
The Following 3 Users Say Thank You to Phil BoBo For This Useful Post: | ||
Jörg Vogel (07-01-2015) |
#5
|
||||
|
||||
Hi Benjamin,
Adding on to Mr Phil Bobo's post.If you are having the names of the objects to be deleted, stored in the Global Table. You can use the destroyobject command like this. int columnnumber = 1;// column number of names for(int i =1;i<=gettablerows("Global Table");i++) { treenode object = node(gettablestr("GlobalTable",i,columnnumber),mod el()); if(objectexists(object)) { destroyobejct(object); } } Last edited by arunkrmahadeva; 07-01-2015 at 10:02 AM. Reason: correction |
The Following User Says Thank You to arunkrmahadeva For This Useful Post: | ||
Benjamin Cohen (07-03-2015) |
Tags |
clearcontents, delete fixed resources, model view |
Thread | Thread Starter | Forum | Replies | Last Post |
Layout Change in Experimenter | Esteban Echeverry | Q&A | 6 | 08-26-2014 12:16 AM |
optimization of layout | naveenkumar | Tips and Tricks | 7 | 02-02-2012 06:00 AM |
WALLS IN A LAYOUT | naveenkumar | Tips and Tricks | 4 | 12-06-2011 05:46 AM |
Change Layout from GUI | Nico Zahn | Q&A | 4 | 12-24-2009 07:42 AM |
How to clear the people from conveyor | Ong Wu Sheng | Q&A | 7 | 12-09-2009 10:21 AM |