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 11-10-2010
Congshi Wang Congshi Wang is offline
Student
 
Join Date: May 2010
Location: Germany
Posts: 58
Downloads: 2
Uploads: 0
Thanks: 48
Thanked 0 Times in 0 Posts
Rep Power: 124
Congshi Wang is on a distinguished road
Default executing automaticly writte flexscript code

Hi,

I got a problem with executing automaticly written flexscript code.

I set up a command that created a production line by excuting the command. The command creates queues and processors and connects them. After creating a queue the command sets its initial inventory by using the onreset and onmessage trigger like this:

setvarstr(last(model()),"resettrigger","treenode current = ownerobject(c);\n
sendmessage(current,current,Number_Kanban_Cards,5, 0);");

setvarstr(last(model()),"messagetrigger",concat(
"treenode current = ownerobject(c);\n",
"int numitems = msgparam(1);\n",
"int flowitemrank = msgparam(2);\n",
"treenode destination = current;\n",
"for (int index = 0; index < numitems; index++)\n",
"{insertcopy(first(rank(node(\"/Tools/FlowItemBin\",model()),flowitemrank)),destination) ;}"
));

The command is correct and the desired code will be written in the resettrigger and messagetrigger of the chosen queue.

But the desired code won't be executed (althought it is already in the trigger-script window) until I manually go into the code window of the resettrigger and messagetrigger and click on the OK button. Then a window pops up and says it will be added a custom code. Not till then the desired code (to create flowitems on reset) will be executed.

Thanks a lot!
  #2  
Old 11-10-2010
Jason Lightfoot Jason Lightfoot is offline
Flexsim Consultant
 
Join Date: Aug 2007
Location: Somerset, UK
Posts: 719
Downloads: 20
Uploads: 0
Thanks: 123
Thanked 953 Times in 446 Posts
Rep Power: 773
Jason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond repute
Default

Sounds like you need to run buildnodeflexscript(<node>)


Thread Thread Starter Forum Replies Last Post
Getting Name of Operator Executing a task mutyisi Q&A 3 11-08-2010 07:17 AM
is it possible to execute "Multiple Table Import" automaticly at the start of run? zhang xin Q&A 3 10-15-2009 09:54 AM
Is it possible that you can have only 100 local variables in your code? Tom David Gripes and Goodies 3 11-06-2008 01:42 PM
Code autocompletion is great! Would like more shortcuts. AlanZhang Gripes and Goodies 2 02-20-2008 10:04 PM
Model Startup Code Lolke Koopmans Q&A 4 12-14-2007 09:51 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.