ATTENTION

This 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

Go Back   FlexSim Community Forum > FlexSim Software > Q&A
Downloads

Q&A Using Flexsim and building models

  #1  
Old 07-01-2015
Benjamin Cohen
Guest
 
Posts: n/a
Downloads: 1
Uploads: 0
Default 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
  #2  
Old 07-01-2015
Steven Hamoen's Avatar
Steven Hamoen Steven Hamoen is offline
Talumis, Flexsim Distributor, The Netherlands
 
Join Date: Aug 2007
Location: Soest, NL
Posts: 854
Downloads: 43
Uploads: 0
Thanks: 391
Thanked 661 Times in 379 Posts
Rep Power: 684
Steven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond reputeSteven Hamoen has a reputation beyond repute
Default

Hi Ben,

Have you tried the command for a new model? applicationcommand("newmodel");


Steven
  #3  
Old 07-01-2015
Benjamin Cohen
Guest
 
Posts: n/a
Downloads: 1
Uploads: 0
Default

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  
Old 07-01-2015
Phil BoBo's Avatar
Phil BoBo Phil BoBo is offline
Flexsim Development
 
Join Date: Jan 2008
Posts: 756
Downloads: 109
Uploads: 18
Thanks: 385
Thanked 1,483 Times in 525 Posts
Rep Power: 1174
Phil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond repute
Default

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()));
If you want to not destroy the FlexsimModelFloor object:

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  
Old 07-01-2015
arunkrmahadeva's Avatar
arunkrmahadeva arunkrmahadeva is offline
CCS, India
 
Join Date: Sep 2013
Location: India
Posts: 71
Downloads: 67
Uploads: 0
Thanks: 285
Thanked 101 Times in 51 Posts
Rep Power: 145
arunkrmahadeva is a jewel in the rougharunkrmahadeva is a jewel in the rougharunkrmahadeva is a jewel in the rougharunkrmahadeva is a jewel in the rough
Default

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


All times are GMT -6.
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.
Copyright 1993-2018 FlexSim Software Products, Inc.