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
|
|||
|
|||
Create combined Flowitems OnMessage
Hello everybody,
maybe you could help me another time. How can I create combined Flowitems with an OnMessage command? I want to fill my queues directly after time 0, when starting the simulation. I also do this with another Flowitem in my model with this code: OnReset Code:
/**CS: Send Triggermessage*/ treenode current = ownerobject(c); senddelayedmessage(current,0,current); return 0; Code:
/**Create Flowitems*/ /** \nNumber to create: */ int numitems = /**/gettablenum("start", 1, 2)/**/; /** \nFlowitem Bin rank: */ int flowitemrank = /**/gettablenum("start", 1, 1)/**/; /** \nDestination: */ treenode destination = /**/current/**/; /**\n\n*/ for (int index = 0; index < numitems; index++) { insertcopy(first(rank(node("/Tools/FlowItemBin",model()),flowitemrank)), destination); } But now the real question: How can I create combined flowitems with a command? With combined flowitems I mean 4 colored textured boxes on a waggon. And I want to have 10 of those loaded waggons in my queue. Thank you already in advance! Jens |
#2
|
||||
|
||||
Quote:
|
The Following User Says Thank You to Steven Hamoen For This Useful Post: | ||
Jens Mühlheimer (02-25-2011) |
#3
|
|||
|
|||
Almost,
The problem was that the variables have been overwritten all the time. I fiddled around with the code a bit and got it working. Thanks a lot: Code:
/**CS: Create stock*/ treenode current = ownerobject(c); int numitems = gettablenum("start", 5, 2); // Number to create int flowitemrank = gettablenum("start", 5, 1); // Which item from the bin treenode destination = current; // Where to create this shit for (int index = 0; index < numitems; index++) { insertcopy(first(rank(node("/Tools/FlowItemBin",model()),flowitemrank)), current); //I assume that this previous line created a wagon in your queue destination = last( current ); //destination becomes your wagon int flowitemrank_box = 1; // here i just introduced another variable for ( int x = 1; x <= 10 ; x++ ) { insertcopy(first(rank(node("/Tools/FlowItemBin",model()),flowitemrank_box)), destination); } } |
Thread | Thread Starter | Forum | Replies | Last Post |
Create flowitems with onmessage and give them an itemtype | Jens Mühlheimer | Q&A | 15 | 07-18-2012 02:48 PM |
create flowitems on reset in queue | Congshi Wang | Q&A | 1 | 12-22-2010 10:58 AM |
Question on OnMessage Trigger | KelvinHo | Q&A | 2 | 01-26-2010 02:41 AM |
Using TE FlowItems to Transport other FlowItems | juan alberto | Q&A | 13 | 09-13-2009 09:00 AM |
Create tables on the fly | AlanZhang | Tips and Tricks | 0 | 08-24-2007 06:01 PM |