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 08-20-2008
William Clausen's Avatar
William Clausen William Clausen is offline
W. Clausen
 
Join Date: Mar 2008
Posts: 12
Downloads: 1
Uploads: 0
Thanks: 9
Thanked 1 Time in 1 Post
Rep Power: 148
William Clausen is on a distinguished road
Default 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  
Old 08-20-2008
Alex Christensen Alex Christensen is offline
Flexsim Technical Support
 
Join Date: Nov 2007
Location: Provo, UT
Posts: 96
Downloads: 41
Uploads: 8
Thanks: 29
Thanked 141 Times in 56 Posts
Rep Power: 298
Alex Christensen is a splendid one to beholdAlex Christensen is a splendid one to beholdAlex Christensen is a splendid one to beholdAlex Christensen is a splendid one to beholdAlex Christensen is a splendid one to beholdAlex Christensen is a splendid one to beholdAlex Christensen is a splendid one to behold
Default

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)
  #3  
Old 08-20-2008
William Clausen's Avatar
William Clausen William Clausen is offline
W. Clausen
 
Join Date: Mar 2008
Posts: 12
Downloads: 1
Uploads: 0
Thanks: 9
Thanked 1 Time in 1 Post
Rep Power: 148
William Clausen is on a distinguished road
Default

Alex,
You rock! thank you for your help. As always I owe you! Hope to see you this October for Flex-symposium!
Bill



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.