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 02-24-2011
Jens Mühlheimer Jens Mühlheimer is offline
Flexsim User
 
Join Date: Jul 2008
Location: Stuttgart, Germany
Posts: 140
Downloads: 8
Uploads: 0
Thanks: 40
Thanked 35 Times in 27 Posts
Rep Power: 174
Jens Mühlheimer will become famous soon enoughJens Mühlheimer will become famous soon enough
Default 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;
OnMessage
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  
Old 02-24-2011
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

Quote:
Originally Posted by Jens Mühlheimer View Post
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;
OnMessage
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);
   //I assume that this previous line created a wagon in your queue
   destination = last( destination ); //destination becomes your wagon
   flowitemrank = TheFlowItemRankOfYourColoredTexturedBox; //flowitemrank becomes the rank of the coloredtexturedbox
   for ( int x = 1; x <= 4 ; x++ ) {
     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
Would this do the trick?
The Following User Says Thank You to Steven Hamoen For This Useful Post:
Jens Mühlheimer (02-25-2011)
  #3  
Old 02-25-2011
Jens Mühlheimer Jens Mühlheimer is offline
Flexsim User
 
Join Date: Jul 2008
Location: Stuttgart, Germany
Posts: 140
Downloads: 8
Uploads: 0
Thanks: 40
Thanked 35 Times in 27 Posts
Rep Power: 174
Jens Mühlheimer will become famous soon enoughJens Mühlheimer will become famous soon enough
Default

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


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.