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 |
|
Downloads |
Q&A Using Flexsim and building models |
#2
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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 |
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 |