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 05-17-2010
Sung Kim Sung Kim is offline
Flexsim User
 
Join Date: Jan 2008
Location: York, PA
Posts: 85
Downloads: 70
Uploads: 0
Thanks: 70
Thanked 9 Times in 6 Posts
Rep Power: 160
Sung Kim is on a distinguished road
Default Passing parameters in executefsnode

I tried to learn how to pass and use parameters (c, i, eventdata) in "executefsnode".

Not quite understand what c, i, and eventdata should be based on help document. According to help, "eventdata" should be only used OnTimerEvent function. Is it different than the parameter "eventdata" for executefsnode? is c = current object and i = item?

My serach in this forum didn't fetch any example of parameter passing executefsnode (at least to my knowledge). All fetched examples seems to have no parameter passing (simply point to the location that has the script, and execute the script without passing parameters). If this is my misunderstanding, please forgive my ignarance and advise me.

Anyway, I will very appreciate if somebody can share an example (or tutorial video clip) that I can learn.

Thanks,
Sung
  #2  
Old 05-26-2010
Brandon Peterson's Avatar
Brandon Peterson Brandon Peterson is offline
The Flexsim Consultant
 
Join Date: Jul 2007
Location: Salt Lake City, Utah
Posts: 382
Downloads: 29
Uploads: 6
Thanks: 192
Thanked 516 Times in 235 Posts
Rep Power: 490
Brandon Peterson has a brilliant futureBrandon Peterson has a brilliant futureBrandon Peterson has a brilliant futureBrandon Peterson has a brilliant futureBrandon Peterson has a brilliant futureBrandon Peterson has a brilliant futureBrandon Peterson has a brilliant futureBrandon Peterson has a brilliant futureBrandon Peterson has a brilliant futureBrandon Peterson has a brilliant futureBrandon Peterson has a brilliant future
Default

Sung,

When you call executefsnode you specify what c and i are for the code that is executed. As for the event data portion, you don't have any access to that in flexscript (only in C++) and as far as I know it is only used by the developers. Here are some examples for you of how to use executefsnode, I have placed the call function and then the code executed below it:

Example 1: this code will call the code while designating c as the object connected to output port 1 and i as the item from the trigger the code is in. The code will then open the input of c if the rank of i is 5.
Call: executefsnode(mynode, outobject(current, 1), item, NULL, 0);
Code:
if(getrank(i) == 5)
openinput(c);

Example 2: this code will check to see if the itemtype of the flowitem passed in is less than the itemtype of the flowitem above it. If so it will swap the items and call itself again to see if the item should be moved further. I intentionally set c as item and i as the node I am calling to illustrate that c and i do not have to correlate to any specific objects as they are defined by you when you use the executefsnode function.
Call: executefsnode(sortnode, item, sortnode, NULL, 0);
Code:
treenode pc = prev(c);
if(objectexists(pc) && getitemtype(c) < getitemtype(pc))
{
setrank(c, getrank(pc));
executefsnode(i, c, i, NULL, 0);
}

I hope these help,
Brandon
__________________
thats not normal.
The Following 3 Users Say Thank You to Brandon Peterson For This Useful Post:
Sung Kim (06-01-2010)
  #3  
Old 06-01-2010
Sung Kim Sung Kim is offline
Flexsim User
 
Join Date: Jan 2008
Location: York, PA
Posts: 85
Downloads: 70
Uploads: 0
Thanks: 70
Thanked 9 Times in 6 Posts
Rep Power: 160
Sung Kim is on a distinguished road
Default Thank you for the example

I am glad that my post finally got somebody's attention.
Thank you very much Brandon!.

Before I got a response, I somehow figured out how it works based on my trial error. It seemed to work fine, but I was not quite sure that I was doing in right way, or understand correctly to use the excutefsnode.
However, after applying and practicing Brandon's sample logic with his explanation, I understand it more clearly and feel much confident in using excutefsnode function.

Thank you again, Brandon!


Thread Thread Starter Forum Replies Last Post
Passing strings into a usercommand Nico Zahn Q&A 6 01-13-2010 11:20 AM


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.