Commands by Category
AGV
Description
Adds a listener event on the agv
Example
agvaddlistener(agv, c, AGV_LISTEN_PRE_ARRIVAL);
Description
Deprecated, use AGV class.
Gets various information about an agv, based on the what parameter:
AGV_CURRENT_CP - Returns the agv's current control point
AGV_ORIGIN_CP - Returns the agv's origin control point
AGV_INTERMEDIATE_DEST_CP - Returns the agv's intermediate destination control point
AGV_DEST_CP - Same as AGV_INTERMEDIATE_DEST_CP
AGV_FINAL_DEST_CP - Returns the agv's final destination control point
AGV_DEST - Returns the agv's destination object
AGV_BATTERY_LEVEL - Returns the agv's current battery level as a percentage of battery capacity (0 - 100)
AGV_AMP_HOURS - Returns the agv's current battery level in amp hours
AGV_START_RECHARGE - Starts the agv recharging. Returns the time it will take to recharge to full capacity.
AGV_RECHARGE_TO_LEVEL - Explicitly set's the agv's battery level to p1 (0 - 100).
AGV_ADD_ALLOC_POINT - Should be called from the travel initialization trigger. Manually adds a control point/control area for allocation, i.e. a control point or control area that would not otherwise need to be allocated as part of the agv's current travel path. The control point/control area is passed as p1, and the distance at which it must be allocated is passed as p2. The command will return a reference to a node that represents that allocation. Use AGV_SET_ALLOC_POINT_DEALLOC_DIST and AGV_SET_CAN_STOP_AT_ALLOC_POINT to specify further data on that allocation point.
AGV_SET_ALLOC_POINT_DEALLOC_DIST - For a manual allocation point that's been added, this sets the travel distance at which the agv can deallocate the object. You should call this at some point after adding the allocation, so that the object will be properly deallocated. p1 is a reference to the allocation point node returned by AGV_ADD_ALLOC_POINT, and p2 is the deallocation distance.
AGV_SET_CAN_STOP_AT_ALLOC_POINT - Sets whether or not the agv can stop at a manually added allocation point. The default is no, i.e. the agv will not stop at the stop distance, but will continue to the next stoppable point before attempting to allocate the object. Setting this to 1 will allow the agv to stop at the manual allocation point to allocate ahead. p1 is a reference to the allocation point node returned by AGV_ADD_ALLOC_POINT, and p2 is 1 or 0.
AGV_ATTACH_TRAILER - Manually attaches a trailer to the AGV. p1: the object to attach. p2: the trailer gap to apply. p3: If 1, the trailer will be attached behind the AGV (attach to the AGV's tail), if 0, the trailer be attached ahead of the AGV (attach to the AGV's head). p4: If 1, the trailer will automatically be detached when the object exits the AGV, if 0, the trailer should be manually detached.
AGV_DETACH_TRAILER - Manually detaches a trailer from the AGV. p1: the object that is attached as a trailer.
AGV_SPEED - Returns the agv's current speed
AGV_PROXIMITY_STATE - Returns 1 if the agv is blocked by proximity on an accumulating path, 0 otherwise.
AGV_ACCUM_AHEAD_AGV - Returns the agv ahead of this agv on an accumulating path, if one exists.
Gets various information about an agv, based on the what parameter:
AGV_CURRENT_CP - Returns the agv's current control point
AGV_ORIGIN_CP - Returns the agv's origin control point
AGV_INTERMEDIATE_DEST_CP - Returns the agv's intermediate destination control point
AGV_DEST_CP - Same as AGV_INTERMEDIATE_DEST_CP
AGV_FINAL_DEST_CP - Returns the agv's final destination control point
AGV_DEST - Returns the agv's destination object
AGV_BATTERY_LEVEL - Returns the agv's current battery level as a percentage of battery capacity (0 - 100)
AGV_AMP_HOURS - Returns the agv's current battery level in amp hours
AGV_START_RECHARGE - Starts the agv recharging. Returns the time it will take to recharge to full capacity.
AGV_RECHARGE_TO_LEVEL - Explicitly set's the agv's battery level to p1 (0 - 100).
AGV_ADD_ALLOC_POINT - Should be called from the travel initialization trigger. Manually adds a control point/control area for allocation, i.e. a control point or control area that would not otherwise need to be allocated as part of the agv's current travel path. The control point/control area is passed as p1, and the distance at which it must be allocated is passed as p2. The command will return a reference to a node that represents that allocation. Use AGV_SET_ALLOC_POINT_DEALLOC_DIST and AGV_SET_CAN_STOP_AT_ALLOC_POINT to specify further data on that allocation point.
AGV_SET_ALLOC_POINT_DEALLOC_DIST - For a manual allocation point that's been added, this sets the travel distance at which the agv can deallocate the object. You should call this at some point after adding the allocation, so that the object will be properly deallocated. p1 is a reference to the allocation point node returned by AGV_ADD_ALLOC_POINT, and p2 is the deallocation distance.
AGV_SET_CAN_STOP_AT_ALLOC_POINT - Sets whether or not the agv can stop at a manually added allocation point. The default is no, i.e. the agv will not stop at the stop distance, but will continue to the next stoppable point before attempting to allocate the object. Setting this to 1 will allow the agv to stop at the manual allocation point to allocate ahead. p1 is a reference to the allocation point node returned by AGV_ADD_ALLOC_POINT, and p2 is 1 or 0.
AGV_ATTACH_TRAILER - Manually attaches a trailer to the AGV. p1: the object to attach. p2: the trailer gap to apply. p3: If 1, the trailer will be attached behind the AGV (attach to the AGV's tail), if 0, the trailer be attached ahead of the AGV (attach to the AGV's head). p4: If 1, the trailer will automatically be detached when the object exits the AGV, if 0, the trailer should be manually detached.
AGV_DETACH_TRAILER - Manually detaches a trailer from the AGV. p1: the object that is attached as a trailer.
AGV_SPEED - Returns the agv's current speed
AGV_PROXIMITY_STATE - Returns 1 if the agv is blocked by proximity on an accumulating path, 0 otherwise.
AGV_ACCUM_AHEAD_AGV - Returns the agv ahead of this agv on an accumulating path, if one exists.
Example
agvinfo(agv, AGV_DEST_CP);
Description
Deprecated, use AGV class.
Reassigns an agv to the specified control point
Reassigns an agv to the specified control point
Example
agvreassigncp(agv, controlpoint);
Description
Deprecated, use AGV class.
Redirects the agv to the designated object/control point. mode can be one of the following values:
REDIRECT_AND_WAIT - if not redirected before arrival, the agv will wait at the destination until redirected
REDIRECT_AS_FINAL - the destination becomes the new final destination for the agv REDIRECT_AND_CONTINUE_ON_ARRIVAL - the agv will continue to the final destination after arriving at the intermediate destination
REDIRECT_AND_CONTINUE_ON_PRE_ARRIVAL - the agv will continue to the final destination after pre-arriving at the intermediate destination (it will not decelerate to a stop)
Redirects the agv to the designated object/control point. mode can be one of the following values:
REDIRECT_AND_WAIT - if not redirected before arrival, the agv will wait at the destination until redirected
REDIRECT_AS_FINAL - the destination becomes the new final destination for the agv REDIRECT_AND_CONTINUE_ON_ARRIVAL - the agv will continue to the final destination after arriving at the intermediate destination
REDIRECT_AND_CONTINUE_ON_PRE_ARRIVAL - the agv will continue to the final destination after pre-arriving at the intermediate destination (it will not decelerate to a stop)
Example
agvredirect(agv, controlpoint, 1);
Description
Returns a reference to an AGV control point
Example
cp("CP547");
Description
Adds a listener to events on one or more control points
Example
cpaddlistener(current, "Location > LoadPoints", c, CP_LISTEN_EXIT | CP_LISTEN_AVAILABLE);
Description
Allocates a control point to the claiming object. If successful, a reference to a coupling node
representing the allocation will be returned.
Example
cpallocate(controlPoint, current, 1);
Description
Returns a control point connection.
Also, if connection is a string and
controlpoint and rank are both 0, then
this command will return the
index of the given connection. This
is for speed, so that you can subsequently
use a number for the connection.
Example
cpconnection(cp, "ForwardTo", 1)
Returns the first ForwardTo connection on cpcpconnection(cp, "LookForWork>NextLookForWork", 1)
Traverses two connections to find an object.
This is the same as cpconnection(cpconnection(cp, "LookForWork", 1), "NextLookForWork", 1)cpconnection(cp, "LookForWork:2>NextLookForWork", 1)
Same as cpconnection(cpconnection(cp, "LookForWork", 2), "NextLookForWork", 1)int connIndex = cpconnection(0, "LookForWork", 0);
treenode obj = cpconnection(cp, connRank, 1);
Gets the index of the connection, and then uses the
index instead of the name.Description
Deallocates a control point from the claiming object. If successful returns 1, otherwise 0.
Example
cpdeallocate(controlPoint, current);
Description
Returns the agv network distance between two control points
Example
cpdistance(cp1, cp2)
Description
Returns 1 if the given control point is available.
byCriterion is not used right now, but is reserved for future use.
Example
if (cpisavailable(cp)) {
...
}
...
}
Description
Returns the number of connections a control point has
Example
cpnumconnections(cp, "ForwardTo")
Description
Returns a reference to the task sequence queue associated with the control point
Example
treenode tsQueue = cptasksequencequeue(cp);
Communication
Commands for communicating with external applications such as sockets, database communication, and links with Microsoft Excel.
Closes the client socket
Description
This command closes the client socket specified as socket.
It must be called sometime after clientcreate(). Once a socket is closed, nothing can read from it or write to it.
The socket number may be reused again by a later call to clientcreate(). This function returns true if the socket closes correctly.
It must be called sometime after clientcreate(). Once a socket is closed, nothing can read from it or write to it.
The socket number may be reused again by a later call to clientcreate(). This function returns true if the socket closes correctly.
Example
clientclose(1);
Attempts to connect the client socket
Description
This command attempts to connect the socket specified by socket to a server running on the machine called hostname, which is listening on the port specified.
The number passed as socket is the number that was previously returned by clientcreate(). The string passed as hostname can be either the computer's name (if it is on the same network as the client) or its IP address. This command should not be called until after a successful call to clientcreate() is made. If the socket does not connect, then it is closed and clientcreate() will have to be called again to reopen it. This functions returns true if the socket connects successfully.
The number passed as socket is the number that was previously returned by clientcreate(). The string passed as hostname can be either the computer's name (if it is on the same network as the client) or its IP address. This command should not be called until after a successful call to clientcreate() is made. If the socket does not connect, then it is closed and clientcreate() will have to be called again to reopen it. This functions returns true if the socket connects successfully.
Example
clientconnect(1,"localhost",1880);
Creates a new client socket with TCP/IP protocol
Description
This command creates a new client socket that is set to communicate using the TCP/IP protocol. FlexSim can create up to fifty client sockets at one time.
Each client can be connected to a different server. This function returns a number that must be stored by the model to reference the socket that was created.
If an error occurs, this function returns 0.
Each client can be connected to a different server. This function returns a number that must be stored by the model to reference the socket that was created.
If an error occurs, this function returns 0.
Example
int socknum = clientcreate();
Receives data sent to the socket
Description
This command receives data that has been sent to the socket specified as socket. The value of socket is the number that is returned by clientcreate(). This command operates differently in flexscript vs. c++. In c++, buffer must be a valid pointer to a char* destination into which the read bytes will be copied. The return value will be the total number of bytes received. Up to bufsize bytes from the clients message will be read and stored in the preallocated character array called buf. In flexscript, however, buffer should be passed as NULL, and the return value will be the actual string that is received. If noblocking = 1, then this command does not block FlexSim program execution, but if noblocking = 0, FlexSim program execution will block (freeze) until something is received from the client.
Example
c++: int bytes = clientreceive(1,Buf,15,0);
flexscript: string readstr = clientreceive(1, NULL, 15, 0);
flexscript: string readstr = clientreceive(1, NULL, 15, 0);
Sends a message across the socket
Description
This command sends a message across the socket specified as socket. The value passed as socket is the number returned by clientcreate(). The charlength is the length of the string being passed and is usually optional. Needed only if the string being sent has NULL characters in it.
Example
clientsend(1,"REQ:service");
Close the currently open Excel workbook
Description
This command closes the currently open Excel workbook. If save is 1, the workbook will be saved before it closes. If save is 0, changes made to the workbook will be discarded.
Example
See the example for excelopen().
Creates a new worksheet in the currently open Excel workbook
Description
Creates a new worksheet. The new sheet will be given the specified name.
Example
excelcreatesheet("MyNewSheet");
Create an Excel workbook
Description
This command creates a workbook in Excel. Only one workbook can be open at a time. The user must call excelclose() before trying to open or create another workbook, opening a new model, compiling the current model, or closing FlexSim. Before reading from the open file, excelsetsheet() must also be called.
Example
excelcreateworkbook();
excelsetsheet("Sheet1");
excelwritenum(1,1,1);
excelsave("NewWorkBook.xlsx");
excelclose(0);
This first creates a link between FlexSim and a new Excel workbook, sets the active sheet in the workbook to "Sheet1", writes a 1 to row 1 column 1, saves the workbook, then closes the workbook.
excelsetsheet("Sheet1");
excelwritenum(1,1,1);
excelsave("NewWorkBook.xlsx");
excelclose(0);
This first creates a link between FlexSim and a new Excel workbook, sets the active sheet in the workbook to "Sheet1", writes a 1 to row 1 column 1, saves the workbook, then closes the workbook.
Deletes the specified range of the currently open Excel workbook
Description
Deletes the specified range. Does not affect the data in the range.
This command does nothing if FlexSim is set to communicate with Excel using DDE (by calling maintenance(1000,1), not FlexSim's default setting).
This command does nothing if FlexSim is set to communicate with Excel using DDE (by calling maintenance(1000,1), not FlexSim's default setting).
Example
exceldeleterange("MyRange");
Delete the worksheet in the currently open Excel workbook
Description
Deletes the specified worksheet. If allowwarning is 1, you will be warned before you delete a sheet with data.
Example
exceldeletesheet("MyNewSheet");
excelexporttable
(str/node/num table, num startrow, num startcol, num numrows, num numcols [, num rowchar, num colchar])
Exports data from a table within FlexSim to the currently open Excel workbook
Description
Exports data from a table within FlexSim to Excel. The table may be referenced by the name of a GlobalTable or by using a treenode reference to a table node. The type of data (string or number) to be exported is determined by the datatype of the cells in the FlexSim table. The user specifies the starting row and column number in Excel, and the total number of rows and columns to export.
Example
excelexporttable("Table1",1,1,5,3);
Retrieves a location parameter about the named range of the currently open Excel workbook
Description
Retrieves a location parameter about the named range. Valid values for param are:
1 = Starting Row Number
2 = Starting Column Number
3 = Ending Row Number
4 = Ending Column Number
5 = Width
6 = Height
This command does nothing if FlexSim is set to communicate with Excel using DDE (by calling maintenance(1000,1), not FlexSim's default setting).
1 = Starting Row Number
2 = Starting Column Number
3 = Ending Row Number
4 = Ending Column Number
5 = Width
6 = Height
This command does nothing if FlexSim is set to communicate with Excel using DDE (by calling maintenance(1000,1), not FlexSim's default setting).
Example
int width = excelgetrangeparam("MyRange",5);
Gets the name of the worksheet associated with rangename of the currently open Excel workbook
Description
Returns the name of the worksheet where the specified range is located.
This command does nothing if FlexSim is set to communicate with Excel using DDE (by calling maintenance(1000,1), not FlexSim's default setting).
This command does nothing if FlexSim is set to communicate with Excel using DDE (by calling maintenance(1000,1), not FlexSim's default setting).
Example
pt(excelgetrangesheet("MyRange"));
Imports data from the currently open Excel workbook to a table in FlexSim
Description
Imports data from Excel to a table in FlexSim. The table may be referenced by the name of a GlobalTable or by using a treenode reference to a table node. The type of data (string or number) to be exported is determined by the datatype of the cells in the FlexSim table. The user specifies the starting row and column number in Excel, and the total number of rows and columns to export.
Example
excelimporttable("MyTable",1,1,5,3);
Launch Microsoft Excel
Description
This command opens Microsoft Excel so that it can be accessed by FlexSim. If launchdir is not specified, the path defined in Tools|Excel...|Global Settings will be used. Otherwise, the launchdir must be an accurate path to the location on the hard drive where EXCEL.EXE is located. It is typically something like "C:/Program Files/Microsoft Office/Office10," but may be different depending on the version of Excel installed. It is generally not required to launch Excel before communicating with it. However, if FlexSim is set to communicate with Excel via DDE (by calling maintenance(1000,1), this is not the default behavior) Excel must be running before any communication can be performed. If excellaunch() is called at the beginning of communication, excelquit() must also be called before the user opens a new model, compiles the current model or closes FlexSim.
Example
excellaunch(" C:/Program Files/Microsoft Office/Office10");
excelopen("C:/mybook.xls");
excelsetsheet("Sheet1");
double thenum = excelreadnum(1,1);
excelclose(true);
excelquit();
This starts Excel, opens a workbook called "mybook," stores a value read from row 1, column 1 from that workbook, then closes the file and Excel.
excelopen("C:/mybook.xls");
excelsetsheet("Sheet1");
double thenum = excelreadnum(1,1);
excelclose(true);
excelquit();
This starts Excel, opens a workbook called "mybook," stores a value read from row 1, column 1 from that workbook, then closes the file and Excel.
Starts the automatic importing of data from Excel to FlexSim tables
Description
Starts the automatic importing of data from Excel sheets to FlexSim tables as setup in the Tools | Excel... | Multiple Table Import window.
Example
excelmultitableimport()
Open the Excel workbook
Description
This command opens the file called workbook in Excel. Only one workbook can be open at a time. The user must call excelclose() before trying to open another workbook, opening a new model, compiling the current model, or closing FlexSim. Before reading from the open file, excelsetsheet() must also be called.
Example
excelopen("mydata.xls");
excelsetsheet("Sheet1");
double myvalue = excelreadnum(1,2);
excelclose(0);
This first creates a link between FlexSim and an Excel workbook called "mydata.xls", then sets the active sheet in the workbook to "Sheet1", sets a local variable called myvalue to the number read from row 1 column 2, then closes the workbook without saving.
excelsetsheet("Sheet1");
double myvalue = excelreadnum(1,2);
excelclose(0);
This first creates a link between FlexSim and an Excel workbook called "mydata.xls", then sets the active sheet in the workbook to "Sheet1", sets a local variable called myvalue to the number read from row 1 column 2, then closes the workbook without saving.
Close Microsoft Excel
Description
This command closes Microsoft Excel if it is open. After this command is called, no other commands to Excel should be called. Any Excel files that were open should be closed before this command is called. You may get an Excel prompt to save changes to any workbooks that were left open. Use excelclose() to avoid this. This command must be called if excellaunch() was called previously.
Example
see excellaunch();
Read the numeric value from a cell of the specified range of the currently open Excel workbook
Description
Reads a numeric value from a cell defined by row and column in the specified named range. The upper-left cell of the range is row 1, column 1.
This command does nothing if FlexSim is set to communicate with Excel using DDE (by calling maintenance(1000,1), not FlexSim's default setting).
This command does nothing if FlexSim is set to communicate with Excel using DDE (by calling maintenance(1000,1), not FlexSim's default setting).
Example
excelreadnum("MyRange",5,1)
Read the text value from a cell of the specified range of the currently open Excel workbook
Description
Reads a text value from a cell defined by row and column in the specified named range. The upper-left cell of the range is row 1, column 1.
This command does nothing if FlexSim is set to communicate with Excel using DDE (by calling maintenance(1000,1), not FlexSim's default setting).
This command does nothing if FlexSim is set to communicate with Excel using DDE (by calling maintenance(1000,1), not FlexSim's default setting).
Example
excelreadstr("MyRange",5,1)
Write the numeric value to a cell of the specified range of the currently open Excel workbook
Description
Writes a numeric value to a cell defined by row and column in the specified named range. The upper-left cell of the range is row 1, column 1.
This command does nothing if FlexSim is set to communicate with Excel using DDE (by calling maintenance(1000,1), not FlexSim's default setting). For writing a whole table of values to Excel, use excelrangewrite.
This command does nothing if FlexSim is set to communicate with Excel using DDE (by calling maintenance(1000,1), not FlexSim's default setting). For writing a whole table of values to Excel, use excelrangewrite.
Example
excelwritenum("MyRange",5,1,99.87)
Write the string value to a cell of the specified range of the currently open Excel workbook
Description
Writes string value to a cell defined by row and column in the specified named range. The upper-left cell of the range is row 1, column 1.
This command does nothing if FlexSim is set to communicate with Excel using DDE (by calling maintenance(1000,1), not FlexSim's default setting). For writing a whole table of values to Excel, use excelrangewrite.
This command does nothing if FlexSim is set to communicate with Excel using DDE (by calling maintenance(1000,1), not FlexSim's default setting). For writing a whole table of values to Excel, use excelrangewrite.
Example
excelwritestr("MyRange",5,1,"My String")
Returns the value of a cell in the active worksheet as a variant
Description
Returns the value of a cell in the active worksheet as a variant. Flags can be specified to specify what exactly is returned from Excel.
Those flags are EXCEL_DATA_NUMBER, EXCEL_DATA_STRING, and EXCEL_DATE_AS_NUM.
EXCEL_DATA_NUMBER will read the Excel data as a number.
EXCEL_DATA_STRING will read the Excel data as a string.
EXCEL_DATE_AS_NUM will interpret any Excel dates as a Flexsim readable date number.
EXCEL_DATA_NUMBER will read the Excel data as a number.
EXCEL_DATA_STRING will read the Excel data as a string.
EXCEL_DATE_AS_NUM will interpret any Excel dates as a Flexsim readable date number.
Example
Variant value = excelreadcell(1, 5, EXCEL_DATA_NUMBER | EXCEL_DATE_AS_NUM);
This returns the value of the 5 column in the first row as a number. If it's a date, the number returned will be Flexsim readable as a date.
This returns the value of the 5 column in the first row as a number. If it's a date, the number returned will be Flexsim readable as a date.
Read the numeric value from a cell of the active sheet of the currently open Excel workbook
Description
Reads a numeric value from a cell defined by row and column of the active sheet of the currently open Excel workbook.
Example
excelreadnum(5,1)
Read the text value from a cell of the active sheet of the currently open Excel workbook
Description
Reads a text value from a cell defined by row and column of the active sheet in the currently open Excel workbook.
Example
excelreadstr(5,1)
Saves the currently open Excel file
Description
Saves the currently open Excel file. If a filename is passed to this command, the file will be saved with that name. This is the equivalent of selecting Save As from Excel's File menu. If no parameters are passed to this command, the file will be saved with its current name, and the original file will be overwritten. This is the equivalent of selecting Save from Excel's File menu.
Example
excelsave("runresults_001.xls")
Creates or changes a named range of the currently open Excel workbook
Description
Creates or changes a named range. The range will be on the active sheet. The range's upper-left cell is defined by startrow and startcolumn. The bottom-right cell is defined by endrow and endcolumn.
This command does nothing if FlexSim is set to communicate with Excel using DDE (by calling maintenance(1000,1), not FlexSim's default setting).
This command does nothing if FlexSim is set to communicate with Excel using DDE (by calling maintenance(1000,1), not FlexSim's default setting).
Example
excelsetrange("MyRange",5,5,10,15);
Sets the active worksheet of the currently open Excel workbook
Description
This command sets the active worksheet in the currently open Excel workbook. Whenever excelreadnum() or excelreadstr() are called, the value read will come from the active worksheet. The active worksheet may be set many times for the same open workbook.
Example
See the example for excelopen().
Gets the version of Microsoft Excel
Description
Returns a string that contains the Excel interface version.
Example
excelversion()
Write the numeric value to a cell of the active sheet of the currently open Excel workbook
Description
Writes a numeric value to a cell defined by row and column of the active sheet in the currently open Excel workbook.
Example
excelwritenum(5,1,99.87)
Write the string value to a cell of the active sheet of the currently open Excel workbook
Description
Writes string value to a cell defined by row and column of the active sheet in the currently open Excel workbook.
Example
excelwritestr(5,1,"My String")
Description
Request a decision from a ReinforcementLearning object.
When training, this will cause the simulation to return a reward for the previous action, make a new observation, and (if the episode is not done) wait for an action from the algorithm.
When running normally (not training), this will make an observation and execute the On Request Action trigger of the ReinforcementLearning object in order to make a heuristic decision or predict an action using a trained AI model.
Use this command to specify exactly when the AI should make a decision.
When training, this will cause the simulation to return a reward for the previous action, make a new observation, and (if the episode is not done) wait for an action from the algorithm.
When running normally (not training), this will make an observation and execute the On Request Action trigger of the ReinforcementLearning object in order to make a heuristic decision or predict an action using a trained AI model.
Use this command to specify exactly when the AI should make a decision.
Example
requestdecision("ReinforcementLearning1");
Open a file using the default application for the file type
Description
Opens a file using the default application used for opening files with the specified extension on your computer. The available commands are: edit, explore, find, open, and print. A return value > 32 means success.
Example
rundocument("open","C:/myfile.doc");
Opens myfile.doc with whatever application is default for opening *.doc files on your computer.
Opens myfile.doc with whatever application is default for opening *.doc files on your computer.
Run an external program
Description
Run an external program. This command will issue a command to the operating system. The commandline may contain full program arguments. A return value > 31 means success.
Example
runprogram("c:/myprogram.exe")
Gets the server will attempt to accept a client connection
Description
The server will attempt to accept a client connection. If noblocking = 0, the command blocks until a connection is made. It returns an index used to reference the connection made.
The server will attempt to accept a connection from a waiting client. A number will be returned that is the index of the connection established. A return value of 0 indicates that no connection was created. This value will be used in all future server calls. If noblocking = 1, the server will not block FlexSim program execution, but will return a 0 if no client attempts to connect. If noblocking = 0, the server will block (freeze) FlexSim program execution until a client attempts to connect. Connections with clients are only made with this command.
The server will attempt to accept a connection from a waiting client. A number will be returned that is the index of the connection established. A return value of 0 indicates that no connection was created. This value will be used in all future server calls. If noblocking = 1, the server will not block FlexSim program execution, but will return a 0 if no client attempts to connect. If noblocking = 0, the server will block (freeze) FlexSim program execution until a client attempts to connect. Connections with clients are only made with this command.
Example
int client = serveraccept(0);
Closes the client connection
Description
The specified connection to a client is closed. Does not close the main server socket. This should be done when the server is completely finished communicating with a client.
Example
servercloseconnection(1);
Closes the main server socket and all open connections
Description
Closes the main server socket and all of the connections that are still open. No more communication can be done until it is created again. All connections should be closed before this is called.
Example
serverclosemain()
Creates a server socket that is listening for connections to the specified port
Description
Creates a server socket that is listening for connections on the specified port. Some ports (called well-known ports) are reserved for special applications. Anything port number over 1024 is usually safe to use.
Example
servercreatemain(1880);
Receives a message from the connection
Description
Receives a message from the specified connection. This command operates differently in flexscript vs. c++. In c++, buffer must be a valid pointer to a char* destination into which the read bytes will be copied. The return value will be the total number of bytes received. Up to bufsize bytes from the clients message will be read and stored in the preallocated character array called buf. In flexscript, however, buffer should be passed as NULL, and the return value will be the actual string that is received. If noblocking = 1, then this command does not block FlexSim program execution, but if noblocking = 0, FlexSim program execution will block (freeze) until something is received from the client.
Example
c++: int bytes = serverreceive(1,Buf,15,0);
flexscript: string readstr = serverreceive(1, NULL, 15, 0);
flexscript: string readstr = serverreceive(1, NULL, 15, 0);
Sends a message to the client connect to connection
Description
Sends the specified text message to the client that is connected to the specified connection. Returns the number of bytes (characters) sent correctly. The text message to be sent must be converted into a char *. The charlength is the length of the string being passed and is usually optional. Needed only if the string being sent has NULL characters in it.
Example
serversend(1,"MadeConnection");
Shuts down the processes started with socketinit()
Description
This command shuts down the processes that were started with socketinit(). It should be called when the model has completely finished working with the sockets that it had open. This function returns true if the shut down is successful. See clientsend() for more information.
Example
socketend();
Initializes background processes that allow Windows Sockets to be used
Description
This command initializes the background processes that allow Windows Sockets to be used. It must be called before any calls to socket commands will work. This function returns true if the initialization is successful. See clientsend() for more information.
Example
socketinit();
Conversions
Commands for converting units, data types, and spatial coordinate.
Asserts string as a char*
Description
Assert type as C style string (e.g. char*). Alias for stringtopchar
Example
apchar("hello")
Gets the number of meters in the number of centimeters
Description
Returns the number of meters in the specified number of centimeters.
Example
cm(3)
Converts the given value (a time) from one time format to another
Description
Converts the given value (a time) from one format to another. The from and to arguments only accept the following values:
FS_DATETIME
XL_DATETIME
MODEL_TIME
DATE_STR
TIME_STR
DATETIME_STR
FS_DATETIME - the number of seconds since Jan 1, 1601. getmodelunit(START_TIME) returns a value in FS_DATETIME units.
XL_DATETIME - the serialized day number, where day 1 is Jan 1, 1900. Feb 10, 2025 1:30 PM is 45698.5625 in XL_DATETIME units. This format is used in Microsoft Excel for dates.
MODEL_TIME - the number of model units since the model start time
DATE_STR - a string representing the date portion of a datetime value. The resulting text will depend on the date format specified in the model settings. If converting from this format, the value must be formatted according to those settings.
TIME_STR - a string representing the time portion of a datetime value. The resulting text will depend on the time format specified in the model settings. If converting from this format, the value must be formatted according to those settings.
DATETIME_STR - a string representing the time and date of a datetime value. The resulting text will depend on the time and date formats specified in the model settings. If converting from this format, the value must be formatted according to those settings; the time portion must be first, separated from the date portion by a single space.
Note that year 3000 and beyond are not supported by this command.
FS_DATETIME
XL_DATETIME
MODEL_TIME
DATE_STR
TIME_STR
DATETIME_STR
FS_DATETIME - the number of seconds since Jan 1, 1601. getmodelunit(START_TIME) returns a value in FS_DATETIME units.
XL_DATETIME - the serialized day number, where day 1 is Jan 1, 1900. Feb 10, 2025 1:30 PM is 45698.5625 in XL_DATETIME units. This format is used in Microsoft Excel for dates.
MODEL_TIME - the number of model units since the model start time
DATE_STR - a string representing the date portion of a datetime value. The resulting text will depend on the date format specified in the model settings. If converting from this format, the value must be formatted according to those settings.
TIME_STR - a string representing the time portion of a datetime value. The resulting text will depend on the time format specified in the model settings. If converting from this format, the value must be formatted according to those settings.
DATETIME_STR - a string representing the time and date of a datetime value. The resulting text will depend on the time and date formats specified in the model settings. If converting from this format, the value must be formatted according to those settings; the time portion must be first, separated from the date portion by a single space.
Note that year 3000 and beyond are not supported by this command.
Example
convert(42308, XL_DATETIME, MODEL_TIME) // converts an Excel date to a valid model time
Gets the number of model time units in the give number of days
Description
Return the number of model time units in the given number of days.
Example
days(1)
Returns 86400 seconds.
Returns 86400 seconds.
Gets the number of model length/time units in the number of feet/minute
Description
Return the number of model length/time units in the specified number of feet/minute.
Example
fpm(9)
Gets the number of model length/time units in the number of feet/minute
Description
Return the number of model length/time units in the specified number of feet/second.
Example
fps(9)
Gets the number of model length units in the number of feet
Description
Return the number of model length units in the specified number of feet.
Example
ft(3)
Gets the number of model time units in the number of hours
Description
Return the number of model time units in the given number of hours.
Example
hours(1)
Returns 3600 seconds.
Returns 3600 seconds.
Gets the number of model length units in the number of inches
Description
Return the number of model length units in the specified number of inches.
Example
in(8)
Gets the number of model time units in the number of minutes
Description
Return the number of model time units in the given number of minutes.
Example
minutes(1);
Returns 60 seconds.
Returns 60 seconds.
Gets the number of model length/time units in the number of miles/hour
Description
Return the number of model length/time units in the specified number of miles/hour.
Example
mph(9)
Gets the number of model time units in the number of seconds
Description
Return the number of model time units in the given number of seconds.
Example
seconds(30);
Returns 0.5 minutes.
Returns 0.5 minutes.
Assert type as a node pointer
Description
Assert type as a node pointer. Only serves a real purpose in C++.
Example
tonode(getnodenum(couplingnode))
Converts the numeric value of couplingnode to a treenode
Converts the numeric value of couplingnode to a treenode
Assert type as a number
Description
Assert type as an arithmetic number. Only serves a real purpose in C++.
Example
return tonum(current);
This returns a pointer to the current object, casting it as a number.
This returns a pointer to the current object, casting it as a number.
Description
For developer use. Assert type as pointer. Assert that the argument thing is of type void*. Only serves a real purpose in C++, but is safe to use in flexscript.
Example
toptr(so())
Conveyor
Description
Deprecated, use Conveyor class.
Example
conveyorgetmotor(conveyor);
Description
Deprecated, use Conveyor class.
Example
conveyorinfo(conveyor, CONV_INFO_ESTIMATE_CONVEY_TIME);
Description
Deprecated, use Conveyor class.
Example
conveyorresumeitem(item);
Description
Deprecated, use Conveyor class.
Example
conveyorsenditem(item, outobject(current, 1));
Description
Deprecated, use Conveyor class.
Example
conveyorsetspeed(conveyor, 1);
Description
Deprecated, use Conveyor class.
Example
conveyorstopitem(item);
Description
Deprecated, use Conveyor.MergeController class.
Example
mergegetlanestate(current, 5)
Description
Deprecated, use Conveyor.MergeController class.
Example
mergegetnumlanes(current)
Description
Deprecated, use Conveyor.MergeController class.
Example
mergeislaneclear(current, 5)
Description
Deprecated, use Conveyor.MergeController class.
Example
mergereleaselane(current, 1)
Deprecated
Commands that are no longer supported, or for which alternative commands have been made. The documentation for these commands has been discontinued, and therefore may be incorrect. Many of the commands still work for backwards compatibility purposes, but we encourage you to use their alternatives instead.
Deprecated, use the + operator
Description
This command is deprecated. Use the + operator instead.
Addition of value1 to value2. This returns the result of the arithmetic expression value1+value2.
Addition of value1 to value2. This returns the result of the arithmetic expression value1+value2.
Example
double sum = add(1,2);
Deprecated
Description
This command is deprecated. Adds a new entry to the Movement table that is recorded when Full History is enabled. The new entry records that the flowitem identified by flowitemid moved from the orgin object to the destination object and the specified time. The entry also records that the flowitem's itemtype at the time of the movement was the itemtype passed as the third parameter. Users should only have to use this command in very rare situations.
Example
addfullhistorymoverecord(getnodenum(uniqueid(item)), time(), current, current.outObjects[1], item.type);
Deprecated
Description
This command is deprecated. Adds a new entry to the State table that is recorded when Full History is enabled. The new entry records that the specified object passed in as the third parameter changed to the specified state at the time that is entered as the first parameter. This should only need to be called if the object is having its state changed by soem command other than setstate().
Example
addfullhistorystaterecord(time(), STATE_IDLE, current);
Deprecated, use the && operator
Description
This command is deprecated. Use the && operator instead..
Example
Deprecated, use Math.atan2()
Description
Example
double myangle = angle(distx, disty)
Deprecated, use tonode()
Description
This command is deprecated. Use tonode() instead.
Assert type as node pointer.
Assert type as node pointer.
Example
anode(so())
Deprecated, use tonum()
Description
This command is deprecated. Use tonum() instead.
Assert type as arithmetic number.
Assert type as arithmetic number.
Example
anum(so())
Deprecated, use toptr()
Description
This command is deprecated. Use toptr() instead.
Assert type as pointer
Assert type as pointer
Example
aptr(so())
Deprecated, use getvarnode()
Description
This command is deprecated. Use var(), var_s() or getvarnode() instead.
Example
att(current,1)
Deprecated, use getvarnode()
Description
This command is deprecated. Use getvarnode() instead.
Get the attribute node of an object by name. An attribute node is one which resides inside the "variables" node of the structure of an object. This function will return the pointer to the node called name inside the variables node of object. var_s supercedes this command.
Get the attribute node of an object by name. An attribute node is one which resides inside the "variables" node of the structure of an object. This function will return the pointer to the node called name inside the variables node of object. var_s supercedes this command.
Example
att_s(current,"myatt")
Description
This command is deprecated. Use the Video Recorder instead.
Example
Description
This command is deprecated. Use the Video Recorder instead.
Example
Description
This command is deprecated. Use the Video Recorder instead.
Example
bcgetitemkinematics
(obj basicconveyor, obj item, num kinematictype {0-main kinematic : 1-time dependent : 2-convey dependent})
Deprecated, legacy conveyors are no longer supported
Description
Deprecated, Legacy conveyors are no longer supported.
This command is used in conjunction with the BasicConveyor object.
The bcgetitemkinematics command is used to obtain a reference to one of the three kinematics associated with a flowitem traveling on a BasicConveyor:
0 = The main convey state kinematics. You may get kinematic information from this, but do not change the kinematic by adding kinematics or initializing it.
1 = A user-definable kinematics that is dependent on simulation time.
2 = A user-definable kinematics that is dependent on the convey position of the flowitem on the conveyor.
The two user-definable kinematics are available for the user to set up customized kinematic motion in addition to traveling down the length of the conveyor. Use bcgetitemkinematics to get a reference to the desired kinematics node, and then use standard initkinematics() and addkinematic() commands as normal. You will need to use the alternative initkinematics parameter list: initkinematics(node, x, y, z, rx, ry, rz, managerots, localcoords). Also, if you add kinematics to the type 2 convey depend kinematic node, bear in mind that all time units for that kinematic no longer apply to actual simulation time units. Instead, they are interpretted as "convey units". For example, a speed of 5 is no longer 5 units per time unit, but is instead 5 units per conveyed unit. Acceleration is not distance per time squared, but distance per conveyed unit squared. Start times are no longer a time to start the kinematic, but a position along the conveyor to start the kinematic at. As an example, let's say you add a kinematic to the convey dependent kinematic node to travel 1 unit in the y direction with "start time" 5 and "max speed" 0.5. What that translates to for the convey dependent kinematic is that the item will start traveling in the y direction once it reaches 5 units along the conveyor. Also, for every unit that it travels down the length of the conveyor, it will travel 0.5 units in the y direction (0.5 y units per convey unit). Thus it will finish the y kinematic once it has travelled 7 units down the conveyor. If the item is blocked in the middle because of accumulation, say at convey position 6, then its y kinematic will also stop, and not resume until the item resumes along the conveyor.
See bcsetitemconveystate command documentation for a general description of the BasicConveyor object.
This command is used in conjunction with the BasicConveyor object.
The bcgetitemkinematics command is used to obtain a reference to one of the three kinematics associated with a flowitem traveling on a BasicConveyor:
0 = The main convey state kinematics. You may get kinematic information from this, but do not change the kinematic by adding kinematics or initializing it.
1 = A user-definable kinematics that is dependent on simulation time.
2 = A user-definable kinematics that is dependent on the convey position of the flowitem on the conveyor.
The two user-definable kinematics are available for the user to set up customized kinematic motion in addition to traveling down the length of the conveyor. Use bcgetitemkinematics to get a reference to the desired kinematics node, and then use standard initkinematics() and addkinematic() commands as normal. You will need to use the alternative initkinematics parameter list: initkinematics(node, x, y, z, rx, ry, rz, managerots, localcoords). Also, if you add kinematics to the type 2 convey depend kinematic node, bear in mind that all time units for that kinematic no longer apply to actual simulation time units. Instead, they are interpretted as "convey units". For example, a speed of 5 is no longer 5 units per time unit, but is instead 5 units per conveyed unit. Acceleration is not distance per time squared, but distance per conveyed unit squared. Start times are no longer a time to start the kinematic, but a position along the conveyor to start the kinematic at. As an example, let's say you add a kinematic to the convey dependent kinematic node to travel 1 unit in the y direction with "start time" 5 and "max speed" 0.5. What that translates to for the convey dependent kinematic is that the item will start traveling in the y direction once it reaches 5 units along the conveyor. Also, for every unit that it travels down the length of the conveyor, it will travel 0.5 units in the y direction (0.5 y units per convey unit). Thus it will finish the y kinematic once it has travelled 7 units down the conveyor. If the item is blocked in the middle because of accumulation, say at convey position 6, then its y kinematic will also stop, and not resume until the item resumes along the conveyor.
See bcsetitemconveystate command documentation for a general description of the BasicConveyor object.
Example
treenode kin = bcgetitemkinematics(current, item, 2);
treenode kin2 = bcgetitemkinematics(current, item, 1);
initkinematics(kin, 0,0,0, 0,0,0, 0,0);
addkinematic(kin, 0,1,1,0.5,1,1,0,0, 5, KINEMATIC_TRAVEL);
initkinematics(kin2, 0,0,0, 0,0,0, 0,0);
addkinematic(kin2, 0,0,720,360,0,0,0,0, time()+5.0, KINEMATIC_ROTATE);
treenode kin2 = bcgetitemkinematics(current, item, 1);
initkinematics(kin, 0,0,0, 0,0,0, 0,0);
addkinematic(kin, 0,1,1,0.5,1,1,0,0, 5, KINEMATIC_TRAVEL);
initkinematics(kin2, 0,0,0, 0,0,0, 0,0);
addkinematic(kin2, 0,0,720,360,0,0,0,0, time()+5.0, KINEMATIC_ROTATE);
Deprecated, legacy conveyors are no longer supported
Description
Deprecated, Legacy conveyors are no longer supported.
This command is used in conjunction with the BasicConveyor object
The bcgetitemposition command returns the current position of an item on a BasicConveyor object. The position is measured along the conveyor's length from the head of the conveyor to the flowitem's edge furthest from the head of the conveyor.
See bcsetitemconveystate command documentation for a general description of the BasicConveyor object.
This command is used in conjunction with the BasicConveyor object
The bcgetitemposition command returns the current position of an item on a BasicConveyor object. The position is measured along the conveyor's length from the head of the conveyor to the flowitem's edge furthest from the head of the conveyor.
See bcsetitemconveystate command documentation for a general description of the BasicConveyor object.
Example
bcgetitemposition(current,current.first);
Deprecated, legacy conveyors are no longer supported
Description
Deprecated, Legacy conveyors are no longer supported.
This command is used in conjunction with the BasicConveyor object.
The bcsetdirection command stops all flowitems on the conveyor and sets the direction of travel to 1=forward and 0=reverse. All flowitems will need to have their convey state reset with the bcsetitemconveystate() command before they will begin moving again. The example below shows how to stop the conveyor, and then have all the flowitems accelerate up to a speed of 1 in the reverse direction. Any additional item kinematics will still be active after a direction change.
See bcsetitemconveystate command documentation for a general description of the BasicConveyor object.
This command is used in conjunction with the BasicConveyor object.
The bcsetdirection command stops all flowitems on the conveyor and sets the direction of travel to 1=forward and 0=reverse. All flowitems will need to have their convey state reset with the bcsetitemconveystate() command before they will begin moving again. The example below shows how to stop the conveyor, and then have all the flowitems accelerate up to a speed of 1 in the reverse direction. Any additional item kinematics will still be active after a direction change.
See bcsetitemconveystate command documentation for a general description of the BasicConveyor object.
Example
bcsetdirection(so(),0);
for(int i = 1; i <= so().subnodes.length; i++)
{
treenode item = so().subnodes[i];
bcsetitemconveystate(so(), item, bcgetitemposition(so(), item), 0, 1, 0.2);
}
for(int i = 1; i <= so().subnodes.length; i++)
{
treenode item = so().subnodes[i];
bcsetitemconveystate(so(), item, bcgetitemposition(so(), item), 0, 1, 0.2);
}
bcsetitemconveystate
(obj basicconveyor, obj item, num startpoint, num startspeed, num targetspeed, num accdec)
Deprecated, legacy conveyors are no longer supported
Description
Deprecated, Legacy conveyors are no longer supported.
This command is used in conjunction with the BasicConveyor object.
The BasicConveyor object allows flowitems to be moved in and out of the conveyor at any time and at any location. Each flowitem on the BasicConveyor can be assigned and re-assigned its own kinematic profile defining how the flowitem is to move along the conveyor. When one flowitem overtakes another flowitem on the conveyor which is either stopped or traveling at a slower speed, it will slow down immediately to match that flowitem's speed. Although flowitems may travel in either direction along the conveyor, all flowitems will travel in the same direction at any given time. The travel direction of the conveyor is set with the bcsetdirection() command. As flowitems are moved in and out of the conveyor, other flowitems on the conveyor are aware of the increase or decrease in available space along the conveyor, and will accumulate naturally. After a flowitem enters the conveyor, either indirectly with the receiveitem() command or directly with the moveobject() command; it is necessary to define the flowitem's initial kinematic profile. This profile is refered to as the flowitem's "convey state", and it is set with the bcsetitemconveystate() command. The convey state for a flowitem can be set multiple times if desired. The following are definitions for the parameters used to define the convey state of a flowitem:
basicconveyor = A reference to the conveyor.
item = A reference to the flowitem.
startpoint = The starting location for the flowitem as measured from the beginning of the conveyor, along the conveyor's length to the flowitem's edge furthest from the head of the conveyor (the leading edge if the conveyor's direction is forward, the trailing edge if the conveyor's direction is backward).
startspeed = The initial speed the flowitem will begin traveling at.
targetspeed = The target speed the flowitem will try to achieve. If the targetspeed is greater than the startspeed, then the flowitem will accelerate up to the target speed; otherwise it will decelerate down to the target speed. If both the startspeed and the targetspeed are set to 0, the flowitem will be positioned at the startpoint, and will not move.
accdec = The acceleration or deceleration used to achieve the target speed over time. A value of 0 indicates infinite acceleration/deceleration; or in other words the flowitem will reach it's targetspeed immediately.
No destination or termination speed is required, because the flowitems continue traveling along the conveyor until they either reach the end of the conveyor, run into another flowitem, or their convey state is changed again. The BasicConveyor allows multiple "Decision Points" to be defined along its length. These trigger points are convenient locations to update the convey state of a flowitem. In addition to the main convey state kinematic assigned to the flowitem with the bcsetitemconveystate() command, a flowitem has two other kinematic structures associated with it that may be used to apply custom kinematic motion (translation or rotation) in addition to the travel motion along the conveyor. One of the kinematic structures is based on simulated time units, and the other is based on distance units along the length of the conveyor. To access these kinematic structures, use the bcgetitemkinematics() command, then use the initkinematics() and addkinematic() commands to create the custom kinematic motion desired. See bcgetitemkinematics() command documentation for more information.
This command is used in conjunction with the BasicConveyor object.
The BasicConveyor object allows flowitems to be moved in and out of the conveyor at any time and at any location. Each flowitem on the BasicConveyor can be assigned and re-assigned its own kinematic profile defining how the flowitem is to move along the conveyor. When one flowitem overtakes another flowitem on the conveyor which is either stopped or traveling at a slower speed, it will slow down immediately to match that flowitem's speed. Although flowitems may travel in either direction along the conveyor, all flowitems will travel in the same direction at any given time. The travel direction of the conveyor is set with the bcsetdirection() command. As flowitems are moved in and out of the conveyor, other flowitems on the conveyor are aware of the increase or decrease in available space along the conveyor, and will accumulate naturally. After a flowitem enters the conveyor, either indirectly with the receiveitem() command or directly with the moveobject() command; it is necessary to define the flowitem's initial kinematic profile. This profile is refered to as the flowitem's "convey state", and it is set with the bcsetitemconveystate() command. The convey state for a flowitem can be set multiple times if desired. The following are definitions for the parameters used to define the convey state of a flowitem:
basicconveyor = A reference to the conveyor.
item = A reference to the flowitem.
startpoint = The starting location for the flowitem as measured from the beginning of the conveyor, along the conveyor's length to the flowitem's edge furthest from the head of the conveyor (the leading edge if the conveyor's direction is forward, the trailing edge if the conveyor's direction is backward).
startspeed = The initial speed the flowitem will begin traveling at.
targetspeed = The target speed the flowitem will try to achieve. If the targetspeed is greater than the startspeed, then the flowitem will accelerate up to the target speed; otherwise it will decelerate down to the target speed. If both the startspeed and the targetspeed are set to 0, the flowitem will be positioned at the startpoint, and will not move.
accdec = The acceleration or deceleration used to achieve the target speed over time. A value of 0 indicates infinite acceleration/deceleration; or in other words the flowitem will reach it's targetspeed immediately.
No destination or termination speed is required, because the flowitems continue traveling along the conveyor until they either reach the end of the conveyor, run into another flowitem, or their convey state is changed again. The BasicConveyor allows multiple "Decision Points" to be defined along its length. These trigger points are convenient locations to update the convey state of a flowitem. In addition to the main convey state kinematic assigned to the flowitem with the bcsetitemconveystate() command, a flowitem has two other kinematic structures associated with it that may be used to apply custom kinematic motion (translation or rotation) in addition to the travel motion along the conveyor. One of the kinematic structures is based on simulated time units, and the other is based on distance units along the length of the conveyor. To access these kinematic structures, use the bcgetitemkinematics() command, then use the initkinematics() and addkinematic() commands to create the custom kinematic motion desired. See bcgetitemkinematics() command documentation for more information.
Example
bcsetitemconveystate(current, item, position, 0, 60, 0);
Deprecated, use & operator
Description
This command is deprecated. Use & operator instead.
Returns a bitwise AND operation on the two 32 bit integer values.
Returns a bitwise AND operation on the two 32 bit integer values.
Example
int bwa = bitwiseand(0x460, 0x040);
This example sets bwa to the value 0x020.
This example sets bwa to the value 0x020.
Deprecated, use ~ operator
Description
This command is deprecated. Use ~ operator instead.
Returns the bitwise not of the 32 bit integer value
Returns the bitwise not of the 32 bit integer value
Example
int bwn = bitwisenot(0x0);
This example sets bwn to the value 0xffffffff
This example sets bwn to the value 0xffffffff
Deprecated, use | operator
Description
This command is deprecated. Use | operator instead.
Returns the bitwise OR of the 32 bit integer values
Returns the bitwise OR of the 32 bit integer values
Example
int bwo = bitwiseor(0x15, 0x01);
This example sets bwo to the value 0x15
This example sets bwo to the value 0x15
Deprecated, use ^ operator
Description
This command is deprecated. Use ^ operator instead.
Returns the bitwise XOR of the 32 bit integer values
Returns the bitwise XOR of the 32 bit integer values
Example
int bwxo = bitwisexor(0x15, 0x01);
This example sets bwxo to the value 0x14
This example sets bwxo to the value 0x14
Deprecated, use Table class
Description
This command is deprecated. Use the Table class instead.
Example
Deprecated, use Object.centerObjects[]
Description
This command is deprecated. Use Object.centerObjects[] instead.
Reference the object connected to an object's center port.
Reference the object connected to an object's center port.
Example
Deprecated, use conveyor.targetSpeed
Description
This command is deprecated. Legacy conveyors are no longer supported. Use Conveyor.targetSpeed instead.
Changes the speed of the conveyor to newspeed.
Changes the speed of the conveyor to newspeed.
Example
changeconveyorspeed(current, 4);
This example changes the conveyor's speed to 4.
This example changes the conveyor's speed to 4.
Clears the output console
Description
This command clears the output console if it is open. The output console is where output from the pt(), pf(), and pr() commands is printed.
Example
if (v_printerror == 1)
{
clearconsole();
pt("An Error occurred");
}
This clears the output console and prints a simple error message to it if the variable called printerror is equal to 1.
{
clearconsole();
pt("An Error occurred");
}
This clears the output console and prints a simple error message to it if the variable called printerror is equal to 1.
Deprecated
Description
This command is deprecated. Deletes all of the data that has been collected by the Full History system. If resetuniqueid is 1, then the unique IDs of the flowitems that are created after this command is called will being again at 1. Typically, this parameter should be 0, as that will continue numbering so that old flowitems are not confused with new flowitems.
Example
clearfullhistory(0);
Deprecated, use Table class
Description
This command is deprecated. Use the Table class instead.
Example
Deprecated, use Object.input.close()
Description
This command is deprecated. Use Object.input.close() instead.
This command blocks the input of the object. Only the input ports themselves, or the input in general needs to be closed to block entry. When port connections are displayed with sufficient size in the view window, you will see a small red bar drawn across all the input ports (squares) for the object, signifying the input ports are blocked. Individual ports may still be open and drawn in green, but entry to the object is still blocked because of the red bar. Compare this command with stopinput().
This command blocks the input of the object. Only the input ports themselves, or the input in general needs to be closed to block entry. When port connections are displayed with sufficient size in the view window, you will see a small red bar drawn across all the input ports (squares) for the object, signifying the input ports are blocked. Individual ports may still be open and drawn in green, but entry to the object is still blocked because of the red bar. Compare this command with stopinput().
Example
if (current.subnodes.length == getvarnum(current,"maxcontent")
closeinput(current);
This blocks the input ports of current when it has too many objects inside it.
closeinput(current);
This blocks the input ports of current when it has too many objects inside it.
Deprecated, use Object.output.close()
Description
This command is deprecated. Use Object.output.close() instead.
This command blocks the output of the object. Only the output ports themselves, or the output in general needs to be closed to block the exit. When port connections are displayed with sufficient size in the view window, you will see a small red bar drawn across all the output ports (squares) for the object, signifying the output ports are blocked. Individual ports may still be open and drawn in green, but exit from the object is still blocked because of the red bar. Compare this command with stopoutput().
This command blocks the output of the object. Only the output ports themselves, or the output in general needs to be closed to block the exit. When port connections are displayed with sufficient size in the view window, you will see a small red bar drawn across all the output ports (squares) for the object, signifying the output ports are blocked. Individual ports may still be open and drawn in green, but exit from the object is still blocked because of the red bar. Compare this command with stopoutput().
Example
if (current.subnodes.length == current.mincontent)
closeoutput(current);
This blocks the output ports of current, if current has too few objects inside it.
closeoutput(current);
This blocks the output ports of current, if current has too few objects inside it.
Deprecated, use == operator
Description
This command is deprecated. Use the == operator instead. myStr == "Hello"
Test for string equality.
Test for string equality.
Example
Deprecated, use + operator
Description
This command is deprecated. Use the + operator instead. "a" + "b" + "c"
Concatenates strings together.
Concatenates strings together.
Example
Deprecated, use contextdragconnection()
Description
This command is deprecated. Use contextdragconnection() instead.
Connect ports of two objects. The two objects are connected by checking whether the ports exist on the objects in question and then connecting them. The output port of the first object will be connected to the input of the second object. If the ports do not exist, or are already connected then the command will abort. To connect two objects by automatically adding ports, see the command objectconnect().
Connect ports of two objects. The two objects are connected by checking whether the ports exist on the objects in question and then connecting them. The output port of the first object will be connected to the input of the second object. If the ports do not exist, or are already connected then the command will abort. To connect two objects by automatically adding ports, see the command objectconnect().
Example
connect(model().subnodes[2],1,model().subnodes[3],2)
Deprecated, use tracked variables or Process Flow
Description
This command is deprecated. Use tracked variables and/or Process Flow to track custom statistics.
Example
Deprecated, use tracked variables or Process Flow
Description
This command is deprecated. Use tracked variables and/or Process Flow to track custom statistics.
Example
Description
The value of the iterator used with several commands such as repeat(), findmatch(), findmin(), and findmax(). The value of count will depend on which iteration is currently being executed.
Example
findmax(Table("MyTable").numRows, Table("MyTable")[count][5])
This example returns the maximum value found in column 5, among all the rows of the table MyTable.
This example returns the maximum value found in column 5, among all the rows of the table MyTable.
Deprecated, do not use
Description
This command is deprecated. Do not use.
Example
Deprecated, do not use
Description
This command is deprecated. Do not use.
Example
Copies thenode into the specified container
Description
This command is deprecated. Use treenode.copy() instead.
Copy thenode into the node specified as container. This command is different from createinstance() in that it does not attempt to establish any links between thenode and any class. If an instantiation is required, use createinstance() instead.
If samename is 1, the copy will have the same name as thenode.
If samename is 0, the newly created node's name will be thenode's name with a random number added to the end.
If inobject is 1, the copy will be created in the object data portion of the container. If the container does not have object data, the command does nothing.
If cached is 1, a pre-cached version of the node will be copied. This is generally faster.
If replace is 1, the copy will overwrite container, instead of being placed inside it.
If those parameters are not specified, they default to 0.
Copy thenode into the node specified as container. This command is different from createinstance() in that it does not attempt to establish any links between thenode and any class. If an instantiation is required, use createinstance() instead.
If samename is 1, the copy will have the same name as thenode.
If samename is 0, the newly created node's name will be thenode's name with a random number added to the end.
If inobject is 1, the copy will be created in the object data portion of the container. If the container does not have object data, the command does nothing.
If cached is 1, a pre-cached version of the node will be copied. This is generally faster.
If replace is 1, the copy will overwrite container, instead of being placed inside it.
If those parameters are not specified, they default to 0.
Example
createcopy(Model.find("Tools/FlowItemBin/7/1"), current)
Deprecated, use Process Flow instead
Description
This command is deprecated. Use Process Flow instead.
This command creates a task sequence for the object specified by dispatcher that causes it to pause its current task for delaytime seconds. During the time that it is delayed, it will be in the state specified by state. The task sequence will be given a priority of priority and a preempting value of preempting. The possible values for preempting are:
0 - PREEMPT_NOT
1 - PREEMPT_ONLY
2 - PREEMPT_AND_ABORT_ACTIVE
3 - PREEMPT_AND_ABORT_ALL
This command creates a task sequence for the object specified by dispatcher that causes it to pause its current task for delaytime seconds. During the time that it is delayed, it will be in the state specified by state. The task sequence will be given a priority of priority and a preempting value of preempting. The possible values for preempting are:
0 - PREEMPT_NOT
1 - PREEMPT_ONLY
2 - PREEMPT_AND_ABORT_ACTIVE
3 - PREEMPT_AND_ABORT_ALL
Example
createdelaytask(current.centerObjects[1], 25, SCHEDULED_DOWN, 1, PREEMPT_NOT);
Deprecated, use Process Flow instead
Description
This command is deprecated. Use Process Flow instead.
Creates an instance of the named global task sequence with the given dynamic parameters 1-5 and dispatches it to the specified dispatcher. Returns a reference to the created global task sequence. Note that this does not dispatch the task sequence. You need to dispatch it yourself using dispatchtasksequence().
Creates an instance of the named global task sequence with the given dynamic parameters 1-5 and dispatches it to the specified dispatcher. Returns a reference to the created global task sequence. Note that this does not dispatch the task sequence. You need to dispatch it yourself using dispatchtasksequence().
Example
treenode ts = createglobaltasksequence("GlobalTS", current.centerObjects[1])
dispatchtasksequence(ts)
dispatchtasksequence(ts)
Description
This command is deprecated. Use Object.create() instead.
For developer use.
This command creates an instance of the class specified as class and places it in the object specified as location. The instance will be given a name that is the name of the class followed by a number. The instance will have all of the variables and attributes of class and it's superclasses. Nodes in the behavior node will not be copied into the instance, as they apply to all instances of the class. The object passed as class should be in the library. Generally, location is the model. The library and the model can be easily referenced using the library() and model() commands.
For developer use.
This command creates an instance of the class specified as class and places it in the object specified as location. The instance will be given a name that is the name of the class followed by a number. The instance will have all of the variables and attributes of class and it's superclasses. Nodes in the behavior node will not be copied into the instance, as they apply to all instances of the class. The object passed as class should be in the library. Generally, location is the model. The library and the model can be easily referenced using the library() and model() commands.
Example
createinstance(library().find("?Source"), model());
This creates an instance of the Source class in the model.
This creates an instance of the Source class in the model.
Deprecated, use Process Flow instead
Description
This command is deprecated. Use Process Flow instead.
This command creates a task sequence for the object specified by dispatcher that causes it to load flowitem. The object will not travel to the flowitem before loading it. This task sequence will be given a priority of priority and a preempting value of preempting. The possible values for preempting are:
0 - PREEMPT_NOT
1 - PREEMPT_ONLY
2 - PREEMPT_AND_ABORT_ACTIVE
3 - PREEMPT_AND_ABORT_ALL
This command creates a task sequence for the object specified by dispatcher that causes it to load flowitem. The object will not travel to the flowitem before loading it. This task sequence will be given a priority of priority and a preempting value of preempting. The possible values for preempting are:
0 - PREEMPT_NOT
1 - PREEMPT_ONLY
2 - PREEMPT_AND_ABORT_ACTIVE
3 - PREEMPT_AND_ABORT_ALL
Example
createloadtask(current.centerObjects[1],current.centerObjects[2],item, 1, PREEMPT_NOT);
createsendmessagetask
(obj taskexecuter, obj receiver, num priority, num preempting , num param1, num param2, num param3)
Deprecated, use Process Flow instead
Description
This command is deprecated. Use Process Flow instead.
This command creates a task sequence on the object specifies as dispatcher that causes it to send a message to the object specified as receiver. The OnMessage trigger of the receiving object will be executed when the message is sent. The values passed as param1, param2, and param3 will be available in the trigger function using the param() command. This task sequence will be given a priority of priority and a preempting value of preempting. The possible values for preempting are:
0 - PREEMPT_NOT
1 - PREEMPT_ONLY
2 - PREEMPT_AND_ABORT_ACTIVE
3 - PREEMPT_AND_ABORT_ALL
This command creates a task sequence on the object specifies as dispatcher that causes it to send a message to the object specified as receiver. The OnMessage trigger of the receiving object will be executed when the message is sent. The values passed as param1, param2, and param3 will be available in the trigger function using the param() command. This task sequence will be given a priority of priority and a preempting value of preempting. The possible values for preempting are:
0 - PREEMPT_NOT
1 - PREEMPT_ONLY
2 - PREEMPT_AND_ABORT_ACTIVE
3 - PREEMPT_AND_ABORT_ALL
Example
createsendmessagetask(current, current.centerObjects[1],1,PREEMPT_NOT,5, 6, 7);
createstandardtask
(obj taskexecuter, obj origin, obj destination, obj flowitem, num priority, num preempting)
Deprecated, use Process Flow instead
Description
This command is deprecated. Use Process Flow instead.
This command creates a task sequence for the object specified by dispatcher that causes it to travel to origin, load flowitem, travel to destination and unload flowitem. This task sequence will be given a priority of priority and a preempting value of preempting. The possible values for preempting are:
0 - PREEMPT_NOT
1 - PREEMPT_ONLY
2 - PREEMPT_AND_ABORT_ACTIVE
3 - PREEMPT_AND_ABORT_ALL
This command creates a task sequence for the object specified by dispatcher that causes it to travel to origin, load flowitem, travel to destination and unload flowitem. This task sequence will be given a priority of priority and a preempting value of preempting. The possible values for preempting are:
0 - PREEMPT_NOT
1 - PREEMPT_ONLY
2 - PREEMPT_AND_ABORT_ACTIVE
3 - PREEMPT_AND_ABORT_ALL
Example
createstandardtaskcurrent.centerObjects[1],current.centerObjects[2],current.centerObjects[3],item, 1, PREEMPT_NOT);
createtravelloadtask
(obj taskexecuter, obj destination, obj flowitem, num priority, num preempting)
Deprecated, use Process Flow instead
Description
This command is deprecated. Use Process Flow instead.
This command creates a task sequence for the object specified by dispatcher that causes it to travel to destination, and load flowitem. This task sequence will be given a priority of priority and a preempting value of preempting. The possible values for preempting are:
0 - PREEMPT_NOT
1 - PREEMPT_ONLY
2 - PREEMPT_AND_ABORT_ACTIVE
3 - PREEMPT_AND_ABORT_ALL
This command creates a task sequence for the object specified by dispatcher that causes it to travel to destination, and load flowitem. This task sequence will be given a priority of priority and a preempting value of preempting. The possible values for preempting are:
0 - PREEMPT_NOT
1 - PREEMPT_ONLY
2 - PREEMPT_AND_ABORT_ACTIVE
3 - PREEMPT_AND_ABORT_ALL
Example
createtravelloadtask(current.centerObjects[1],current.centerObjects[2],item, 1, PREEMPT_NOT);
Deprecated, use Process Flow instead
Description
This command is deprecated. Use Process Flow instead.
This command creates a task sequence for the object specified by dispatcher that causes it to travel to destination. It will travel until its front edge reaches destination. This task sequence will be given a priority of priority and a preempting value of preempting. The possible values for preempting are:
0 - PREEMPT_NOT
1 - PREEMPT_ONLY
2 - PREEMPT_AND_ABORT_ACTIVE
3 - PREEMPT_AND_ABORT_ALL
This command creates a task sequence for the object specified by dispatcher that causes it to travel to destination. It will travel until its front edge reaches destination. This task sequence will be given a priority of priority and a preempting value of preempting. The possible values for preempting are:
0 - PREEMPT_NOT
1 - PREEMPT_ONLY
2 - PREEMPT_AND_ABORT_ACTIVE
3 - PREEMPT_AND_ABORT_ALL
Example
createtraveltask( current.centerObjects[1], current.centerObjects[2], 1, PREEMPT_NOT);
createtraveltolocandwaittask
(obj taskexecuter, num relativeloc, num x, num y, num z, num endspeed, num state, num priority, num preempting)
Deprecated, use Process Flow instead
Description
This command is deprecated. Use Process Flow instead.
This command creates a task sequence for the object specified by dispatcher that causes it to travel to the point specified by xlox, y, and z. Once the object reaches that point, it will wait in the state specified as state until an endwaittask() command is issued to it. For a list of legal states, see setstate(). If relativeloc is 1, the specified point is relative to the origin of dispatcher. If relativeloc is 0, the specified point is the exact point in
the model that dispatcher will try to travel to. It will travel until its front edge reaches the specified point. This task sequence will be given a priority of priority and a preempting value of preempting. The possible values for preempting are:
0 - PREEMPT_NOT
1 - PREEMPT_ONLY
2 - PREEMPT_AND_ABORT_ACTIVE
3 - PREEMPT_AND_ABORT_ALL
This command creates a task sequence for the object specified by dispatcher that causes it to travel to the point specified by xlox, y, and z. Once the object reaches that point, it will wait in the state specified as state until an endwaittask() command is issued to it. For a list of legal states, see setstate(). If relativeloc is 1, the specified point is relative to the origin of dispatcher. If relativeloc is 0, the specified point is the exact point in
the model that dispatcher will try to travel to. It will travel until its front edge reaches the specified point. This task sequence will be given a priority of priority and a preempting value of preempting. The possible values for preempting are:
0 - PREEMPT_NOT
1 - PREEMPT_ONLY
2 - PREEMPT_AND_ABORT_ACTIVE
3 - PREEMPT_AND_ABORT_ALL
Example
createtraveltolocandwaittask(current.centerObjects[1], 1, 5.15, 2.5, 0, 0, STATE_IDLE, 1, PREEMPT_NOT);
createtraveltoloctask
(obj dispatcher, num relativeloc, num x, num y, num z, num endspeed, num priority, num preempting)
Deprecated, use Process Flow instead
Description
This command is deprecated. Use Process Flow instead.
This command creates a task sequence for the object specified by dispatcher that causes it to travel to the point specified by xlox, y, and z. If relativeloc is 1, the specified point is relative to the origin of dispatcher. If relativeloc is 0, the specified point is the exact point in the model that dispatcher will try to travel to. It will travel until its front edge reaches the specified point. This task sequence will be given a priority of priority and a preempting value of preempting. The possible values for preempting are:
0 - PREEMPT_NOT
1 - PREEMPT_ONLY
2 - PREEMPT_AND_ABORT_ACTIVE
3 - PREEMPT_AND_ABORT_ALL
This command creates a task sequence for the object specified by dispatcher that causes it to travel to the point specified by xlox, y, and z. If relativeloc is 1, the specified point is relative to the origin of dispatcher. If relativeloc is 0, the specified point is the exact point in the model that dispatcher will try to travel to. It will travel until its front edge reaches the specified point. This task sequence will be given a priority of priority and a preempting value of preempting. The possible values for preempting are:
0 - PREEMPT_NOT
1 - PREEMPT_ONLY
2 - PREEMPT_AND_ABORT_ACTIVE
3 - PREEMPT_AND_ABORT_ALL
Example
createtraveltoloctask(current.centerObjects[1], 1, 5.15, 2.5, 0, 0, 1, PREEMPT_NOT);
createtravelunloadtask
(obj taskexecuter, obj destination, obj flowitem, num priority, num preempting)
Deprecated, use Process Flow instead
Description
This command is deprecated. Use Process Flow instead.
This command creates a task sequence for the object specified by dispatcher that causes it to travel to destination, and unload flowitem. This task sequence will be given a priority of priority and a preempting value of preempting. The possible values for preempting are:
0 - PREEMPT_NOT
1 - PREEMPT_ONLY
2 - PREEMPT_AND_ABORT_ACTIVE
3 - PREEMPT_AND_ABORT_ALL
This command creates a task sequence for the object specified by dispatcher that causes it to travel to destination, and unload flowitem. This task sequence will be given a priority of priority and a preempting value of preempting. The possible values for preempting are:
0 - PREEMPT_NOT
1 - PREEMPT_ONLY
2 - PREEMPT_AND_ABORT_ACTIVE
3 - PREEMPT_AND_ABORT_ALL
Example
createtravelunloadtask(current.centerObjects[1],current.centerObjects[2],item, 1, PREEMPT_NOT);
Deprecated, use Process Flow instead
Description
This command is deprecated. Use Process Flow instead.
This command creates a task sequence for the object specified by dispatcher that causes it to unload flowitem into the object specified by destination. The object will not travel to the location before unloading. This task sequence will be given a priority of priority and a preempting value of preempting. The possible values for preempting are:
0 - PREEMPT_NOT
1 - PREEMPT_ONLY
2 - PREEMPT_AND_ABORT_ACTIVE
3 - PREEMPT_AND_ABORT_ALL
This command creates a task sequence for the object specified by dispatcher that causes it to unload flowitem into the object specified by destination. The object will not travel to the location before unloading. This task sequence will be given a priority of priority and a preempting value of preempting. The possible values for preempting are:
0 - PREEMPT_NOT
1 - PREEMPT_ONLY
2 - PREEMPT_AND_ABORT_ACTIVE
3 - PREEMPT_AND_ABORT_ALL
Example
createunloadtask(current.centerObjects[1],current.centerObjects[2],item, 1, PREEMPT_NOT);
Deprecated, use Process Flow instead
Description
This command is deprecated. Use Process Flow instead.
This command creates a task sequence on the object specified as dispatcher that causes the object to not perform new task sequences that it is given until it has been released. The object can be released with the endwaittask() command. The object will be in the state specified by state while it is waiting. For a list of possible states, see setstate() command. This task sequence will be given a priority of priority and a preempting value of preempting. The possible values for preempting are:
0 - PREEMPT_NOT
1 - PREEMPT_ONLY
2 - PREEMPT_AND_ABORT_ACTIVE
3 - PREEMPT_AND_ABORT_ALL
This command creates a task sequence on the object specified as dispatcher that causes the object to not perform new task sequences that it is given until it has been released. The object can be released with the endwaittask() command. The object will be in the state specified by state while it is waiting. For a list of possible states, see setstate() command. This task sequence will be given a priority of priority and a preempting value of preempting. The possible values for preempting are:
0 - PREEMPT_NOT
1 - PREEMPT_ONLY
2 - PREEMPT_AND_ABORT_ACTIVE
3 - PREEMPT_AND_ABORT_ALL
Example
createwaittask(current.centerObjects[1], STATE_IDLE, 1, PREEMPT_NOT);
Description
This command is deprecated. This should not be used as a special command with the setcurrent command anymore. Instead, declare a treenode variable type as current, then use current in your code as any other variable type.
Example
treenode current = model().subnodes[3];
pt(current.name);
This sets the object that is ranked 3 in the model to current and prints its name to the output console.
pt(current.name);
This sets the object that is ranked 3 in the model to current and prints its name to the output console.
Deprecated. Use Database.Connection
Description
This command is deprecated. Use Database.Connection instead.
Example
dbchangetable("Inventory");
This closes the currently open table and opens a table called Inventory.
This closes the currently open table and opens a table called Inventory.
Deprecated. Use Database.Connection
Description
This command is deprecated. Use Database.Connection instead.
Example
if (current.donegatheringdata == 1)
dbclose();
If the label donegatheringdata on current is set to 1, the current database is closed.
dbclose();
If the label donegatheringdata on current is set to 1, the current database is closed.
Description
This command is deprecated. Use Database.Connection instead.
The starting row and column in the table are specified as well as how many rows and columns
to export.
The starting row and column in the table are specified as well as how many rows and columns
to export.
Example
dbexportnode(so(),1,1,4,5);
Deprecated. Use Database.Connection
Description
This command is deprecated. Use Database.Connection instead.
Example
dbexportnode("MyTable4",2,2,3,3);
Deprecated. Use Database.Connection
Description
This command is deprecated. Use Database.Connection instead.
Example
string ColName = dbgetfieldname(1);
This sets ColName to the name of the first column in the current database.
This sets ColName to the name of the first column in the current database.
Deprecated. Use Database.Connection
Description
This command is deprecated. Use Database.Connection instead.
Example
dbgetmetrics()
Deprecated. Use Database.Connection
Description
This command is deprecated. Use Database.Connection instead.
Example
if (dbgetmode() != DBMODE_CLOSED)
ColName = dbgetfieldname(1);
If the database is open, ColName is set to the name of the first column in the database.
ColName = dbgetfieldname(1);
If the database is open, ColName is set to the name of the first column in the database.
Deprecated. Use Database.Connection
Description
This command is deprecated. Use Database.Connection instead.
Example
for (int x=1; x<=dbgetnumcols(); x++)
Table("MyTable")[1][x] = stringtonum(dbgettablecell(1,x));
This copies the values from a column in the database to a column in a GlobalTable.
Table("MyTable")[1][x] = stringtonum(dbgettablecell(1,x));
This copies the values from a column in the database to a column in a GlobalTable.
Deprecated. Use Database.Connection
Description
This command is deprecated. Use Database.Connection instead.
Example
for (int x=1; x<=dbgetnumrows(); x++)
Table("MyTable")[x][1] = stringtonum(dbgettablecell(x,1));
This copies the values from a row in the database to a row in a GlobalTable.
Table("MyTable")[x][1] = stringtonum(dbgettablecell(x,1));
This copies the values from a row in the database to a row in a GlobalTable.
Deprecated. Use Database.Connection
Description
This command is deprecated. Use Database.Connection instead.
Example
double tablevalue = stringtonum(dbgettablecell(1,1));
This sets tablevalue to the number that is stored in the first row and first column of the database.
This sets tablevalue to the number that is stored in the first row and first column of the database.
Deprecated. Use Database.Connection
Description
This command is deprecated. Use Database.Connection instead.
Example
double val = dbgettablenum(2,3);
Deprecated. Use Database.Connection
Description
This command is deprecated. Use Database.Connection instead.
Example
string val = dbgettablenum(2,3);
Deprecated. Use Database.Connection
Description
This command is deprecated. Use Database.Connection instead.
Example
dbimportnode(so(),1,1,4,5);
Deprecated. Use Database.Connection
Description
This command is deprecated. Use Database.Connection instead.
Example
dbimportnode("MyTable4",2,2,3,3);
Deprecated. Use Database.Connection
Description
This command is deprecated. Use Database.Connection instead.
Example
dbopen("itemdrive","timetable",1);
This opens a database with the alias "itemdrive" and opens the table called "timetable" in Table mode.
dbopen("warehouse","select * from inventory",0);
This opens a database with the alias "warehouse" and performs a SQL query on it. The database is open in SQL mode.
This opens a database with the alias "itemdrive" and opens the table called "timetable" in Table mode.
dbopen("warehouse","select * from inventory",0);
This opens a database with the alias "warehouse" and performs a SQL query on it. The database is open in SQL mode.
Deprecated. Use Database.Connection
Description
This command is deprecated. Use Database.Connection instead.
Example
for (int x=1; x<= model().subnodes.length; x++)
dbsettablecell(x,1,model().subnodes[x].name);
This places the names of all of the objects in the model into the first column of the current database.
dbsettablecell(x,1,model().subnodes[x].name);
This places the names of all of the objects in the model into the first column of the current database.
Deprecated. Use Database.Connection
Description
This command is deprecated. Use Database.Connection instead.
Example
dbsettablenum(2,3,56.5);
Deprecated. Use Database.Connection
Description
This command is deprecated. Use Database.Connection instead.
Example
dbgettablestr(1,1,"John");
Deprecated. Use Database.Connection
Description
This command is deprecated. Use Database.Connection instead.
Example
dbsqlquery("select processtime from timetable where type='1'");
This returns a new table based on the SQL query passed.
dbsqlquery("update timetable set processtime=type*2");
This updates the database based on the query passed.
This returns a new table based on the SQL query passed.
dbsqlquery("update timetable set processtime=type*2");
This updates the database based on the query passed.
Deprecated. Use Database.Connection
Description
This command is deprecated. Use Database.Connection instead.
Example
dbusername("user1","abc123XYZ");
This sets the username to "user1" and the password to "abc123XYZ". These values will be used to access a database the next time dbopen() is called.
dbusername("","");
This clears out the last set username and password. The next time dbopen() is called, the database will be accessed without a username or password.
This sets the username to "user1" and the password to "abc123XYZ". These values will be used to access a database the next time dbopen() is called.
dbusername("","");
This clears out the last set username and password. The next time dbopen() is called, the database will be accessed without a username or password.
Deprecated. Use Database.Connection
Description
This command is deprecated. Use Database.Connection instead.
Example
dbviewtable();
Deprecated. Use Database.Connection
Description
This command is deprecated. Use Database.Connection instead.
Example
dbwritechanges()
Deprecated, use contextdragconnection()
Description
This command is deprecated. Use contextdragconnection() instead.
Either connects or disconnects ports between fromobject and toobject according to the specified characterpressed. This command mimics the keyboard and mouse combinations used to connect/disconnect object ports. For instance an 'A' would be as if the letter "A" were held down on the keyboard while click-dragging from the fromobject to the toobject. For 'A' and 'Q' it connects and disconnects output ports to input ports. For 'S' and 'W' it connects and disconnects central ports. Can only be used in C++, not flexscript.
Either connects or disconnects ports between fromobject and toobject according to the specified characterpressed. This command mimics the keyboard and mouse combinations used to connect/disconnect object ports. For instance an 'A' would be as if the letter "A" were held down on the keyboard while click-dragging from the fromobject to the toobject. For 'A' and 'Q' it connects and disconnects output ports to input ports. For 'S' and 'W' it connects and disconnects central ports. Can only be used in C++, not flexscript.
Example
defaultdragconnection(model().subnodes[count], model().subnodes[2], 'A')
Deprecated, use treenode.labels["LabelName"].destroy()
Description
This command is deprecated. Use treenode.labels["LableName"].destroy() instead.
Deletes the specified label from the node called "labels" on the specified object.
The specified label can either be the labelname as a string or the label's rank as a number.
If the label does not exist in that node, this command does nothing.
Deletes the specified label from the node called "labels" on the specified object.
The specified label can either be the labelname as a string or the label's rank as a number.
If the label does not exist in that node, this command does nothing.
Example
dellabel(current,"MyLabel")
Deprecated, use the / operator
Description
This command is deprecated. Use the / operator instead.
Division of value1 by value2. If value2 is zero, the calculation is aborted and zero is returned.
Division of value1 by value2. If value2 is zero, the calculation is aborted and zero is returned.
Example
div(10,2)
Deprecated, use the / operator
Description
This command is deprecated. Use / operator instead.
This is an alias for div().
This is an alias for div().
Example
divide(10,2)
Deprecated
Description
This command is deprecated. Turns Full History collection on and off. If the parameter passed in is 1, Full History will be turned on. If it is 0, it will be turned off. This command should not be called directly. Instead, use the Enable Full History menu option to turn Full History on or off.
Example
enablefullhistory(1); // Turns Full History collection on
Deprecated, use Process Flow or freeoperators()
Description
This command is deprecated. Use Process Flow instead or the freeoperators() command instead.
This command releases the object specified as dispatcher from a wait task issued by the createwaittask(). Once the object is released, it will return to the state that it was previously in, and it will begin to perform any task sequences that are in its tasksequence queue.
This command releases the object specified as dispatcher from a wait task issued by the createwaittask(). Once the object is released, it will return to the state that it was previously in, and it will begin to perform any task sequences that are in its tasksequence queue.
Example
endwaittask(current.centerObjects[1]);
Deprecated, use the == operator
Description
This command is deprecated. Use the == operator instead..
Example
excelexportnode
(node table, num startrow, num startcol, num numrows, num numcols [, num rowchar, num colchar])
Deprecated, use excelexporttable()
Description
This command is deprecated. Use excelexporttable() instead.
Example
excelexportnode(reftable("Table1"),1,1,5,3);
excelimportnode
(obj node, num startrow, num startcol, num numrows, num numcols [, num rowchar, num colchar])
Deprecated, use excelimporttable()
Description
This command is deprecated. Use excelimporttable() instead
Example
excelimportnode(so(),1,1,5,3);
Deprecated
Description
This command is deprecated. This command allows the user to send an Excel 4.0 macro command to Excel. This language is no longer maintained by Microsoft and may be removed from future versions of Excel.
Example
excelmacro("select(\"r1c1:r5c5\")");
This selects the section of the workbook beginning at row 1, column 1 to row 5, column 5.
This selects the section of the workbook beginning at row 1, column 1 to row 5, column 5.
excelrangeread
(str rangename[treenode target], num row, num col[, num numRows, num numCols, num flags])
Reads an Excel range and dumps it to a treenode
Description
This function is overloaded so that it has two functions depending on which arguments you pass in.
The first (where you pass in a string) is deprecated. Use excelrangereadnum() and excelrangereadstr() instead.
The second (where you pass in a treenode) will read a range in Excel and assign all of the data in that range to the target treenode. If the treenode has bundle data, the excel data will be set on the bundle. Otherwise, subnodes will be inserted under the target treenode that will have the Excel data set on them as either string or number data, in the same format as Global Tables.
The origin of the range is specified by the row and col passed in, and the second pair of numbers will specify the size of the range. If 0 is passed in for any one of these, Flexsim will automatically choose the boundary in that direction of the Excel range that has data.
Flags can be passed in to change exactly what is read from Excel. Those flags are EXCEL_DATA_AUTOMATIC, EXCEL_DATA_NUMBER, EXCEL_DATA_STRING, EXCEL_DATE_AS_NUM, EXCEL_USE_COLUMNHEADERS and EXCEL_USE_ROWHEADERS.
EXCEL_DATA_AUTOMATIC will assign string or number data based on what the datatype of the Excel cell is. This is the default behavior.
EXCEL_DATA_NUMBER will force all Excel data to be read as a number.
EXCEL_DATA_STRING will force all Excel data to be read as a string.
EXCEL_DATE_AS_NUM will read any Excel dates as numbers readable by Flexsim as dates. Otherwise, the data will come in as a string.
EXCEL_USE_COLUMNHEADERS will take the first row of data and use it as names for the table columns instead of data.
EXCEL_USE_ROWHEADERS will take the first column of data and use it as names for the table rows instead of data.
The second (where you pass in a treenode) will read a range in Excel and assign all of the data in that range to the target treenode. If the treenode has bundle data, the excel data will be set on the bundle. Otherwise, subnodes will be inserted under the target treenode that will have the Excel data set on them as either string or number data, in the same format as Global Tables.
The origin of the range is specified by the row and col passed in, and the second pair of numbers will specify the size of the range. If 0 is passed in for any one of these, Flexsim will automatically choose the boundary in that direction of the Excel range that has data.
Flags can be passed in to change exactly what is read from Excel. Those flags are EXCEL_DATA_AUTOMATIC, EXCEL_DATA_NUMBER, EXCEL_DATA_STRING, EXCEL_DATE_AS_NUM, EXCEL_USE_COLUMNHEADERS and EXCEL_USE_ROWHEADERS.
EXCEL_DATA_AUTOMATIC will assign string or number data based on what the datatype of the Excel cell is. This is the default behavior.
EXCEL_DATA_NUMBER will force all Excel data to be read as a number.
EXCEL_DATA_STRING will force all Excel data to be read as a string.
EXCEL_DATE_AS_NUM will read any Excel dates as numbers readable by Flexsim as dates. Otherwise, the data will come in as a string.
EXCEL_USE_COLUMNHEADERS will take the first row of data and use it as names for the table columns instead of data.
EXCEL_USE_ROWHEADERS will take the first column of data and use it as names for the table rows instead of data.
Example
treenode myTable = node ("Tools/GlobalTables/GlobalTable1>variables/data", model());
excelrangeread(myTable, 1, 1, 5, 0, EXCEL_DATA_AUTOMATIC | EXCEL_USE_COLUMNHEADERS);
This will read data from the active sheet starting at cell A1. It will read the first five rows, and read as many columns as have data in them. The first row will be used as names for the columns of the Global Table we're writing to. Therefore, if the Excel sheet has 10 columns with data in them, a total of 40 nodes will be inserted under the data variable of the Global Table. Each of those nodes will have the datatype of their corresponding Excel cell.
excelrangeread(myTable, 1, 1, 5, 0, EXCEL_DATA_AUTOMATIC | EXCEL_USE_COLUMNHEADERS);
This will read data from the active sheet starting at cell A1. It will read the first five rows, and read as many columns as have data in them. The first row will be used as names for the columns of the Global Table we're writing to. Therefore, if the Excel sheet has 10 columns with data in them, a total of 40 nodes will be inserted under the data variable of the Global Table. Each of those nodes will have the datatype of their corresponding Excel cell.
Reads data from a source table node and writes it to the active Excel sheet
Description
This function will write all the of the data from the source table node to the active Excel sheet. If the treenode has bundle data,
this will read the bundle and write it to the sheet, otherwise it will look for child nodes with data on them, like a Global Table. The row and col passed in
specify where on the Excel sheet to begin writing the data. All of the data on the source node will always be written. Flags can be passed in to change the use
of headers. Those flags are EXCEL_USE_COLUMNHEADERS and EXCEL_USE_ROWHEADERS.
EXCEL_USE_COLUMNHEADERS will write any existing column headers as a separate row in the Excel table.
EXCEL_USE_ROWHEADERS will write any existing row headers as a separate column in the Excel table.
EXCEL_USE_COLUMNHEADERS will write any existing column headers as a separate row in the Excel table.
EXCEL_USE_ROWHEADERS will write any existing row headers as a separate column in the Excel table.
Example
treenode myTable = node("Tools/GlobalTables/GlobalTable1>variables/data", model());
excelrangewrite(myTable, 1, 1, EXCEL_USE_ROWHEADERS | EXCEL_USE_COLUMNHEADERS);
This will take all of the data in GlobalTable1 and write it to the active Excel sheet, starting at cell A1. Before it writes any of the actual data, there will be a row of column headers and column of row headers.
excelrangewrite(myTable, 1, 1, EXCEL_USE_ROWHEADERS | EXCEL_USE_COLUMNHEADERS);
This will take all of the data in GlobalTable1 and write it to the active Excel sheet, starting at cell A1. Before it writes any of the actual data, there will be a row of column headers and column of row headers.
Deprecated, use excelreadnum(), excelreadstr() or excelreadcell()
Description
This command is deprecated. Use excelreadnum(), excelreadstr() or excelreadcell() instead.
Example
Deprecated, use excelwritenum() and excelwritestr()
Description
This command is deprecated. Use excelwritenum() and excelwritestr() instead.
Example
Deprecated, use Table.executeCell() or the Table's [] operators
Description
This command is deprecated. Use Table.executeCell() or the Table class's [] operators instead.
Executes the table cell's text as Flexscript.
Executes the table cell's text as Flexscript.
Example
Deprecated
Description
This command is deprecated. Writes to a database (.mdb file) the Full History data that was collected during a run. If a file name is passed to this command, that name willbe used for the database. If no file name is passed in, the user will be prompted for a file to save the data to. If the file (either passed in or selected from a dialog) does not exist, it will be created.
Example
exportfullhistory("myrundata.mdb");
Description
This command is deprecated. Use the Group class instead.
Create a new family (a list of nodes used for organizing relational information).
Create a new family (a list of nodes used for organizing relational information).
Example
familycreate(item,"family1")
Description
This command is deprecated. Use the Group class instead.
Delete a family.
Delete a family.
Example
familydelete(item,"family1")
Description
This command is deprecated. Use the Group class instead.
Returns a pointer to a member of the specified family.
Returns a pointer to a member of the specified family.
Example
familymember(item,"family1",2)
Description
This command is deprecated. Use the Group class instead.
Adds a new family member to the specified familycontainer.
Adds a new family member to the specified familycontainer.
Example
familymemberadd(item,"family1",item.subnodes[1])
Description
This command is deprecated. Use the Group class instead.
Removes a family member from the specified familycontainer.
Removes a family member from the specified familycontainer.
Example
familymemberdel(item,"family1",item.subnodes[2])
Description
This command is deprecated. Use the Group class instead.
Returns the size of the specified family.
Returns the size of the specified family.
Example
familymemberqty(item,"family1")
Deprecated, use the Array class
Description
This command is deprecated. Use the Array class to construct the array using an array literal: Array arr = [1, 2, 3];
Fill a local array with values.
Fill a local array with values.
Example
Description
Performs a matching test a defined number of times, and when a match is found, returns a user-definable value
associated with that match. Within the match expression and return expression, "count" can be used to determine
which iteration your are on in the check. This can be used to search in a list of things for a matching item or criterion. If returnexpression is not included in the call, then findmatch() will return the count associated
with the matching expression. If no matches are found, findmatch() will return 0. If reverseorder is 1, then
it will go backwards, assigning count to nr first, then nr - 1, etc. down to 1. If
returnexpression is left out, then findmatch will return the count associated with the
found match.
Example
int portNr = findmatch(current.outObjects.length, current.outObjects[count].subnodes.length < 5);
This example will return the output port number that corresponds to the first object it finds connected to current's output ports that has a content less than 5.
treenode object = findmatch(current.outObjects.length, current.outObjects[count].subnodes.length < 5, current.outObjects[count]);
This example is similar to the previous example except it will return the object itself instead of the associated port number.
int item2Rank = findmatch(current.subnodes.length, current.subnodes[count].type == 2);
This example will return the rank number of the first item found in current's queue that has an item type of 2.
This example will return the output port number that corresponds to the first object it finds connected to current's output ports that has a content less than 5.
treenode object = findmatch(current.outObjects.length, current.outObjects[count].subnodes.length < 5, current.outObjects[count]);
This example is similar to the previous example except it will return the object itself instead of the associated port number.
int item2Rank = findmatch(current.subnodes.length, current.subnodes[count].type == 2);
This example will return the rank number of the first item found in current's queue that has an item type of 2.
findmax
(num nr, num valueexpression[, returnexpression = maxvalue, num criterion = true, num reverseorder = 0])
Description
Iteratively evaluates an expression, and then returns the maximum value found, or a user-definable return value
associated with that maximum value. Within the value expression, return expression and criterion, "count" can be used to determine
which iteration you are on in the check. If the return expression is not defined, the maximum value found will be returned.
Additionally, you can specify a criterion to filter out values as invalid. If criterion is defined and nothing meets the
criterion, 0 will be returned.
Example
double latestCreation = findmax(current.subnodes.length, getcreationtime(current.subnodes[count]));
This example will return the maximum creation time of all items in current.
int largestQueuePortNr = findmax(current.inObjects.length, current.inObjects[count].subnodes.length;
This example will return the input port number associated with the object with the largest queue of items.
int largestQueuePortNr = findmax(current.inObjects.length, current.inObjects[count].subnodes.length, count, getitemstate(current.inObjects[count].first) == FR_STATE_READY);
This example is the same as the previous example, but additionally in includes a criterion that the first item in the upstream object must also have been released.
This example will return the maximum creation time of all items in current.
int largestQueuePortNr = findmax(current.inObjects.length, current.inObjects[count].subnodes.length;
This example will return the input port number associated with the object with the largest queue of items.
int largestQueuePortNr = findmax(current.inObjects.length, current.inObjects[count].subnodes.length, count, getitemstate(current.inObjects[count].first) == FR_STATE_READY);
This example is the same as the previous example, but additionally in includes a criterion that the first item in the upstream object must also have been released.
findmin
(num nr, num valueexpression[, returnexpression = maxvalue, num criterion = true, num reverseorder = 0])
Description
Iteratively evaluates an expression, and then returns the minimum value found, or a user-definable return value
associated with that minimum value. findmin() is the same as findmax() except it finds the minimum value instead
of the maximum value. For more information, refer to the documentation for findmax().
Example
Refer to findmax()
Description
This command is deprecated. Use selectedobject() instead.
Iterate on the node that is both selected (red) and highlighted (yellow) in the selected view. Reference the selected and highlighted node by using "a" within the loop.
Iterate on the node that is both selected (red) and highlighted (yellow) in the selected view. Reference the selected and highlighted node by using "a" within the loop.
Example
forobjecthighlightedin(sv())
{
pt(a.name); pr();
}
This prints to the outputconsole the name of the selected, highlighted node in the first level of the model.
{
pt(a.name); pr();
}
This prints to the outputconsole the name of the selected, highlighted node in the first level of the model.
Description
This command is deprecated. Use for() or while() commands instead.
Execute a block of code for each node that is in the tree layer directly under the node specified as container. To access the node that is currently active in the loop, the "a" command is used. The forobjectlayerunder() command can only be used in flexscript, not C++.
Execute a block of code for each node that is in the tree layer directly under the node specified as container. To access the node that is currently active in the loop, the "a" command is used. The forobjectlayerunder() command can only be used in flexscript, not C++.
Example
forobjectlayerunder(model())
{
pt(a.name); pr();
}
This prints to the outputconsole the name of every object in the first level of the model.
{
pt(a.name); pr();
}
This prints to the outputconsole the name of every object in the first level of the model.
Description
This command is deprecated. Use for() or while() commands instead.
Execute a block of code for each node that is in the same layer and has a rank value less than or equal to the rank of the object specified as thenode. To access the node that is currently active in the loop, the "a" command is used. The forobjectsbefore() command can only be used in flexscript, not C++.
Execute a block of code for each node that is in the same layer and has a rank value less than or equal to the rank of the object specified as thenode. To access the node that is currently active in the loop, the "a" command is used. The forobjectsbefore() command can only be used in flexscript, not C++.
Example
forobjectsbefore(model.subnodes[5]))
{
pt(a.name); pr();
}
This prints to the outputconsole the name of the first 5 objects in the model.
{
pt(a.name); pr();
}
This prints to the outputconsole the name of the first 5 objects in the model.
Description
This command is deprecated. Use for() or while() commands instead.
Execute a block of code for each node that is in the same layer and has a rank value greater than the rank of the object specified as thenode. To access the node that is currently active in the loop, the "a" command is used. The forobjectsbehind() command can only be used in flexscript, not C++.
Execute a block of code for each node that is in the same layer and has a rank value greater than the rank of the object specified as thenode. To access the node that is currently active in the loop, the "a" command is used. The forobjectsbehind() command can only be used in flexscript, not C++.
Example
forobjectsbehind(model.subnodes[5])
{
pt(a.name); pr();
}
This prints to the outputconsole the name of the objects in the model starting with the sixth one.
{
pt(a.name); pr();
}
This prints to the outputconsole the name of the objects in the model starting with the sixth one.
Description
This command is deprecated. Instead use:
for(int i =1; i<= container.subnodes.length; i++)
{
if(switch_selected(container.subnodes[i]))
{
pt(container.subnodes[i].name); pr();
}
}
The block following the command will be iterated upon once for each selected object in the container. The value of the "a" command will return the pointer to the object being iterated upon. This command is not available in C++.
for(int i =1; i<= container.subnodes.length; i++)
{
if(switch_selected(container.subnodes[i]))
{
pt(container.subnodes[i].name); pr();
}
}
The block following the command will be iterated upon once for each selected object in the container. The value of the "a" command will return the pointer to the object being iterated upon. This command is not available in C++.
Example
forobjectselectionset(library()) { pt(a.name); pr(); }
This prints to the outputconsole the name of every object currently selected in the library tree.
This prints to the outputconsole the name of every object currently selected in the library tree.
Deprecated, use the >= operator
Description
This command is deprecated. Use the >= operator instead.
Example
Deprecated, use labels
Description
This command is deprecated. Use labels instead.
Returns the itemtype value of a flow item.
Returns the itemtype value of a flow item.
Example
getitemtype(so())
Deprecated, use treenode.LabelName
Description
This command is deprecated. Use treenode.labelProperties instead.
Gets the value of an object's label.
Gets the value of an object's label.
Example
Deprecated, use treenode.LabelName
Description
This command is deprecated. Use treenode.labelProperties instead.
Gets the number value of an object's label.
Gets the number value of an object's label.
Example
Deprecated, use treenode.LabelName
Description
This command is deprecated. Use treenode.labelProperties instead.
Gets the string value of an object's label
Gets the string value of an object's label
Example
Description
This command is deprecated. Use getmodelunit() instead.
Example
Description
This command is deprecated. Use getmodelunit() instead.
Returns a name or abbreviation of the current model's units.
Returns a name or abbreviation of the current model's units.
Example
Deprecated
Description
This command is deprecated. Returns a movement record that has been recorded for the Full History Report. A movement record is created every time a flowitem moves from one object to another if Full History is enabled. The parameter passed to this function is the number of the record (beginning at 1) that the user wishes to retrieve. If this command is called in C++, the return value is a MoveRecord*. If this command is called in FlexScript, the return value can be assigned to an int.
Example
See the example for getnummoverecords().
Deprecated
Description
This command is deprecated. Returns one of the values from the movement record that is passed in as the first parameter to the function. This record is the return value from a call to getmoverecord(). The value passed to this function as the second parameter indicates which value from the movement record the user wishes to retrieve:
0 = The record ID. This is the record\'s row number in the movement table.
1 = The ItemID of the flowitem whose movement is recorded by the record.
2 = The time the flowitem moved.
3 = The object that the flowitem moved from. This is returned as an int and should be converted to a treenode using tonode().
4 = The object that the flowitem moved to. This is returned as an int and should be converted to a treenode using tonode();
5 = The itemtype of the flowitem at the time it moved.
0 = The record ID. This is the record\'s row number in the movement table.
1 = The ItemID of the flowitem whose movement is recorded by the record.
2 = The time the flowitem moved.
3 = The object that the flowitem moved from. This is returned as an int and should be converted to a treenode using tonode().
4 = The object that the flowitem moved to. This is returned as an int and should be converted to a treenode using tonode();
5 = The itemtype of the flowitem at the time it moved.
Example
See the example for getnummoverecords().
Deprecated
Description
This command is deprecated. Returns the number of movement records that have been collected for the Full History Report. The records are deleted when a model is reset, so this will return 0 before a model run. If Full History is not enabled, this will return 0.
Example
// Print the move records that have been recorded
for (int rec = 1; rec <= getnummoverecords(); rec++)
{
int record = getmoverecord(rec);
pd(getmoverecordvalue(record,0)); pt(" ");
pd(getmoverecordvalue(record,1)); pt(" ");
pf(getmoverecordvalue(record,2)); pt(" ");
pt(getmoverecordvalue(record,3).name); pt(" ");
pt(getmoverecordvalue(record,4).name); pt(" ");
pd(getmoverecordvalue(record,5)); pt(" ");
}
for (int rec = 1; rec <= getnummoverecords(); rec++)
{
int record = getmoverecord(rec);
pd(getmoverecordvalue(record,0)); pt(" ");
pd(getmoverecordvalue(record,1)); pt(" ");
pf(getmoverecordvalue(record,2)); pt(" ");
pt(getmoverecordvalue(record,3).name); pt(" ");
pt(getmoverecordvalue(record,4).name); pt(" ");
pd(getmoverecordvalue(record,5)); pt(" ");
}
Deprecated
Description
This command is deprecated. Returns the number of state change records that have been collected for the Full History Report. The records are deleted when a model is reset, so this will return 0 before a model run. If Full History is not enabled, this will return 0.
Example
// Print the state change records that have been recorded
for (int rec = 1; rec <= getnumstaterecords(); rec++)
{
int record = getstaterecord(rec);
pd(getstaterecordvalue(record,0)); pt(" ");
pf(getstaterecordvalue(record,1)); pt(" ");
pd(getstaterecordvalue(record,2)); pt(" ");
pt(getstaterecordvalue(record,3).name); pr();
}
for (int rec = 1; rec <= getnumstaterecords(); rec++)
{
int record = getstaterecord(rec);
pd(getstaterecordvalue(record,0)); pt(" ");
pf(getstaterecordvalue(record,1)); pt(" ");
pd(getstaterecordvalue(record,2)); pt(" ");
pt(getstaterecordvalue(record,3).name); pr();
}
Deprecated, do not use.
Description
This command is deprecated. Do not use.
Returns the index number of the bmp or jpeg image currently assigned to the base of the object.
Returns the index number of the bmp or jpeg image currently assigned to the base of the object.
Example
getobjectimageindex(item);
Deprecated, use Table.query()
Description
This command is deprecated. Use Table.query() instead.
Returns the source table's row number associated with a matched row in the last query() result.
table - If a string, it is the name of the table as defined in the FROM statement. If you used an alias, it should be the table's alias. If a number, it should be the 1-based index of the table in the FROM statement. If there is only one table in the query, this should be 1. For multiple tables, the first table in the FROM is 1, the second is 2, etc.
matchRow - The 1-based row of the result table of the query.
Note that this command will not work if you use aggregator functions such as MIN(), MAX(), AVG(), etc. in the SELECT clause. When aggregators are used, this command just returns the number of rows in the source table.
Returns the source table's row number associated with a matched row in the last query() result.
table - If a string, it is the name of the table as defined in the FROM statement. If you used an alias, it should be the table's alias. If a number, it should be the 1-based index of the table in the FROM statement. If there is only one table in the query, this should be 1. For multiple tables, the first table in the FROM is 1, the second is 2, etc.
matchRow - The 1-based row of the result table of the query.
Note that this command will not work if you use aggregator functions such as MIN(), MAX(), AVG(), etc. in the SELECT clause. When aggregators are used, this command just returns the number of rows in the source table.
Example
Deprecated, use Table.query()
Description
This command is deprecated. Use Table.query() instead.
Returns a value in the result table for the last call to query()
row - The 1-based row number of the result table
col - The 1-based column number of the result table, or the name of the result column. If you have defined aliases in the select statement, the column name should be the alias.
Returns a value in the result table for the last call to query()
row - The 1-based row number of the result table
col - The 1-based column number of the result table, or the name of the result column. If you have defined aliases in the select statement, the column name should be the alias.
Example
Deprecated
Description
This command is deprecated. Returns a state change record that has been recorded for the Full History Report. A state change record is created every time an object changes state if Full History is enabled. The parameter passed to this function is the number of the record (beginning at 1) that the user wishes to retrieve. If this command is called in C++, the return value is a StateRecord*. If this command is called in FlexScript, the return value can be assigned to an int.
Example
See the example for getnumstaterecords().
Deprecated
Description
This command is deprecated. Returns one of the values from the state change record that is passed in as the first parameter to the function. This record is the return value from a call to getstaterecord(). The value passed to this function as the second parameter indicates which value from the state change record the user wishes to retrieve:
0 = The record ID. This is the record\'s row number in the movement table.
1 = The time of the state change.
2 = The state that the object changed to.
3 = The object that changed state. This is returned as an int and should be converted to a treenode using tonode().
0 = The record ID. This is the record\'s row number in the movement table.
1 = The time of the state change.
2 = The state that the object changed to.
3 = The object that changed state. This is returned as an int and should be converted to a treenode using tonode().
Example
See the example for getnumstaterecords().
Deprecated, use Table.getColHeader() or Table.getRowHeader()
Description
This command is deprecated. Use Table.getColHeader()
or Table.getRowHeader() instead.
Gets the value of the header field of a table.
Gets the value of the header field of a table.
Example
Deprecated, use the Table's [] operators
Description
This command is deprecated. Use the Table class's [] operators instead.
Gets the number value in a table cell.
Gets the number value in a table cell.
Example
Deprecated, use the Table's [] operators
Description
This command is deprecated. Use the Table class's [] operators instead.
Gets the text value in a table cell.
Gets the text value in a table cell.
Example
Deprecated, use Tracked Variable class
Description
This command is deprecated. Use the TrackedVariable class instead.
Example
Deprecated, use the mesh() API
Description
This command is deprecated. Do not use. Use the mesh() API instead.
Example
Deprecated, use fglColor()
Description
This command is deprecated. Use fglColor() instead.
Example
Deprecated, use fglColor()
Description
This command is deprecated. Use fglColor() instead.
Example
Deprecated, use fglDisable()
Description
This command is deprecated. Use fglDisable() instead.
Example
Deprecated, use fglEnable()
Description
This command is deprecated. Use fglEnable() instead.
Example
Deprecated, use the mesh() API
Description
This command is deprecated. Do not use. Use the mesh() API instead.
Example
Deprecated, use fglLoadIdentity()
Description
This command is deprecated. Use fglLoadIdentity() instead.
Example
Deprecated, use fglMatrixMode()
Description
This command is deprecated. Use fglMatrixMode() instead.
Example
Deprecated, use fglNormal()
Description
This command is deprecated. Use fglNormal() instead.
Example
glNormal3d(1,0,0);
Deprecated, use List("GlobalListName")
Description
This command is deprecated. Use List("GlobalListName") instead.
References a global list by name.
References a global list by name.
Example
Deprecated, use fglPopMatrix()
Description
This command is deprecated. Use fglPopMatrix() instead.
Example
Deprecated, do not use
Description
This command is deprecated. Do not use.
Example
Deprecated, use fglPushMatrix()
Description
This command is deprecated. Use fglPushMatrix() instead.
Example
Deprecated, use fglRotate()
Description
This command is deprecated. Use fglRotate() instead.
Example
Deprecated, use fglScale()
Description
This command is deprecated. Use fglScale() instead.
Example
Deprecated, use the mesh() API
Description
This command is deprecated. Do not use. Use the mesh() API instead.
Example
Deprecated, use fglTranslate()
Description
This command is deprecated. Use fglTranslate() instead.
Example
Deprecated, use the mesh() API
Description
This command is deprecated. Do not use. Use the mesh() API instead.
Example
Deprecated, use Group[]
Description
This command is deprecated. Use Group[] instead.
Gets a reference to a group member.
Gets a reference to a group member.
Example
Deprecated, use Group.removeMember()
Description
Example
Deprecated, use the > operator
Description
This command is deprecated. Use the > operator instead..
Example
Description
For developer use. Used to get information about a command. Enter the command name in parameter 3.
The return value will be copied into the string data of destnode.
"what" defines what information is needed, as follows:
1 - returns the xml fragment string that contains the documentation for that command
"what" defines what information is needed, as follows:
1 - returns the xml fragment string that contains the documentation for that command
Example
helpcommands(
Deprecated, use switch_hidelabel()
Description
This command is deprecated. Use switch_hidelabel() instead.
This command sets the specified object to show or hide its name and basic statistics on the screen. A value of 1 is show and a value of 0 is hide. If the name and statistics are hidden for an object, they will not be visible in any view window. View windows also have an attribute that controls this connector display of all objects in the view.
This command sets the specified object to show or hide its name and basic statistics on the screen. A value of 1 is show and a value of 0 is hide. If the name and statistics are hidden for an object, they will not be visible in any view window. View windows also have an attribute that controls this connector display of all objects in the view.
Example
hidelabel(current,0);
This sets the object referenced by current so that its name and statistics will not be drawn.
This sets the object referenced by current so that its name and statistics will not be drawn.
Deprecated, use switch_hideconnectors()
Description
This command is deprecated. Use switch_hideconnectors() instead.
This command sets the specified object to show or hide its ports and connections. A value of 1 is show and a value of 0 is hide. If the ports and connections are hidden, they will not be visible in any view window.
This command sets the specified object to show or hide its ports and connections. A value of 1 is show and a value of 0 is hide. If the ports and connections are hidden, they will not be visible in any view window.
Example
hideports(current,1);
This sets the current object to show its ports and connections in all view windows.
This sets the current object to show its ports and connections in all view windows.
Deprecated, use += operator
Description
This command is deprecated. Use += operator instead. myNode.value += 2;
Increments the value of a node by a defined amount.
Increments the value of a node by a defined amount.
Example
inc(current.mylabel,1)
Deprecated, use Tracked Variable class
Description
This command is deprecated. Use the TrackedVariable class instead.
Example
Deprecated, use user libraries
Description
This command is deprecated. Use user libraries instead.
Install a service pack (.fpk).
Install a service pack (.fpk).
Example
installpackage("C:/mypak.fpk")
Description
This command is deprecated. This should not be used as a special command with the setitem command anymore. Instead, declare a treenode variable type as item, then use item in your code as any other variable type.
Example
treenode item = model().subnodes[3];
pt(item.name);
This sets the object that is ranked 3 in the model to item and prints its name to the output console.
pt(item.name);
This sets the object that is ranked 3 in the model to item and prints its name to the output console.
Deprecated, use for() or while() commands
Description
This command is deprecated. Use for() or while() commands instead.
Repeatedly execute the following block {} with counter value traversing from start to end being incremented by step. The count command can be used to access the current counter value on each iteration. The return value of count will depend on which iteration is currently being executed.
Repeatedly execute the following block {} with counter value traversing from start to end being incremented by step. The count command can be used to access the current counter value on each iteration. The return value of count will depend on which iteration is currently being executed.
Example
iterate(1,9,2)
{
pd(count);pr();
}
Prints the following numbers to the outputconsole: 1,3,5,7,9
{
pd(count);pr();
}
Prints the following numbers to the outputconsole: 1,3,5,7,9
Deprecated, use the <= operator
Description
This command is deprecated. Use the <= operator instead.
Example
Deprecated, use List.backOrders()
Description
Example
Deprecated, use the Array class
Description
This command is deprecated. Use the Array class instead.
Index of occurrence of value in list. The list, of length qty, is searched and the position in the list of the value val is returned by this function.
Index of occurrence of value in list. The list, of length qty, is searched and the position in the list of the value val is returned by this function.
Example
listinlist(5,3,2,1,2,3,4)
This returns the index number 4 because 3 is the fourth number in the list of 5 numbers.
This returns the index number 4 because 3 is the fourth number in the list of 5 numbers.
Deprecated, use the Array class
Description
This command is deprecated. Use the Array class instead.
Index of highest value. The list, of length qty, is searched and the position in the list of the highest value is returned by this function.
Index of highest value. The list, of length qty, is searched and the position in the list of the highest value is returned by this function.
Example
listmax(5,2,1,2,3,4)
This returns a 5 because 4 is the largest value and it is fifth in the list of five numbers.
This returns a 5 because 4 is the largest value and it is fifth in the list of five numbers.
Deprecated, use the Array class
Description
This command is deprecated. Use the Array class instead.
Highest value. The list, of length qty, is searched and the value of the highest value is returned by this function.
Highest value. The list, of length qty, is searched and the value of the highest value is returned by this function.
Example
listmaximum(5,2,1,2,3,4)
This returns a 4 because it is the highest value in the list.
This returns a 4 because it is the highest value in the list.
Deprecated, use the Array class
Description
This command is deprecated. Use the Array class instead.
Average of values. The mean of the values in the list, of length qty, is returned by this function.
Average of values. The mean of the values in the list, of length qty, is returned by this function.
Example
listmean(5,2,1,2,3,4)
This returns 2.5.
This returns 2.5.
Deprecated, use the Array class
Description
This command is deprecated. Use the Array class instead.
Index of lowest value. The list, of length qty, is searched and the position in the list of the lowest value is returned by this function.
Index of lowest value. The list, of length qty, is searched and the position in the list of the lowest value is returned by this function.
Example
listmin(5,2,1,2,3,4)
This returns 2 because 1 is the lowest value and it is second in the list.
This returns 2 because 1 is the lowest value and it is second in the list.
Deprecated, use the Array class
Description
This command is deprecated. Use the Array class instead.
Lowest value. The list, of length qty, is searched and the value of the lowest value is returned by this function.
Lowest value. The list, of length qty, is searched and the value of the lowest value is returned by this function.
Example
listminimum(5,2,1,2,3,4)
This returns 1 because that is the lowest value in the list.
This returns 1 because that is the lowest value in the list.
Deprecated, use the * operator
Description
This command is deprecated. Use the * operator instead.
Product of list. The product of all the values in the list, of length qty, is returned by this function.
Product of list. The product of all the values in the list, of length qty, is returned by this function.
Example
listmul(5,2,1,2,3,4)
This returns the value 48.
This returns the value 48.
Deprecated, use List.backOrders()[backOrderNum].remove() or List.entries()[enterNum].remove()
Description
This command is deprecated. Use List.backOrders()[backOrderNum].remove()
or List.entries()[entryNum].remove() instead.
Removes an entry or back order from its owning list.
Removes an entry or back order from its owning list.
Example
Deprecated, use the - operator
Description
This command is deprecated. Use the - operator instead.
Subtraction of list. The list, of length qty, is traversed and the first value has all subsequent values subtracted from it and then is returned by this function.
Subtraction of list. The list, of length qty, is traversed and the first value has all subsequent values subtracted from it and then is returned by this function.
Example
listsub(5,2,1,2,3,4)
Deprecated, use the Array class
Description
This command is deprecated. Use the + operator instead.
Sum of values. The sum of all the values in the list, of length qty, is returned by this function.
Sum of values. The sum of all the values in the list, of length qty, is returned by this function.
Example
listsum(5,2,1,2,3,4)
Deprecated, use soundload()
Description
This command is deprecated. Use soundload() instead.
A sound file on disk will be loaded into FlexSim and recorded in the Media List. The media list of FlexSim will keep a list of all loaded sounds. Each sound has a corresponding name and an index. This command will return the index corresponding to the loaded sound. The sound must be a .wav file.
A sound file on disk will be loaded into FlexSim and recorded in the Media List. The media list of FlexSim will keep a list of all loaded sounds. Each sound has a corresponding name and an index. This command will return the index corresponding to the loaded sound. The sound must be a .wav file.
Example
int applauseindex = loadsound("c:/My Music/APPLAUSE.WAV");
Deprecated, use local variables
Description
This command is deprecated. Use local variables like treenode, int, double, string instead.
Gets a reference to an indexed local variable as a treenode. You must use localarray() to define how many local variables are used and what data type they should have. Can only be used in flexscript.
Gets a reference to an indexed local variable as a treenode. You must use localarray() to define how many local variables are used and what data type they should have. Can only be used in flexscript.
Example
setnodenum(local(1),4);
Sets the 1st variable in the localarray to 4.
Sets the 1st variable in the localarray to 4.
Deprecated, use Array class
Description
This command is deprecated. Use the Array class instead.
Allocate general purpose local array with the given quantity of local variables.
Type can be: 1 = num, 2 = str, 3 = coupling, 4 = obj. May only be used in flexscript.
Allocate general purpose local array with the given quantity of local variables.
Type can be: 1 = num, 2 = str, 3 = coupling, 4 = obj. May only be used in flexscript.
Example
localarray(1,4)
Returns a random sample from a lognormal distribution
Description
lognormal() and lognormal2() are similar functions, but with different parameter definitions. lognormal() uses parameter definitions as defined on wikipedia and other sites. lognormal2() uses parameters as defined in the latest versions of Expertfit. Essentially, the parameters can be converted as follows:
lognormal( location, normalmean, normalstdev ) = lognormal2( location, Math.exp( normalmean ), normalstdev )
lognormal2( location, scale, shape ) = lognormal( location, Math.log( scale ), shape ) (Math.exp(x) is e raised to the x power, and Math.log(x) is the natural logarithm of x.)
Please make sure you use the right distribution. Using the wrong distribution could result in bad simulation results.
lognormal( location, normalmean, normalstdev, stream ) is a continuous probability distribution.
Inputs:
location : ( - ∞, ∞ )
normalmean such that ( Math.exp( normalmean ) > 0 )
normalstdev such that ( normalstdev > 0 )
stream is a reference to one of FlexSim's random number streams {0,1,2,...}
Outputs:
range = ( location , ∞ )
mean = location + Math.exp( normalmean + normalstdev²⁄ 2)
variance = Math.exp( 2*normalmean + normalstdev² ) [ Math.exp( normalstdev² ) − 1 ]
Probability Density Functions:

Possible Applications:
Used to model the time to perform some task, and to model quantities that are the product of a large number of other quantities. It can also be used as a rough model in the absence of data.
Comments:
The probability density for the lognormal distribution takes on shapes similar to gamma( normalstdev, normalmean ) and weibull( normalstdev, normalmean ) densities for normalstdev > 1, but can have a large spike close to x=0 that is often useful.
lognormal( location, normalmean, normalstdev ) = lognormal2( location, Math.exp( normalmean ), normalstdev )
lognormal2( location, scale, shape ) = lognormal( location, Math.log( scale ), shape ) (Math.exp(x) is e raised to the x power, and Math.log(x) is the natural logarithm of x.)
Please make sure you use the right distribution. Using the wrong distribution could result in bad simulation results.
lognormal( location, normalmean, normalstdev, stream ) is a continuous probability distribution.
Inputs:
location : ( - ∞, ∞ )
normalmean such that ( Math.exp( normalmean ) > 0 )
normalstdev such that ( normalstdev > 0 )
stream is a reference to one of FlexSim's random number streams {0,1,2,...}
Outputs:
range = ( location , ∞ )
mean = location + Math.exp( normalmean + normalstdev²⁄ 2)
variance = Math.exp( 2*normalmean + normalstdev² ) [ Math.exp( normalstdev² ) − 1 ]
Probability Density Functions:

Possible Applications:
Used to model the time to perform some task, and to model quantities that are the product of a large number of other quantities. It can also be used as a rough model in the absence of data.
Comments:
The probability density for the lognormal distribution takes on shapes similar to gamma( normalstdev, normalmean ) and weibull( normalstdev, normalmean ) densities for normalstdev > 1, but can have a large spike close to x=0 that is often useful.
Example
Returns a random sample from a lognormal distribution
Description
This command is an alternative to the lognormal2 command, used in the absence of data. You can specify the
mean and standard deviation, and the command will calculate from those parameters the proper location, scale, and shape
parameters for the lognormal2 command, and return a sample from that distribution. Note that the shape of the distribution
is pre-defined to be a bell-shaped curve with a reasonably long right tail. Hence this command isn't as flexible as the
lognormal2 command. This command, similar to the triangular distribution, should be used in the absence of
data, where you know the mean and standard deviation of the distribution, and you assume that the distribution is right-skewed
(it has a longer right tail), but you do not have a real data set to fit to a distribution. Refer to lognormal2
for more information. Relating to the diagram describing the lognormal2 distribution, the lognormalmeanstdev command uses a
normalstdev/shape value of 0.75 to define its shape. Note that since the shape of the
distribution is hard-set, depending on the mean and standard deviation values, this may return a negative value.
Example
double cycletime = lognormalmeanstdev(10, 2);
This example will return a random value that follows a right-skewed lognormal distribution with a mean of 10 and standard deviation of 2.
This example will return a random value that follows a right-skewed lognormal distribution with a mean of 10 and standard deviation of 2.
Deprecated, use the < operator
Description
This command is deprecated. Use the < operator instead.
Example
Deprecated, use maintree()
Description
This command is deprecated. Use maintree() instead.
Get the main tree node. This is one of the two primary databases of FlexSim. Also called the "Project Tree". The other primary database is the views tree node also called the "View Layout Tree"
Get the main tree node. This is one of the two primary databases of FlexSim. Also called the "Project Tree". The other primary database is the views tree node also called the "View Layout Tree"
Example
main()
Deprecated, use the Array class
Description
This command is deprecated. Use Array(qty) instead. Array array = Array(4);
Initializes a local array.
Initializes a local array.
Example
Deprecated
Description
This command is deprecated. Use the DLL functionality provided with version 4 instead.
Used with dll plugins. The type can be:
MOD_LOAD (1)
MOD_UNLOAD (2)
MOD_GETFUNCTION (3)
MOD_RUNFUNCTION (4)
Used with dll plugins. The type can be:
MOD_LOAD (1)
MOD_UNLOAD (2)
MOD_GETFUNCTION (3)
MOD_RUNFUNCTION (4)
Example
module(MOD_UNLOAD,main.find("project/exec/dll/1"))
Deprecated, use the * operator
Description
This command is deprecated. Use the * operator instead.
Product of a and b. This returns the result of the arithmetic expression value1*value2.
Product of a and b. This returns the result of the arithmetic expression value1*value2.
Example
double product = mul(3,4);
Deprecated, use the != operator
Description
This command is deprecated. Use the != operator instead.
Example
Deprecated, use the ! operator
Description
This command is deprecated. Use the ! operator instead.
Example
Deprecated, use Object.centerObjects.length
Description
This command is deprecated. Use Object.centerObjects.length instead.
Number of center ports of object.
Number of center ports of object.
Example
Deprecated, use Object.outObjects.length
Description
Example
ntravelto
(obj traveler, obj spline, num endx, num endy, num endz, num vmax, num acc, num dec, num startspeed, num endspeed)
Deprecated, use kinematics instead
Description
This command is deprecated. Use kinematics instead.
Causes the object to travel to a given rz and return the simulation time that it will arrive. Similar to the travelto command, but includes a start and end speed definition. Used in the development of the TaskExecuter.
Causes the object to travel to a given rz and return the simulation time that it will arrive. Similar to the travelto command, but includes a start and end speed definition. Used in the development of the TaskExecuter.
Example
ntravelto(current, 0, 5, 8, 0, 1, 1, 1, 0, 1)
Deprecated, use kinematics instead
Description
This command is deprecated. Use kinematics instead.
Updates the rz of an object after a ntravelto() command was called on it. Used in the OnPreDraw of the TaskExecuter to update it's position.
Updates the rz of an object after a ntravelto() command was called on it. Used in the OnPreDraw of the TaskExecuter to update it's position.
Example
ntraveltoupdate(current)
Deprecated, use contextdragconnection()
Description
This command is deprecated. Use contextdragconnection() instead.
Connect two objects, adding needed ports. Object1 will have an output port added, and object2 will have an inport added as needed. Then the ports are connected.
Connect two objects, adding needed ports. Object1 will have an output port added, and object2 will have an inport added as needed. Then the ports are connected.
Example
connect(so(),so().next)
Deprecated, use getshapeindex()
Description
This command is deprecated. Use getshapeindex() instead.
Get the index of the object's default shape. The media list of FlexSim will keep a list of all loaded shapes. Each shape has a corresponding name and an index. This command will return the index corresponding to the objects default shape.
Get the index of the object's default shape. The media list of FlexSim will keep a list of all loaded shapes. Each shape has a corresponding name and an index. This command will return the index corresponding to the objects default shape.
Example
objectshapecode(so())
Deprecated, use getobjecttextureindex()
Description
This command is deprecated. Use getobjecttextureindex() instead.
Gets the index of the object's default image. The media list of FlexSim will keep a list of all loaded textures (images). Each texture has a corresponding name and an index. This command will return the index corresponding to the objects default texture (image).
Gets the index of the object's default image. The media list of FlexSim will keep a list of all loaded textures (images). Each texture has a corresponding name and an index. This command will return the index corresponding to the objects default texture (image).
Example
objecttexcode(current)
Deprecated
Description
This command is deprecated.
Example
Deprecated, use fglColor()
Description
This command is deprecated. Use fglColor() instead.
Example
Deprecated, use fglEnable(GL_LIGHTING) and fglDisable(GL_LIGHTING)
Description
This command is deprecated. Use fglEnable(GL_LIGHTING) and fglDisable(GL_LIGHTING) instead.
Example
Deprecated, use Object.input.open()
Description
This command is deprecated. Use Object.input.open() instead.
This command unblocks the input of the object after it has been previously blocked with the closeinput() command. It is necessary that both the input ports themselves, and the input in general, are open before entry will be allowed. It is advised that modelers never use this command in any field other than the OnMessage field which has been triggered with the senddelayedmessage() command, because commands which open ports often spawn several other activities that shouldn't be performed during transitional events. Compare this command with resumeinput().
This command unblocks the input of the object after it has been previously blocked with the closeinput() command. It is necessary that both the input ports themselves, and the input in general, are open before entry will be allowed. It is advised that modelers never use this command in any field other than the OnMessage field which has been triggered with the senddelayedmessage() command, because commands which open ports often spawn several other activities that shouldn't be performed during transitional events. Compare this command with resumeinput().
Example
if (current.subnodes.length < maxcontent)
openinput(current);
openinput(current);
Deprecated, use Object.output.open()
Description
This command is deprecated. Use Object.output.open() instead.
This command unblocks the output of the object after it has been previously blocked with the closeoutput() command. It is necessary that both the output ports themselves, and the output in general, are open before exiting is allowed. It is advised that modelers never use this command in any field other than the OnMessage field which has been triggered with the senddelayedmessage() command, because commands which open ports often spawn several other activities that shouldn't be performed during transitional events. Compare this command with resumeoutput().
This command unblocks the output of the object after it has been previously blocked with the closeoutput() command. It is necessary that both the output ports themselves, and the output in general, are open before exiting is allowed. It is advised that modelers never use this command in any field other than the OnMessage field which has been triggered with the senddelayedmessage() command, because commands which open ports often spawn several other activities that shouldn't be performed during transitional events. Compare this command with resumeoutput().
Example
if (current.subnodes.length > mincontent)
openoutput(current);
openoutput(current);
Deprecated, use the || operator
Description
This command is deprecated. Use the || operator instead.
Example
Deprecated, use Object.outObjects[]
Description
This command is deprecated. Use Object.outObjects[] instead.
Reference the downstream object connected to an upstream object's output port.
Reference the downstream object connected to an upstream object's output port.
Example
Deprecated, use param()
Description
This command is deprecated. Use param instead.
This command is used inside a function that is called by the nodefunction() command. It returns the parameter passed to nodefunction specified by index as a node (or treenode). The first additional parameter passed to nodefunction() is parameter 1, the second is parameter 2, etc. Parameters can also be retrieved using parval() and parstr() for casting them as numbers and strings respectively.
This command is used inside a function that is called by the nodefunction() command. It returns the parameter passed to nodefunction specified by index as a node (or treenode). The first additional parameter passed to nodefunction() is parameter 1, the second is parameter 2, etc. Parameters can also be retrieved using parval() and parstr() for casting them as numbers and strings respectively.
Example
If a trigger/field is called with:
nodefunction(thefuncnode, item)
then within the trigger/field, getting access to the item passed as the first additional parameter would be done with:
treenode item = parnode(1);
nodefunction(thefuncnode, item)
then within the trigger/field, getting access to the item passed as the first additional parameter would be done with:
treenode item = parnode(1);
Deprecated, use param()
Description
This command is deprecated. Use param instead.
This command is used inside a function that is called by the nodefunction() command. It returns the parameter passed to nodefunction specified by index as a string. The first additional parameter passed to nodefunction() is parameter 1, the second is parameter 2, etc. Parameters can also be retrieved using the param() command.
This command is used inside a function that is called by the nodefunction() command. It returns the parameter passed to nodefunction specified by index as a string. The first additional parameter passed to nodefunction() is parameter 1, the second is parameter 2, etc. Parameters can also be retrieved using the param() command.
Example
If a trigger/field is called with:
nodefunction(thefuncnode, passingstr)
then within the trigger/field, getting access to the passingstr string passed as the first additional parameter would be done with:
string passedstr = parstr(1);
nodefunction(thefuncnode, passingstr)
then within the trigger/field, getting access to the passingstr string passed as the first additional parameter would be done with:
string passedstr = parstr(1);
Deprecated, do not use
Description
This command is deprecated. Used to set values on a "particle" object, which is no longer supported.
Example
Deprecated, use param()
Description
This command is deprecated. Use param instead.
This command is used inside a function that is called by the nodefunction() command. It returns the parameter passed to nodefunction specified by index as a number. The first additional parameter passed to nodefunction() is parameter 1, the second is parameter 2, etc. Parameters can also be retrieved using parnode() and parstr() for casting them as a treenode and string respectively.
This command is used inside a function that is called by the nodefunction() command. It returns the parameter passed to nodefunction specified by index as a number. The first additional parameter passed to nodefunction() is parameter 1, the second is parameter 2, etc. Parameters can also be retrieved using parnode() and parstr() for casting them as a treenode and string respectively.
Example
If a trigger/field is called with:
nodefunction(thefuncnode, passingval)
then within the trigger/field, getting access to the passingval passed as the first additional parameter would be done with:
double passedval = parval(1);
nodefunction(thefuncnode, passingval)
then within the trigger/field, getting access to the passingval passed as the first additional parameter would be done with:
double passedval = parval(1);
Deprecated, use print()
Description
This command is deprecated. Use the print() command instead.
Print an ASCII character to the output console.
Print an ASCII character to the output console.
Example
Deprecated, use print()
Description
This command is deprecated. Use the print() command instead.
Print an integer to the output console.
Print an integer to the output console.
Example
Deprecated, use print()
Description
This command is deprecated. Use the print() command instead.
Print a floating point number to the output console.
Print a floating point number to the output console.
Example
Description
This command is deprecated. This should not be used as a special command with the setport command anymore. Instead, declare an int variable type as port, then use port in your code as any other variable type.
Example
int port = param(3);
pd(port);
This sets port to param(3) and then prints the value to the output console.
pd(port);
This sets port to param(3) and then prints the value to the output console.
Deprecated, use print()
Description
This command is deprecated. Use the print() command instead.
Print a new line to the output console.
Print a new line to the output console.
Example
Deprecated, use print()
Description
This command is deprecated. Use the print() command instead.
Print text to the output console.
Example
Deprecated, use Table.query()
Description
This command is deprecated. Use Table.query() instead.
See Miscellaneous Concepts > SQL Queries for more information.
Example
Deprecated, use Table("GlobalTableName")
Description
This command is deprecated. Use the Table class instead.
Gets a reference to a global table.
Gets a reference to a global table.
Example
Table table = reftable("GlobalTable1")
Deprecated, use Vec3.project()
Description
This command is deprecated. Use Vec3.project() instead.
This command returns the x, y, or z location of an object relative to an object that contains it. The containerobj does not need to be the immediate container, but does need to eventually be a container of the object. Use a coordinate value of 1,2,3 for x,y,z respectively.
This command returns the x, y, or z location of an object relative to an object that contains it. The containerobj does not need to be the immediate container, but does need to eventually be a container of the object. Use a coordinate value of 1,2,3 for x,y,z respectively.
Example
double x = relloc(current,model(),1);
double y = relloc(current,model(),2);
double z = relloc(current,model(),3);
Sets x, y and z to the x,y,z positions of the current object relative to the model space.
double y = relloc(current,model(),2);
double z = relloc(current,model(),3);
Sets x, y and z to the x,y,z positions of the current object relative to the model space.
Description
Executes expression the specified number of times. The expression can use "count" to get the 1-based number of the iteration being executed.
Example
repeat(current.outObjects.length, current.outObjects[count].input.close);
This example will close the input of all objects connected to the output ports of current.
This example will close the input of all objects connected to the output ports of current.
Deprecated, use resetmodel()
Description
This command is deprecated. Use resetmodel() instead.
For developer use. This command resets the model. The simulation clock is set to 0, and the OnReset event function is called for every object in the model. The OnReset events generally call the ResetTrigger functions that the users define. The model must be compiled before it can be reset. The resetmodel() command should typically be used instead of reset().
For developer use. This command resets the model. The simulation clock is set to 0, and the OnReset event function is called for every object in the model. The OnReset events generally call the ResetTrigger functions that the users define. The model must be compiled before it can be reset. The resetmodel() command should typically be used instead of reset().
Example
reset();
go();
This resets then runs the model.
go();
This resets then runs the model.
Deprecated, use Object.input.resume()
Description
This command is deprecated. Use Object.input.resume() instead.
This command opens the input of an object just like openinput() does, but because it keeps track of previous stopinput() commands called on the object, it will only open input after all stops have been resumed. Refer to openinput() documentation for additional information.
This command opens the input of an object just like openinput() does, but because it keeps track of previous stopinput() commands called on the object, it will only open input after all stops have been resumed. Refer to openinput() documentation for additional information.
Example
resumeinput(current.centerObjects[1]);
Deprecated, use Object.resume()
Description
This command is deprecated. Use Object.resume() instead.
Tells the object that it may resume whatever it was doing before stopobject() was called on it.
The id value is optional and is for matching stop requests with resume requests. Refer to the stopobject()
documentation for more information on this.
Tells the object that it may resume whatever it was doing before stopobject() was called on it.
The id value is optional and is for matching stop requests with resume requests. Refer to the stopobject()
documentation for more information on this.
Example
resumeobject(current.centerObjects[1]);
Deprecated, use Object.output.resume()
Description
This command is deprecated. Use Object.output.resume() instead.
This command opens the output of an object just like openoutput() does, but because it keeps track of previous stopoutput() commands called on the object, it will only open output after all stops have been resumed. Refer to openoutput() documentation for additional information.
This command opens the output of an object just like openoutput() does, but because it keeps track of previous stopoutput() commands called on the object, it will only open output after all stops have been resumed. Refer to openoutput() documentation for additional information.
Example
resumeoutput(current.centerObjects[1]);
Deprecated, do not use
Description
This command is deprecated. Do not use.
Example
Deprecated, do not use
Description
This command is deprecated. Do not use.
Example
Deprecated, use user libraries
Description
This command is deprecated. Use user libraries instead.
This saves the node to disk as a service pack file (.fpk).
A save file dialog box will appear, allowing you to define the path and name of the file. A service pack is nothing more than a node with subnodes. The first subnode is assumed to be toggled flexscript and contain string data with code. When the service pack is loaded using File | Install Service Pack, the first subnode of you service pack will execute automatically. The code will usually copy the other subnodes into the MAIN and VIEW trees.
This saves the node to disk as a service pack file (.fpk).
A save file dialog box will appear, allowing you to define the path and name of the file. A service pack is nothing more than a node with subnodes. The first subnode is assumed to be toggled flexscript and contain string data with code. When the service pack is loaded using File | Install Service Pack, the first subnode of you service pack will execute automatically. The code will usually copy the other subnodes into the MAIN and VIEW trees.
Example
savefpk(so());
Deprecated, use Object.setLocation()
Description
This command is deprecated. Use Object.setLocation() instead.
Sets the x, y, and z location of the object's rotational center, relative to its container.
Sets the x, y, and z location of the object's rotational center, relative to its container.
Example
Deprecated, do not use
Description
This command is deprecated. Do not use.
Example
Deprecated, use labels
Description
This command is deprecated. Use labels instead.
This command sets the itemtype attribute of the object to value. If the object does not have the itemtype attribute, this command does nothing. The attribute itemtype is typically used to distinguish between different types of flowitems that may be of the same class.
This command sets the itemtype attribute of the object to value. If the object does not have the itemtype attribute, this command does nothing. The attribute itemtype is typically used to distinguish between different types of flowitems that may be of the same class.
Example
setitemtype(item,duniform(1,3));
This sets the itemtype attribute of the flowitem referenced by item to a random integer between 1 and 3.
This sets the itemtype attribute of the flowitem referenced by item to a random integer between 1 and 3.
Deprecated, use treenode.LabelName
Description
This command is deprecated. Use treenode.labelProperties instead.
Sets the value of an object's label.
Sets the value of an object's label.
Example
Deprecated, use treenode.LabelName
Description
Example
Deprecated, use treenode.LabelName
Description
Example
Deprecated, do not use.
Description
This command is deprecated. Do not use.
Sets the index number of the bmp or jpeg image to be assigned to the base of the object (2D shape and base image). For the new index to take effect, the imagebase node of the object must be removed or renamed, so this command renames the imagebase node to "_imagebase" for you. The index number must be a valid index number of a currently imported bmp or jpeg image. To view currently imported images, or to import another bmp or jpeg image, use the Import Media option in the ToolBox.
Sets the index number of the bmp or jpeg image to be assigned to the base of the object (2D shape and base image). For the new index to take effect, the imagebase node of the object must be removed or renamed, so this command renames the imagebase node to "_imagebase" for you. The index number must be a valid index number of a currently imported bmp or jpeg image. To view currently imported images, or to import another bmp or jpeg image, use the Import Media option in the ToolBox.
Example
setobjectimageindex(item,gettextureindex("fs3d\\BBsphere.bmp"));
Deprecated, use Table.query()
Description
This command is deprecated. Use Table.query() instead.
See Miscellaneous Concepts > SQL Queries for more information.
Example
Deprecated, use Table class
Description
This command is deprecated. Use the Table class instead.
Example
Deprecated, use Table.setColHeader() or Table.setRowHeader()
Description
This command is deprecated. Use Table.setColHeader()
or Table.setRowHeader() instead.
Sets the value of the header field of a table
Sets the value of the header field of a table
Example
Deprecated, use the Table's [] operators
Description
This command is deprecated. Use the Table class's [] operators instead.
Sets the number value in a table cell.
Sets the number value in a table cell.
Example
Deprecated, use the Table's [] operators
Description
This command is deprecated. Use the Table class's [] operators instead.
Sets the text value in a table cell.
Sets the text value in a table cell.
Example
Deprecated, use Tracked Variable class
Description
This command is deprecated. Use the TrackedVariable class instead.
Example
Deprecated
Description
This command is deprecated. This command is currently deprecated because a faster leaner implementation of the undo functionality has been developed that does not use this command.
Sets the maximum number of allowable undos. A copy of the entire model will be saved each time a mouse is clicked or a key is pressed. Using the setundos command, you specify the maximum number of model copies that will be remembered for undoing. This command first requires creating a node in the main tree named undo and giving it number data.
Sets the maximum number of allowable undos. A copy of the entire model will be saved each time a mouse is clicked or a key is pressed. Using the setundos command, you specify the maximum number of model copies that will be remembered for undoing. This command first requires creating a node in the main tree named undo and giving it number data.
Example
setundos(2);
Deprecated, do not use
Description
This command is deprecated. Do not use.
Example
Deprecated, use drawtomodelscale()
Description
This command is deprecated. Use drawtomodelscale() instead.
Set the OpenGL space to the global matrix.
Set the OpenGL space to the global matrix.
Example
spaceglobal()
Deprecated, use drawtoobjectscale()
Description
This command is deprecated. Do not use. Use drawtoobjectscale() instead.
Example
spaceobject()
startanimation
(obj object, num/str animation[, num speedtype, num speedvalue, num repeattype, num repeatvalue])
Deprecated, use Animation class
Description
This command is deprecated. Use the Animation class instead.
Starts an animation on an object.
Starts an animation on an object.
Example
startanimation(current, "Stand");
Deprecated, use the Model class
Description
This command is deprecated. Use Model.statisticalTime instead.
Returns the current simulation time with respect to when stats were last reset, such as since the warmup time has passed in an experiment or since resetstats() was executed.
Returns the current simulation time with respect to when stats were last reset, such as since the warmup time has passed in an experiment or since resetstats() was executed.
Example
item.TimeIn = statisticaltime();
This sets the label called "TimeIn" on the object referenced by item to the current simulation clock time.
This sets the label called "TimeIn" on the object referenced by item to the current simulation clock time.
Deprecated, use Animation class
Description
This command is deprecated. Use the Animation class instead.
Stops an animation on an object.
Stops an animation on an object.
Example
stopanimation(current, "Walk");
Deprecated, use Object.input.stop()
Description
This command is deprecated. Use Object.input.stop() instead.
This command closes the input of the object just like closeinput() does, but it also keeps track of consecutive stopinput() commands, and will only open input after all stops have been resumed. Refer to closeinput() documentation for additional information.
This command closes the input of the object just like closeinput() does, but it also keeps track of consecutive stopinput() commands, and will only open input after all stops have been resumed. Refer to closeinput() documentation for additional information.
Example
stopinput(current.centerObjects[1]);
Deprecated, use Object.stop()
Description
This command is deprecated. Use Object.stop() instead.
Tells the object to stop whatever it is doing, go into the state specified (in the state profile if specified), and waits for resumeobject() to be called. Stopobject commands are accumulated, meaning if stopobject is called twice on the same object, the object will not resume its operations until resumeobject has been called twice as well. Stopping an object depends on the type of object that is being stopped.
For FixedResources, generally events are delayed indefinitely, input and output is stopped, and all operations going into and out of the object are stopped. This means that TaskExecuters trying to load/unload to or from the object will have to wait until the object has been resumed.
For TaskExecuters, events are not delayed, but rather a preempting task sequence with priority of 100,000 is created for the TaskExecuter, with one TE_STOP task in it.
Be aware that, if there are several stop requests for the same object, the state for each stop request is not remembered. If an object is requested to stop by entity A with state 12, and then is later requested to stop by entity B for state 14, it will go into state 14 and forget state 12. Even if entity B resumes the object before entity A, the object will remain in state 14 until all stop requests have resumed.
The last two parameters, id and priority, are optional and have recently been added to fix the problem in the previous paragraph. If you specify these parameters, then it will store a record of the stop request, instead of just incrementing a value for the number of stops requested. The id is like a key for that stop request. The priority allows the object to prioritize its stop requests. For example, if you have a stop request for the scheduled down state, and another for the breakdown state at the same time, technically the object should be in two states at once, but since a FlexSim object can only be in one state at a time, the priority value breaks the tie and goes into the state of the highest priority stop request.
The id value should match an id value that is added to a resumeobject() command later on. This is for matching stop requests with their appropriate resume requests. For example, if you stop an object for scheduled maintenance with and id of 1, once the scheduled maintenance is finished, you will need to resume the object with the same id of 1.
Tells the object to stop whatever it is doing, go into the state specified (in the state profile if specified), and waits for resumeobject() to be called. Stopobject commands are accumulated, meaning if stopobject is called twice on the same object, the object will not resume its operations until resumeobject has been called twice as well. Stopping an object depends on the type of object that is being stopped.
For FixedResources, generally events are delayed indefinitely, input and output is stopped, and all operations going into and out of the object are stopped. This means that TaskExecuters trying to load/unload to or from the object will have to wait until the object has been resumed.
For TaskExecuters, events are not delayed, but rather a preempting task sequence with priority of 100,000 is created for the TaskExecuter, with one TE_STOP task in it.
Be aware that, if there are several stop requests for the same object, the state for each stop request is not remembered. If an object is requested to stop by entity A with state 12, and then is later requested to stop by entity B for state 14, it will go into state 14 and forget state 12. Even if entity B resumes the object before entity A, the object will remain in state 14 until all stop requests have resumed.
The last two parameters, id and priority, are optional and have recently been added to fix the problem in the previous paragraph. If you specify these parameters, then it will store a record of the stop request, instead of just incrementing a value for the number of stops requested. The id is like a key for that stop request. The priority allows the object to prioritize its stop requests. For example, if you have a stop request for the scheduled down state, and another for the breakdown state at the same time, technically the object should be in two states at once, but since a FlexSim object can only be in one state at a time, the priority value breaks the tie and goes into the state of the highest priority stop request.
The id value should match an id value that is added to a resumeobject() command later on. This is for matching stop requests with their appropriate resume requests. For example, if you stop an object for scheduled maintenance with and id of 1, once the scheduled maintenance is finished, you will need to resume the object with the same id of 1.
Example
stopobject(current.centerObjects[1], STATE_BLOCKED);
Deprecated, use Object.output.stop()
Description
This command is deprecated. Use Object.output.stop() instead.
This command closes the output of the object just like closeoutput() does, but it also keeps track of consecutive stopoutput() commands, and will only open output after all stops have been resumed. Refer to closeoutput() documentation for additional information.
This command closes the output of the object just like closeoutput() does, but it also keeps track of consecutive stopoutput() commands, and will only open output after all stops have been resumed. Refer to closeoutput() documentation for additional information.
Example
stopoutput(current.centerObjects[1]);
Description
This command is deprecated. This command is currently deprecated because a faster leaner implementation of the undo functionality has been developed that does not use this command.
It explicitly stores an archived copy of the current model inside the undo folder of the main tree. Refer to undos() command documentation for more information.
It explicitly stores an archived copy of the current model inside the undo folder of the main tree. Refer to undos() command documentation for more information.
Example
store();
Deprecated, use string.substr()
Description
Example
stringpart("Hello",2,3) returns the sub string "llo".
Description
This command is deprecated. You can simply return strings from C++ user commands with the return statement.
Prior to FlexSim 7.7, this command was used to return a string from a C++ implementation of a user command. This command was only needed in C++. In FlexScript user commands, you can simply return the string with the return statement.
Prior to FlexSim 7.7, this command was used to return a string from a C++ implementation of a user command. This command was only needed in C++. In FlexScript user commands, you can simply return the string with the return statement.
Example
C++: stringreturn(result, callpoint); return 0;
Deprecated, use apchar()
Description
This command is deprecated. Use apchar() instead.
This command returns the string as a pointer to a C++ character. This is used to convert variables of type string to type char* for some C++ commands which only take char*'s. It is not needed in Flexscript.
This command returns the string as a pointer to a C++ character. This is used to convert variables of type string to type char* for some C++ commands which only take char*'s. It is not needed in Flexscript.
Example
setname(current,stringtopchar("ThisObjectName"));
This sets the name of the object referenced by current to "ThisObjectName". The stringtopchar() command may not be mandatory here, but it is legal.
This sets the name of the object referenced by current to "ThisObjectName". The stringtopchar() command may not be mandatory here, but it is legal.
Deprecated, use \"
Description
This command is deprecated. Use \" instead to include quotation marks within a string.
Example
strquote("hello")
Deprecated, use the - operator
Description
This command is deprecated. Use the - operator instead.
operator instead. of value1 and value2. This returns the result of the arithmetic expression value1-value2.
operator instead. of value1 and value2. This returns the result of the arithmetic expression value1-value2.
Example
double operator instead. = sub(10,4);
Deprecated, do not use
Description
This command is deprecated. Do not use. Get or set the "Show 2D Shape" flag of the object. A value of 1 is hide, a value of 0 is show, and a value of -1 gets the current value. The 2D shape (base) of an object is visible in the Planar view window. Note that view windows also have an attribute named hideallbases that controls the display of 2D shapes (bases) for ALL objects in their view.
Example
switch_hidebase(so(),1)
Deprecated, use Tracked Variable class
Description
This command is deprecated. Use the TrackedVariable class instead.
Example
Deprecated, use treenode.up
Description
Example
transfernode(current.labels["inactivequeue"].first, current.labels["activequeue"]);
Deprecated, use kinematics
Description
This command is deprecated. Use kinematics instead.
Calculate current travel parameters for the object. A travel path will be calculated. Once set, the object's position will be calculated based on the travel path as defined by this command. This function returns the time of travel end. This function can be used in conjunction with a spline to create curved travel paths.
Calculate current travel parameters for the object. A travel path will be calculated. Once set, the object's position will be calculated based on the travel path as defined by this command. This function returns the time of travel end. This function can be used in conjunction with a spline to create curved travel paths.
Example
travelto(traveler,NULL,100,100,0,5,1,6)
Deprecated, use kinematics
Description
This command is deprecated. Use kinematics instead.
Update the object's position based on it's current travel parameters. Explicitly set an object's position based on the time and travel path parameters as calculated from the travelto() command on object, using spline as the path geometry if desired.
Update the object's position based on it's current travel parameters. Explicitly set an object's position based on the time and travel path parameters as calculated from the travelto() command on object, using spline as the path geometry if desired.
Example
traveltoupdate(current)
Updates the current object's position based on the travel parameters set earlier by the traveto() command. This command is usually executed from the Custom Draw Code field.
Updates the current object's position based on the travel parameters set earlier by the traveto() command. This command is usually executed from the Custom Draw Code field.
Description
This command is deprecated. This command is currently deprecated because a faster leaner implementation of the undo functionality has been developed that does not use this command.
This command is used to turn on (1) and off (0) the automatic saving of model copies each time there is a mouse click or key press. Use the setundos command, to specify the maximum number of model copies that will be remembered for undoing. To function correctly, this command requires first creating a node in the main tree named undo and giving it number data.
This command is used to turn on (1) and off (0) the automatic saving of model copies each time there is a mouse click or key press. Use the setundos command, to specify the maximum number of model copies that will be remembered for undoing. To function correctly, this command requires first creating a node in the main tree named undo and giving it number data.
Example
undos(1);
Deprecated, use Animation class
Description
This command is deprecated. Use the Animation class instead.
Updates an animation on an object.
Updates an animation on an object.
Example
updateanimation(current);
Deprecated, use the Toolbox
Description
This command is deprecated, use the Toolbox.
Updates the tools menu to reflect any additions or deletions to the tools.
Updates the tools menu to reflect any additions or deletions to the tools.
Example
updatetoolsmenu()
Deprecated, use nodefunction()
Description
This command is deprecated. Use nodefunction() instead because it will work on any node.
Executes code associated with a node found in the object's userfunctions group having the specified rank index. Use param() within the called function node to retrieve the arguments passed into the function.
Executes code associated with a node found in the object's userfunctions group having the specified rank index. Use param() within the called function node to retrieve the arguments passed into the function.
Example
userfunction_s(current,4,1,2,3)
Executes the code associated with a node ranked 4th in the userfunctions group of the current object.
Executes the code associated with a node ranked 4th in the userfunctions group of the current object.
Deprecated, use nodefunction()
Description
This command is deprecated. Use nodefunction() instead, because it will work on any node.
Executes code associated with a node found in the object's userfunctions group having the specified name. Use param() within the called function node to retrieve the arguments passed into the function.
Executes code associated with a node found in the object's userfunctions group having the specified name. Use param() within the called function node to retrieve the arguments passed into the function.
Example
userfunction_s(current,"myfunc",1,2,3)
Executes the code associated with a node named "myfunc" in the userfunctions group of the current object.
Executes the code associated with a node named "myfunc" in the userfunctions group of the current object.
Deprecated, use getvarnode()
Description
This command is deprecated. Use getvarnode() instead.
Get the node of an object in 'variables' by index.
Get the node of an object in 'variables' by index.
Example
var(so(),1)
Deprecated, use getvarnode()
Description
This command is deprecated. Use getvarnode() instead.
Get the node of an object in 'variables' by name.
Get the node of an object in 'variables' by name.
Example
var_s(current,"myatt")
Deprecated, use Object.getLocation()
Description
This command is deprecated. Use Object.getLocation().
Gets the x location of the rotational center of the object within its container.
Gets the x location of the rotational center of the object within its container.
Example
Deprecated, use Object.location or Object.getLocation()
Description
This command is deprecated. Use Object.location
or Object.getLocation().
Gets the x location of an object.
Gets the x location of an object.
Example
Deprecated, use Object.rotation or Object.setRotation()
Description
This command is deprecated. Use Object.rotation
or Object.setRotation() instead.
Gets the x rotation of an object (rotation about the x-axis).
Gets the x rotation of an object (rotation about the x-axis).
Example
Deprecated, use Object.getLocation()
Description
This command is deprecated. Use Object.getLocation() instead.
Gets the y location of the rotational center of the object within its container.
Gets the y location of the rotational center of the object within its container.
Example
Deprecated, use Object.location or Object.getLocation()
Description
This command is deprecated. Use Object.location
or Object.getLocation() instead.
Gets the y location of an object.
Gets the y location of an object.
Example
Deprecated, use Object.getLocation()
Description
This command is deprecated. Use Object.getLocation() instead.
Gets the z location of the rotational center of the object within its container.
Gets the z location of the rotational center of the object within its container.
Example
Deprecated, use Object.location or Object.getLocation()
Description
This command is deprecated. Use Object.location
or Object.getLocation() instead.
Gets the z location of an object.
Gets the z location of an object.
Example
Development
High-level development commands not typically intended for end users.
addcommand
(obj codenode, str commandname, str description, str parameters, str example [, str cppprefix, str shortdescription])
Description
For developer use. Adds a Flexscript command to the current list of available commands. The new command is available until the next compile. The Tools | User Commands menu is for end-users to create their own commands.
Example
addcommand(...)
Description
For developer use. Backs up the file by appending a ! onto the specified file's name. Note that this doesn't copy the file. You would do this before an overwrite of a file.
Example
backupfile(modeldir() + "mydocument.htm");
Description
For developer use. This command builds Flexscript trees for all of the nodes in the tree that are designated as Flexscript nodes. A Flexscript node must have a Flexscript tree made before it can run. This option is available in the main menu under Build -> Build All Flexscript. This must be done before running a model with Flexscript written anywhere in it. It should also be done after making any changes to GUIs.
Example
buildall();
This builds Flexscript trees for all Flexscript nodes in the tree.
This builds Flexscript trees for all Flexscript nodes in the tree.
Description
For developer use. This command builds Flexscript trees for the node specified as node if it is designated as a Flexscript node. A Flexscript node must have a Flexscript tree made before it can run.
Example
buildnodeflexscript(Table("mytable").cell(1,2));
This builds a Flexscript tree for the node at row 1 column 2 of the GlobalTable named "mytable", if it is a Flexscript node.
This builds a Flexscript tree for the node at row 1 column 2 of the GlobalTable named "mytable", if it is a Flexscript node.
Change resolution
Description
Change resolution
Example
changedisplay(1024,768,0,0,0)
Description
For developer use. This command recursively deletes Flexscript trees starting at the node specified.
Example
cleannodeflexscript(model());
This cleans all the Flexscript nodes in the model.
This cleans all the Flexscript nodes in the model.
Description
For developer use. Use destroyobject().
Delete thenode.
Delete thenode.
Example
cmddelete(model().subnodes[4]))
Description
For developer use.
Load a file by name and extension. Recognizes: Project (fsp), Session (fss), Model (fsm), View Layout (fsv). If silent is 0, the user will be asked to confirm that they are opening the correct file.
Load a file by name and extension. Recognizes: Project (fsp), Session (fss), Model (fsm), View Layout (fsv). If silent is 0, the user will be asked to confirm that they are opening the correct file.
Example
cmdloadbyextension("c:/mysession.fss",0)
Description
For developer use.
Load a session by name.
Load a session by name.
Example
cmdloadsession("c:/mysession.fss")
Description
For developer use.
Load a tree by file path into desttree. By default, after loading, all flexscript will be built. If nobuild is 1, flexscript will not be built. Set nobuild to 1 if you are executing this command from a script node that is toggled as flexscript, or else your script will not finish properly.
Load a tree by file path into desttree. By default, after loading, all flexscript will be built. If nobuild is 1, flexscript will not be built. Set nobuild to 1 if you are executing this command from a script node that is toggled as flexscript, or else your script will not finish properly.
Example
cmdloadtree(node("MAIN:/project/model/2"),"c:/mytree.t"))
Description
For developer use.
Start a new model. This command will clear the contents of the model by deleting all objects in the model.
Start a new model. This command will clear the contents of the model by deleting all objects in the model.
Example
cmdnew()
Description
For developer use.
Open a new model. This command will cause an Open Model Dialog box to appear from which a model file can be selected for opening.
Open a new model. This command will cause an Open Model Dialog box to appear from which a model file can be selected for opening.
Example
cmdopen()
Description
For developer use.
Save the model. This command will cause an SaveAs Model Dialog box to appear from which a model file name can be specified for saving.
Save the model. This command will cause an SaveAs Model Dialog box to appear from which a model file name can be specified for saving.
Example
cmdsaveas()
Description
For developer use.
Save a session by name.
Save a session by name.
Example
cmdsavesession("c:/mysession.fss")
Save a Tree by name
Description
Save a Tree by name
Example
cmdsavetree(node("MAIN:/project/library/1"),"c:\\mytree.t"))
Description
For developer use.
Execute the console code as Flexscript.
Execute the console code as Flexscript.
Example
Description
For developer use. Copy the attributes from one object to another. Use mask parameter to enable specific groups (from least significant):
ATTCOPY_ALL
ATTCOPY_SPATIAL
ATTCOPY_OFFSETS
ATTCOPY_VISUAL
ATTCOPY_MEDIA ATTCOPY_LABELS
ATTCOPY_VARIABLES
ATTCOPY_DESCRIPTIVE
ATTCOPY_TABLES
Use the OR operator (|) to combine these values into a single value for the mask parameter.
ATTCOPY_ALL
ATTCOPY_SPATIAL
ATTCOPY_OFFSETS
ATTCOPY_VISUAL
ATTCOPY_MEDIA ATTCOPY_LABELS
ATTCOPY_VARIABLES
ATTCOPY_DESCRIPTIVE
ATTCOPY_TABLES
Use the OR operator (|) to combine these values into a single value for the mask parameter.
Example
copyattributes(library().subnodes[1],model().subnodes[1],ATTCOPY_SPATIAL | ATTCOPY_VISUAL)
Description
For developer use. Copies the color of the highlighted object to all of the selected objects
Example
copycolor(current)
Description
For developer use. Copies the label with the name specified by parameter 2 or stored on the string data of the node in parameter 2 from the parameter 1 object to all selected objects in the model.
Example
copylabel(selectedobject(ownerview(c)), c.find(">labelname"))
Description
For developer use. Copies all labels from the parameter 1 object to all selected objects in the model. By default it clears out all existing
labels and replaces them with the labels on the parameter 1 object. If mode is 1, existing labels will be overwritten by any incoming labels with the same name,
but will otherwise be left alone. If mode is 2, only labels that the selected objects do not already have will be copied.
Example
copylabels(selectedobject(ownerview(c)), c.find(">labelname"))
Description
For developer use. Copies the variable with the name held by the node in parameter 2 from the parameter 1 object to all selected objects in the model.
Example
copyvariable(selectedobject(ownerview(c)), c.find(">variablename"))
Description
For developer use. Copies all variables from the parameter 1 object to all selected objects in the model.
Example
copyvariables(selectedobject(ownerview(c)))
Description
For developer use. Copies all visuals from the parameter 1 object to all selected objects in the model.
Example
copyvisuals(selectedobject(ownerview(c)),1)
Description
For developer use.
Returns the stats of:
1 - clock
2 - flythrough
3 - ticker
Returns the stats of:
1 - clock
2 - flythrough
3 - ticker
Example
daemonstate(1)
Description
For developer use. Accesses the current model's command documenation and updates a file called usercommands.xml so that the user commands are included in the command documentation
Example
documentusercommands();
SYSTEM USE ONLY
Description
SYSTEM USE ONLY - used to update global variables to match preferences. Called in startupRT.txt and in OnSelect of Excel Preferences GUI.
Example
excelupdatepreferences()
Description
For developer use. Set the OpenGL debug level. The higher the number, the more scrutiny is put on the system, and the more reporting is done. 0 is none, 3 is maximum.
Example
fgldebuglevel(3)
Description
For developer use (Dynamo). Looks for the string "READONLY" in the PROPERTY_COMMENTS of the specified file.
Example
fileisreadonly(pdir() + "\\flexsim.exe")
Description
For developer use. Fill an object with attribute from an attribute group.
Example
fillwithatts(so(),1)
Description
For developer use. This command checks for errors in all flexscript nodes under and including the specified startingnode and outputs the results to the compiler console if it finds atleast one error.
Example
fscheckall(main());
Description
For developer use. Executes code associated with a node found in the object's eventfunctions group having the specified event code. The event code is not the rank of the node in the eventfunctions group, but it corresponds to one of the following pre-defined FlexSim event :
OnReset 1
OnMessage 2
OnEvent 3
OnDraw 4
OnInopen 5
OnOutopen 6
OnReceive 7
OnSend 8
OnEntering 9
OnExiting 10
OnCompile 11
OnCreate 12
OnDestroy 13
OnLoad 14
OnCollision 15
OnClick 16
OnRunend 17
OnRunstart 18
OnInterrupted 19
OnCaptured 20
OnListen 21
OnPredraw 22
OnDrawplanar 23
OnPredrawplanar 24
OnPreListen 25
OnReset 1
OnMessage 2
OnEvent 3
OnDraw 4
OnInopen 5
OnOutopen 6
OnReceive 7
OnSend 8
OnEntering 9
OnExiting 10
OnCompile 11
OnCreate 12
OnDestroy 13
OnLoad 14
OnCollision 15
OnClick 16
OnRunend 17
OnRunstart 18
OnInterrupted 19
OnCaptured 20
OnListen 21
OnPredraw 22
OnDrawplanar 23
OnPredrawplanar 24
OnPreListen 25
Example
function_n(current,1,1,2,3)
Executes the OnReset event function defined on the current object.
Executes the OnReset event function defined on the current object.
Description
For developer use. Executes code associated with the node found in the object's eventfunctions group having the specified name. For a list of the pre-defined system level events in FlexSim refer to function_n() command documentation.
Example
function_s(current,"OnReset",1,2,3)
Executes the OnReset event function defined on the current object.
Executes the OnReset event function defined on the current object.
Description
For developer use. Returns the current application's title as a string.
Example
msg(getapplicationtitle(),"Hello world.");
Description
For developer use. Used in parameters window to access the next object when the "Next" button on the parameters window is pressed.
Example
Refer to object parameters properties windows in the view tree
Description
For developer use. Gets the value for the specified property in the specified file.
Example
getproperty(modeldir() + "MyModel.fsm",1);
Description
For developer use. Connects the object passed in as param(1) to every selected object in the model using the letter passed in as param(2).
Typically used in GUIs.
Typically used in GUIs.
Example
groupconnectfrom(selectedobject(ownerview(c)),"A");
Description
For developer use. Connects every selected object in the model to the object passed in as param(1) using the letter passed in as param(2).
Typically used in GUIs.
Typically used in GUIs.
Example
groupconnectto(selectedobject(ownerview(c)),"A");
Description
For developer use. Copies the connections on the object passed in as param(1) onto every selected object in the model.
Typically used in GUIs
Typically used in GUIs
Example
groupcopyconnections(selectedobject(ownerview(c)));
Description
For developer use. Returns the number of attributes.
Example
howmanyattributes()
Description
For developer use. Returns the number of commands.
Example
howmanycommands()
Description
For developer use. Do various licensing operations.
Example
licenseactivation(LA_SET_ACTIVATION_SERVER_PARAMS,"@localhost",0);
Description
For developer use. Set a maintenance switch.
The first parameter designates the operation. The second parameter designates a state to set it to.
Maintenance switches:
0. print this list
1. deadlinks
2. atttrbute bind method (0=names, 1=indices, 2=bootstrap)
3. numberprecision
4. display binding report
5. usercollisions
6. post-onsend
7. loadsavemode
8. disablefscheck
9. disablefspreprocess
10. splinetension
11. streamalizer
12. immediately load extended docs
13. save reps at experiment end
14. suppress object library compile
15. suppress global compile
16. set runtime info
17. get runtime info
18. bind c++ functions
19. autorebind c++ functions onoff
20. get presentation mode
21. refresh main menu
22. is optquest enabled
23. flypaths in seconds units
24. chached ports on/off
25. bind on reset on/off
26. set category name (user command group is 22, other 23, 24+ is available)
27. object sizermode 0. default 1. 3-axis
28. show hidden nodes in tree
29. hide 3d cursor
30. supress simclock redraw
31. use parser two
32. grid draw settings: bitwise field: 0x1-auto expand grid, 0x2-show grid axes, 0x4-show grid origin
1000. DDE
The first parameter designates the operation. The second parameter designates a state to set it to.
Maintenance switches:
0. print this list
1. deadlinks
2. atttrbute bind method (0=names, 1=indices, 2=bootstrap)
3. numberprecision
4. display binding report
5. usercollisions
6. post-onsend
7. loadsavemode
8. disablefscheck
9. disablefspreprocess
10. splinetension
11. streamalizer
12. immediately load extended docs
13. save reps at experiment end
14. suppress object library compile
15. suppress global compile
16. set runtime info
17. get runtime info
18. bind c++ functions
19. autorebind c++ functions onoff
20. get presentation mode
21. refresh main menu
22. is optquest enabled
23. flypaths in seconds units
24. chached ports on/off
25. bind on reset on/off
26. set category name (user command group is 22, other 23, 24+ is available)
27. object sizermode 0. default 1. 3-axis
28. show hidden nodes in tree
29. hide 3d cursor
30. supress simclock redraw
31. use parser two
32. grid draw settings: bitwise field: 0x1-auto expand grid, 0x2-show grid axes, 0x4-show grid origin
1000. DDE
Example
maintenance(0)
Description
For developer use. Sets the current model edit mode. You can query the current mode with -1.
Example
modeleditmode("AConnect");
Posts a Windows Message to close the window
Description
Posts a message onto the Windows message queue to close the window. This allows you to finish any scripting code before the window is actually closed.
Example
postclosewindowmessage(ownerview(c));
Description
For developer use. This gives direct access to the Windows API PostMessage() command, posting a message to a window. Use windowfromnode() or getviewhwnd() to get access to the window handle. Refer to Windows API documentation for more information. Not that you cannot use a message that uses lParam or wParam as an [out] parameter, or one that you pass in as a pointer to a struct. You should be able to pass strings into lParam or wParam, but again thay cannot be [out] parameters. FlexSim does not include all possible WM_ messages in its flexscript macros, so if you want to use one in flexscript, you will need to find the definition in the windows header files and add the definition to your flexscript code.
Example
postwindowmessage(windowfromnode(view), WM_COPY, 0,0);
Rebinds object attributes
Description
Rebinds object attributes for the given node. If you delete or add an attribute to an object, the object's attribute cache will not immediately reflect that change, so you can call rebindobjectattributes to update the object's attribute cache. This is the same as right-clicking on the object and selecting Edit|Rebind Object Attributes.
Example
rebindobjectattributes(c)
Load recovery files
Description
Load recovery files. phase: 1 or 2
Example
recover(1)
Description
For developer use. Refreshes the command list.
Example
refreshcommandlist()
Description
For developer use. Refreshes all global variables to their initial values.
Example
refreshglobalvariables()
Description
For developer use. Starts the expertfit program automatically if licensed.
Example
runexpertfit()
Description
For developer use. This gives direct access to the Windows API SendMessage() command, sending a message to a window. Use windowfromnode() or getviewhwnd() to get access to the window handle. Refer to Windows API documentation for more information. Not that you cannot use a message that uses lParam or wParam as an [out] parameter, or one that you pass in as a pointer to a struct. You should be able to pass strings into lParam or wParam, but again thay cannot be [out] parameters. FlexSim does not include all possible WM_ messages in its flexscript macros, so if you want to use one in flexscript, you will need to find the definition in the windows header files and add the definition to your flexscript code.
Example
sendwindowmessage(windowfromnode(view), WM_COPY, 0,0);
Description
For developer use. Sets the current application's title.
Example
setapplicationtitle("Custom Application Title");
Description
For developer use. Set a sleep time for each cycle of the message loop to decrease cpu load. Use carefully because a large value can make FlexSim unresponsive to user input. Every interval milliseconds, FlexSim will pause for a period of sleeptime milliseconds. This command may help certain laptops that tend to overheat due to excessive cpu usage.
Example
setmessageloopsleep(1)
Description
For developer use. Sets the value for the specified property in the specified file to the newvalue.
Example
setproperty(modeldir() + "MyModel.fsm",1,"Custom Title");
Description
For developer use. Set the ticker script node. If tickspersecond is specified, the code will be executed that many times per second, otherwise the code associated with the node will be executed at each iteration of the windows event loop. The node must be toggled FlexScript or C++. No model events are created in association with the ticker node execution. To turn off ticker execution, use setticker(0).
Example
setticker(so())
Description
For developer use. Enable or disable aspects of stats collection. Set a 32 bit enable mask: Sum of flags. Bits: 0 = State; 1 = Flow; 2 = Inside Ports.
Example
statsenablemask(add(1,2))
Description
For developer use. This command queries the joystick or controller state or sets functionality for a joystick or controller.
stickno defines an id for the joystick or gamepad you want to query. This is a number between 0 and 32. Usually you will only have one joystick connected to your computer, so in this case you should use the value 1 as stickno. If you are using a gamepad, you might need to use stickno 2. For Xbox controllers, stickno will be a value between 0 and 3. For VR controllers, stickno will be either 0 or 1. For Oculus touch controllers, stickno 0 is the left hand and stickno 1 is the right hand. Use stickno -1 to get the status, position, or rotation of a connected VR headset.
command defines the operation that the command should perform. This should be one of the macros below:
STICK_JOY_STATUS - Queries the connectivity of the joystick. If the joystick is connected properly, then this command will return 0. If the return value is non-zero, then there is some error with the joystick's connectivity, and you can view the system console to see what the error is. The following errors apply:
MMSYSERR_NODRIVER - The joystick driver is not present.
MMSYSERR_INVALPARAM - Invalid joystick ID or hwnd is NULL.
JOYERR_NOCANDO - Cannot capture joystick input because a required service (such as a Windows timer) is unavailable.
JOYERR_UNPLUGGED - The specified joystick is not connected to the system.
JOYERR_PARMS - Invalid joystick ID or hwnd is NULL.
STICK_JOY_XPOS - Current X-coordinate of the joystick. This is a number between 0 and 65535. 0 means the joystick is pushed all the way to the left, 65535 means it is pushed all the way to the right, and 32768 is exactly in the center. If you are using a gamepad, then this is the x position of the left side joystick.
STICK_JOY_YPOS - Current Y-coordinate of the joystick. Again this is a number between 0 and 65535. 0 is up, 65535 is down. If you are using a gamepad, this is the position of the gamepad's left joystick.
STICK_JOY_ZPOS - Current Z-coordinate of the joystick. If you are using a joystick, this will usually be the current setting of the joystick's throttle. Again it is a value between 0 and 65535. If you are using a gamepad, this represents the y position of the right side joystick.
STICK_JOY_BUTTONS - Current state of the 32 joystick buttons. This is bitwise integer with each bit representing the state of a given button. For a joystick, the main trigger button is usually represented by the 0x00000001 bit, other buttons on the stick are 0x00000002 and 0x00000004, and buttons on the base of the joystick are then higher order bits. You will need to test these out on your own as each joystick is a little different.
STICK_JOY_SET_CAPTURE - This command sets the joystick capture to a FlexSim window that you specify. This command requires the win and p parameters to be passed in. By executing this command, joystick messages will be sent to the OnStick attribute of the view. For example, if you have an ortho view that you would like to listen to joystick events, you would call this command, passing the ortho view's HWND handle (use windowfromnode()), and a polling period. The period specifies a time interval in milliseconds to repeatedly call the OnStick event. If p is 0, then the OnStick event will only be called when the joystick's state changes. If p is greater than 0, then the OnStick event will simply be called at the end of each sample period interval. Example: stick(1,5, windowfromnode(sv()), 200); This will cause the OnStick event to be called every 200 milliseconds. In order for this to work, you need to add an OnStick attribute to the view (you may also need to rebind the view's attributes after adding it: right-click->Edit|Rebind Object Attributes).
STICK_JOY_RELEASE_CAPTURE - This command releases the joystick capture for the window that was previously captured with the 5 command. You need to pass in the win parameter as with command 5.
STICK_JOY_RPOS - Current position of the rudder or fourth joystick axis of the joystick. For a joystick, this is usually the rotation of the joystick if your joystick can rotate around its z axis. Again it is a number between 0 and 65535. If you are using a gamepad, it is the x position of the right side joystick.
STICK_JOY_UPOS - Current fifth axis position of the joystick.
STICK_JOY_VPOS - Current sixth axis position of the joystick.
STICK_JOY_POV - Current position of the point-of-view control of the joystick. It is a number between 0 and 35900 and represents the number of degrees times 100. For a gamepad, this represents the directional pad on the left of the gamepad. Up is 0, right is 9000, down is 18000, left is 27000. If the directional pad is not pressed, the value will be 65535. If you are using a joystick, there may be a directional thumb controller on the stick itself that you can press up, down, right, or left, and this will get the setting of that controller.
STICK_JOY_CURRENT_BUTTON - Current button number that is pressed.
STICK_JOY_FLAGS - Flags indicating the valid information returned about the joystick.
STICK_XBOX_STATUS - Queries the connectivity of the Xbox controller. If the controller is connected properly, this returns 0.
STICK_XBOX_BUTTONS - Bitmask of the device digital buttons. A set bit indicates that the corresponding button is pressed.
STICK_XBOX_LEFT_THUMB_X - Left thumbstick x-axis value. Each of the thumbstick axis members is a signed value between -32768 and 32767 describing the position of the thumbstick. A value of 0 is centered. Negative values signify down or to the left. Positive values signify up or to the right.
STICK_XBOX_LEFT_THUMB_Y - Left thumbstick y-axis value. The value is between -32768 and 32767.
STICK_XBOX_RIGHT_THUMB_X - Right thumbstick x-axis value. The value is between -32768 and 32767.
STICK_XBOX_RIGHT_THUMB_Y - Right thumbstick y-axis value. The value is between -32768 and 32767.
STICK_XBOX_LEFT_TRIGGER - The current value of the left trigger analog control. The value is between 0 and 255.
STICK_XBOX_RIGHT_TRIGGER - The current value of the right trigger analog control. The value is between 0 and 255.
STICK_VR_STATUS - Returns 1 if an Oculus Rift controller is active. Returns 2 if an HTC Vive controller is active. Returns 0 if the controller is inactive. Returns nullvar if the controller is not attached.
STICK_VR_THUMB_X - Thumbstick or trackpad x-axis value between -1 and 1.
STICK_VR_THUMB_Y - Thumbstick or trackpad y-axis value between -1 and 1.
STICK_VR_INDEX_TRIGGER - Index trigger value between 0 and 1.
STICK_VR_GRIP_TRIGGER - Grip trigger value between 0 and 1. On HTC Vive, grip button is pressed.
STICK_VR_BUTTON_1 - The first button is pressed. A or X on Oculus Rift. Unused on HTC Vive.
STICK_VR_BUTTON_2 - The second button is pressed. B or Y on Oculus Rift. Unused on HTC Vive.
STICK_VR_BUTTON_3 - The third button is pressed. Enter or Home on Oculus Rift. Menu on HTC Vive.
STICK_VR_BUTTON_4 - The fourth button is pressed. Thumbstick on Oculus Rift. Trackpad on HTC Vive.
STICK_VR_TOUCH_BUTTON_1 - The first button is touched. Unused on HTC Vive.
STICK_VR_TOUCH_BUTTON_2 - The second button is touched. Unused on HTC Vive.
STICK_VR_TOUCH_BUTTON_3 - The third button is touched. Unused on Oculus Rift.
STICK_VR_TOUCH_BUTTON_4 - The fourth button is touched.
STICK_VR_TOUCH_THUMB_REST - The thumb rest sensor is touched on Oculus Rift. Unused on HTC Vive.
STICK_VR_TOUCH_INDEX_TRIGGER - The index trigger sensor is touched.
STICK_VR_TOUCH_POINTING - The hand gesture is pointing on Oculus Rift. Unused on HTC Vive.
STICK_VR_TOUCH_THUMB_UP - The hand gesture is thumbs-up on Oculus Rift. Unused on HTC Vive.
STICK_VR_HAND_POSITION - The controller position in VR space.
STICK_VR_HAND_ROTATION - The controller rotation in VR rotation coordinates.
STICK_VR_HAND_WORLD_POSITION - The controller position in FlexSim world space.
STICK_VR_HAND_WORLD_ROTATION - The controller rotation in FlexSim rotation coordinates.
STICK_VR_HAND_OFFSET_POSITION - The controller's position in FlexSim world space, but with an offset applied based on the controller's rotation. Pass an array as the offset vector in the p parameter. You can use this option to get a point relative to the controller, such as a finger position or where the controller is pointing.
STICK_VR_TARGET_FLOOR_POSITION - The target position on the floor that the controller is pointing towards. Pass a value in the p parameter for the maximum distance away from the controller.
STICK_VR_SET_VIBRATION - Causes the controller to vibrate. On Oculus Rift, pass an array for the p parameter where the first element is a value between 0 and 1 for the frequency and the second element is a value between 0 and 1 for the amplitude. On HTC Vive, pass a duration in microseconds for the p parameter.
STICK_VR_SUBMIT_VIBRATION - Causes the controller to subtly vibrate. On original Oculus Touch controllers, pass an array of amplitudes (0 - 255) for the p parameter to be queued up and executed. Unused on HTC Vive or Oculus Rift S controllers.
stickno defines an id for the joystick or gamepad you want to query. This is a number between 0 and 32. Usually you will only have one joystick connected to your computer, so in this case you should use the value 1 as stickno. If you are using a gamepad, you might need to use stickno 2. For Xbox controllers, stickno will be a value between 0 and 3. For VR controllers, stickno will be either 0 or 1. For Oculus touch controllers, stickno 0 is the left hand and stickno 1 is the right hand. Use stickno -1 to get the status, position, or rotation of a connected VR headset.
command defines the operation that the command should perform. This should be one of the macros below:
STICK_JOY_STATUS - Queries the connectivity of the joystick. If the joystick is connected properly, then this command will return 0. If the return value is non-zero, then there is some error with the joystick's connectivity, and you can view the system console to see what the error is. The following errors apply:
MMSYSERR_NODRIVER - The joystick driver is not present.
MMSYSERR_INVALPARAM - Invalid joystick ID or hwnd is NULL.
JOYERR_NOCANDO - Cannot capture joystick input because a required service (such as a Windows timer) is unavailable.
JOYERR_UNPLUGGED - The specified joystick is not connected to the system.
JOYERR_PARMS - Invalid joystick ID or hwnd is NULL.
STICK_JOY_XPOS - Current X-coordinate of the joystick. This is a number between 0 and 65535. 0 means the joystick is pushed all the way to the left, 65535 means it is pushed all the way to the right, and 32768 is exactly in the center. If you are using a gamepad, then this is the x position of the left side joystick.
STICK_JOY_YPOS - Current Y-coordinate of the joystick. Again this is a number between 0 and 65535. 0 is up, 65535 is down. If you are using a gamepad, this is the position of the gamepad's left joystick.
STICK_JOY_ZPOS - Current Z-coordinate of the joystick. If you are using a joystick, this will usually be the current setting of the joystick's throttle. Again it is a value between 0 and 65535. If you are using a gamepad, this represents the y position of the right side joystick.
STICK_JOY_BUTTONS - Current state of the 32 joystick buttons. This is bitwise integer with each bit representing the state of a given button. For a joystick, the main trigger button is usually represented by the 0x00000001 bit, other buttons on the stick are 0x00000002 and 0x00000004, and buttons on the base of the joystick are then higher order bits. You will need to test these out on your own as each joystick is a little different.
STICK_JOY_SET_CAPTURE - This command sets the joystick capture to a FlexSim window that you specify. This command requires the win and p parameters to be passed in. By executing this command, joystick messages will be sent to the OnStick attribute of the view. For example, if you have an ortho view that you would like to listen to joystick events, you would call this command, passing the ortho view's HWND handle (use windowfromnode()), and a polling period. The period specifies a time interval in milliseconds to repeatedly call the OnStick event. If p is 0, then the OnStick event will only be called when the joystick's state changes. If p is greater than 0, then the OnStick event will simply be called at the end of each sample period interval. Example: stick(1,5, windowfromnode(sv()), 200); This will cause the OnStick event to be called every 200 milliseconds. In order for this to work, you need to add an OnStick attribute to the view (you may also need to rebind the view's attributes after adding it: right-click->Edit|Rebind Object Attributes).
STICK_JOY_RELEASE_CAPTURE - This command releases the joystick capture for the window that was previously captured with the 5 command. You need to pass in the win parameter as with command 5.
STICK_JOY_RPOS - Current position of the rudder or fourth joystick axis of the joystick. For a joystick, this is usually the rotation of the joystick if your joystick can rotate around its z axis. Again it is a number between 0 and 65535. If you are using a gamepad, it is the x position of the right side joystick.
STICK_JOY_UPOS - Current fifth axis position of the joystick.
STICK_JOY_VPOS - Current sixth axis position of the joystick.
STICK_JOY_POV - Current position of the point-of-view control of the joystick. It is a number between 0 and 35900 and represents the number of degrees times 100. For a gamepad, this represents the directional pad on the left of the gamepad. Up is 0, right is 9000, down is 18000, left is 27000. If the directional pad is not pressed, the value will be 65535. If you are using a joystick, there may be a directional thumb controller on the stick itself that you can press up, down, right, or left, and this will get the setting of that controller.
STICK_JOY_CURRENT_BUTTON - Current button number that is pressed.
STICK_JOY_FLAGS - Flags indicating the valid information returned about the joystick.
STICK_XBOX_STATUS - Queries the connectivity of the Xbox controller. If the controller is connected properly, this returns 0.
STICK_XBOX_BUTTONS - Bitmask of the device digital buttons. A set bit indicates that the corresponding button is pressed.
STICK_XBOX_LEFT_THUMB_X - Left thumbstick x-axis value. Each of the thumbstick axis members is a signed value between -32768 and 32767 describing the position of the thumbstick. A value of 0 is centered. Negative values signify down or to the left. Positive values signify up or to the right.
STICK_XBOX_LEFT_THUMB_Y - Left thumbstick y-axis value. The value is between -32768 and 32767.
STICK_XBOX_RIGHT_THUMB_X - Right thumbstick x-axis value. The value is between -32768 and 32767.
STICK_XBOX_RIGHT_THUMB_Y - Right thumbstick y-axis value. The value is between -32768 and 32767.
STICK_XBOX_LEFT_TRIGGER - The current value of the left trigger analog control. The value is between 0 and 255.
STICK_XBOX_RIGHT_TRIGGER - The current value of the right trigger analog control. The value is between 0 and 255.
STICK_VR_STATUS - Returns 1 if an Oculus Rift controller is active. Returns 2 if an HTC Vive controller is active. Returns 0 if the controller is inactive. Returns nullvar if the controller is not attached.
STICK_VR_THUMB_X - Thumbstick or trackpad x-axis value between -1 and 1.
STICK_VR_THUMB_Y - Thumbstick or trackpad y-axis value between -1 and 1.
STICK_VR_INDEX_TRIGGER - Index trigger value between 0 and 1.
STICK_VR_GRIP_TRIGGER - Grip trigger value between 0 and 1. On HTC Vive, grip button is pressed.
STICK_VR_BUTTON_1 - The first button is pressed. A or X on Oculus Rift. Unused on HTC Vive.
STICK_VR_BUTTON_2 - The second button is pressed. B or Y on Oculus Rift. Unused on HTC Vive.
STICK_VR_BUTTON_3 - The third button is pressed. Enter or Home on Oculus Rift. Menu on HTC Vive.
STICK_VR_BUTTON_4 - The fourth button is pressed. Thumbstick on Oculus Rift. Trackpad on HTC Vive.
STICK_VR_TOUCH_BUTTON_1 - The first button is touched. Unused on HTC Vive.
STICK_VR_TOUCH_BUTTON_2 - The second button is touched. Unused on HTC Vive.
STICK_VR_TOUCH_BUTTON_3 - The third button is touched. Unused on Oculus Rift.
STICK_VR_TOUCH_BUTTON_4 - The fourth button is touched.
STICK_VR_TOUCH_THUMB_REST - The thumb rest sensor is touched on Oculus Rift. Unused on HTC Vive.
STICK_VR_TOUCH_INDEX_TRIGGER - The index trigger sensor is touched.
STICK_VR_TOUCH_POINTING - The hand gesture is pointing on Oculus Rift. Unused on HTC Vive.
STICK_VR_TOUCH_THUMB_UP - The hand gesture is thumbs-up on Oculus Rift. Unused on HTC Vive.
STICK_VR_HAND_POSITION - The controller position in VR space.
STICK_VR_HAND_ROTATION - The controller rotation in VR rotation coordinates.
STICK_VR_HAND_WORLD_POSITION - The controller position in FlexSim world space.
STICK_VR_HAND_WORLD_ROTATION - The controller rotation in FlexSim rotation coordinates.
STICK_VR_HAND_OFFSET_POSITION - The controller's position in FlexSim world space, but with an offset applied based on the controller's rotation. Pass an array as the offset vector in the p parameter. You can use this option to get a point relative to the controller, such as a finger position or where the controller is pointing.
STICK_VR_TARGET_FLOOR_POSITION - The target position on the floor that the controller is pointing towards. Pass a value in the p parameter for the maximum distance away from the controller.
STICK_VR_SET_VIBRATION - Causes the controller to vibrate. On Oculus Rift, pass an array for the p parameter where the first element is a value between 0 and 1 for the frequency and the second element is a value between 0 and 1 for the amplitude. On HTC Vive, pass a duration in microseconds for the p parameter.
STICK_VR_SUBMIT_VIBRATION - Causes the controller to subtly vibrate. On original Oculus Touch controllers, pass an array of amplitudes (0 - 255) for the p parameter to be queued up and executed. Unused on HTC Vive or Oculus Rift S controllers.
Example
stick(1, STICK_JOY_YPOS); This gets the y position of the joystick id 1
Description
For developer use. Bit mask. Disables draw in window types. Bits: 0 - TREE; 1 - PLANAR; 2 - SPATIAL
Example
suspenddraw(1)
Description
For developer use. Add and set; or remove a dynamic switch variable to/from an object. When set to on, a node called var will be added to the structure of object and have a numerical value of 1 assigned to it. When set to off, a node called var, if present will be removed from the structure of object. Used in model update code.
Example
switch_variable(so(),"arrivalmode",1);
Toggles all code nodes under startpoint as either C++ or flexscript
Description
Traverses the tree starting at start point and toggles all code nodes to either c++ or flexscript. 1 toggles to c++, 0 toggles to flexscript. This will only change nodes that have not been locked to their code state. This is the same as using the menu option Build|Make all code C++ or Build|Make all code flexscript.
Example
toggleallcodestates(model(), 1);
Description
For developer use. Set a 32 bit trace mask: Sum of Math.pow(2,N1)+Math.pow(2,N2)... where Nx are the event numbers to be reported in the trace. See View|Trace Debugger...
Example
tracemaskevents(listsum(Math.pow(2,1),Math.pow(2,2),Math.pow(2,3)))
Description
For developer use. Set an object to be included in the event reporting in the trace debugger. See View|Trace Debugger...
Example
tracemaskobject(Model.find("Processor3"))
Description
For developer use. Define a start and end time for event reporting in the trace debugger. See View|Trace Debugger...
Example
tracemasktime(100,200)
Drawing
Commands associated with drawing graphics in the planar, orthographic, or perspective views. Draw commands are designed for use in OnDraw events such as the "Custom Draw Code" field found in an object's Properties window.
Description
This function is used in an OpenGL call sequence. When OpenGL commands are being used to draw a scene, this command will bind the texture loaded into FlexSim with the index textureid. Once bound, a texture will be used to render any polygons drawn subsequently. Texture mapping is the application (or mapping) of an image (or texture) to the surface of a polygon or other graphics primitive.
Example
bindtexture(10)
Use loaded texture with index number 10 for rendering any subsequent polygons
Use loaded texture with index number 10 for rendering any subsequent polygons
Draws text in a 3d view
Description
This command is similar to drawtext(), but can only be used in a 3D view, and its parameter set is stripped down to
provide direct access to the text rendering procedure. Whereas drawtext() does some automatic scaling based on the current object,
as well as some OpenGL state changes, etc., draw3dtext() calls the text drawing procedure directly, so any positioning, scaling,
color settings, etc., should be done with OpenGL commands, i.e. glTranslated(), glScaled(), glColor3d(), etc.
Example
draw3dtext(current.name);
Draws a simple box
Description
Draws a simple box. If glbegin is 1, then it will call glBegin before drawing.
This command is a shortcut way to draw an OpenGL type cube that allows more control over lighting,
coloring, and texturing than the drawcube() command.
Example
drawbox(5,0,0, 2,1,3, 1);
drawcolumn
(num x, num y, num z, num totalsides, num baseradius, num topradius, num height, num rx, num ry, num rz, num red {0-255}, num green {0-255}, num blue {0-255} [, num opacity {0-1}, num textureindex, num textureXrepeat, num textureYrepeat])
Draws a 3D column
Description
A very versatile command that can draw anything with multiple sides and a height such as a square, a pentagon, a pyramid, and even a cylinder (if the total number of sides is large).
Draws a column with its origin (center of base) positioned at x, y, z. The column is then defined by the number of sides, a base radius, a top radius, and a height. The column can be rotated in degrees about each axis with rx, ry, rz. The color is defined by the red, green, blue color components ranging from 0 to 255.
An optional opacity parameter will change the column from clear (0) to opaque (1). If a valid textureindex number is entered, then the associated image will be repeated textureXrepeat and textureYrepeat times on each face of the column.
The location, size and rotation of the column are by default relative to the object it is drawn on. The parameters shown in brackets [ ] must ALL be used or ALL not used. The textureindex is a numeric value that can be learned using the gettextureindex() command or through the Tools | Media Files menu.
Draws a column with its origin (center of base) positioned at x, y, z. The column is then defined by the number of sides, a base radius, a top radius, and a height. The column can be rotated in degrees about each axis with rx, ry, rz. The color is defined by the red, green, blue color components ranging from 0 to 255.
An optional opacity parameter will change the column from clear (0) to opaque (1). If a valid textureindex number is entered, then the associated image will be repeated textureXrepeat and textureYrepeat times on each face of the column.
The location, size and rotation of the column are by default relative to the object it is drawn on. The parameters shown in brackets [ ] must ALL be used or ALL not used. The textureindex is a numeric value that can be learned using the gettextureindex() command or through the Tools | Media Files menu.
Example
drawcolumn(0,0,0, 5 ,4,2, 6 ,0,0,0, 175,175,175, .6, 3, 5,1);
drawcube
(num x, num y, num z, num sx, num sy, num sz, num rx, num ry, num rz, num red {0-255}, num green {0-255}, num blue {0-255} [, num opacity {0-1}, num textureindex, num textureXrepeat, num textureYrepeat])
Draws a 3D cube
Description
Draws a cube with its origin (bottom left corner) positioned at x, y, z. Its length, width, and height is defined by sx, sy, and sz respectively. It can be rotated in degrees about the x, y, and z axis by rx, ry, and rz. The color is defined by the red, green, blue color components ranging from 0 to 255.
An optional opacity parameter will change the cube from clear (0) to opaque (1). If a valid textureindex number is entered, then the associated image will be repeated textureXrepeat and textureYrepeat times on each face of the cube.
The location, size and rotation of the cube are by default relative to the object it is drawn on. The optional parameters shown in brackets [ ] must ALL be used or ALL not used. The textureindex is a numeric value that can be learned using the gettextureindex() command or through the Tools | Media Files menu.
An optional opacity parameter will change the cube from clear (0) to opaque (1). If a valid textureindex number is entered, then the associated image will be repeated textureXrepeat and textureYrepeat times on each face of the cube.
The location, size and rotation of the cube are by default relative to the object it is drawn on. The optional parameters shown in brackets [ ] must ALL be used or ALL not used. The textureindex is a numeric value that can be learned using the gettextureindex() command or through the Tools | Media Files menu.
Example
drawcube(0,0,0, 5,3,2, 0,0,0, 175,175,175, .6, 3, 1,1);
drawcylinder
(num x, num y, num z, num baseradius, num topradius, num height, num rx, num ry, num rz, num red {0-255}, num green {0-255}, num blue {0-255} [, num opacity {0-1}, num textureindex])
Draws a 3D clyinder
Description
This command draws a hollow cylinder with its origin (center of base) positioned at x, y, z. The cylinder's dimensions are defined by a base radius, a top radius and a height. Use the drawdisk() command to cap off the ends of the cylinder. The cylinder can be rotated in degrees about the x, y, and z axis by rx, ry, and rz. The color is defined by the red, green, blue color components ranging from 0 to 255.
An optional opacity parameter will change the cylinder from clear (0) to opaque (1). If a valid textureindex number is entered, then the associated image will be used as texturing around the outside circumference of the cylinder.
The location, size and rotation of the cylinder are by default relative to the object it is drawn on. The optional parameters shown in brackets [ ] must ALL be used or ALL not used. The textureindex is a numeric value that can be learned using the gettextureindex() command or through the Tools | Media Files menu.
An optional opacity parameter will change the cylinder from clear (0) to opaque (1). If a valid textureindex number is entered, then the associated image will be used as texturing around the outside circumference of the cylinder.
The location, size and rotation of the cylinder are by default relative to the object it is drawn on. The optional parameters shown in brackets [ ] must ALL be used or ALL not used. The textureindex is a numeric value that can be learned using the gettextureindex() command or through the Tools | Media Files menu.
Example
drawcylinder(0,0,0, 1,1, 5, 0,0,0, 175,175,175, .6,3);
drawdisk
(num x, num y, num z, num innerradius, num outerradius, num startangle, num sweepangle, num rx, num ry, num rz, num red {0-255}, num green {0-255}, num blue {0-255} [, num opacity {0-1}, num textureindex])
Draw a 3D disk
Description
Draws a flat planar disk with its origin (center of radius) positioned at x, y, z. The disk's dimensions are defined by an inner radius, an outer radius, a start angle, and a sweep angle. A sweep angle of 360 makes a complete circle. An innerradius greater than 0 will create a disk with a hole in the middle of it. The disk can be rotated in degrees about the x, y, and z axis by rx, ry, and rz. The color is defined by the red, green, blue color components ranging from 0 to 255.
An optional opacity parameter will change the disk from clear (0) to opaque (1). If a valid textureindex number is entered, then the associated image will be used as texturing across the face of the disk.
The location, size and rotation of the disk are by default relative to the object it is drawn on. The optional parameters shown in brackets [ ] must ALL be used or ALL not used. The textureindex is a numeric value that can be learned using the gettextureindex() command or through the Tools | Media Files menu.
An optional opacity parameter will change the disk from clear (0) to opaque (1). If a valid textureindex number is entered, then the associated image will be used as texturing across the face of the disk.
The location, size and rotation of the disk are by default relative to the object it is drawn on. The optional parameters shown in brackets [ ] must ALL be used or ALL not used. The textureindex is a numeric value that can be learned using the gettextureindex() command or through the Tools | Media Files menu.
Example
drawdisk(0,0,0, .5,2, 90,270, 0,0,0, 175,175,175, 1,3);
Description
This command can only be used in a 3D view. It draws a texture-mapped text string. This uses the same functionality that draws
the names and stats below objects. If scaled correctly, it draws a very crisp, readable text. Use this in conjunction with setdrawnamefunction()
to customize the data that is shown in the box below objects. Unlike drawtext(), this command's parameter set is much more stripped down, so you
should use gl commands (i.e. fglTranslate(), fglScale(), fglColor(), etc.) to set up the location, size, and render settings before drawing
the text.
Example
Add the following code to an object's Custom Draw Code trigger:
if(!param(2)) {
setdrawnamefunction(80, 15, c, param(1), 1);
} else {
fglTranslate(-40, -15, 0);
drawflattext("Hello World");
}
This will draw the text Hello World in the display box below the objectSpecifies the font to be used with drawtext()
Description
Call before drawtext, to define font to be drawn. After drawtext is called, the font will be reset to default. There are currently 12 font types (numbers 0 through 11).
Example
drawfont(2)
Draws an image
Description
Draws the image at imagepath in the view. The scaling value specifies
how the image will be positioned and scaled.
NO_SCALE (or 0): Draws the image at location x,y with the width and height being based on the size of the image.
SCALE_DOWN: Draws the image centered in the rectangle created by x,y,width,height and scales the image proportionally down to fit if necessary.
SCALE_UP_DOWN: Draws the image centered in the rectangle created by x,y,width, height and scales the image proportionally up or down to fit.
SCALE_INDEPENDENT: Draws the image at x,y with the size of width and height.
NO_SCALE (or 0): Draws the image at location x,y with the width and height being based on the size of the image.
SCALE_DOWN: Draws the image centered in the rectangle created by x,y,width,height and scales the image proportionally down to fit if necessary.
SCALE_UP_DOWN: Draws the image centered in the rectangle created by x,y,width, height and scales the image proportionally up or down to fit.
SCALE_INDEPENDENT: Draws the image at x,y with the size of width and height.
Example
drawimage(c, "buttons\\visible_eye.png", 0, 10, 0, 0, 0);
drawline
(obj view, num x1, num y1, num z1, num x2, num y2, num z2, num red {0-1}, num green {0-1}, num blue {0-1})
Draws a planar line
Description
This command draws a planar line with a starting point of xloc1, yloc1, zloc1, and an ending point of xloc2, yloc2, zloc2. The color is defined by the red, green, blue color components ranging from 0 to 1.
Example
fglDisable(GL_LIGHTING);
drawline(view, 0, 0, 0, 2, 2, 2, 1, 0, 0);
fglEnable(GL_LIGHTING);
This example draws a line from point (0,0,0) to point (2,2,2). The line will be red in color.
drawline(view, 0, 0, 0, 2, 2, 2, 1, 0, 0);
fglEnable(GL_LIGHTING);
This example draws a line from point (0,0,0) to point (2,2,2). The line will be red in color.
Draws a 3D shape
Description
Draws a 3d object with the specified shape and texture indices.
Example
drawtomodelscale(current);
drawobject(view,getshapeindex("fs3d//texturebox.wrl"),gettextureindex("flexsim.bmp"));
Set the drawing scale to that of the model, then draw the texturebox.wrl shape using flexsim.bmp as a texture.
drawobject(view,getshapeindex("fs3d//texturebox.wrl"),gettextureindex("flexsim.bmp"));
Set the drawing scale to that of the model, then draw the texturebox.wrl shape using flexsim.bmp as a texture.
drawpie
(obj view, num x, num y, num z, num x2, num y2, num z2, num startangle, num endangle, num red {0-1}, num green {0-1}, num blue {0-1})
Draws a flat pie shape
Description
Draws a flat pie shape with its origin (center of radius) positioned at the midpoint between [x1,y1,z1] and [x2,y2,z2]. The angles are measured in degrees counterclockwise from the positive x axis. Negative angles are measured clockwise. The pie is filled from the start angle to the endangle counterclockwise. The color is defined by the red, green, blue color components ranging from 0 to 1.
Example
drawpie(view,3,3,0,0,0,0,45,90,0.5,0,0);
drawquad
(obj view, num x1, num y1, num z1, num x2, num y2, num z2, num x3, num y3, num z3, num x4, num y4, num z4, num red {0-1}, num green {0-1}, num blue {0-1})
Draws a planar quadrilateral
Description
This command draws a planar quadrilateral with vertices defined by x1, y1, z1, x2, y2, z2, x3, y3, z3, x4, y4, and z4. The color is defined by the red, green, blue color components ranging from 0 to 1. The resultant shape and lighting is dependent on the order or sequence in which the vertices are defined. If vertices are all in one plane, consider using drawrectangle() command.
Example
drawquad(view, 0, 0, 1, 0, 0, 0, 2, 2, 2, 4, 5, 6, 1, 0, 0);
This example draws a quadrilateral with vertices defined by the following four points: (0,0,0), (1,0,0), (2,2,2), and (4,5,6). The quadrilateral will be red in color.
This example draws a quadrilateral with vertices defined by the following four points: (0,0,0), (1,0,0), (2,2,2), and (4,5,6). The quadrilateral will be red in color.
drawrect
(obj view, num x1, num y1, num z1, num x2, num y2, num z2, num red {0-1}, num green {0-1}, num blue {0-1})
Draws a planar rectangle
Description
This command draws a planar rectangle with opposite corners defined by x1, y1, z1, and x2, y2, and z2. Both points must lie in a plane parallel to the xy plane.
The color is defined by the red, green, blue color components ranging from 0 to 1.
This command can be called in a planar, 3D, graph, or panel view. See also drawquad()
Example
drawrect(view, 0,0,.5, 1, 1, .5, 1, 0, 0);
Draws a red rectangle with opposite corners (0,0,.5) and (1,1,.5).
Draws a red rectangle with opposite corners (0,0,.5) and (1,1,.5).
drawrectangle
(num x, num y, num z, num length, num width, num rx, num ry, num rz, num red {0-255}, num green {0-255}, num blue {0-255} [, num opacity {0-1}, num textureindex, num textureXrepeat, num textureYrepeat])
Draw a 3D rectangle
Description
Draws a flat planar rectangle with a user-defined location, length, width, rotation, and color. The drawquad() command must be used to draw a rectangle that is not parallel with the x, y or z plane.
An optional opacity parameter will change the rectangle from clear (0) to opaque (1). If a valid textureindex number is entered, then the associated image will be repeated textureXrepeat and textureYrepeat times across the face of the rectangular plane as texturing.
The location, size and rotation of the rectangle are by default relative to the object it is drawn on. The optional parameters shown in brackets [ ] must ALL be used or ALL not used. The textureindex is a numeric value that can be learned using the gettextureindex() command or through the Tools | Media Files menu.
An optional opacity parameter will change the rectangle from clear (0) to opaque (1). If a valid textureindex number is entered, then the associated image will be repeated textureXrepeat and textureYrepeat times across the face of the rectangular plane as texturing.
The location, size and rotation of the rectangle are by default relative to the object it is drawn on. The optional parameters shown in brackets [ ] must ALL be used or ALL not used. The textureindex is a numeric value that can be learned using the gettextureindex() command or through the Tools | Media Files menu.
Example
drawrectangle(0,0,0, 2,3, 0,0,0, 175,175,175, .6, 1, 2,3);
In OnDraw: draw shadow volume
Description
In OnDraw: draw shadow volume
Example
drawshadow(1);
drawsphere
(num x, num y, num z, num radius, num red {0-255}, num green {0-255}, num blue {0-255} [, num opacity {0-1}, num textureindex])
Draw a 3D sphere
Description
Draws a hollow sphere with its origin (center of sphere) positioned at x, y, z. The sphere's dimensions are defined by a single radius. The color is defined by the red, green, blue color components ranging from 0 to 255.
An optional opacity parameter will change the sphere from clear (0) to opaque (1). If a valid textureindex number is entered, then the associated image will be wrapped over the surface of the sphere as a texture.
The location, size and rotation of the sphere are by default relative to the object it is drawn on. The optional parameters shown in brackets [ ] must ALL be used or ALL not used. The textureindex is a numeric value that can be learned using the gettextureindex() command or through the Tools | Media Files menu.
An optional opacity parameter will change the sphere from clear (0) to opaque (1). If a valid textureindex number is entered, then the associated image will be wrapped over the surface of the sphere as a texture.
The location, size and rotation of the sphere are by default relative to the object it is drawn on. The optional parameters shown in brackets [ ] must ALL be used or ALL not used. The textureindex is a numeric value that can be learned using the gettextureindex() command or through the Tools | Media Files menu.
Example
drawsphere(0,0,0,5,175,175,175,1,3);
drawtext
(obj view, str text, num x, num y, num z [, num width, num height, num thickness, num rx, num ry, num rz, num red {0-1}, num green {0-1}, num blue {0-1} , num opacity {0-1}, num flags])
Draws text
Description
This command draws text at a location defined by x, y, and z.
The width parameter is not used. The text width and height is determined by the height parameter.
The rotation is defined by rx, ry, and rz. The color is defined by the red, green, blue color components ranging from 0 to 1. You can
define the flags parameter as follows: 0x1 = bold, 0x2 = italic, 0x4 = underline. The flags parameter only applies to non-3d views
The opacity if used should be a number ranging between 0 (full transparency) to 1 (opaque).
Call drawfont() command to change font type before calling drawtext() if desired.
This command can be used in a planar, 3D, graph or panel view.
Example
drawtext(view, "Hello", 0,0,0, 0,.3,.1, 90,0,0, 1,0,0, .8);
This example draws "Hello" at location (0,0,0) with size 0.3, thickness 0.1, rotation (90,0,0), an rgb color (1,0,0), and opacity of 0.8.
This example draws "Hello" at location (0,0,0) with size 0.3, thickness 0.1, rotation (90,0,0), an rgb color (1,0,0), and opacity of 0.8.
Gets the current drawing scale of the model
Description
Returns the current drawing scale to that of the model after a previous call of drawtoobjectscale(). This is equivalent to the following OpenGL function:
glScalef(1/object.location.x,1/object.location.y,1/object.location.z);
glScalef(1/object.location.x,1/object.location.y,1/object.location.z);
Example
drawtomodelscale(current);
Scale subsequent draw commands to the size of the object
Description
This command causes all subsequent draw commands to be scaled according to the size of the object. This is equivalent to the following OpenGL function:
glScalef(object.location.x,object.location.y,object.location.z);
By default, the scale is originally set to that of the object.
glScalef(object.location.x,object.location.y,object.location.z);
By default, the scale is originally set to that of the object.
Example
drawtoobjectscale(current);
drawtriangle
(obj view, num x1, num y1, num z1, num x2, num y2, num z2, num x3, num y3, num z3, num red {0-1}, num green {0-1}, num blue {0-1})
Draws a planar triangle
Description
This command draws a planar triangle with vertices defined by xloc1, yloc1, zloc1, xloc2, yloc2, zloc2, xloc3, yloc3, and zloc3. The color is defined by the red, green, blue color components ranging from 0 to 1.
Example
drawtriangle(view, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0);
This example draws a triangle with vertices defined by the following three points: (0,0,0), (1,0,0), and (0,1,0). The triangle will be red in color.
This example draws a triangle with vertices defined by the following three points: (0,0,0), (1,0,0), and (0,1,0). The triangle will be red in color.
Sets the color for drawing a mesh in OpenGL
Description
Sets the color for drawing a mesh in OpenGL. The rgb color components are between 0 and 1. The optional alpha component is between 0 (transparent) and 1 (opaque).
Example
Disables an OpenGL draw setting
Description
Disables an OpenGL draw setting. See glEnable() for list of draw settings.
You can refer to standard OpenGL documentation for more information if needed.
Example
fglDisable(GL_LIGHTING);
Enables an OpenGL draw setting
Description
Enables an OpenGL draw setting.
Note that for optimization purposes, FlexSim's drawing engine does not automatically restore the
enabled/disabled state of a given setting, so it is up to you, if you use this command, to restore
the setting to its default after you have executed your drawing functionality. Failing to restore
a setting to its default will result in weird rendering of other objects in the model.
Common OpenGL draw settings:
GL_LIGHTING
Turns lighting on and off.
Turn it on if polygons do not change color when they turn away from the viewer.
Default: enabled.
GL_CULL_FACE
Turns back-face culling on and off
Turn it off if you want both sides (front and back) of all polygons drawn.
Default: disabled.
GL_TEXTURE_2D
Turns texturing on and off.
Turn it off if a texture is being displayed and you don't want it there.
Default: enabled.
You can refer to standard OpenGL documentation on glEnable() for more information if needed.
Common OpenGL draw settings:
GL_LIGHTING
Turns lighting on and off.
Turn it on if polygons do not change color when they turn away from the viewer.
Default: enabled.
GL_CULL_FACE
Turns back-face culling on and off
Turn it off if you want both sides (front and back) of all polygons drawn.
Default: disabled.
GL_TEXTURE_2D
Turns texturing on and off.
Turn it off if a texture is being displayed and you don't want it there.
Default: enabled.
You can refer to standard OpenGL documentation on glEnable() for more information if needed.
Example
fglEnable(GL_LIGHTING);