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-02-2008
KelvinHo KelvinHo is offline
Flexsim User
 
Join Date: Jan 2008
Location: Hong Kong
Posts: 129
Downloads: 18
Uploads: 1
Thanks: 44
Thanked 23 Times in 7 Posts
Rep Power: 171
KelvinHo will become famous soon enough
Default is there a command opposite to "destroyobject" which create a object?

I tried to find in the command list but failed.
  #2  
Old 07-03-2008
Lars-Olof Leven Lars-Olof Leven is offline
Flexsim Distributor
 
Join Date: Aug 2007
Location: Sweden, Borlnge
Posts: 312
Downloads: 278
Uploads: 2
Thanks: 300
Thanked 256 Times in 139 Posts
Rep Power: 330
Lars-Olof Leven is a splendid one to beholdLars-Olof Leven is a splendid one to beholdLars-Olof Leven is a splendid one to beholdLars-Olof Leven is a splendid one to beholdLars-Olof Leven is a splendid one to beholdLars-Olof Leven is a splendid one to beholdLars-Olof Leven is a splendid one to behold
Default

Hi,

Look at createinstance and/or insertcopy.

I do not remember which of createinstance and insertcopy is best to use or when they should be used.

Lars-Olof
The Following User Says Thank You to Lars-Olof Leven For This Useful Post:
KelvinHo (07-03-2008)
  #3  
Old 07-03-2008
Jason Lightfoot Jason Lightfoot is offline
Flexsim Consultant
 
Join Date: Aug 2007
Location: Somerset, UK
Posts: 719
Downloads: 20
Uploads: 0
Thanks: 123
Thanked 953 Times in 446 Posts
Rep Power: 773
Jason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond repute
Default

I think as a rule you should use createinstance when creating something from the library, and createcopy when creating a flowitem, a copy of an object in a user library or an instance that is already in the model.

Also when creating flowitems there are examples in Flexsim where the flowitem is created in the model() root and then moved to a fixed resource using moveobject(). I think the advantage of doing this is you get entrytriggers etc, and the flowitem info is managed for you (frinit on the object), including (I believe) moverecords.


Another point is that createcopy will not recycle flowitems. If you want to do that, you'll need to find the recyclecontainer for the flowitem in the FlowItemBin and transfer an item into the model() root and then move that object into your fixed resource. You'll then want to call resetuniqueid(item) and setnodenum(stats_creationtime(item),time())
in order that the stats are correct and you can still output the full history.
The Following 4 Users Say Thank You to Jason Lightfoot For This Useful Post:
Lars-Olof Leven (07-03-2008)
  #4  
Old 07-03-2008
Kris Geisberger Kris Geisberger is offline
Flexsim Canada, Forum Moderator
 
Join Date: Aug 2007
Location: Canada
Posts: 209
Downloads: 54
Uploads: 1
Thanks: 99
Thanked 389 Times in 133 Posts
Rep Power: 451
Kris Geisberger has much to be proud ofKris Geisberger has much to be proud ofKris Geisberger has much to be proud ofKris Geisberger has much to be proud ofKris Geisberger has much to be proud ofKris Geisberger has much to be proud ofKris Geisberger has much to be proud ofKris Geisberger has much to be proud ofKris Geisberger has much to be proud ofKris Geisberger has much to be proud of
Default

Below is some code to support Jason's response for a flowitem with recycling implemented. I usually create a global variable treenode that points to the recycle bin for a given flowitem class (eg. PalletRecycleBin).

For the pallet flowitem, this would be:
MAIN:/project/model/Tools/FlowItemBin/Pallet/2

Note that you will not be able to do this until a recycle bin has been created. The recycle bin is a folder node that is created when the first flowitem enters a Sink with recycling specified for a given flowitem class (see attached screenshot).


int numitems = 10;
treenode nextitem = NULL;

for(int index=1; index<=numitems; index++)
{
if(content(PalletRecycleBin) == 0)
nextitem = insertcopy(prev(PalletRecycleBin), model());
else
{
nextitem = last(PalletRecycleBin);
transfernode(nextitem , model());
}

resetuniqueid(nextitem);
setnodenum(stats_creationtime(nextitem),time());
setitemtype(nextitem, 0); //reset itemtype here if required
//reset labels here if required

moveobject(nextitem, destinationobject); //you will have to define the destinationobject
}
Attached Thumbnails
Click image for larger version
Name:	item recycle bin.jpg
Views:	283
Size:	16.8 KB
ID:	361  
The Following 5 Users Say Thank You to Kris Geisberger For This Useful Post:
Tom David (07-03-2008)


Thread Thread Starter Forum Replies Last Post
Does the "loaduserlibrary" command has a flaw? Steven Hamoen Q&A 1 06-03-2008 02:47 PM
about "no select" and "show parameter window from side bar" qin tian Gripes and Goodies 3 03-21-2008 08:10 AM
Which variable stores "Properties -> General ->Flags -> Protected" information? KelvinHo Q&A 1 03-06-2008 06:18 AM
"Getting Started" and "Tutorial" models for v4.01 Cliff King Product Announcements 0 12-10-2007 07:34 PM
Canceling "Set Object Reset Position" AlanZhang Q&A 8 10-15-2007 12:04 PM


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.