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-26-2011
shashanktrivedi shashanktrivedi is offline
Flexsim User
 
Join Date: Apr 2011
Posts: 59
Downloads: 26
Uploads: 0
Thanks: 26
Thanked 16 Times in 3 Posts
Rep Power: 122
shashanktrivedi will become famous soon enough
Default 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
Attached Files
File Type: zip model1.zip (17.5 KB, 144 views)
  #2  
Old 05-26-2011
Pablo Concha Pablo Concha is offline
Flexsim User
 
Join Date: Aug 2007
Posts: 104
Downloads: 100
Uploads: 1
Thanks: 103
Thanked 52 Times in 37 Posts
Rep Power: 232
Pablo Concha is just really nicePablo Concha is just really nicePablo Concha is just really nicePablo Concha is just really nice
Default

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)
  #3  
Old 05-26-2011
shashanktrivedi shashanktrivedi is offline
Flexsim User
 
Join Date: Apr 2011
Posts: 59
Downloads: 26
Uploads: 0
Thanks: 26
Thanked 16 Times in 3 Posts
Rep Power: 122
shashanktrivedi will become famous soon enough
Default

Thanks Pablo, yup its working.

Regards
Shashank Trivedi

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


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.