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
|
||||
|
||||
Interpreting System Console
Hello everybody,
I have a model where I'm creating Items with the OnMessage-Trigger, just like this: treenodecurrent = ownerobject(c); int nNumitems = 2; int nFlowitemrank = 6; treenode pDestination = current; int nLoadingPosition = 1; closeoutput(current); for (int nIndex = 0; nIndex < nNumitems; nIndex++) { insertcopy(first(rank(node("/Tools/FlowItemBin",model()),nFlowitemrank)), pDestination); setitemtype(rank(current,content(current)),msgparam(1)); setlabelnum(item,"Loading_Position",nLoadingPosition); nLoadingPosition = nLoadingPosition +1; } openoutput(current); The System console tells me following: The label named "Loading_Position" was referenced but does not exist on (null) The Label is defined at the FlowItemBin, the spelling is also right. Is it right that the label can't be setted because the item isn't actual created? Could ypu please give me tipps that I can solve the problem? Thank you. Greetings, FlorianK |
#2
|
|||
|
|||
insertcopy() returns a reference to the item that is created
treenode newitem = insertcopy(...); Take a look at the code behind the OnMessage pick option called "Create Flowitems" |
The Following User Says Thank You to Kris Geisberger For This Useful Post: | ||
FlorianK (03-26-2013) |
#3
|
||||
|
||||
You never defined "item" so it is null. You are trying to set the "Loading_Position" label on null.
You should use: Code:
insertcopy(first(rank(node("/Tools/FlowItemBin",model()),nFlowitemrank)), pDestination); setitemtype(rank(current,content(current)),msgparam(1)); setlabelnum(rank(current,content(current)),"Loading_Position",nLoadingPosition); nLoadingPosition = nLoadingPosition +1; Code:
treenode newitem = insertcopy(first(rank(node("/Tools/FlowItemBin",model()),nFlowitemrank)), pDestination); setitemtype(newitem,msgparam(1)); setlabelnum(newitem,"Loading_Position",nLoadingPosition); nLoadingPosition = nLoadingPosition +1; |
The Following User Says Thank You to Phil BoBo For This Useful Post: | ||
FlorianK (03-26-2013) |
#4
|
||||
|
||||
Hello Chris,
thanks for your hint with the treenod. While Phil wrote athe example codes, I was able to understand it and made it the same way => treenode newitem = insertcopy(first(rank(node("/Tools/FlowItemBin",model()),nFlowitemrank)), pDestination); Thank you both for your help. |
Thread | Thread Starter | Forum | Replies | Last Post |
disable system console | juan alberto | Q&A | 3 | 11-07-2011 05:52 AM |
what is the problem ,the system console print ? | LINWEIXU | Q&A | 5 | 08-23-2010 08:38 AM |
Suppressing "FULL PARTNER in-out" in System Console | david_white | Q&A | 1 | 07-30-2010 12:52 PM |
system console problem ? | LINWEIXU | Q&A | 16 | 06-18-2010 03:25 AM |
Can I write to the system console? | Steven Hamoen | Q&A | 2 | 11-26-2008 06:37 AM |