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
|
|||
|
|||
Dynamic Script
Hi All,
We have created a simple model, having one source, queue, processor and sink. This model has been automatically created using flexsim script in button over gui. In this script we are also generating dynamic script on source for creating item types and item colors in triggering creation node. This script is coming very well on the source triggering creation node, but this source script does not get executed when you run the model. Strange phenomenon is if we open the source triggering creation node and press ok then apply then it gets executed. Basically this is a manual intervention which we want to avoid. We are clueless how to get source script executed with out manual intervention. Flexsim script on button over gui for the source is as follows string str; createinstance(node("/Source",library()),model()); treenode sourcenode = last(model()); str = "treenode item = parnode(1); treenode current = ownerobject(c); int rownumber = parval(2); //row number of the schedule/sequence table { //************* PickOption Start *************\\ /**Set Itemtype and Color*/ /** \nFlowitem: */ treenode involved = /**/item/**/; /** \nItemtype: */ double ishan = /**/duniform(1,10,3)/**/; /**\n\n*/ setitemtype(involved,ishan); colorarray(involved,ishan); //rebindobjectattributes(c); } //******* PickOption End *******\\ "; setnodestr(getvarnode(sourcenode,"creationtrigger" ),str); repaintall(); Attaching model for the reference as well Thanks in advance Regards Shashank Trivedi |
#2
|
|||
|
|||
Hi,
It seems the creationtrigger node is changed to flexscript node after applying manually... i added these two lines before the repaint all on the On Press code, and it work ok i think... switch_flexscript(getvarnode(sourcenode,"creationtrigger"), 1); buildnodeflexscript(getvarnode(sourcenode,"creationtrigger")); regards Pablo Concha Erilkin |
The Following User Says Thank You to Pablo Concha For This Useful Post: | ||
shashanktrivedi (05-26-2011) |
Tags |
automatic, dynamic, script |
Thread | Thread Starter | Forum | Replies | Last Post |
InputBox in Flexsim script | AlanZhang | User Development | 1 | 04-08-2015 05:08 AM |
Dynamic Transportation | shashanktrivedi | Q&A | 2 | 05-25-2011 10:48 PM |
Dynamic Scripting itemtype | shashanktrivedi | Q&A | 3 | 05-25-2011 10:44 PM |
Need A Script | Gavin Douglas | Q&A | 3 | 07-18-2008 10:00 AM |
Dynamic script generation: Good Example with a User Command | Naresh Yamani | Tips and Tricks | 2 | 05-16-2008 06:54 PM |