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
|
||||
|
||||
To Sleep, to sleep but not to dream.
Hello all,
First thank you all for your excellent advise in the past. It's great to have people who can point you in the right direction! I'm experiencing some issues with a code block that I've created to animate an item in one of my models. The issue is that the C++ code built in checker that comes with the Flexsim package (here I assume this is not a derivative of the downloaded C++ express edition add on.) gives a specific error: "The Function Sleep is not recognized." Find the code below. Is there another way to create a pause without getch? I've included a link to the MSDN help web site below that gives an example of the sleep function. I believe as I'm new to C++ that "sleep" is a valid function?? Perhaps I'm wrong /**Clausen: Redraw for Roll Stand Animation*/ treenodeitem = parnode(1); treenodecurrent = ownerobject(c); //for(startExpression; testExpression; countExpression) //{ // block of code; "Pull" as defined in Global variables. //} double x = - 18.74; //Roll Stand original position for(x=yloc(Pull); x <= -13.9; x--) // For next count down logic { sleep(2000); // Pause for the human eye. } // http://msdn.microsoft.com/en-us/libr...91(VS.85).aspx --- Thought for the day -- "Reality.sys missing: universe halted." |
#2
|
|||
|
|||
sleep is a valid C++ function, but you are trying to use it with Flexscript, an interpreted C++-like language with many functions. You can see documentation about all the functions in Flexscript by going to Help>Commands in the main menu. If you want to use C++ commands that are not available in Flexscript, like sleep, you will have to select the C++ radio button on the bottom of a code edit window, press OK, press OK in the parameters or properties window, then hit F2 (or go to Build>Compile Model... in the main menu).
You'll have to have a compiler configured correctly in the start menu Flexsim Compiler Configurator. You can download a free express version of Microsoft Visual C++ from http://www.microsoft.com/express/vc/, but you will have to configure it in the compiler configurator to Visual C++ Express 2008, not Visual Studio 2008 (Standard or Professional). A better way to make a delay in a Flexsim model would be to use the Flexscript command senddelayedmessage. Go to Help>Commands in the main menu for more info. |
The Following User Says Thank You to Alex Christensen For This Useful Post: | ||
William Clausen (08-20-2008) |