Tom David
03-25-2010, 10:22 PM
I am not sure if someone else needs it, but it took me a while to figure out how to set the run speed in Flexsim HC and update the main panel. Thanks to Cliff for giving me a hint how to update the scroll bar and develop such a nice piece of software which is called Flexsim HC.
I like if my models always start with the same run speed, that’s why I use this code in nearly every model.
Here is the code I use if I set the run speed to 12, which I do normally in a User Event at OnReset:
// SET RUNSPEED
double dRunspeed = 12.00;
treenode ScrollBar = node("/active/Main Panel/bar2/runspeedpanel/ScrollBarPanel/ScrollBar",views());
treenode RunSpeed = node("/active/Main Panel/bar2/runspeedpanel/ScrollBarPanel/RunSpeed",views());
set(node("MAIN:/project/exec/step"), dRunspeed / 60);
int iDecimals = 2;
if(dRunspeed > 10) iDecimals = 1;
if(dRunspeed > 100) iDecimals = 0;
sets(node(">value", RunSpeed), numtostring(dRunspeed, 0, iDecimals));
setnodenum(node(">itemcurrent", ScrollBar), dRunspeed / 60);
setnodenum(node(">value", ScrollBar), dRunspeed / 60);
applylinks(ScrollBar, 1);
applylinks(RunSpeed, 1);
I like if my models always start with the same run speed, that’s why I use this code in nearly every model.
Here is the code I use if I set the run speed to 12, which I do normally in a User Event at OnReset:
// SET RUNSPEED
double dRunspeed = 12.00;
treenode ScrollBar = node("/active/Main Panel/bar2/runspeedpanel/ScrollBarPanel/ScrollBar",views());
treenode RunSpeed = node("/active/Main Panel/bar2/runspeedpanel/ScrollBarPanel/RunSpeed",views());
set(node("MAIN:/project/exec/step"), dRunspeed / 60);
int iDecimals = 2;
if(dRunspeed > 10) iDecimals = 1;
if(dRunspeed > 100) iDecimals = 0;
sets(node(">value", RunSpeed), numtostring(dRunspeed, 0, iDecimals));
setnodenum(node(">itemcurrent", ScrollBar), dRunspeed / 60);
setnodenum(node(">value", ScrollBar), dRunspeed / 60);
applylinks(ScrollBar, 1);
applylinks(RunSpeed, 1);