Alphabetical Command Reference

$iter (num index)
See User Manual > Miscellaneous Concepts > SQL Queries
Description
See Miscellaneous Concepts > SQL Queries for more information.
Example
a <no parentheses>
Description
This command is used to reference objects during iterations of certain flexscript commands such as forobjectlayerunder() and forobjecttreeunder(). This command does not require parentheses, and can only be used in C++.
Example
See forobjecttreeunder().
acos (num ratio)
Deprecated, use Math.acos()
Description
This command is deprecated. Use Math.acos() instead.

Gets the arccos of an angle in radians.
Example
activateview (obj viewnode)
Description
For developer use. This command makes a GUI window active and visible. It should be used to open a window that is stored in the view tree without creating a copy of the view in the active tree, in order to make direct changes that will be saved in the view tree instead of being deleted when the window is closed. Generally, the command createview() should be used to open GUI windows. Use makeactive() if you want to make an already open view the active, or top, window.
Example
activateview(views.find("standardviews/other/FindReplace"));

This opens the node called FindReplace in the folder called standardviews/other in the view tree.
activedocumentnode ()
Gets the currently active document window
Description
Returns the currently active document window. If the active document window is a tabbed window, it will return the active tab page node.
Example
treenode activedoc = activedocumentnode();
activedocumentview ()
Gets the currently active document window as an HWND
Description
Returns the currently active document window as an HWND. To get the node associated with the window, use activedocumentnode().
Example
treenode activedoc = nodefromwindow(activedocumentview());
activeview ()
Gets the currently active window as an HWND
Description
Returns the currently active window as an HWND. To get the node associated with the window, use nodefromwindow()
Example
treenode viewnode = nodefromwindow(activeview());
add (num value1, num value2)
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.
Example
double sum = add(1,2);
addbundleentry (node datanode[, field1val, field2val, ...])
Adds a new entry to the bundle (base 0)
Description
Adds a new entry to the bundle (base 0). All fields must be added before adding entries. The optional field values will be added to the fields in the given order. Up to 29 field values can be given. For bundles with more fields, use setbundlevalue.
Example
int lastentry = addbundleentry(x, time(), current.subnodes.length);
addbundlefield (node datanode, str fieldname, num type[, num maxstrsize])
Adds a field to the bundle
Description
Adds a field to the bundle with the given field name. Returns the field rank (base 0) of the added field. All fields for a bundle must be added before any entries are added. The type is a bitwise flag that must be one of the following values:

BUNDLE_FIELD_TYPE_DOUBLE : stores a 64-bit double
BUNDLE_FIELD_TYPE_FLOAT : stores a 32-bit float
BUNDLE_FIELD_TYPE_INT : stores a 32-bit integer
BUNDLE_FIELD_TYPE_STR : stores a string. If used, you should also define the maximum string size, which will be the space allocated for each string entry. If maxstrsize is unspecified, the default will be 32 bytes. The field will be able to store strings at least as long as the specified length, and any longer strings will be truncated.
BUNDLE_FIELD_TYPE_VARCHAR: stores a string. This field type does not impose a limit on string length. This field type is recommended if you need variable string lengths, or if strings are frequently repeated.
BUNDLE_FIELD_TYPE_NODEREF : stores a reference to a node
BUNDLE_FIELD_TYPE_BINARY : stores a 1 or 0 as a single bit. Bits are allocated in blocks of 32, so that one binary field requires 32 bits. However, 32 binary fields can share a single block.

You can optionally bitwise combine any of the above values (except BUNDLE_FIELD_TYPE_BINARY) with BUNDLE_FIELD_INDEX_MAP. All values in this type of field will be indexed for quick lookup (O(log n)) using getbundleindexentries().

You can optionally combine BUNDLE_FIELD_TYPE_INT, BUNDLE_FIELD_TYPE_STR, BUNDLE_FIELD_TYPE_VARCHAR, or BUNDLE_FIELD_TYPE_NODEREF with BUNDLE_FIELD_INDEX_HASH. All values in this type of field will be indexed for quick lookup (O(1)) using getbundleindexentries(). This type of field is only recommended for use with bundles that rarely, if ever, change size while the model is running.

You can optionally combine any of the above values (except BUNDLE_FIELD_TYPE_BINARY) with BUNDLE_FIELD_NULLABLE, to allow those fields to contain null values. If a field is nullable, you can pass a null Variant in to setbundlevalue(), and it is possible to get a null Variant from getbundlevalue().
Example
addbundlefield(x, "Object Name", BUNDLE_FIELD_TYPE_STR | BUNDLE_FIELD_NULLABLE, 64);
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(...)
addfullhistorymoverecord (num flowitemid, num time, obj origin, obj destination, num itemtype)
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);
addfullhistorystaterecord (num time, num state, obj object)
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);
addkinematic (node infonode, num x, num y, num z, num targetspeed, num acc, num dec, num startspeed, num endspeed, num starttime, num type )
Adds one kinematic operation to a set of kinematics
Description
Adds one kinematic operation to a set of kinematics. For more information, refer to the user manual documentation on kinematics.
Example
addkinematic(current.labels["kinematics"], 1, 0, 0, 5,0,0, 0,0, time(), KINEMATIC_TRAVEL);
addlabel (obj object, str labelname [, num/str value])
Deprecated, use treenode.LabelName
Description
This command is deprecated. Use treenode.LabelName or treenode.labels.assert() instead.

Adds a label to object.
Example
addsphere (obj object, num x, num y, num z, num radius)
Description
For developer use. Adds a collision sphere with the specified radius to the specified object at location x, y, z relative to the object. TaskExecuters allow users to add collision spheres and draw collision spheres through the object's Parameters window, but commands are needed to add and draw collision spheres to other objects when needed.
Example
addsphere(Processor1, 2, -1.25, .75, 1);
addsystemcontrolleritem (obj systemcontroller, num productid, num linenum, num target, num starttime [, num newcolumn1, num newcolumn2, num newcolumn3, num newcolumn4])
For Dynamo use
Description
For Dynamo use. Adds a new line item to a SystemController's schedule during a model run. Does not actually add a new row to the table. The parameters are the same data that the SystemController's schedule requires. The newcolumn parameters are numbers that could have been added to each row of the SystemController's schedule table.
Example
addsystemcontrolleritem(current.centerObjects[1],0,1,1,0);
addtablecol (str/num/node table [, num column, num datatype])
Deprecated, use Table.addCol()
Description
This command is deprecated. Use Table.addCol(). instead.

Adds a column to a table.
Example
addtablerow (str/num/node table [, num row, num datatype])
Deprecated, use Table.addRow()
Description
This command is deprecated. Use Table.addRow() instead.

Adds a row to a table
Example
addtoeventtypelegend (str name, num parameter, num value, str legendname)
Description
The eventtype legend allows you to associate a string with a given value for a given parameter in that eventtype. Passing a negative number for 'parameter' allows you to add a preceeding string to explain the parameter. If the 'parameter' is negative and the 'value' is -1, then it assumes the number is a pointer to a node and will display the node's path as a string.
Example
addtoeventtypelegend(index,-1,-1,"resource: "); // for p1, display the text "resource: " and display the path for the object
addtoeventtypelegend(index,-2,0,"covermode: "); // for p2, display the text "covermode: "
addtoeventtypelegend(index,2,1,"YellowToGreen"); // for p2, a value of 1 should display "YellowToGreen" instead of the number 1
addtoeventtypelegend(index,2,2,"RedToGreen"); // for p2, a value of 2 should display "RedToGreen" instead of the number 2
addtoeventtypelegend(index,3,0,""); // for p3, this makes zeroes blank
addtoeventtypelegend(index,4,0,""); // for p4, this makes zeroes blank
addviewtext (node view, string text)
Description
For developer use. Add text to the specified window.
Example
addviewtext(sv(),"Hello")
agvaddlistener (obj agv, node listenernode, num flags[, ...])
Description
Adds a listener event on the agv
Example
agvaddlistener(agv, c, AGV_LISTEN_PRE_ARRIVAL);
agvinfo (obj agv, num what[, p1, p2, p3, p4])
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.
Example
agvinfo(agv, AGV_DEST_CP);
agvreassigncp (obj agv, obj controlpoint)
Description
Deprecated, use AGV class.
Reassigns an agv to the specified control point
Example
agvreassigncp(agv, controlpoint);
agvredirect (obj agv, obj object/controlpoint, num mode)
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)
Example
agvredirect(agv, controlpoint, 1);
and (num/node condition1, num/node condition2)
Deprecated, use the && operator
Description
This command is deprecated. Use the && operator instead..
Example
angle (num dx, num dy)
Deprecated, use Math.atan2()
Description
This command is deprecated. Use Math.atan2() instead.

Returns the angle in degrees, rotated clockwise from the positive x axis, of the vector (dx, dy). Calling angle(dx, dy) is the same as calling -Math.degrees(Math.atan2(dy, dx)).
Example
double myangle = angle(distx, disty)
anode (thing)
Deprecated, use tonode()
Description
This command is deprecated. Use tonode() instead.

Assert type as node pointer.
Example
anode(so())
anum (thing)
Deprecated, use tonum()
Description
This command is deprecated. Use tonum() instead.

Assert type as arithmetic number.
Example
anum(so())
apchar (str string)
Asserts string as a char*
Description
Assert type as C style string (e.g. char*). Alias for stringtopchar
Example
apchar("hello")
applicationcommand (str name[, p1, p2, p3, ...])
Description
For developer use. Execute a command based on its name. This command will search for the named node in VIEW:/nodefunctions, then in MAIN:/project/exec/globals/nodefunctions, then in VIEW:/commands, and lastly in the FlexSim Engine. If it finds a toggled node, it will call nodefunction on that node passing in up to 10 number parameters. If it finds an untoggled node, it will call executefsnode() on that node passing in n1 as c, n2 as i, and n3 as eventcode.
Example
applicationcommand("outputconsole");
applyalleditstonodes ([obj view])
Description
For developer use. Applies all view edits. This is done before a compile or save.
Example
applyalleditstonodes
applyeditstonode (obj view, obj editednode)
Description
For developer use. Applies view changes to a node. This is usually only needed for a table view, and is essentially the same as mouse-clicking off of the table's currently active cell. This is the opposite of applytoedits.
Example
applyeditstonode(ownerview(c), current)
applyshapefactors (obj object)
Applies all of the shape factors to object
Description
This command applies all of the shape factors to the object if it has any.
Example
applyshapefactors(item);
applytoedits (obj view, obj editednode)
Description
For developer use. Applies programmatic changes to a node if that node has been selected in a view. This is usually only needed for a table view. This is the opposite of applyeditstonode().
Example
applytoedits(ownerview(c), current)
aptr (thing)
Deprecated, use toptr()
Description
This command is deprecated. Use toptr() instead.

Assert type as pointer
Example
aptr(so())
arraysize (var array)
Deprecated, use array.length
Description
This command is deprecated. Use Array.length instead.

Gets the number of elements in an array.
Example
asciistr (str string [, num index])
Description
This command returns the ascii value of the character at the specified index (0-based) of the string. If index is not specified, the first character of the string is used.
Example
asciistr("fred",1) returns 114, the ascii value of 'r'
asin (num ratio)
Deprecated, use Math.asin()
Description
This command is deprecated. Use Math.asin() instead.

Gets the arcsin of an angle in radians.
Example
assertattribute (obj object, str attributename, num datatype)
Deprecated, use Object.attrs.assert()
Description
This command is deprecated. Use Object.attrs.assert().

Gets a reference to attribute attributename of object, creates the attribute if it does not exist.
Example
assertlabel (obj object, str labelname, num datatype)
Deprecated, use treenode.labels.assert()
Description
This command is deprecated. Use treenode.labels.assert() instead.

Gets a reference to label labelname, creating the label if it does not exist.
Example
assertsubnode (node containernode, str name[, num datatype])
Deprecated, use treenode.subnodes.assert()
Description
This command is deprecated. Use treenode.subnodes.assert() instead.
Example
assertvariable (obj object, str variablename, num datatype)
Gets a reference to variable variablename of object, creates the variable if it does not exist
Description
This command returns a reference to a variable with the given name. If the variable does not exist, one is created with the defined data type.
Example
treenode newvar = assertvariable(Model.find("/Processor1"),"MyVariable", DATATYPE_NUMBER);
atan (num ratio)
Deprecated, use Math.atan()
Description
This command is deprecated. Use Math.atan() instead.

Gets the arctan of an angle in radians.
Example
atan2 (num dy, num dx)
Deprecated, use Math.atan2()
Description
This command is deprecated. Use Math.atan2() instead.

Example
att (obj object, num index)
Deprecated, use getvarnode()
Description
This command is deprecated. Use var(), var_s() or getvarnode() instead.
Example
att(current,1)
att_s (obj object, str name)
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.
Example
att_s(current,"myatt")
autoloadallmedia ([node thenode])
Description
For developer use. This command loads all of the media (images and shapes) required by the current views, library, and model. Images are either .bmp or .jpg graphics files. Shapes are either .3ds or .wrl files. This command may take some time to complete, if there are many images or shapes that need to be loaded. This command is not available in C++.
Example
autoloadallmedia();

This reloads all of the media needed for the current model.
autoloadimages ()
Description
For developer use. This command loads all of the images required by the current views, library, and model. Images are either .bmp or .jpg graphics files. This command may take some time to complete, if there are many images that need to be loaded. This command is not available in C++.
Example
autoloadimages();

This reloads all of the images needed for the current model.
autoloadshapes ()
Description
For developer use. This command loads all 3D shapes required by the current views, library, and model. Shapes are either .3ds or .wrl files. This command may take some time to complete, if there are many shapes that need to be loaded. This command is not available in C++.
Example
autoloadshapes();

This reloads all of the shapes needed for the current model.
autoloadsounds ()
Description
For developer use. This command loads all sounds required by the current views, library, and model as declared by "sound" attributes on the objects. This command may take some time to complete, if there are many sounds that need to be loaded. This command is not available in C++.
Example
autoloadsounds();

This reloads all of the sounds needed for the current model.
avi (int cmd, str filename, num tex, num frame)
Not fully implemented
Description
Not fully implemented yet. Will eventually apply an avi video as a texture of a 3d object.
Example
aviadd (node viewnode)
Description
This command is deprecated. Use the Video Recorder instead.
Example
avifinish (node viewnode)
Description
This command is deprecated. Use the Video Recorder instead.
Example
avistart (str filename, node viewnode, num fps)
Description
This command is deprecated. Use the Video Recorder instead.
Example
backupfile (str filepath)
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");
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.
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);
bcgetitemposition (obj basicconveyor, obj item)
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.
Example
bcgetitemposition(current,current.first);
bcsetdirection (obj basicconveyor, num direction)
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.
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);
}
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.
Example
bcsetitemconveystate(current, item, position, 0, 60, 0);
beginaggregatedundo (obj view, str description)
Description
Begins an aggregated undo record for the specified view. Any undoable commands that are executed between this command and the next endaggregatedundo() command will be encapsulated into a single undoable operation. Returns the id for the created record. See Miscellaneous Concepts > Advanced Undo for more information.
Example
int id = beginaggregatedundo(c.find("@/TheTable"),"Name Change");
beginignoreundo ()
Description
Used in conjunction with beginaggregatedundo() and endaggregatedundo(). Any commands called between beginignoreundo() and endignoreundo() will not be added as undoable commands within the aggregated undo record. See Miscellaneous Concepts > Advanced Undo for more information.
Example
beginignoreundo();
bernoulli (num prob, num succeed-value, num fail-value[, num stream])
Returns one of two possible values, based on the given probability
Description
bernoulli( p, a, b, stream ) is a discrete probability distribution.

Inputs:
p is the probability that a will be returned;  where p∈ ( 0, 100 )
100 −p is the probability that b will be returned.
a∈ ( - ∞, ∞ )
b∈ ( - ∞, ∞ )
stream is a reference to one of FlexSim's random number streams {0,1,2,...}

Outputs:
range = { a , b }
mean = ( ap + b(100−p) ) 100
variance = (p100)(1 −p100) when a=1 and b=0

Possible Applications:
Used to model a random occurrence that has two possible outcomes such as a pass/fail test. It is possible to generate more than two values by nesting bernoulli commands; however, it is better to use empirical distributions in these cases.

Comments:
The bernoulli(p, 1, 0) and binomial(1, p) distributions are the same.
Example
treenode curoperator = current.centerObjects[bernoulli(90,1,2,1)];

The bernoulli command in this example has a 90 percent probability of returning 1 otherwise it will return 2, using random number stream 1. It is used within a centerObject reference such that 90 percent of the time curoperator references the object connected to center port 1 of the current object, otherwise curoperator references the object connected to center port 2.
beta (num min, num max, num shape1, num shape2[, num stream])
Returns a random sample from a beta distribution
Description
beta( a, b, α1, α2, stream ) is a bounded continuous probability distribution.

Inputs:
a is the lower-endpoint parameter ∈ ( - ∞, ∞ )
b is the upper-endpoint parameter( b > a )
α1 is the 1st  shape parameter ( 0, ∞ )
α2 is the 2nd shape parameter ( 0, ∞ )
stream is a reference to one of FlexSim's random number streams {0,1,2,...}

Outputs:
range = ( a , b )
mean = a + α1(ba) (α1 + α2)
variance = α1α2(ba (α1 + α2)²(α1 + α2 + 1)

Probability Density Functions:



Possible Applications:
The beta distribution is often used to model task durations in the absence of real data because it can be definitively bounded between a minimum and maximum value, and it can take on a number of different probability density shapes depending on the two shape parameters used. For most real world task durations, the density shape will have a longer right tail than a left, so if you know the mean μ and the mode (most likely value) m, you can back calculate suitable shape parameters with the following equations:

α1 ≅ ( μa)(2mab) (mμ)(ba)

α2α1(bμ) (μa)

Comments:
The beta( a, b, 1, 1) and uniform( a, b) distributions are the same.
The density is symmetric about (a + b) 2 when α1 = α2.
The density will have a hump and longer right tail when α2 > α1 > 1.
The mean and mode are equal when α1 = α2 > 1.
Example
double ptime = beta(8, 12, 1.3, 3, 5);

The ptime variable is set equal to a beta distribution having a minimum value of 8, a maximum value of 12, and shape factors of 1.3 and 3 for α1 and α2 respectively. FlexSim's random stream number 5 will be used to generate variates from the distribution. The distribution density will have a nice humped curve with a long right tail.
bindtexture (num textureid)
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
binomial (num trials, num prob[, num stream])
Returns a random sample from a binomial distribution
Description
binomial( t, p, stream ) is a discrete probability distribution used to represent the number of successes in t independent Bernoulli trials with probability p of sucess on each trial.

Inputs:
t is the number of independent trials { 1, 2, ..., ∞ }.
p is the probability of success for any given trial (0, 100)
stream is a reference to one of FlexSim's random number streams {0,1,2,...}

Outputs:
range = { 0, 1, 2, ..., t }
mean = tp 100
variance = t ( p 100 )( 1 −p 100 )

Possible Applications:
The binomial distribution is useful for modeling the number of defective parts in a batch of size t, or the actual number of people in random size groups, or maybe the number of items ordered from inventory.

Comments:
The binomial(1, p ) and bernoulli( p, 1, 0 ) distributions are the same.
The binomial( t, p ) distribution is symmetric when p = 50 percent.
Example
int fparts = binomial(item.batchsize, 10, 5);

The number of failed parts will be written to the fparts variable based on a 10% probability that any given part will fail within a batch quantity defined by a label on the flowitem named "batchsize". FlexSim's random stream number 5 will be used to generate variates from the distribution.
bitwiseand (num a, num b)
Deprecated, use & operator
Description
This command is deprecated. Use & operator instead.

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.
bitwisenot (num a)
Deprecated, use ~ operator
Description
This command is deprecated. Use ~ operator instead.

Returns the bitwise not of the 32 bit integer value
Example
int bwn = bitwisenot(0x0);
This example sets bwn to the value 0xffffffff
bitwiseor (num a, num b)
Deprecated, use | operator
Description
This command is deprecated. Use | operator instead.

Returns the bitwise OR of the 32 bit integer values
Example
int bwo = bitwiseor(0x15, 0x01);
This example sets bwo to the value 0x15
bitwisexor (num a, num b)
Deprecated, use ^ operator
Description
This command is deprecated. Use ^ operator instead.

Returns the bitwise XOR of the 32 bit integer values
Example
int bwxo = bitwisexor(0x15, 0x01);
This example sets bwxo to the value 0x14
break
Description
Break out of a loop or the case of a switch statement {}
Example
break;
buildall ()
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.
buildnodeflexscript (node codenode)
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.
c <no parentheses>
Description
This command is used to reference the active node during a function's execution. If the function was called using nodefunction(), c returns a reference to the node on which the function is written. If the function is an event function, c returns a reference to the object that contains the event.
Example
treenode current = ownerobject(c);
calculateconfidence (num stddev, num nrofdatapoints, num confidence)
Description
For developer use. Calculates the confidence interval for the given standard deviation and number of data points. The return value is the distance on one side of the interval from the sample mean. This uses the t distribution to calculate the confidence interval. Confidence values must be either 90, 95, or 99. This is used in the experimenter to calculate the confidence intervals for the mean of performance measures for each scenario.
Example
calculateconfidence(5.82, nrofsamples, 90)
callwebscriptmethod (obj view, str domid, str methodname, int type [, num/str data ...])
Description
Call a method on a DOM element in the HTML document of an HTML view. You must define the type of data of any parameters that are to be passed into the method. The following types are available:
CWSM_DOUBLE
CWSM_STRING
CWSM_NODE
CWSM_BUNDLE
CWSM_BUNDLE_HEADER
CWSM_BUNDLE_DATA
CWSM_JSON
The last parameter passed into the method must be CWSM_END.
When using the CWSM_JSON type, the json string must start with json:. For example, json:{"title":"My Title"}
Example
callwebscriptmethod(view, "chart", "updateData", CWSM_DOUBLE, time(), CWSM_NODE, getvarnode(current, "data"), CWSM_STRING, "My Title", CWSM_END);
This examples calls the method named updateData on the element with id "chart".
case value:
Description
One case in a switch statement {}
Example
case 5: { msg("case statement",""); }
cauchy (num location, num scale[, num stream])
Returns a random sample from a cauchy distribution
Description
Generates a continuous random variate from a cauchy distribution with parameters as defined.
Example
cdir ()
Description
Returns a string of the path to FlexSim's install directory.
Example
string userpath = cdir(); For a standard installation this will return C:\Program Files\Flexsim3\
ceil (num num)
Deprecated, use Math.ceil()
Description
This command is deprecated. Use Math.ceil() instead.

Gets the smallest integral value not less than num.
Example
cell (node table, num col, num row)
Deprecated, use Table.cell()
Description
This command is deprecated. Use Table.cell() instead.
Example
cellrc (obj object, num row, num col)
Deprecated, use Table.cell()
Description
This command is deprecated. Use Table.cell() instead.

Gets a reference to the table's cell.
Example
double val = getnodenum(cellrc(reftable("MyTable"),2,3));
cellrowcolumn (node table, num row, num col)
Deprecated, use Table class
Description
This command is deprecated. Use the Table class instead.
Example
cempirical (str/node/num table[, num stream])
Returns a random sample from a continuous empirical distribution
Description
A continuous empirical distribution with percentages and values defined in the table specified.

Empirical distributions reference tables created by the user that contain a list of values and probability percentages associated with each value. Probability percentages must be entered in column 1 starting with row 1 of the table, and the associated values are entered in column 2. The table may have as many rows as needed to define as many values as desired. The percents are entered as numbers between 0 and 100, and should add up to a total of 100 percent; otherwise any values defined after a cumulative percentage of 100 is reached will never be returned.

There are three commands in FlexSim that can be used to generate random variates from the empirical distributions defined in tables. The three commands are dempirical(), empirical() and cempirical(). The first one is a discrete distribution and will return the explicit values listed in the table. The next two are bounded continuous distributions, meaning they return a continous number within a range. The values in column 2 for the continuous distributions must be in ascending order because they will interpolate values between two adjacent values in the table.

Let's assume we have a table with 4 rows and 2 columns. In column one are the percentages 10, 20, 30 and 40 adding up to 100 percent. In column two are the values 0.1, 0.2, 0.3 and 0.4. Now let's see the differences between the discrete empirical command and the two continuous empirical commands. The discrete command will only generate random variates that match exactly the values that were entered into column two of the table. The continuous commands will generate random variates that are real numbers uniformly distributed between two adjacent numbers in column two of the table. The difference between the two continuous commands is in how the bounds of the uniform ranges are defined.

The command dempirical("mytable") will return the number 0.1 for ten percent of the samples, the number 0.2 for twenty percent of the samples, the number 0.3 for thirty percent of the samples, and the number 0.4 for forty percent of the samples assuming a very large sample set.

The command empirical("mytable") will return a number uniformly distributed between 0.1 and 0.2 for ten percent of the samples, a number uniformly distributed between 0.2 and 0.3 for twenty percent of the samples, a number uniformly distributed between 0.3 and 0.4 for thirty percent of the samples and a number uniformly distributed between 0.4 and 0.4 for forty percent of the samples. If you want the last forty percent to be between 0.4 and 0.5 instead of 0.4, add a 5th row with column one being a value of 0 and column two being 0.5 or the desired upper bound.

The command cempirical("mytable") will return a number uniformly distributed between 0.0 and 0.1 for ten percent of the samples, a number uniformly distributed between 0.1 and 0.2 for twenty percent of the samples, a number uniformly distributed between 0.2 and 0.3 for thirty percent of the samples and a number uniformly distributed between 0.3 and 0.4 for forty percent of the samples. You can define a lower bound for the first ten percent to be a value different than 0.0 by adding a row to the beginning of the table (row 1) where column one is a value of 0 and column two is 0.05 or the desired lower bound.

Here is a summary in tabular form showing the possible return values ("x") for each of the three distribution functions:



Here is an example of adding a "dummy" first row so that cempirical() starts at 0.05 instead of 0.0 (notice that row 1 has a probability of 0 percent):



Here is an example of adding a "dummy" last row so that empirical() has a range between each value including the last (any number can be entered for the percent of the last row because the percents already add up to 100% with the previous row, so it doesn't matter what it is):



When using ExpertFit to determine an empirical distribution that matches your data, you need to be aware that if your data has been defined as integers, then ExpertFit will fit it for use with dempirical(), and if your data has been defined as real numbers, ExpertFit will fit it for use with empirical(). When your data set is composed of real numbers, ExpertFit will show the same percentage for the last value as for the previous to last value, but you'll notice that the percents add up to 100% with the second to last entry.
Example
cempirical("mytable", 5);

Returns a random variate from a continuous empirical distribution defined in a global table named "mytable" using random number stream 5.

cempirical(current.labels["ptime"] 5);

Returns a random variate from a continuous empirical distribution defined in a node table defined on a label named "ptime" of the current object, and using random number stream 5.
centerobject (obj object, num centerportnum)
Deprecated, use Object.centerObjects[]
Description
This command is deprecated. Use Object.centerObjects[] instead.

Reference the object connected to an object's center port.
Example
changeconveyorspeed (obj conveyor, num newspeed )
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.
Example
changeconveyorspeed(current, 4);
This example changes the conveyor's speed to 4.
changedisplay (num width, num height, num depth, num fullscreen, num test)
Change resolution
Description
Change resolution
Example
changedisplay(1024,768,0,0,0)
changepersonvisuals (treenode person, string category, num/string index [, Array color])
Change the person's visuals (Head, Hair, Skin Texture, Clothes)
Description
Change the person's visuals (Head, Hair, Skin Texture, Clothes). This can be done dynamically during the model run.
Example
changepersonvisuals(person, "Shirt", "Scrubs", Color.red)
changetask (obj tasksequence, num taskrank, num type [, obj involved1, obj involved2 , num var1, num var2, num var3, num var4] )
Dynamically change a task in tasksequence
Description
This command is deprecated. Use the TaskSequence and TaskSequence.Task class methods and properties instead. This command lets you change a task dynamically. For example, if you want an operator to travel to object B instead of traveling to object A, but a task has already been created for him to travel to object A, you can use this command to change the task.

The first parameter (tasksequence) specifies the tasksequence containing the task. The second parameter (taskrank) specifies the rank of the task in the tasksequence. All other parameters are the same as for the inserttask command.

This command should only be executed if the task is not the currently active task in the task sequence!
Example
changetask(gettasksequence(current, 0), 4, TASKTYPE_TRAVEL, current.centerObjects[5]);

This example changes the fourth task in the current object's active task sequence to a travel task to travel to the object connected to the 5th center port of the current object.
checkdllconnection (node dllnode, num force)
Returns 1 if the node is properly connected with a dll function
Description
Returns 1 if the node is properly connected with a dll function. Otherwise returns 0. If force is 1, then if the node is not connected, it will attempt to bind it to a dll function, and will return 1 if successful, 0 if not. The node must be toggled as DLL and have proper data specifying the path to the dll and the function name.
Example
if(!checkdllconnection(getvarnode(current, "exittrigger"), 1)) msg("DLL Error","Error connecting to dll.")

This will attempt to connect and object's exit trigger node with a dll function, and will print a message if it is unsuccessful.
checkforexistingview (obj view [, num mode])
Description
For developer use. Checks to see if there are any currently active windows that match this window.
Compares the beginning of each name of each window in the active view node with the beginning of the name of the specified view.
Along with comparing the beginning of the names, this compares each objectfocus as well.
If mode is specified and is not 0, it will compare the viewfocus instead of the objectfocus.
Example
checkforexistingview(c)
classobject (obj object)
Returns the class object of an instance
Description
Returns the class object of an instance.
Example
if(classobject(current) == library().find("?Processor"))
{
pt("Processor1 is an instance of the Processor class.");pr();
}

This prints a message to the output console if current is a Processor.
cleannodeflexscript (node startnode)
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.
clearbundle (node datanode[, num resetflags = 0])
Clears all bundle data
Description
Clears the bundle data associated with datanode. This will clear all entries as well as all fields in the bundle. resetflags is a bitwise mask for flags to initialize the bundle by. Valid values are:
BUNDLE_FLAG_UNPAGED = 0x1 - The bundle's entries will be stored in an unpaged, contiguous block of memory.
BUNDLE_FLAG_IR_OPT = 0x10 - The bundle will use additional memory (32 bits per row) to improve insert/remove performance for rows in the middle of the bundle.
Example
clearbundle(x);
clearconsole ()
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.
clearcontents (node thenode)
Deprecated, use treenode.subnodes.clear()
Description
This command is deprecated. Use treenode.subnodes.clear() instead.

Destroys all of the objects/nodes under the node.
Example
clearfullhistory (int resetuniqueid)
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);
clearglobaltable (str/node/num table)
Deprecated, use Table class
Description
This command is deprecated. Use the Table class instead.
Example
clearundohistory ([obj view])
Description
Deletes all undo records in the undohistory of the specified view. If no view is specified, it will clear the global undo history used by the 3D and tree windows.
Example
clearundohistory(view);
clickcode ()
Description
For developer use. Returns the type of click in a view. Used in the OnClick event.

DOUBLE_CLICK returns 1
LEFT_PRESS returns 2
LEFT_RELEASE returns 3
RIGHT_PRESS returns 4
RIGHT_RELEASE returns 5
Example
if(clickcode()==2)
{
pt("Clicked!!");pr();
}

This prints the statement "Clicked!!" to the output console when the left mouse button is pressed.
clientclose (num socket)
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.
Example
clientclose(1);
clientconnect (num socket, str hostname, num port)
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.
Example
clientconnect(1,"localhost",1880);
clientcreate ()
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.
Example
int socknum = clientcreate();
clientreceive (num socket, str buffer, num buffersize, num noblock[1/0])
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);
clientsend (num socket, str message[, num charlength])
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");
closeallip (obj object)
Close all input ports of object
Description
Close all input ports of object. Closing all input ports of an object will block entry to the object. Modelers should only use this command when working with fluid objects because the internal behavior of discrete objects controls the opening and closing of their ports, and therefore this command may be overridden. For discrete objects the modeler is referred to closeinput() and stopinput().
Example
closeallip(current)
closeallop (obj object)
Close all output ports of object
Description
Close all output ports of object. Closing all output ports of an object will block the exit of that object. Modelers should only use this command when working with fluid objects because the internal behavior of discrete objects controls the opening and closing of their ports, and therefore this command may be overridden. For discrete objects the modeler is referred to closeoutput() and stopoutput().
Example
closeallop(current)
closeinput (obj object)
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().
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.
closeip (obj object, num inputportnum)
Close one input port of object
Description
Close just inputportnum of object. Closing an input port of an object will block entry to the object through that port. Modelers should only use this command when working with fluid objects because the internal behavior of discrete objects controls the opening and closing of their ports, and therefore this command may be overridden. For discrete objects the modeler is referred to closeinput() and stopinput().
Example
closeip(current,1)
closenodeedge (obj object, num edgenum)
Closes entry to the networknode's edge
Description
Closes entry to the networknode's specified edge number.
The edge's color will turn orange indicating it is closed.
Open or close status of an edge will only be checked by a traveler
when traveling from one node to the next (not when entering a node from an offset)
Example
closenodeedge(current.centerObjects[1], 3);
closeop (obj object, num outputportnum)
Close one output port of object
Description
Close just outputportnum of object. Closing an output port of an object will block the exit from the object through that port. Modelers should only use this command when working with fluid objects because the internal behavior of discrete objects controls the opening and closing of their ports, and therefore this command may be overridden. For discrete objects the modeler is referred to closeoutput() and stopoutput().
Example
closeop(current,1)
closeoutput (obj object)
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().
Example
if (current.subnodes.length == current.mincontent)
closeoutput(current);

This blocks the output ports of current, if current has too few objects inside it.
closeview (node viewnode)
Description
For developer use. This command closes the view specified as viewnode. If viewnode is not a viewwindow or GUI, this command does nothing. The view is not removed from the active views folder, however. Use destroyobject() to remove it.
Example
treenode activewindows = views().find("active");
while (activewindows.subnodes.length != 0)
{
closeview(activewindows.first);
}

This closes all of the windows that are in the active node of the views tree. This will generally close all of the windows that are currently open.
cm (num centimeters)
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)
cmdcompile ()
Description
For developer use.

Compile the project.
Example
cmdcompile()
cmddelete (node thenode)
Description
For developer use. Use destroyobject().

Delete thenode.
Example
cmddelete(model().subnodes[4]))
cmdexit ()
Description
For developer use.

Closes FlexSim.
Example
cmdexit()
cmdloadbyextension (str filename, num silent)
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.
Example
cmdloadbyextension("c:/mysession.fss",0)
cmdloadsession (str filename)
Description
For developer use.

Load a session by name.
Example
cmdloadsession("c:/mysession.fss")
cmdloadtree (obj desttree, str filename [, num nobuild])
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.
Example
cmdloadtree(node("MAIN:/project/model/2"),"c:/mytree.t"))
cmdnew ()
Description
For developer use.

Start a new model. This command will clear the contents of the model by deleting all objects in the model.
Example
cmdnew()
cmdopen ()
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.
Example
cmdopen()
cmdsaveas ()
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.
Example
cmdsaveas()
cmdsavesession (str filename)
Description
For developer use.

Save a session by name.
Example
cmdsavesession("c:/mysession.fss")
cmdsavetree (obj tree, str filename)
Save a Tree by name
Description
Save a Tree by name
Example
cmdsavetree(node("MAIN:/project/library/1"),"c:\\mytree.t"))
codetotemplate (obj code, obj edit)
Description
For developer use.

Converts C++/Flexscript code into template code and sets the view text of edit to the template code. The code parameter should reference a node that contains text with C++/Flexscript code on it. This is used in a picklist's template code drop-down to create template code from the actual C++/Flexscript code.
Example
codetotemplate(so(),sv())
codetotemplatetext (node codeobject, node toobjecttext [, num firstcommentonly])
Description
For developer use. Converts C++/Flexscript code into template code. Sets the text in toobjecttext to the template code of the code found in codeobject's text
Example
coloraqua (obj object)
Deprecated, use the Color class
Description
This command is deprecated. Instead set Object.color to Color.aqua instead.

Sets the color of object to aqua.
Example
colorarray (obj object, num colornumber)
Deprecated, use the Color class
Description
This command is deprecated. Instead set Object.color to Color.byNumber() instead.

Sets the color of object based on a color index.
Example
colorblack (obj object)
Deprecated, use the Color class
Description
This command is deprecated. Instead set Object.color to Color.black instead.

Sets an object's color to black.
Example
colorblue (obj object)
Deprecated, use the Color class
Description
This command is deprecated. Instead set Object.color to Color.blue instead.

Sets the color of object to blue.
Example
colorbrown (obj object)
Deprecated, use the Color class
Description
This command is deprecated. Instead set Object.color to Color.brown instead.

Sets the color of object to brown.
Example
colorgray (obj object)
Deprecated, use the Color class
Description
This command is deprecated. Instead set Object.color to Color.gray instead.

Sets the color of object to gray.
Example
colorgreen (obj object)
Deprecated, use the Color class
Description
This command is deprecated. Instead set Object.color to Color.green instead.

Sets the color of object to green.
Example
colorlightblue (obj object)
Deprecated, use the Color class
Description
This command is deprecated. Instead set Object.color to Color.lightBlue instead.

Sets the color of object to lightblue.
Example
colorlime (obj object)
Deprecated, use the Color class
Description
This command is deprecated. Instead set Object.color to Color.lime instead.

Sets the color of object to lime.
Example
colororange (obj object)
Deprecated, use the Color class
Description
This command is deprecated. Instead set Object.color to Color.orange instead.

Sets the color of object to orange.
Example
colorpink (obj object)
Deprecated, use the Color class
Description
This command is deprecated. Instead set Object.color to Color.pink instead.

Sets the color of object to pink.
Example
colorpurple (obj object)
Deprecated, use the Color class
Description
This command is deprecated. Instead set Object.color to Color.purple instead.

Sets the color of object to purple.
Example
colorrandom (obj object)
Deprecated, use the Color class
Description
This command is deprecated. Instead set Object.color to Color.random() instead.

Sets the color of object to a random color.
Example
colorred (obj object)
Deprecated, use the Color class
Description
This command is deprecated. Instead set Object.color to Color.red instead.

Sets the color of object to red.
Example
colorrgb (obj object, num red, num green, num blue)
Deprecated, use the Color class
Description
This command is deprecated. Instead set Object.color to Color() instead.

Sets the color of an object using red, green and blue components.
Example
colorsilver (obj object)
Deprecated, use the Color class
Description
This command is deprecated. Instead set Object.color to Color.silver instead.

Sets the color of object to silver.
Example
colorteal (obj object)
Deprecated, use the Color class
Description
This command is deprecated. Instead set Object.color to Color.teal instead.

Sets the color of object to teal.
Example
colorwhite (obj object)
Deprecated, use the Color class
Description
This command is deprecated. Instead set Object.color to Color.white instead.

Sets the color of object to white.
Example
coloryellow (obj object)
Deprecated, use the Color class
Description
This command is deprecated. Instead set Object.color to Color.yellow instead.

Sets the color of object to yellow.
Example
combocurrentnode (obj combonode)
Description
For developer use. Returns the current node of the specified picklist combobox.
Example
createview(
"VIEW:/standardviews/picklisttemplate","",
combocurrentnode(c.find("../pickoptions").getPath(0, 1)
);
comborefresh (obj combonode)
Description
For developer use. Refreshes a picklist combobox contents.
Example
comborefresh(current);
commandlineparam (str param)
Description
Returns the specified commandline parameter that was passed in if FlexSim is being run from the commandline.
Example
commandlineparam("nrofops");

This example will return the "nrofops" commandline parameter.
If a batch opens FlexSim with the line:
flexsim.exe myfile.fsm -nrofops 8
Then within FlexSim, commandlineparam("nrofops") will return "8". You can use either the unix-style hyphen (-) or the windows-style forward slash (/) to define a command-line parameter
comparetext (str text1, str text2[, int ignorecase])
Deprecated, use == operator
Description
This command is deprecated. Use the == operator instead. myStr == "Hello"

Test for string equality.
Example
comparetrees (obj tree1, obj tree2)
Description
For developer use. Test trees for equality.
Example
comparetrees(node("MAIN:/project/model/1"),node("MAIN:/project/model/2"))
concat (str text1, str text2 [, str text3, ...])
Deprecated, use + operator
Description
This command is deprecated. Use the + operator instead. "a" + "b" + "c"

Concatenates strings together.
Example
connect (obj object1, num port1, obj object2, num port2)
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().
Example
connect(model().subnodes[2],1,model().subnodes[3],2)
consoleexecutefs (HWND input, HWND output)
Description
For developer use.

Execute the console code as Flexscript.
Example
containerentry (obj container, obj item)
Deprecated, use tracked variables or Process Flow
Description
This command is deprecated. Use tracked variables and/or Process Flow to track custom statistics.
Example
containerexit (obj container, obj item)
Deprecated, use tracked variables or Process Flow
Description
This command is deprecated. Use tracked variables and/or Process Flow to track custom statistics.
Example
content (node parent)
Deprecated, use treenode.subnodes.length
Description
This command is deprecated. Use treenode.subnodes.length instead.

Gets the number of child nodes in a parent node.
Example
contentobj (obj container)
Deprected, use Object.attrs.length
Description
This command is deprecated. Use Object.attrs.length instead.

Gets the content of the object's attribute sub-tree.
Example
contentunder (node thenode [, num objectsonly)
Description
This command returns the number of nodes in the tree that are inside the node specified as thenode plus the number of nodes that may be contained in any sub-trees that begin at that layer. If thenode does not contain any other nodes, this command returns 0. If objectsonly is not specified or 0, any node in the FlexSim tree can be passed as thenode. If objectsonly is not 0, any node passed in as thenode that isn't an object will return 0.
Example
if (contentunder(current) >= getvarnum(current,"maxcontent"))
{
current.input.close;
}

This closes the inputs of current if the number of objects contained under current is greater than or equal to the variable called maxcontent of the object referenced by thisobjectdata.
contextdragconnection (obj fromobject, obj toobject, str/num characterpressed)
Creates an A or S connection between objects
Description
This command mimicks holding the specified letter down on the keyboard, clicking on the fromobject and then dragging to the toobject with the mouse.
Whatever context sensitive action takes place when using the actual keyboard and mouse combinations, will occur when this command is executed.
This command can be used in both Flexscript and C++.
Example
contextdragconnection(model().subnodes[5], model().subnodes3], "A");
continue
Description
Continues immediately to the next iteration of a for or while loop without executing any of the remaining code in the current loop.
Example
if(thisloopnotneeded) continue;
continueaggregatedundo (obj view)
Description
Continues the previously-finished aggregated undo record for the specified view. This is used if some other logic created and finished an aggregated undo, but you want it to append any subsequent changes onto the previously finished undo record. See Miscellaneous Concepts > Advanced Undo for more information.
Example
int id = continueaggregatedundo(c.find("@/TheTable"));
controlpressed ()
Description
For devloper use. Test if CTRL key is pressed
Example
controlpressed()
convert (var value, var from, var to)
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.
Example
convert(42308, XL_DATETIME, MODEL_TIME) // converts an Excel date to a valid model time
conveyorgetmotor (obj conveyor)
Description
Deprecated, use Conveyor class.
Example
conveyorgetmotor(conveyor);
conveyorinfo (obj conveyor, num info[, p1, p2, p3, p4, p5])
Description
Deprecated, use Conveyor class.
Example
conveyorinfo(conveyor, CONV_INFO_ESTIMATE_CONVEY_TIME);
conveyorresumeitem (obj item[, num force])
Description
Deprecated, use Conveyor class.
Example
conveyorresumeitem(item);
conveyorsenditem (obj item, obj dest)
Description
Deprecated, use Conveyor class.
Example
conveyorsenditem(item, outobject(current, 1));
conveyorsetspeed (obj conveyor, num toSpeed)
Description
Deprecated, use Conveyor class.
Example
conveyorsetspeed(conveyor, 1);
conveyorstopitem (obj item)
Description
Deprecated, use Conveyor class.
Example
conveyorstopitem(item);
copyattributes (obj destination, obj source, num mask)
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.
Example
copyattributes(library().subnodes[1],model().subnodes[1],ATTCOPY_SPATIAL | ATTCOPY_VISUAL)
copycolor (obj highlightedobj)
Description
For developer use. Copies the color of the highlighted object to all of the selected objects
Example
copycolor(current)
copylabel (obj highlightedobject, str/obj labelnamenode)
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"))
copylabels (obj highlightedobj[, num mode])
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"))
copyvariable (obj fromobject, obj variablenamenode)
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"))
copyvariables (obj fromobject)
Description
For developer use. Copies all variables from the parameter 1 object to all selected objects in the model.
Example
copyvariables(selectedobject(ownerview(c)))
copyvisuals (obj highlightedobj [, num copyshapefactorsalso])
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)
cos (num angle)
Deprecated, use Math.cos().
Description
This command is deprecated. Use Math.cos() instead.

Gets the cos of an angle in radians.
Example
count ()
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.
cp (obj/str object_or_name)
Description
Returns a reference to an AGV control point
Example
cp("CP547");
cpaddlistener (obj rootObj, str connectionPath, node listenerNode, num flags[, ...])
Description
Adds a listener to events on one or more control points
Example
cpaddlistener(current, "Location > LoadPoints", c, CP_LISTEN_EXIT | CP_LISTEN_AVAILABLE);
cpallocate (obj controlPoint, obj allocator, num force)
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);
cpconnection (obj controlpoint/object, num/str connection, num rank)
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 cp
cpconnection(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.
cpcpno (obj object, num port)
Description
This command returns the center port number that is connected to the specified center port number of object.
Example
int otherport = cpcpno(current,1);

This sets otherport to the number of the port that current's first center port is connected to.
cpdeallocate (obj controlPoint, obj allocator)
Description
Deallocates a control point from the claiming object. If successful returns 1, otherwise 0.
Example
cpdeallocate(controlPoint, current);
cpdistance (obj fromControlPoint, obj toControlPoint)
Description
Returns the agv network distance between two control points
Example
cpdistance(cp1, cp2)
cpisavailable (obj controlpoint)
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)) {
...
}
cpnumconnections (obj controlpoint, num/str connection)
Description
Returns the number of connections a control point has
Example
cpnumconnections(cp, "ForwardTo")
cppgettoken (obj textblock, num tokenindex)
Deprecated, do not use
Description
This command is deprecated. Do not use.
Example
cppsettoken (obj textblock, num tokenindex, str insertiontext)
Deprecated, do not use
Description
This command is deprecated. Do not use.
Example
cptasksequencequeue (obj controlpoint)
Description
Returns a reference to the task sequence queue associated with the control point
Example
treenode tsQueue = cptasksequencequeue(cp);
createcoordinatedtasksequence (obj dispatcher)
Create a new, empty coordinated task sequence
Description
Create a new, empty coordinated task sequence on the specified Dispatcher. Must be followed at some point by dispatchcoordinatedtasksequence.
Example
createcoordinatedtasksequence(current.centerObjects[1]);
createcopy (node thenode, node container [, num samename, num inobject, num cached, num replace])
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.
Example
createcopy(Model.find("Tools/FlowItemBin/7/1"), current)
createcoupling (node container1, node container2)
Creates a pointer coupling inside the two container nodes
Description
Creates a pointer coupling inside the two container nodes
Example
createcoupling(current.labels["items"], item.labels["owner"]);
createdelaytask (obj dispatcher, num delaytime, 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 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);
createemptytasksequence (obj dispatcher, num priority, num preempting)
Creates a new task sequence in the dispatcher's queue and returns a reference to it
Description
This command is deprecated. Use TaskSequence.create() instead. Creates an empty task sequence in the dispatcher's tasksequence queue. Tasks should be added to this task sequence once it is created, using the inserttask command. The task sequence is dispatched with the dispatchtasksequence command. This command returns a pointer to the newly created tasksequence node. The possible values for preempting are:

0 - PREEMPT_NOT
1 - PREEMPT_ONLY
2 - PREEMPT_AND_ABORT_ACTIVE
3 - PREEMPT_AND_ABORT_ALL
Example
createemptytasksequence(current.centerObjects[1], 1, PREEMPT_NOT);
createevent (obj object, num time, num code[, str data, node involved])
Description
For developer use. This command creates an event that will occur sometime in the future in the model's run. The event will be created for the object specified by object. It will occur time seconds from the time that this command is called. If an event needs to occur that the same simulation time that it was created at, time should be 0. When the event occurs, the OnTimerEvent event function of the class of object will be called. This function will be passed code, data, and involved. These values can be accessed in OnTimerEvent as eventcode, eventdata, and i. Generally, eventcode is used to determine what type of event is being created or executed. Eventdata is used as a description of the event for the user's benefit. It is generally not important to the execution of OnTimerEvent. Any objects that are involved in the event, such as a flowitem that is entering or exiting, are passed as involved and are referenced in OnTimerEvent as i. There are predefined values for code that the user should use listed below:

1 - EVENT_OPENINPUTS
2 - EVENT_OPENOUTPUTS
3 - EVENT_PROCESSFINISH
4 - EVENT_CREATEPART
5 - EVENT_DESTROYPRODUCT
6 - EVENT_CONVEYEND
7 - EVENT_BEGINLOADTIME
8 - EVENT_BEGINUNLOADTIME
9 - EVENT_ENDLOADTIME
10 - EVENT_ENDUNLOADTIME
11 - EVENT_ENDDELAYTIME
12 - EVENT_BEGINDOWNTIME
13 - EVENT_ENDDOWNTIME
14 - EVENT_ENDWAITTIME
15 - EVENT_MEETBATCHQTY
16 - EVENT_ENDTRAVELTIME
17 - EVENT_ENDSETUP

If a user wishes to create their own types of events, they should use values for code that are greater than 100. See also eventcode and eventdata.
Example
if (current.subnodes.length >= current.mincontent)
{
createevent(current,5,EVENT_OPENOUTPUTS,"openoutputs",involved);
}

This creates an event that will occur in 5 simulation seconds that will open the output ports of the object specified as current, for the flowitem specified by involved, if the content of current is less than the label called mincontent of the object referenced by current.
createglobaltasksequence (str name, obj dispatcher [, obj dp1, obj dp2, obj dp3, obj dp4, obj dp5])
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().
Example
treenode ts = createglobaltasksequence("GlobalTS", current.centerObjects[1])
dispatchtasksequence(ts)
createinstance (obj class, obj location)
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.
Example
createinstance(library().find("?Source"), model());
This creates an instance of the Source class in the model.
createloadtask (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 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);
createpopup (str viewpath, str objectfocus, str viewfocus, obj relativeto, num x, num y, num sx, num sy)
Creates a new popup window
Description
Similar to the createview command in that it creates a new window. However, FlexSim manages this window so that whenever the user clicks outside of the window, the window will be closed. Code template pop-ups use this command to create a drop-down in which you can edit the template code. The pop-up view must contain a style attribute with the WS_POPUP style. You also specify a view node "relative to" which the popup's location will be set (usually whatever view you're writing code on). Also specify an offset location in pixels from relativeto's top-left corner, and a size of the pop-up.
Example
treenode combobox = c.find("../pickoptions");
createpopup(
     "VIEW:/standardviews/picklisttemplate",
     combobox.find(">pickprimary+").getPath(0,1),
     combocurrentnode(combobox).getPath(0,1),
     combobox,
     0,20,combobox.location.x, 150
);
This code is similar to what is used to create the template code pop-up for many of FlexSim's edit fields.
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
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
Example
createstandardtaskcurrent.centerObjects[1],current.centerObjects[2],current.centerObjects[3],item, 1, PREEMPT_NOT);
createtickevent (obj fluidobject)
Creates a tick event for fluidobject and all objects assigned to that Ticker
Description
Creates a Tick event for the Fluid Object that is passed in and all of the other Fluid Objects that are controlled by the same Ticker. This allows the user to cause fluid material to move at times that are not the Ticker's normal tick times. The user can also pass a specific Ticker as the parameter to this command.
Example
createtickevent(current);
createtoken (obj instanceObject, obj/str activity, int start)
Description
Deprecated. Use Token.create.
Example
treenode token = createtoken(node("Operator1", model()), "Start", 0);
setlabel(token, "type", 1);
releasetoken(token);
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
Example
createtravelloadtask(current.centerObjects[1],current.centerObjects[2],item, 1, PREEMPT_NOT);
createtraveltask (obj taskexecuter, obj destination, 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. 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
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
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
Example
createtravelunloadtask(current.centerObjects[1],current.centerObjects[2],item, 1, PREEMPT_NOT);
createundorecord (obj view, obj object, num undocode[, num p1, num p2, num p3])
Description
Creates an undo record for the specified view. Returns the uniqueid for the created record.

Undo codes:
UNDO_AGGREGATED 1
UNDO_MOVE_SIZE_ROTATE 2
UNDO_MOVE_SIZE_ROTATE_GROUP 3
UNDO_SELECTION_CHANGE 4
UNDO_CREATE_OBJECT 5
UNDO_DELETE_OBJECT 6
UNDO_CHANGE_DATA 7
UNDO_CHANGE_RANK 8
UNDO_CHANGE_NAME 9
UNDO_MOVE_OBJECT 10
UNDO_DELETE_COUPLING 11
UNDO_AGGREGATED_FIRST_RECORD 12
UNDO_DESTROY_BRANCH 13
UNDO_CHANGE_FLAGS 14
UNDO_REPLACE_OBJECT 15
UNDO_CUSTOM 16
UNDO_CALLBACK 17
See Miscellaneous Concepts > Advanced Undo for more information.
Example
int id = createundorecord(ownerobject(c), selectedobject(ownerobject(c)), UNDO_CUSTOM);
createunloadtask (obj dispatcher, 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 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);
createuserlibrary ()
Description
For developer use. This command creates a new user library
Example
createuserlibrary();
createview (str viewpath[, str objectfocus, str viewfocus])
Description
For developer use. This command creates a new GUI window in the active node of the views tree. This window is a copy of the window whose path is given in viewpath. The window will have an object focus of objectfocus and a view focus of viewfocus. Objectfocus and viewfocus are generally the same for most GUI windows. They should be the path of the node that this GUI window is representing.
Example
createview("VIEW:/standardviews/other/FindReplace","MAIN:/project/model/Tools/precision","MAIN:/project/model/Tools/precision");

This creates the Find Replace GUI.
createwaittask (obj taskexecuter, 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 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);
cubemap (int cmd, int FACEa, int FACEb, int FACEc, int FACEd, int FACEe, int FACEf)
Attaches 2D images to vertices of a 3D model
Description
This command can be used to attach 2D images to vertices of a 3D model and the texture image is wallpapered onto the geometry of the 3D model. The six faces can be defined by FACEa, FACEb, FACEc, FACEd, FACEe, and FACEf. We can directly use the number of the reference texture after importing into media files. The parameter cmd will take the following values whenever writing OpenGL call sequences.

1- CUBEMAP_INIT : To initialises the texture if nothing defined earlier
2- CUBEMAP_BEGIN : Enables texture generation and begin map
3- CUBEMAP_END : Disable texture generation and end map
4- CUBEMAP_SHUT : Delete map
Example
cubemap(2, 39,39,39,39,39,39);
current <no parentheses>
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.
currentfile ()
Gets the path to the currently open model
Description
Returns the path of the currently open model.
Example
currentfile();
cursorinfo (obj/num view, num operation, num x/y/z, num pos/move)
Description
For developer use. This command represents a lot of functionality wrapped up into one command. It is a way of getting information regarding the position/state of the mouse for a window control.

view: the associated view, such as an ortho or planar view. This can also be an HWND (stored in a double).

operation: the type of operation you want to do:
    1 - gets x or y positions of the cursor in a planar view
    2 - get orthographic or perspective view coordinates
    3 - get current mouse button state.
             return value:
             0 : no buttons down
             1 : left down
             2 : right down
             3 : right and left down
             4 : double left click
    4 - update the cursor position
    5 - gets x or y positions of the cursor relative to the view
    6 - gets x or y positions of the cursor in screen coordinates
    7 - sets the x or y position of the cursor

xyz: 1(x), 2(y), or 3(z); not used for operation 3. For operation 4, if xyz=1, the cursor position will be updated with objects being drawing, if xyz=2 it will be updated with only the floor drawn.

pos/move: 1(pos) or 2(move); 1 gets absolute mouse position, and 2 gets the change since last update. only used for operations 1-2.

The best way to test this functionality out is just by trial and error. Add an OnMouseMove attribute to the ortho view (make sure you rebind the view's attributes after you've added it: Build|Rebind Object Attributes), then print information to the output console.
Example
cursorinfo(c,2,1,1)
daemonstate (num thing)
Description
For developer use.

Returns the stats of:
1 - clock
2 - flythrough
3 - ticker
Example
daemonstate(1)
dataplot (obj tree, num type, num action, num x, num y, num z)
Description
For developer use. This command lets you create, reset or add data to a histogram, x/y chart, or a data series. The first three parameters define the associated node in the tree as well as the operation to do. The last three parameters, x,y and z, define the appropriate data for the operation. The first parameter should be the main node in the tree that holds the graph/histo data. The second parameter should be either 1, 2, or 3, and defines the type of data that the node holds. 1 means graphx data. For this data type the node contains a list of sub-nodes, and each sub-node contains a number that is a unique point in a data series. 2 means graphxy. For this data type, the node again contains a list of sub-nodes but this time the sub-nodes are paired together as x/y pairs. Nodes ranked 1 and 2 hold the x and y values for one data point, nodes 3 and 4 hold x and y values for the next data point, etc. A type parameter of 3 means histo data. Here the node holds data associated with a histogram. The action parameter should be either 1, 2, or 3, and defines the action that you want to do. 1 means a create operation. This is only needed for histogram type data, as it needs to set up the node's sub-tree structure. To create a histogram plot, pass the minimum value for the histogram as the x parameter, the maximum value of the histogram as the y value, and the number of divisions, or buckets, as the z parameter. An action parameter value of 2 means you want to reset the data. This will clear the content of the node for graphx or graphxy data, and will reset the histogram values for histogram data. An action parameter value of 3 means you want to add a data point. For graphx and histo data, pass the data point as the x parameter. For graphxy data, pass the as the x and y paramters. In summary: Type: 1-graphx/2-graphxy/3-histo.
Action: 1-create (only needed for histo data)/2-reset/3-add point.
Data: x,y are data points [histo create: x=start, y=end, z=nr of divisions].
Example
dataplot(stats_contentgraph(model.find("Processor2")),2,3,8.6,5,0); This adds a point to Processor2's content graph for time 8.6 and content 5. This example is only for demonstration purposes. You should never need to do this since the Processor automatically maintains its content graph.
days (num days)
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.
dbchangetable (str tablename)
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.
dbclose ()
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.
dbexportnode (obj tablenode, num startrow, num startcol, num numrows, num numcols)
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.
Example
dbexportnode(so(),1,1,4,5);
dbexporttable (str tablename, num startrow, num startcol, num numrows, num numcols)
Deprecated. Use Database.Connection
Description
This command is deprecated. Use Database.Connection instead.
Example
dbexportnode("MyTable4",2,2,3,3);
dbgetfieldname (num column)
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.
dbgetmetrics ()
Deprecated. Use Database.Connection
Description
This command is deprecated. Use Database.Connection instead.
Example
dbgetmetrics()
dbgetmode ()
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.
dbgetnumcols ()
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.
dbgetnumrows ()
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.
dbgettablecell (num row, num col)
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.
dbgettablenum (num row, num col)
Deprecated. Use Database.Connection
Description
This command is deprecated. Use Database.Connection instead.
Example
double val = dbgettablenum(2,3);
dbgettablestr (num row, num col)
Deprecated. Use Database.Connection
Description
This command is deprecated. Use Database.Connection instead.
Example
string val = dbgettablenum(2,3);
dbimportnode (obj tablenode, num startrow, num startcol, num numrows, num numcols)
Deprecated. Use Database.Connection
Description
This command is deprecated. Use Database.Connection instead.
Example
dbimportnode(so(),1,1,4,5);
dbimporttable (str tablename, num startrow, num startcol, num numrows, num numcols)
Deprecated. Use Database.Connection
Description
This command is deprecated. Use Database.Connection instead.
Example
dbimportnode("MyTable4",2,2,3,3);
dbopen (str databasename, str command {SQL string or Tablename}, num usetable [, num showlogin])
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.
dbsettablecell (num row, num col, str value)
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.
dbsettablenum (num row, num col, num val)
Deprecated. Use Database.Connection
Description
This command is deprecated. Use Database.Connection instead.
Example
dbsettablenum(2,3,56.5);
dbsettablestr (num row, num col, str val)
Deprecated. Use Database.Connection
Description
This command is deprecated. Use Database.Connection instead.
Example
dbgettablestr(1,1,"John");
dbsqlquery (str query[, num forwardOnlyCursor])
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.
dbusername (str username, str password)
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.
dbviewtable ()
Deprecated. Use Database.Connection
Description
This command is deprecated. Use Database.Connection instead.
Example
dbviewtable();
dbwritechanges ()
Deprecated. Use Database.Connection
Description
This command is deprecated. Use Database.Connection instead.
Example
dbwritechanges()
deactivatekinematics (node kinematicsnode)
Causes kinematics to do nothing when updatekinematics() is called
Description
Causes kinematics to do nothing when updatekinematics() is subsequently called instead of updating the object. Call this in the reset trigger of an object to free the object to move it around in the ortho view.
Example
deactivatekinematics(current.labels["kinLabel"]);
debug ([num operation, num/obj p2, num/obj p3])
Acts like a breakpoint in Flexscript to start debugging
Description
For developer use. This command is used to control the Flexscript step debugger. Calling this command without any parameters will behave as if there is a breakpoint at that line of code.

Operations:
DEBUG_STOP 0
DEBUG_STEP 1
DEBUG_CONTINUE 2
DEBUG_IS_STOPPED 3
DEBUG_GET_LINE_NR 4
DEBUG_DUMP_VARIABLES 5
DEBUG_STOP_SIMULATION 6
DEBUG_REFRESH_BREAK_POINTS 7
DEBUG_ADD_BREAK_POINT 8
DEBUG_DELETE_BREAK_POINT 9
DEBUG_GET_WATCH_VARIABLE 10
DEBUG_ENABLE_CODE_PROFILING 11
DEBUG_PRINT_CODE_PROFILING_INFO 12
DEBUG_RESET_CODE_PROFILING 13
Example
debug();
default :
Description
The default case in a switch statement {}
Example
default: { msg("case statement",""); }
defaultdragconnection (obj fromobject, obj toobject, char characterpressed)
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.
Example
defaultdragconnection(model().subnodes[count], model().subnodes[2], 'A')
degreestoradians (num degrees)
Deprecated, use Math.radians()
Description
This command is deprecated. Use Math.radians() instead.

Convert degrees to radians.
Example
delayednodefunction (node thenode, double timeDelay[, par1, par2, ... par10])
Description
For developer use. This command executes a function that is defined on thenode after a defined delay time. It works the same as the nodefunction() command, except it delays firing the node for the given delay time.
Example
delayednodefunction(current.myFunc, tonum(item));
delayevents (num value)
Description
For developer use. Delay all events in the eventlist. The times of all events in the eventlist will be incremented by value.
Example
delayevents(20)
delayeventsofobject (obj object, num value)
Description
For developer use. Delay events of object. The timed events of object are incremented by value, and the eventlist re-sorted. Value may be positive or negative.
Example
delayeventsofobject(model().subnodes[2],20)
deleteselected ()
Description
For developer use. Deletes all selected objects in the model.
Example
deleteselected()
deletetablecol (str/num/node table, num column)
Deprecated, use Table.deleteCol()
Description
This command is deprecated. Use Table.deleteCol(). instead.

Removes a column from a table.
Example
deletetablerow (str/num/node table, num row)
Deprecated, use Table.deleteRow()
Description
This command is deprecated. Use Table.deleteRow() instead.

Removes a row from a table.
Example
dellabel (obj object, str/num label)
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.
Example
dellabel(current,"MyLabel")
dempirical (str/node/num table[, num stream])
Returns a random sample from a discrete empirical distribution
Description
A discrete empirical distribution.

The table referenced must contain a list of values and probability percentages associated with each of the values. Probability percentages must be entered in column 1 starting with row 1 of the table, and their associated values are entered in column 2. The table may have as many rows as needed to define as many values as desired. The percents are entered as numbers between 0 and 100, and should add up to a total of 100 percent; otherwise any values defined after a cumulative percentage of 100 is reached will never be returned.

A detailed description of the three empirical distributions used in FlexSim and their differences is included with the cempirical() command.
Example
int ptype = dempirical("prodtypes", 5);

Assigns a value to the ptype variable using a discrete empirical distribution defined in a global table named "prodtypes" using random number stream 5.

dempirical(current.labels["route"], 5);

Returns a random variate from a discrete empirical distribution defined in a node table defined on the label named "route" of the current object, and using random number stream 5.
deselectall ()
Description
For developer use. Deselects all objects in the model.
Example
deselectall()
destroyevent (node event)
Description
For developer use. Destroys a particular event from the event list.
Example
destroyevent(node("MAIN:/1/exec/events").last)
destroyeventsofobject (obj object [, num simtime, num code, str data, node involved])
Destroys events associated with object
Description
Destroys events associated with the given object. The first parameter, object, is the only required parameter. Other parameters are optional and provide a filter for choosing which events to destroy, as follows:

time: If greater than or equal to the time that that the command is called, this parameter will filter events by their time. If the event's time is not equal to the time passed in, then the event will not be destroyed. Pass -1 if you don't want this as a filter.

code: If greater than 0, this parameter filters events by their event code. If the event's code is not equal to the code passed in, the event will not be destroyed.

data: If not NULL, this parameter filters events by the data string associated with the event. If the event's data string is not equal to the string passed in, the event will not be destroyed.

involved: If not NULL, this parameter filters events by their involved node or object. If the event's involved node is not equal to the node passed in, the event will not be destroyed.
Example
destroyeventsofobject(model().subnodes[2])
destroymessageevents (obj object, num time, obj fromobj[, num param1, num param2, num param3])
Destroys message events associated with object
Description
Destroys message events associated with the given object.

If no message parameters are included, all message events will be destroyed.
Example
destroymessageevents(current, time(), NULL, 8)
destroyobject (node thenode)
Deprecated, use treenode.destroy()
Description
This command is deprecated. Use treenode.destroy() instead.

Destroys thenode.
Example
diffsign (num value1, num value2)
Deprecated, use Math.sign()
Description
This command is deprecated. Use Math.sign() instead.
Example
dispatchcoordinatedtasksequence (obj tasksequence)
Dispatches the coordinated task sequence
Description
Dispatches the specified coordinated task sequence. Must be called after calling createcoordinatedtasksequence().
Example
dispatchcoordinatedtasksequence(newts);
dispatchtasksequence (obj tasksequence)
Dispatches the task sequence, initiating handling/execution of the task sequence
Description
This command is deprecated. Use TaskSequence.dispatch() instead. Tells the dispatcher/taskexecuter in which the specified task sequence resides to handle that task sequence. Users should create the task sequence using the createemptytasksequence command, then add tasks using the inserttask command, then cause the task sequence to be handled using the dispatchtasksequence command.
Example
dispatchtasksequence(newtasksequence);
distancetotravel (obj traveler, obj destination)
Gets the distance a traveler would need to travel to reach destination
Description
Returns the distance that a traveler (Operator, Transporter, etc) would need to travel in order to reach the given destination. If the object is connected to a network, then it will return the travel distance along the network.
Example
distancetotravel(current.centerObjects[1], current);
distcutoff (num radius)
Sets a globally applied cutoff radius for object drawing
Description
Sets a globally applied cutoff radius (from the viewpoint) for object drawing.
Example
discutoff(10)
distfromviewpoint (obj object, obj view)
How far from the viewpoint object is in the window view
Description
Returns how far from the viewpoint the object specified as object is in the view window specified as view. This value is only meaningful if view is a reference to a Perspective window.
Example
double dist = distfromviewpoint(model().subnodes[2],sv());

This sets dist to the distance from the first object in the model to the viewer's eye.
div (num value1, num value2)
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.
Example
div(10,2)
divide (num value1, num value2)
Deprecated, use the / operator
Description
This command is deprecated. Use / operator instead.

This is an alias for div().
Example
divide(10,2)
documentsdir ()
Gets the full path to the currently active user's FlexSim Projects folder in My Documents
Description
Returns a full path to the currently active user's FlexSim Projects folder in My Documents
Example
documentsdir()
documentusercommands ()
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();
draginfo (num operation[, num val])
Gets or set values related to draggin the mouse
Description
Get or set values related to dragging the mouse.

Operations:
    DRAG_INFO_DX 1 - gets dx
    DRAG_INFO_DY 2 - gets dy
    DRAG_INFO_DZ 3 - gets dz
    DRAG_INFO_MDX 4 - gets mdx
    DRAG_INFO_MDY 5 - gets mdy
    DRAG_INFO_BUTTON_STATE 6 - gets the button state
    DRAG_INFO_SET_DX 7 - sets dx to val
    DRAG_INFO_SET_DY 8 - sets dy to val
    DRAG_INFO_SET_DZ 9 - sets dz to val
    DRAG_INFO_SET_MDX 10 - sets mdx to val
    DRAG_INFO_SET_MDY 11 - sets mdy to val
    DRAG_INFO_SET_BUTTON_STATE 12 - sets the button state to val
Example
double dx = draginfo(DRAG_INFO_DX);
draw3dtext (str text[, num asBitmap])
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);
drawbox (num x, num y, num z, num sx, num sy, num sz, num glbegin)
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.
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.
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.
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.
Example
drawdisk(0,0,0, .5,2, 90,270, 0,0,0, 175,175,175, 1,3);
drawflattext (str text)
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 object
drawfont (num font)
Specifies 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)
drawimage (obj view, str imagepath, num x, num y, num width, num height, num scaling)
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.
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.
drawobject (obj view, num shapeindex, num textureindex[, num animation, treenode shapedata])
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.
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.
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).
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.
Example
drawrectangle(0,0,0, 2,3, 0,0,0, 175,175,175, .6, 1, 2,3);
drawshadow (num phase (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.
Example
drawsphere(0,0,0,5,175,175,175,1,3);
drawspheres (obj object, obj view)
Description
For developer use. Draws the collision spheres assigned to the specified object. TaskExecuters allow users to add collision spheres and draw collision spheres through the object's Parameters window, but commands are needed to add and draw collision spheres to other objects when needed
Example
drawspheres(current,view);
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.
drawtomodelscale (obj object)
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);
Example
drawtomodelscale(current);
drawtoobjectscale (obj object)
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.
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.
dropnodefrom ()
Description
For developer use. Returns the view from which a node was dropped.
Example
dropnodefrom()
dropnodeto ()
Description
For developer use. Returns the view into which a node was dropped.
Example
dropnodeto()
dropuserlibraryobject (obj object [, obj ontoobject, num x, num y, num z, obj ontoview, num viewalreadyset])
Description
For developer use. Drops the specified object as if it were dragged from a user library into the model.
Example
dropuserlibraryobject(node("MAIN:/project/userlibrary/1/1"));
dropx ()
Gets the x position of a drop action
Description
Get the x position of a drop action
Example
dropx()
dropy ()
Gets the y position of a drop action
Description
Get the y position of a drop action
Example
dropy()
dropz ()
Gets the z position of a drop action
Description
Get the z position of a drop action
Example
dropz()
dumpquery (node dumpNode[, num asTable])
Deprecated, use Table.query()
Description
This command is deprecated. Use Table.query() instead.

Dumps the full result table for the last call to query() into a node. If asTable is 1, it will dump the result as table data. If asTable is 0, it will dump it as bundle data.
Example
duniform (num min, num max[, num stream])
Returns random integer between the min and max
Description
duniform( a, b, stream ) is a bounded discrete probability distribution.

Inputs:
a is the lower-endpoint parameter
b is the upper-endpoint parameter
a and b are integer numbers where a < b
ba is the scale parameter
stream is a reference to one of FlexSim's random number streams {0,1,2,...}

Outputs:
range = { a, a+1, ..., b }
mean = ( a + b ) 2
variance = ( (ba + 1)²− 1 ) 12

Possible Applications:
Used to approximate a quantity that is felt to be randomly varying between a and b, but hardly anything else is known.

Comments:
There is an equal probability that an a, or b, or any discrete (integer) number inbetween will be returned.
Example
duniform(1, 6, 3);

Random number stream 3 will be used to generate a random variate from a discrete uniform distribution having a minimum value of 1 and a maximum value of 6. This simulates the roll of a dice.
duplicateselected ()
Description
For developer use. Duplicates all selected objects in the model.
Example
duplicateselected()
dynamicsplineall (node starttree)
Description
For developer use. Un-cache all splines for objects under starttree. Any splines in the model become editable or "unlocked". Spline rendering becomes slower in editable mode. In editable mode, splines can be edited dynamically.
Example
dynamicsplineall(model())
else { }
Description
Used in conjunction with the "if" statement to declare what (if any) code should be executed when the condition for the "if" is false.
Example
if( item.Weight < 100 )
{
     msg("TRUE","");
}
else
{
     msg("FALSE","");
}

This example will display the TRUE message when the value of the item's Weight label is less than 100, and the FALSE message when it is not.
embedfile (num mode, str projectpath, str filepath)
Embeds a file in a node
Description
This command is used to embed a file in a node. mode can take the following values, 1=embed, 2=extract, 3=remove.
Example
empirical (str/node/num table[, num stream])
Description
A continuous empirical distribution.

The table referenced must contain a list of values and probability percentages associated with each of the values. Probability percentages must be entered in column 1 starting with row 1 of the table, and their associated values are entered in column 2. The table may have as many rows as needed to define as many values as desired. The percents are entered as numbers between 0 and 100, and should add up to a total of 100 percent; otherwise any values defined after a cumulative percentage of 100 is reached will never be returned.

A detailed description of the three empirical distributions used in FlexSim and their differences is included with the cempirical() command.
Example
empirical("mytable", 5);

Returns a random variate from a continuous empirical distribution defined in a global table named "mytable" using random number stream 5.

empirical(current.labels["ptime"], 5);

Returns a random variate from a continuous empirical distribution defined in a table defined on a label named "ptime" on the current object using random number stream 5.
emptyfluidobject (obj object)
Sets the contents of the fluid object to 0
Description
Sets the contents of the fluid object to 0.
Example
emptyfluidobject(current);
enablecode (node codenode [, num mode])
Makes the node a code node
Description
If mode is 0, then the node is set to FlexScript unless the node is already a code node and then it leaves the node as is. If mode is non-zero, then it forces a given toggle: 1-FlexScript, 2-C++, 3-DLL.

This command is used in the code edit window to toggle the node as FlexScript or DLL.
Example
enablecode(getvarnode(current, "exittrigger"));
enablefullhistory (num on/off)
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
endaggregatedundo (obj view, num id)
Description
Ends an aggregated undo record for the specified view. Any undoable commands that are executed between this command and the previous beginaggregatedundo() command will be encapsulated into a single undoable operation. Pass the id returned by the beginaggregatedundo() function. See Miscellaneous Concepts > Advanced Undo for more information.
Example
endaggregatedundo(c.find("@/TheTable"),id);
endignoreundo ()
Description
Used in conjunction with beginaggregatedundo() and endaggregatedundo(). Any commands called between beginignoreundo() and endignoreundo() will not be added as undoable commands within the aggregated undo record. See Miscellaneous Concepts > Advanced Undo for more information.
Example
endignoreundo();
endoffile ()
Returns 1 if the end of the currently open file has been reached
Description
Returns 1 if the end of the currently open file has been reached. Used with fileopen()
Example
while(!endoffile()){string nextline = filereadline();}
endreplication (num onlyifexperimenting)
Ends the current experimenter replication
Description
Will end the current experimenter replication. Use this if your experiment's end time is dependent on a certain condition becoming true instead of a set end time. Specify 1 for onlyifexperimenting to make sure that you only stop if you are running the experiment.
Example
if(current.stats.output >= 5000) endreplication(1);
endwaittask (obj taskexecuter)
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.
Example
endwaittask(current.centerObjects[1]);
eq (num/node value1, num/node value2)
Deprecated, use the == operator
Description
This command is deprecated. Use the == operator instead..
Example
erlang (num location, num scale, num shape[, num stream])
Returns a random sample from an erlang distribution
Description
erlang( γ, β, m, stream ) is a non-negative continuous probability distribution.

Inputs:
γ is the location parameter ∈ ( - ∞, ∞ )
β is the scale parameter ( β > 0 )
m is the shape parameter ∈ {1, 2, ... }
stream is a reference to one of FlexSim's random number streams {0,1,2,...}

Outputs:
range = ( γ , ∞ )
mean = γ + mβ
variance = mβ²

Possible Applications:
Used to model the time to complete some task such as assembly, customer service and machine repair.

Comments:
When γ = 0, this distribution is known as the m-Erlang(β) distribution.
The exponential( γ, β ) and erlang( γ, β, 1 ) distributions are the same.
For a positive integer m, the gamma( γ, β, m ) and erlang( γ, β, m ) distributions are the same.
Example
double servicetime = erlang(60, 2, 4, 5);

The servicetime variable is set equal to a erlang distribution with a location parameter of 60, a scale parameter of 2, a shape parameter of 4, using random stream number 5. The mean is 100 + (2*4) = 108.
evaluatepullcriteria (obj fixedresource, obj item, num portnr[, num bypassflags])
Causes the FixedResource object to re-fire its pull requirement
Description
Tells the FixedResource to evaluate its pull requirement for the passed item that is in the object through the input port portnr. This command returns the value returned by the pull requirement field if the item can be pulled. If the item cannot be pulled for any of various reasons (such as closed ports or the item not being released), then this command returns 0. The bypassflags parameter is a bitwise combination of macros that start with BYPASS_ to specify certain criteria to ignore in determining item availability.
Example
evaluatepullcriteria(current, item, 1); // See also Pull Best Item picklist option
eventcode <no parentheses>
Description
For developer use. This command returns the number value that was passed to the createevent() command as code. It is only used in the OnTimerEvent function of the library objects. It is generally used to identify the type of event that is occurring. This command should not have parentheses when it is called. See also createevent() and eventdata.
Example
if (eventcode == EVENT_OPENINPUTS)
thisobjectdata->openinputs();

This calls a method called openinputs() on the object referenced by thisobjectdata if the value EVENT_OPENINPUTS was passed to the createevent() function.
eventdata <no parentheses>
Description
For developer use. This command returns the string value that was passed to the createevent() command as data. It is only used in the OnTimerEvent function of the library objects. Generally, it is used as a description to the user of the type of event that is occurring. It is not generally used in the execution of the OnTimerEvent function, for speed reasons. This command should not have parentheses when it is called. See also createevent() and eventcode.
Example
if (comparetext(eventdata,"openinputs"))
{
thisobjectdata->openinputs();
}

This calls a method called openinputs on the object referenced by thisobjectdata if the string value passed to createevent() is equal to "openinputs".
eventget (num index, num thing)
An event attribute for the event at index
Description
Returns an event attribute at the specified index in MAIN:/project/exec/events.
thing can be:
1 = client
2 = time
3 = code
4 = data
5 = involved
6 = event node
Example
eventget(2,3)
eventlisten (obj object, str eventName, node relayNode[, num flags, par1, par2, ... par10])
Description
This command will create a listening mechanism where whenever the defined event is called on object, relayNode will also be executed. flags is a bitwise mask of one of the following values:
EVENT_PRE_LISTEN: The listening function will be called before theNode is called.
EVENT_LISTEN: (default) The listening function will be called after theNode is called.
EVENT_PERSIST: The listener will persist across model resets.
EVENT_PASS_THROUGH_PARAMS: When theNode is called, the parameters passed into the event will also be "passed through" into the listening node. In this case, par1, par2, etc. are not used.
EVENT_LISTEN_ONCE: The listening mechanism will automatically be removed after the first event firing.
When the listening node is called, if it returns EVENT_STOP_LISTENING, the listener mechanism will be removed and the listening node will no longer be called. The return value is a reference to a node associated with the listening. If this node is later deleted, the listening mechanism will stop.

To get a list of the events that can be listened to on an object, call function_s(object, "enumerateEvents", destNode). The object will dump a table onto destNode that contains information on all the events that can be listened to on the object.

Some events may have "requirements". This means that in order to properly bind to the event, you have to pass additional parameters in. The enumeration table will give information on the number of requirements and their names. When requirements are needed they displace and shift par1, par2, etc. For example, if an event has 2 requirements, these requirements will take up par1 and par2 of the eventlisten() call, and par3 will then become param(1) in relayNode's code.
Example
eventlisten(current, "OnEntry", current.entrylistener);
eventloginfo (num operation, num n1)
Description
For developer use. Returns a string value describing something related to the Event Log.

Operations:
ELI_GET_OBJECTPATH 1 - returns the path of the object at index n1 from the objectpaths array.
ELI_GET_INVOLVEDPATH 2 - returns the path of the object at index n1 from the involvedpaths array.
ELI_GET_OTHERPATH 3 - returns the path of the object at index n1 from the otherpaths array.
ELI_EVENTTYPE_NAME 4 - returns the name of the eventtype at index n1 from the eventtypes array.
ELI_LOGGEDEVENTTYPE_NAME 5 - returns the name of the logged eventtype at index n1 from the loggedeventtypes array.

Other operations relating to the Event Log that return number values can be accessed using the applicationcommand() function:
"seteventlogging" - enables or disables logging for eventtype n1.
"geteventlogging" - returns whether logging is enabled for eventtype n1.
"getobjectpathslistsize" - returns the size of the objectpaths array.
"getinvolvedpathslistsize" - returns the size of the involvedpaths array.
"getotherpathslistsize" - returns the size of the otherpaths array.
"geteventtypeslistsize" - returns the size of the eventtypes array.
"getloggedeventtypeslistsize" - returns the size of the loggedeventtypes array.
"geteventtypecode" - returns the index of the eventtype by name passed as n1.
Example
string objectpath = eventloginfo(ELI_GET_OBJECTPATH,1);
eventqty ()
Gets the number of events currently pending
Description
Returns the number of events currently pending.
Example
eventqty()
excelclose (num save [1/0])
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().
excelcreatesheet (str name)
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");
excelcreateworkbook ()
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.
exceldeleterange (str rangename)
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).
Example
exceldeleterange("MyRange");
exceldeletesheet (str name [, int allowwarning])
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");
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);
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);
excelgetrangeparam (str rangename, num param)
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).
Example
int width = excelgetrangeparam("MyRange",5);
excelgetrangesheet (str rangename)
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).
Example
pt(excelgetrangesheet("MyRange"));
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);
excelimporttable (str/node/num table, num startrow, num startcol, num numrows, num numcols)
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);
excellaunch ([str launchdir])
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.
excelmacro (str macro)
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.
excelmultitableexport ()
Starts the automatic exporting of data from FlexSim tables to Excel
Description
Starts the automatic exporting of data from FlexSim tables to Excel sheets as setup in the Excel Import/Export tool.
Example
excelmultitableexport()
excelmultitableimport ()
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 Excel Import/Export tool.
Example
excelmultitableimport()
excelopen (str workbook)
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.
excelquit ()
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();
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.

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.
excelrangereadnum (str rangename, num row, num column)
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).
Example
excelreadnum("MyRange",5,1)
excelrangereadstr (str rangename, num row, num column [, num rowchar, num colchar])
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).
Example
excelreadstr("MyRange",5,1)
excelrangewrite (treenode source, num row, num col, num flags)
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.
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.
excelrangewritenum (str rangename, num row, num column, num value)
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.
Example
excelwritenum("MyRange",5,1,99.87)
excelrangewritestr (str rangename, num row, num column, str value)
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.
Example
excelwritestr("MyRange",5,1,"My String")
excelread (num row, num col)
Deprecated, use excelreadnum(), excelreadstr() or excelreadcell()
Description
This command is deprecated. Use excelreadnum(), excelreadstr() or excelreadcell() instead.
Example
excelreadcell (num row, num col[, num flags])
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.
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.
excelreadnum (num row, num column [, num rowchar, num colchar])
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)
excelreadstr (num row, num column [, num rowchar, num colchar])
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)
excelsave ([str filename])
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")
excelsetrange (str rangename, num startrow, num startcolumn, num endrow, num endcolumn)
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).
Example
excelsetrange("MyRange",5,5,10,15);
excelsetsheet (str sheetname)
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().
excelupdatepreferences ()
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()
excelversion ()
Gets the version of Microsoft Excel
Description
Returns a string that contains the Excel interface version.
Example
excelversion()
excelwrite (str data, num row, num col)
Deprecated, use excelwritenum() and excelwritestr()
Description
This command is deprecated. Use excelwritenum() and excelwritestr() instead.
Example
excelwritenum (num row, num column, num value [, num rowchar, num colchar])
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)
excelwritestr (num row, num column, str value [, num rowchar, num colchar])
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")
executefsfile (str filename, num direct)
Description
For developer use. Executes Flexscript code in a file. The specified file is loaded and its content is executed. The contents of the file are assumed to be valid Flexscript code. If direct is 0, then FlexSim's program directory will be concatenated onto the front of filename, otherwise filename will remain as it is.
Example
executefsfile("c:/myscript.fs",1)
executefsnode (node thenode, node c[, node i, node/num/str eventdata, int nobuild])
Execute a node as Flexscript
Description
Dynamically execute a node as Flexscript. If the node is not already Flexscript, the nobuild parameter should be 0. Used to parse string data into Flexscript to execute, such as from a global table or label. The c and i parameters can be accessed in the function as c and i. The eventdata parameter can be accessed as eventdata if it is a string or as eventcode (an integer) if it is a number. If eventdata is a node, it can be accessed using tonode(eventdata) in the function.
Example
executefsnode(current.labels["myFunc"],NULL,NULL,NULL,0)

This executes the script on current's myFunc label, passing NULL into the function for c,i,and eventdata.
executestring (str thestring[, node c, node i, obj eventdata])
Executes a string as flexscript
Description
Executes the given string as flexscript. Parameters 2-4 are the same as executefsnode.
Example
executestring("profileevents()");
executesubflow (obj/str processFlow [, obj instanceObject, str startActivity, str finishActivity])
Description
Creates a token in a Process Flow Sub Flow which starts that sub flow. Once the created token hits a Finish activity it will return the value evaluted from the Return Value field.
instanceObject: If the instanceObject is specified then current may be used by the activities in the Sub Flow to get access to the instanceObject. This can be useful when multiple objects execute the same Sub Flow but require object specific data.
If no Start activity is specified, the activities in the Sub Flow will be searched and the first Start activity will be used.
If multiple Finish activities are contained in the Sub Flow, the return value will be evaluated from whichever Finish activity the token enters. However, if internal sub flows cause other tokens to enter a Finish activity, it may be necessary to specify the Finish activity name so the correct return value is evaluated.

NOTE: It is important that the activities used in the Sub Flow do not create delays or wait. If the token is interrupted by a delay or wait, the token will not arrive at the Finish activity when the executesubflow function finishes.
Example
return executesubflow("SubFlow1", processor);
executetablecell (str/node/num table, num row, num column)
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.
Example
exp (num value)
Deprecated, use Math.exp()
Description
This command is deprecated. Use Math.exp() instead.

Returns (e ^ value) where e is 2.7183.
Example
exponential (num location, num scale [, num stream])
Returns a random sample from an exponential distribution
Description
exponential( γ, β, stream) is a non-negative continuous probability distribution.

Inputs:
γ is the location parameter ∈ ( - ∞, ∞ )
β is the scale parameter ( 0, ∞ )
stream is a reference to one of FlexSim's random number streams {0,1,2,...}

Outputs:
range = ( γ, ∞ )
mean = γ + β
variance = β²

Possible Applications:
Often used to model the interarrival times of a continous stream of customers and/or customer orders into a system. It is also a popular distribution for modeling the time between failure of mechanical equipment.

Comments:
Variates less than the mean occur much more frequently than variates greater than the mean.
The exponential distribution is the only continuous distribution with the memoryless property of producing totally independent variates.
If the location parameter (γ) is set to zero, then β becomes the mean, and the distribution's variates will range between zero and infinity.
The exponential( γ, β ) and gamma( γ, β, 1 ) distributions are the same.
Example
exponential(0, 10, 5);

An exponential distribution with a location of 0 and a scale of 10 (mean = 10). FlexSim's random stream number 5 will be used to generate variates from the distribution.
exportdataset (node datatree, str filename, num format[, str wrOption = "w"])
Description
Export tree dataset to .CSV (Comma Separated Value) format.
the format parameter can be:
1 = table
2 = graph
3 = graphxy
This implements the opposite functionality of importdataset(). Refer to importdataset() for more information.
Example
exportdataset(so(),"mydataset.csv",1)
exportfullhistory ([str filename, num scenario, num replication])
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");
exporttable (node exportnode, str filename[, num exportcolumnnames = 0, num exportrownames = 0, str listseparator = 0, str decimalseparator = 0])
Export a table in .CSV format
Description
Export a table in .CSV (Comma Separated Value) format.
Example
exporttable(so(),"mytable.csv",1, 1)

This exports the table designated as so(), including row and column headers.
extremevalue1a (num location, num scale[, num stream])
Returns a random sample from a extremevalue1a distribution
Description
Generates a continuous random variate from a extremevalue1a distribution with parameters as defined.
Example
extremevalue1b (num location, num scale[, num stream])
Returns a random sample from a extremevalue1b distribution
Description
Generates a continuous random variate from a extremevalue1b distribution with parameters as defined.
Example
fabs (num value)
Deprecated, use Math.fabs()
Description
This command is deprecated. Use Math.fabs() instead.

Absolute value of the argument.
Example
factorial (num value)
Deprecated, use Math.factorial()
Description
This command is deprecated. Use Math.factorial() instead.

Factorial of value.
Example
familycreate (obj familycontainer, str name)
Description
This command is deprecated. Use the Group class instead.

Create a new family (a list of nodes used for organizing relational information).
Example
familycreate(item,"family1")
familydelete (obj familycontainer, str name)
Description
This command is deprecated. Use the Group class instead.

Delete a family.
Example
familydelete(item,"family1")
familymember (obj familycontainer, str name, num index)
Description
This command is deprecated. Use the Group class instead.

Returns a pointer to a member of the specified family.
Example
familymember(item,"family1",2)
familymemberadd (obj familycontainer, str name, obj member)
Description
This command is deprecated. Use the Group class instead.

Adds a new family member to the specified familycontainer.
Example
familymemberadd(item,"family1",item.subnodes[1])
familymemberdel (obj familycontainer, str name, obj member)
Description
This command is deprecated. Use the Group class instead.

Removes a family member from the specified familycontainer.
Example
familymemberdel(item,"family1",item.subnodes[2])
familymemberqty (obj familycontainer, str name)
Description
This command is deprecated. Use the Group class instead.

Returns the size of the specified family.
Example
familymemberqty(item,"family1")
fastforward ()
Description
For developer use. Saves off the current runspeed, sets the run speed to max, suspends draw, and then runs to the next stop time. Once the next stop time is reached drawing is resumed and the runspeed is restored.
Example
fastforward()
fastspline (obj spline, num perc [0-1])
Description
For developer use. Get a spline mapping from a cached spline. This command will set the values to be returned by subsequent calls to the splinex(), spliney(), splinez(), splinerx(), splinery(), splinerz(), splinelength(), splineposobject() commands. It will use the precalculated values for the spline object given in spline. The parameter perc is the position along the spline of interest. The precalculated values are evaluated when the fastsplineall() or fastsplineupdate() commands are used.
Example
fastspline(splinestartnode,1)

This activates the spline pointed to splinestartnode at its furthest point (100 percent along the spline).
fastsplineall (obj starttree {model}, num res)
Description
For developer use. Cache all splines at once. The geometry for all splines in the model are evaluated and "locked" in order to accelerate the rendering and evaluation of spline geometry. This command will set the values to be returned by subsequent calls to the splinex(), spliney(), splinez(), splinery(), splinery(), splinery(), splinelength(), splineposobject() commands whenever calling fastspline().
Example
fastsplineall(model(),20)
fastsplineupdate (obj spline, num res)
Description
For developer use. Cache a spline's shape to increase it's speed. The geometry for all splines in the model are re-evaluated and "locked" in order to accelerate the rendering and evaluation of spline geometry. This command will set the values to be returned by subsequent calls to the splinex(), spliney(), splinez(), splinerx(), splinery(), splinerz(), splinelength(), splineposobject() commands whenever calling fastspline().
Example
fastsplineupdate(so(),20)
fglColor (num red {0-1}, num green {0-1}, num blue {0-1}[, num alpha {0-1}])
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
fgldebuglevel (num level [0-3])
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)
fglDisable (num setting)
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);
fglEnable (num setting)
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.
Example
fglEnable(GL_LIGHTING);
fglinfo (num operation, obj view)
Gets information about a 3D view's draw state
Description
This command gives you access to various information about the draw state of a 3d view. Logic/data that is performed/returned is based on the operation parameter, as follows:

FGL_INFO_SHADERTYPE - returns what part of the draw pass is happening, such as rendering the shadow map (SHADERTYPE_RENDER_SHADOWS), blurring the shadow map (SHADERTYPE_BLUR), or rendering the objects to the screen (SHADERTYPE_DEFAULT).

Example
/*do not draw this object when rendering the shadow map*/
if (fglinfo(FGL_INFO_SHADERTYPE, view) == SHADERTYPE_RENDER_SHADOWS)
    return 0;
fglLoadIdentity ()
Description
Loads the identity matrix into the current OpenGL drawing context, or in other words, replaces the current matrix with the identity matrix. A matrix is just a way to specify a whole bunch of n-dimensional transformations in one convenient package. Loading the identity matrix is simply a way of resetting things to the origin, so there's no rotation, translation or scaling. The default position is (0,0,0) and the default orientation is looking down the negative z-axis. You can refer to standard OpenGL documentation for more information if needed.
Example
fglLoadIdentity()
fglMatrixMode (num mode)
Specifies which matrix stack is the target for subsequent matrix operations
Description
Specifies which matrix stack is the target for subsequent matrix operations. A matrix is just a way to specify a whole bunch of n-dimensional transformations in one convenient package. Three values are accepted: GL_MODELVIEW, GL_PROJECTION, and GL_TEXTURE. The initial value is GL_MODELVIEW which is used when moving objects around the scene. You can refer to standard OpenGL documentation for more information if needed.
Example
fglMatrixMode(GL_MODELVIEW);
fglNormal (num x, num y, num z)
Sets the normal vector for shading subsequent vertices in OpenGL
Description
Sets the normal vector for shading subsequent vertices in OpenGL drawing. Polygons will be flat shaded unless normals are applied to them. A normal is a vector that is perpendicular to the polygon and points in the direction the polygon is facing. Remember polygons with vertices defined in a counter-clockwise winding points forward per the "right-hand rule". Polygon shading is based on the angle between the normals and the light source. Normals are applied to each vertex in the same way colors are, but is usually just defined at the start of each polygon definition. When a polygon's normals point directly at the light source, they are brightly shaded; and are darker shaded when the angles are skewed. You can refer to standard OpenGL documentation for more information if needed.
Example
fglNormal(1,0,0);
fglPopMatrix ()
Pops the current OpenGL drawing context from the matrix stack
Description
Pops the current OpenGL drawing context from the matrix stack, or in other words returns to the space on the top of the stack. The OpenGL stack stores the space matrix in a LIFO fashion. You can refer to standard OpenGL documentation for more information if needed.
Example
fglPopMatrix();
fglPushMatrix ()
Pushes the current OpenGL drawing context onto the matrix stack
Description
Pushes the current OpenGL drawing context onto the matrix stack which can later be retrieved with glPopMatrix(). If you are drawing more than one object and you don't want the glTranslated, glRotated or glScaled to affect the next objects, you should use glPushMatrix and glPopMatrix. The OpenGL stack stores the space matrices in a LIFO fashion. You can refer to standard OpenGL documentation for more information if needed.
Example
fglPushMatrix();
fglRotate (num degrees, num x, num y, num z)
Rotates the current OpenGL drawing context by degrees around axis x,y,z
Description
Rotates the current OpenGL drawing context by degrees around an axis defined by the vertex (x,y,z). Anything drawn after a rotation is based on the new rotation of the axes. See glVertex3d for definition of the OpenGL xyz coordinate system. You can refer to standard OpenGL documentation for more information if needed.
Example
fglRotate(90,1,0,0);
fglScale (num x, num y, num z)
Scales the current OpenGL drawing context by x,y,z
Description
Scales the current OpenGL drawing context by the given scale parameters. See glVertex3d for definition of the OpenGL xyz coordinate system. Anything drawn after this command is based on the change in scale of the axes. You can refer to standard OpenGL documentation for more information if needed.
Example
fglScale(2,4,1);
fglTranslate (num x, num y, num z)
Translates the current OpenGL drawing context by x,y,z
Description
Translates the current OpenGL drawing context by the given translation parameters. See glVertex3d for definition of the OpenGL xyz coordinate system. Anything drawn after a translation is based on the new location of the axes. You can refer to standard OpenGL documentation for more information if needed.
Example
fglTranslate(15, 4, 0);
filebrowse (str extension, str description, str startpath)
Opens a file selection dialog
Description
Opens a file selection dialog that allows the user to select the specified file type(s). Different types should be separated by semicolons(;). The dialog's default directory is the path specified. The commands pdir() and cdir() can only be passed as the path parameter in C++.
Example
string filename = filebrowse("*.fsm; *.fsp; *.fsv; *.fss","FlexSim Files",pdir());
fileclose ()
Closes the FlexSim file interface
Description
Closes the FlexSim file interface and saves any data written to the file while it was open.
Example
fileclose()
fileexists (str filepath)
Returns 1 if the file exists, 0 otherwise
Description
Returns 1 if the file exists, otherwise 0.
Example
if(fileexists("C:/myfile.txt"))
{
    fileopen("C:/myfile.txt");
    fpt("Hello World");
    fileclose();
}
fileisreadonly (str filename)
Description
For developer use (Dynamo). Looks for the string "READONLY" in the PROPERTY_COMMENTS of the specified file.
Example
fileisreadonly(pdir() + "\\flexsim.exe")
fileopen (str filename [, str opentype])
Opens the FlexSim file interface
Description
Opens the FlexSim file interface. Returns 1 if successful. Returns 0 if an error is encountered.

Parameter 2 can be "w" for writing, "r" for reading, or "a" for appending. Default is "w". Use the commands fpt(), fpr(), fpf(), etc. to write to the opened text file. Use filereadline() to read a line from the file. Using this command, you can only have one file open at a time. To write to multiple files simultaneously, use the C standard fopen/fclose commands or C++ standard fstream classes in C++ or through a dll.

If in write mode, the contents of the file will be cleared, and the file pointer will be set to the top of the file. The file must be closed to save any data written to the file.
Example
fileopen("C:/myfile.txt", "w");
filereadline ()
Reads a line from the currently open file
Description
Reads a line from the currently open file. Used with fileopen()
Example
string nextline = filereadline();
fillarray (array thearray, num/treenode/string val1[, num/treenode/string val2, ...])
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.
Example
fillwithatts (obj object, num attgroup)
Description
For developer use. Fill an object with attribute from an attribute group.
Example
fillwithatts(so(),1)
findmatch (num nr, num matchexpression[, returnexpression = count, num reverseorder = 0])
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.

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.

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()
findownerobject (node thenode)
Description
Like ownerobject(), this command returns the object node containing thenode. Unlike ownerobject(), this command does not cache the result, but searches in the tree for the "owner" node. For example when a TaskExecuter transfers from one NetworkNode to another on a network path, a coupling node is transferred to the new node to keep track of the TaskExecuter's current node, and findownerobject() is used to get access to the correct "owner" node.
Example
findownerobject(c)
findundorecordbyid (obj view, num id)
Description
Returns the undo record with the specified id for the specified view. See Miscellaneous Concepts > Advanced Undo for more information.
Example
int id = createundorecord(ownerobject(c), selectedobject(ownerobject(c)), UNDO_CUSTOM);
treenode record = findundorecordbyid(ownerobject(c),id);
finishundorecord (obj view, num uniqueid)
Description
Finishes an undo record for the specified view. See Miscellaneous Concepts > Advanced Undo for more information.
Example
finishundorecord(view, getundorecordid(record));
firecreateevent (obj object, num x, num y, num z, num iscopy [, num libraryfunctiononly])
Description
For developer use. Fires the creation event of the specified object. x, y, and z are the rz the object was dropped at.
Example
firevalue of 0 islast(model()),0,0,0, 1);
first (node container)
Deprecated, use treenode.first
Description
This command is deprecated. Use treenode.first instead.

Reference a parent node's first child node.
Example
flipselected (num firstX, num firstY, num secondX, num secondY[, node roottree])
Flip selected objects across an axis
Description
Flip selected objects across the axis defined by the two passed xy points
Example
flipselected(1, 5, 2, 7)

This example flips the selected objects across the axis defined by the points point (1, 5) and (2, 7)
floor (num num)
Deprecated, use Math.floor()
Description
This command is deprecated. Use Math.floor() instead.

Gets the largest integral value not greater than num.
Example
fluidcontent (obj fluidobject)
Gets the current fluid content of fluidobject
Description
Returns the current fluid content of the specified Fluid Object. It is the same as reading the "curcontent" variable on the object. This does not have any meaning if a Discrete object is passed in.
Example
double objcontent = fluidcontent(current.outObjects[1]);
fluidmaxcontent (obj fluidobject)
Gets the max fluid content of fluidobject
Description
Returns the defined maximum fluid content of the specified Fluid Object. It is the same as reading the "maxcontent" variable on the object. This does not have any meaning if a Discrete object is passed in.
Example
double objmaxcontent = fluidmaxcontent(current.outObjects[1]);
flyactive ()
Returns 1 if there is an fly path running, 0 otherwise
Description
Returns 1 if there is a fly path currently being run, 0 otherwise.
Example
flyactive()
flyendnode (node x)
Gets a reference to the node that represents the stopping point for the current fly path
Description
Returns a reference to the node in the tree that represents the stopping point for the current fly path.
Example
Used in the presentation builder GUI.
flypath (obj view, num pathno [, num singlerun])
Description
For developer use. This command begins the predefined flypath numbered pathno in the view designated specified as view. Any view window can be passed as view.
Example
flypath(ownerview(c),1);

This will run flypath number 1 in the view window containing an event's code.
flypathadd (obj view, num pathno)
Description
For developer use. This command adds a flypath to the flypath numbered pathno in the view designated specified as view. Any view window can be passed as view.
Example
flypathadd(ownerview(c),1);

This will add a flypath to flypath number 1 in the view window containing an event's code.
flypathreset (obj view, num pathno)
Description
For developer use. This command clears the points from the flypath numbered pathno in the view specified as view. Once the points have been cleared, a new set of flypath points can be generated.
Example
flypathreset(ownerview(c),1);

This clears the flypath points out of flypath 1 in the view containing an event's code.
flystart (obj view)
Description
For developer use. Start fly mode.
Example
flystart(ownerview(c))
flystop ()
Description
For developer use. This command stops any active flypaths.
Example
flystop();

This causes all flypaths that are currently active to stop moving.
flyto (obj view, num endtime, num x, num y, num z, num rx, num ry, num rz)
Description
For developer use. Fly to the specified viewpoint over time.
Example
flyto(sv(),10000,0,0,20,-50,0,-30);
flyupdate ()
Updates the currently active fly path
Description
Updates the currently active fly path if there is one
Example
fmod (num value1, num value2)
Deprecated, use Math.fmod()
Description
This command is deprecated. Use Math.fmod() instead.

Remainder of value1/value2 as a double.
Example
for (initalstatement; whiletrueexpression ; countstatement)
Description
Perform a number of loops. The initialstatement will be executed once before starting the loop. The whiletrueexpression will be evaluated before executing each loop and the loop will stop as soon as this expression is true. The countstatement is executed at the end of each loop and usually increments a counter. Refer to the help manual under Writing Logic in FlexSim for more information.
Example
for(int i = 1; i <= 5; i++)
{
    msg("for loop","");
}
forobjecthighlightedin (obj view) { }
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.
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.
forobjectlayerunder (node container) { }
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++.
Example
forobjectlayerunder(model())
{
     pt(a.name); pr();
}

This prints to the outputconsole the name of every object in the first level of the model.
forobjectsbefore (node thenode) { }
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++.
Example
forobjectsbefore(model.subnodes[5]))
{
    pt(a.name); pr();
}

This prints to the outputconsole the name of the first 5 objects in the model.
forobjectsbehind (node thenode) { }
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++.
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.
forobjectselectionset (node container) { }
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++.
Example
forobjectselectionset(library()) { pt(a.name); pr(); }

This prints to the outputconsole the name of every object currently selected in the library tree.
forobjecttreeunder (node container) { }
Description
Execute a block of code for each node that is in the tree under the node specified as container, including all sub-trees. To access the node that is currently active in the loop, the "a" command is used. The forobjecttreeunder() command can only be used in flexscript, not C++.
Example
forobjecttreeunder(model())
{
     pt(a.name); pr();
}

This prints to the outputconsole the name of every object in the model, including those inside other objects.
fpc (num value)
Prints an ASCII character to the open file
Description
Prints an ASCII character to the open file. Common values: TAB = 9, LF = 10, CR = 13
Example
fpc(9)
fpd (num value)
Prints an integer value to the open file
Description
Prints an integer value to the open file. Floating point values will be truncated.
Example
fpd(3) prints 3
fpd(3.23) prints 3
fpd(3.954) prints 3
fpd(4) prints 4
fpf (num value)
Prints a floating point value to the open file
Description
Prints a floating point value to the open file.
Example
fpf(1.234)
fpm (num feetperminute)
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)
fpr ()
Prints a return (new line) to the open file
Description
Prints a return (new line) to the open file.
Example
fpr()
fps (num feetpersecond)
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)
fpt (str text)
Prints a string to the open file
Description
Prints a string to the open file.
Example
fpt("Hello")
frac (num value)
Deprecated, use Math.frac()
Description
This command is deprecated. Use Math.frac() instead.

Gets the decimal part of value.
Example
freeoperators (obj taskexecuter, obj involved)
Release all operators connected to taskexecuter that are working on involved
Description
Release all operators connected to the specified dispatcher that are currently working on the involved object. This command should be executed from a trigger when you want to release operator(s) that you have called to a process using the requestoperators command or using a utilize task. The first parameter can be either a dispatcher connected to operator(s) that you want to free, or it can be the operator itself. The second parameter is a key for releasing the appropriate operator(s). If you have called the operator(s) using the requestoperators command, then the second parameter of the freeoperators command should match the third parameter of the requestoperators command. If you have given an operator a utilize task, then the second parameter of the freeoperators command should match the involved1 parameter of the utilize task. You would probably execute this command from a trigger like OnProcessFinish or OnSetupFinish. For more information, refer to the task sequence section of the user manual.
Example
freeoperators(current.centerObjects[1], item);
fscheckall (node startingnode)
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());
ft (num feet)
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)
function_n (obj object, num index [, num param_a,...])
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
Example
function_n(current,1,1,2,3)

Executes the OnReset event function defined on the current object.
function_s (obj object, str name [, num param_a,...])
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.
gamma (num location, num scale, num shape[, num stream])
Returns a random sample from a gamma distribution
Description
gamma( γ, β, α, stream ) is a non-negative continuous probability distribution.

Inputs:
γ is the location parameter ∈ ( - ∞, ∞ )
β is the scale parameter ( β > 0 )
α is the shape parameter ( α > 0 )
stream is a reference to one of FlexSim's random number streams {0,1,2,...}

Outputs:
range = ( γ , ∞ )
mean = γ + αβ
variance = αβ²

Probability Density Functions:



Possible Applications:
Used to model the time to complete some task such as assembly, customer service or machine repair.

Comments:
The exponential( γ, β ) and gamma( γ, β, 1 ) distributions are the same.
For a positive integer m, the gamma( γ, β, m ) and erlang( γ, β, m ) distributions are the same.
Shape values less than 1 are rarely used.
Example
double repairtime = gamma(60, 2, 3.4, 5);

The repairtime variable is set equal to a gamma distribution with a location parameter of 60, a scale parameter of 2, a shape parameter of 4, and using random stream number 5. The mean is 100 + (2*3.4) = 106.8.
ge (num value1, num value2)
Deprecated, use the >= operator
Description
This command is deprecated. Use the >= operator instead.
Example
geometric (num prob[, num stream])
Returns a random sample from a geometric distribution
Description
Generates a discrete random number with a geometric distribution and parameters as specified.
Example
get (node thenode)
Deprecated, use treenode.value
Description
This command is deprecated. Use treenode.value instead.

Gets the value of a node with numeric data.
Example
getactiverole (treenode person)
Description
Return the person's active role
Example
getactiverole(token.Person)
getactivity (node/obj/str token/processFlow [, str activityName])
Description
If the first parameters is a ProcessFlow object you must specify a string for the activity name. To get the current activity of a token, use Token.activity.
Example
treenode activity = getactivity(processFlow, "Delay");
getallocatedfromkey (obj coordtasksequence, num key)
Gets a reference to the object allocated for the allocate task for the given key
Description
Returns a reference to the object that has been allocated for the allocate task specified by the given key.
Example
treenode allocatedobj = getallocatedfromkey(getcoordinatedtasksequence(current.centerObjects[1], 0), mykey);
getanimationvar (obj object, num/str animation, str varName)
Gets the current value of an animation variable
Description
Gets the current value of an animation variable. See setanimationvar() for more information on animation variables.
Example
treenode curItem = getanimationvar(current, "Animation1", "Item1");
getapplicationtitle ()
Description
For developer use. Returns the current application's title as a string.
Example
msg(getapplicationtitle(),"Hello world.");
getbatch (obj/str tokenOrBatch[, obj instanceObject, obj/str/num group])
Description
Gets the batch in a Batch activity by token or Group By value. If a token is passed in as parameter 1, then the instanceObject and group parameters are not used.
Example
treenode batch = getbatch(token);
treenode batch = getbatch("Batch", current, 3);
getbundlefieldname (node datanode, num fieldnr)
Gets the name of the nth ranked field (base 0) in the bundle
Description
Returns the name of the nth ranked field (base 0) in the bundle.
Example
string fieldname = getbundlefieldname(x, 5);
getbundlefieldnr (node datanode, str fieldname)
Gets the rank of the bundle field (base 0)
Description
Returns the rank of the bundle field (base 0). If the bundle field doesn't exist, returns -1.
Example
int index = getbundlefieldnr(x, "Field Name");
getbundlefieldtype (node datanode, num fieldnr)
Gets the data type of the bundle field at rank fieldnr (base 0)
Description
Returns the data type of the bundle field at rank fieldnr (base 0). Available return values are:
BUNDLE_FIELD_TYPE_DOUBLE
BUNDLE_FIELD_TYPE_FLOAT
BUNDLE_FIELD_TYPE_INT
BUNDLE_FIELD_TYPE_STR
BUNDLE_FIELD_TYPE_VARCHAR
BUNDLE_FIELD_TYPE_NODEREF
Example
int type = getbundlefieldtype(x, 5);
getbundleindexentries (node datanode, str/num field, str/num value)
Gets all rows with a matching value in the given field
Description
If this command succeeds, it returns an int or an intarray containing all entries (0-based) that contain the given value for the given field. If it fails, it returns -1. It will fail if the datanode is not a bundle, or if the given field is not an indexed field, or if none of values in the field match the given value. See the addbundlefield command for information on how to make an indexed field.
Example
int entryNr = getbundleindexentries(data, "SKU", "FS2016-BLU");
getbundlenrentries (node datanode)
Gets the total number of entries in the bundle
Description
Returns the total number of entries in the bundle.
Example
int nrentries = getbundlenrentries(x);
getbundlenrfields (node datanode)
Gets the total number of fields in the bundle
Description
Returns the total number of fields in the bundle.
Example
int nrfields = getbundlenrfields(x);
getbundlevalue (node datanode, num entrynr, str/num field)
Gets the value of the defined entry (base 0) and field (base 0) of the bundle
Description
Returns the value of the defined entry (base 0) and field (base 0) of the bundle.
Example
string name = getbundlevalue(x, 5, "Object Name");
getcensus ([obj model/group/location])
Description
Get the number of people in the model, a Location group, or an individual location
Example
int census = getcensus(Group("PodA"));
getchecked (obj window)
Description
For developer use. Returns the checked state of a button.
Example
getchecked(c)
getchildtoken (node parentToken [, int childIndex])
Description
Deprecated. Use Token.children[], or Token.children.length.
Example
treenode childToken = getchildtoken(token, 3);
int numChildren = getchildtoken(token);
getchildtokenrank (node childToken)
Description
Deprecated. Use Token.childRank.
Example
int childRank = getchildtokenrank(token);
getcolorcomponent (obj object, num index)
Deprecated, use the Color class
Description
This command is deprecated. Use Color.r or Color.g or Color.b or Color.a instead.

Gets the rgb color component of object
Example
getcoordinatedtasksequence (obj dispatcher, num tasksequencerank)
Gets a reference to a coordinated task sequence
Description
Returns a reference to the coordinated task sequence that is associated with allocation request with the specified rank in the specified dispatcher's
task sequence queue. If the specified rank is zero, then the command assumes that the dispatcher is actually a TaskExecuter, and it returns
a reference to the coordinated task sequence that it is currently allocated for.
Example
treenode coordtasksequence = getcoordinatedtasksequence(current.centerObjects[1], 5);
getcreationtime (obj object)
Gets the time that a flow item was created
Description
Returns the time that a flowitem was first created.
Example
time() - getcreationtime(item)
getcurrentundorecord (obj view[, int flags = 0x1])
Description
Returns a pointer to the treenode associated with the current undo record in the undohistory of the specified view. This is the record that would be undone first when you perform an undo operation. It is also the most recently created record (potentially deep in the undo aggregation hierarchy) when and aggregated undo operation is being created.

The flags parameter lets you optionally adjust what should be returned. 0x1 means get the top-most record for a move-size-rotate undo. 0x2 indicates get the top-most record in a normal aggregated undo.

See Miscellaneous Concepts > Advanced Undo for more information.
Example
treenode record = getcurrentundorecord(view);
getcurtask (node tasksequence)
Gets the current task number of tasksequence
Description
Returns the current task number of the task sequence
Example
if(getcurtask(ts) > 5)
pt("The operator has finished the first five tasks");
getdashboardcontrol (str id [, node startnode])
Returns a reference to the dashboard control associated with id
Description
Returns a reference to the dashboard control that has the ID value of id. This command will search through all open dashboards until it finds a control with matching ID. Passing in a value for startnode will cause the command to only search through the dashboard containing startnode. Dashboard controls include edit fields, buttons, comboboxes, etc.
Example
treenode accelEdit = getdashboardcontrol("accelEdit", c); //Searches through the current dashboard only
getdatastat (num stat, num/node nrSamples/parentNode, num sampler [, num p1, num p2, num p3])
Description
Calculates and returns a certain statistic of a data set.
stat - Can be one of the following values
STAT_MEAN - calculates the sample mean of the set
STAT_MIN - calculates the minimum value in a defined range of values. p1 is the first element in the range (default is the first element in the set), p2 is the last element in the range (default is the last element in the set), and p3 defines a stride, allowing you to look at every nth value (default 1). If either of p1, p2, or p3 is 0, then it will revert to that value's respective default.
STAT_MAX - calculates the maximum element in a defined range of values. p1, p2 and p3 are the same as for STAT_MIN
STAT_VARIANCE - calculates the unbiased variance of the data set
STAT_STD_DEV - calculates the unbiased standard deviation of the set
STAT_SUM - calculates the sum of the set
STAT_CONF_INTERVAL_HALF_WIDTH - calculates the confidence interval half-width of the set. Pass in p1 to define the desired confidence percentage. FlexSim will return precise values for percentages at 80%, 90%, 95%, 98%, 99%, and 99.8% and for sample sizes at or below 100 degrees of freedom. For percentages not in this set, FlexSim will "clamp" it to the nearest percentage ABOVE the percentage passed in. So if you pass in a 75%, it will return an 80% confidence interval. Since an 80% confidence interval will be a "wider" interval, we clamp up to be "safer" with the wider interval. Confidence intervals above 99.8 will simply return 0 (i.e. not valid). For degrees of freedom above above 100, it will assume 100 degrees of freedom.
nrSamples - defines the number of samples in the set.
Note: parameter 2 as a parentNode is deprecated and you should use the parameter 2 as nrSamples option because it encompasses the other and is more flexible. The following deprecated functionality: getdatastat(STAT_MEAN, myNode, 0, 0, 0, 0) can be represented using the newer option with: getdatastat(STAT_MEAN, myNode.subnodes.length, myNode.subnodes[count].value, 0, 0, 0)
sampler - an expression that gets the nth value in the sample.
Use count for determining which value is to be retrieved. Below are several examples:
For calculating the mean of all values in column 5 of global table GT1:
getdatastat(STAT_MEAN, Table("GT1").numRows, Table("GT1")[count][5])
For calculating the sum of all values in field "Time" of a bundle:
getdatastat(STAT_SUM, Table("MyBundle").numRows, Table("MyBundle")[count]["Time"])
Example
getdatatype (thing)
Deprecated, use treenode.dataType
Description
This command is deprecated. Use treenode.dataType instead.

Gets the datatype of a node
Example
getdatatype(so())
getdirbrowse (str initialdir, str message, node result)
Opens a browser window to pick a directory
Description
Opens a browser window to pick a directory. destnode should have string data, and the directory path will be written to its text.
Example
getdirbrowse(documentsdir, "A folder", destnode)
getdrawtextmetric (str text, num fontsize, num metric[, num a])
Description
Returns information about the text. If metric is 1, it will return the width of the text. If metric is 2, it will return the height of the text. If metric is 3, it will return the max fitting length of the text using 'a' as the max extent.
Example
getdrawtextmetric("Hello",12,1,0);
getedgedist (obj netnode, num edgenum)
Gets the distance of the edge of a network node
Description
Returns the distance of the specified edge of the network node.
Example
getedgedist(current, 1)
getedgespeedlimit (obj netnode, num edgenum)
Gets the speed limit of the edge of a network node
Description
Returns the speed limit of the specified edge of the network node.
Example
getedgespeedlimit(current, 1)
getentrytime (obj object)
Gets the time that a flow item entered the current object it is in
Description
Returns the last entry time of the item (the time the flowitem last entered another object).
Example
time() - getentrytime(item)
geteventtime (str EventName, num mode[1/2/3])
Gets a UserEvent's event time
Description
Returns a UserEvent's event time. Mode: 1 - Repeat time intervals, 2 - Exact event time, 3 - Time until event fires
Example
double remainingtime = geteventtime("myevent",3);
getfilebrowse (str extension, str extensiondescription[, str defaultreturn, str location, num savemode, node filelist])
Opens a standard windows file browser dialog window
Description
This command opens a standard Windows file browser dialog window. The files shown in the window will have the extensions defined in extension. Different extensions should be separated by semicolons (;) in extension. The text passed as description will be used in the file browser to describe the type of file to open. This command returns a string that is the path of the selected file. If no file is selected, or Cancel is pressed, the command returns an empty string. See filebrowse() command.
Example
string shapefile = getfilebrowse("*.3ds; *.wrl","3D shape files");

This sets the variable shapefile to the path of a file chosen from a file browser that displays files with the .3ds and .wrl extensions.
getfilesindirectory (str directory, str extension, node destnode)
Description
Retrieves all files in the specified directory that match the specified extension, and populates the content of destnode with nodes holding the path to each matching file. The command returns the number of matching files that were found. The extension parameter should be the specific three (or sometimes four) letter extension that you want to get. For example, if you want all .fsm model files, specify the string "fsm". Also, if you pass "directories" as the extension parameter, then the command will retrieve the list of directories inside the directory. To get all files, no matter the extension, pass "*" as the extension parameter. File paths will be set on the string data (as opposed to the name) of nodes inserted into destnode.
Example

treenode destnode = Model.find("Tools").subnodes.assert("Files");
int nrfiles = getfilesindirectory(documentsdir(), "*", destnode);
for(int i = 1; i <= nrfiles; i++)
{
	mpt("file: ");
	mpt(destnode.subnodes[i].value);
	mpr();
}
getframe (obj object)
Gets the current Shape Frame being drawn for object
Description
Returns the current 3D shape frame that is being drawn for the object. If the 3D shape assigned to the object was named myshape.3ds, and if two additional 3D shapes with file names myshapeFRAME1.3ds and myshapeFRAME2.3ds resided in the same directory as myshape.3ds, then the two additional files would be loaded into FlexSim automatically at the same time myshape.3ds was loaded, and setting the object's frame from 0 to 1 to 2 would change the object's shape to each of the shapes defined by the three files in order.
Example
if(getframe(current) == 3)) setframe(current, 5);
getinput (obj involved)
Deprecated, use Object.stats.input.value
Description
This command is deprecated. Use Object.stats.input.value instead.

Returns the input statistic of the involved object.
Example
double inval = getinput(current.centerObjects[1]);
getiteminvolved (obj item)
Gets the object reference stored in the FixedResource involved variable for the item
Description
This returns the object reference stored in the FixedResource involved variable for the item.
The FixedResource class allows sub-classes to store 1 involved variable on each flowitem. What these variables mean is dependent on the type of class.
For example, a Processor uses the involved variable to store a reference to the dispatcher called for a flowitem if the Processor is set to use operators for the process or setup time.
If you are using the explicit FixedResource class as an object in your model, you can use this command, along with the setitemvar, getitemvar, and setiteminvolved commands, to store variables on the items the object receives.
Example
getiteminvolved(current.first)
getitemsendto (obj item)
Gets the value of the evaluated sendto for the item
Description
This returns the value of the evaluated sendto for the item if it is in a FixedResource and has been released.
Example
getitemsendto(item)
getitemstate (obj item)
Gets the FixedResource state of the flowitem
Description
Returns the FixedResource state of the flowitem. This will be one of 3 values:
FRSTATE_INQUEUE: The flowitem is in-process; it has not been released yet.
FRSTATE_READY: The flowitem has been release, but has not found a downstream object that is ready to receive it.
FRSTATE_MOVEREQUESTED: The flowitem has been released, and a downstream object is ready to receive it, but the item is waiting to get picked up by a transport.
For more information, refer to the FixedResource documentation.
Example
getitemstate(so())
getitemtype (obj object)
Deprecated, use labels
Description
This command is deprecated. Use labels instead.

Returns the itemtype value of a flow item.
Example
getitemtype(so())
getitemvar (obj item, num var)
Gets the value of a FixedResource variable for the item
Description
This returns the value of a FixedResource variable for the item. The var parameter should be either 1, 2, or 3. The FixedResource class allows sub-classes to keep up to 3 number variables on each flowitem. What these variables mean is dependent on the type of class.
For example, a Processor uses variable 1 to store the time the item started its processing time, and variable 2 to store the item's processing time.
If you are using the explicit FixedResource class as an object in your model, you can use this command, along with the setitemvar, getiteminvolved, and setiteminvolved commands, to store variables on the items the object receives.
Example
getitemvar(current.first, 3)
getkinematics (node infonode, num querytype[, num kinematicindex, num updatetime/traveldist])
Gets information from the specified kinematics operation
Description
Gets information from the specified kinematics operation. For more information, refer to the help documentation on kinematics.
Example
getkinematics(current.labels["kinematics"], KINEMATIC_ARRIVALTIME, 1, current.size.x);
getlabel (obj node, str/num label)
Deprecated, use treenode.LabelName
Description
This command is deprecated. Use treenode.labelProperties instead.

Gets the value of an object's label.
Example
getlabelnum (obj node, str/num label)
Deprecated, use treenode.LabelName
Description
This command is deprecated. Use treenode.labelProperties instead.

Gets the number value of an object's label.
Example
getlabelstr (obj node, str/num label)
Deprecated, use treenode.LabelName
Description
This command is deprecated. Use treenode.labelProperties instead.

Gets the string value of an object's label
Example
getlastacquiredresource (node resource, node token)
Description
Gets the last object acquired by the token from the resource.
Example
treenode operator = getlastacquiredresource(operatorResource, token);
getlastfiletype ()
Description
For developer use. Returns the type of the last file saved. 1 = Model file 2 = Project file 3 = View file 4 = Session file 0 = Other file
Example
if (getlastfiletype()) {pt("Known file type"); pr(); }
getlinecontrollerdata (obj linecontroller, num datatype, num column)
For Dynamo use
Description
For Dynamo use. Returns data about the LineController's current job, 1 = ProdID, 2 = LineNum, 3 = Target, 4 = StartTime. 5 = Extra Column
Example
getlinecontrollerdata(current,1,0);
getmodelunit (num querytype)
Description
Returns information about the model's unit settings.
FlexSim's typical units are: time - 1 second, length - 1 meter, volume - 1 liter, mass - 1 kilogram. Also may return a name or abbreviation of the current model's units
querytype can be one of the following values:
TIME_MULTIPLE returns the number of seconds represented by each time unit in the current model
LENGTH_MULTIPLE returns the number of meters represented by each length unit in the current model
FLUID_MULTIPLE returns the number of liters represented by each fluid unit in the current model
FLUID_TYPE returns 0 if the fluid units represent volume, or returns 1 if the fluid units represent mass
DATE_TIME_NODE returns a reference to the date/time node in the model units tree
START_TIME returns the start time in seconds (since Jan 1, 1601)
START_TIME_NODE returns a reference to the start time node in the model units tree
CURRENT_TIME returns the current time in seconds (since Jan 1, 1601)
CURRENT_TIME_NODE returns a reference to the current time node in the model units tree
STOP_TIME returns the next stop time in seconds (since Jan 1, 1601)
STOP_TIME_NODE returns a reference to the stop times node in the model units tree
START_YEAR returns the year associated with the start time as a number
START_MONTH returns the month associated with the start time as a number betweeen 1 (Jan) and 12 (Dec)
START_DAY returns the day associated with the start time as a number, where 1 indicates the first day of the month
START_DAYOFWEEK returns the day associated with the start time as a number, where 0 indicates Sunday
START_HOUR returns the hour associated with the start time as a number between 0 and 23
START_MINUTE returns the minute associated with the start time as a number between 0 and 59
START_SECOND returns the second associated with the start time as a number between 0 and 59
START_MILLISECOND returns the millisecond associated with the start time as a number between 0 and 999
CURRENT_YEAR returns the number of years since the model start time
CURRENT_DAY returns the number of days since the model start time
CURRENT_HOUR returns the number of hours since the model start time
CURRENT_MINUTE returns the number of minutes since the model start time
CURRENT_SECOND returns the number of seconds since the model start time
CURRENT_MILLISECOND returns the number of milliseconds since the model start time
CURRENT_YEAR_OF_TIME returns the year associated with the current time as a number
CURRENT_MONTH_OF_YEAR returns the month associated with the current time as a number between 1 (Jan) and 12 (Dec)
CURRENT_DAY_OF_MONTH returns the day associated with the current time as a number, where 1 indicates the first day of the month
CURRENT_DAY_OF_WEEK returns the day associated with the current time as a number, where 0 indicates Sunday
CURRENT_HOUR_OF_DAY returns the hour associated with the current time as a number between 0 and 23
CURRENT_MINUTE_OF_HOUR returns the minute associated with the current time as a number between 0 and 59
CURRENT_SECOND_OF_MINUTE returns the second associated with the current time as a number between 0 and 59
CURRENT_MILLISECOND_OF_SECOND returns the millisecond associated with the current time as a number between 0 and 999
TIME_NAME returns the name of the model time units
TIME_PLURAL_NAME returns the plural name of the model time units
TIME_ABBREVIATION returns the abbreviation of the model time units
LENGTH_NAME returns the name of the model length units
LENGTH_PLURAL_NAME returns the plural name of the model length units
LENGTH_ABBREVIATION returns the abbreviation of the name of the model length units
FLUID_NAME returns the name of the model fluid units
FLUID_PLURAL_NAME returns the plural name of the model fluid units
FLUID_ABBREVIATION returns the abbreviation of the name of the model fluid units
START_TIME_STR returns the start time as a string, formatted by the date and time formats
CURRENT_TIME_STR returns the current time as a string, formmatted by the date and time formats
STOP_TIME_STR returns the next stop time as a string, formatted by the date and time formats
TIME_FORMAT returns the time format used to format date/time strings
DATE_FORMAT returns the date format used to format date/time strings
Example
getmodelunit(LENGTH_MULTIPLE)
getmodelunitnum (num querytype)
Description
This command is deprecated. Use getmodelunit() instead.
Example
getmodelunitstr (num querytype)
Description
This command is deprecated. Use getmodelunit() instead.

Returns a name or abbreviation of the current model's units.
Example
getmoverecord (num record)
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().
getmoverecordvalue (num record, num value)
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.
Example
See the example for getnummoverecords().
getname (node thenode)
Deprecated, use treenode.name
Description
This command is deprecated. Use treenode.name instead.

Gets the name of a node/object.
Example
getnetnode (obj object, num nodenr)
Gets the nth network node connected to object with an A connection line
Description
Returns the nth network node connected to the object with a "blue" or "station" connection line
Example
getnetnode(current, 1)
getnetnodespline (obj netnode, num edgenr)
Gets a reference to the spline head of netnode's edge edgenr
Description
Returns a reference to the spline head for the specified edge of the network node. You can use spline() commands to then access location data for that spline. Note that the spline head may not be inside the network node you're passing, but rather may be in the network node on the other side of the edge. You can use the isedgeforward() command to query whether the spline is inside the network node. If not, then spline percentages disances passed to the spline() command will be backwards.
Example
treenode splinehead = getnetnodespline(netnode, 2);
getnetworkdistance (num fromnetnoderank, num tonetnoderank)
Gets the network distance between two network nodes
Description
Returns the network distance between the network nodes. Note that the network nodes are referenced by their member ranks, not by the pointer to the network node. Use rankfromnetnode() to get a network node's member rank.
Example
getnetworkdistance(rankfromnetnode(current), rankfromnetnode(current.outObjects[1]));
getnextnetnode (num fromnn, num tonn)
Gets the rank of the next network node from fromnn in order to get to tonn
Description
Returns the rank of the next network node to go to from one network node in getting to the destination network node. The return value and parameters will all be network node member ranks. Use rankfromnetnode() to get the member rank of a network node, and netnodefromrank() to get the network node from the member rank.
Example
treenode nextnode = netnodefromrank(getnextnetnode(rankfromnetnode(current), rankfromnetnode(Model.find("NN5"))));
getnextnetnodeoutport (num fromnn, num tonn)
Gets the output port of the network node fromnn in order to get to tonn
Description
Returns the output port, or edge number, to go to in getting from a source network node to a destination network node.
Example
int outport = getnextnetnodeoutport(rankfromnetnode(current), rankfromnetnode(Model.find("NN5")));
getnextparametersobject (obj startobject, str guifocus, num doguifocusclass, num searchforward)
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
getnodename (node thenode)
Deprecated, use treenode.value
Description
This command is deprecated. Use treenode.name instead.

Gets the name of a node/object.
Example
getnodenum (node thenode)
Deprecated, use treenode.value
Description
This command is deprecated. Use treenode.value instead.

Gets the value of a node with numeric data.
Example
getnodestr (node thenode)
Deprecated, use treenode.value
Description
This command is deprecated. Use treenode.value instead.

Gets the value of a node with string data.
Example
getnroftasks (obj tasksequence)
Gets the number of uncompleted tasks in the tasksequence
Description
This command is deprecated. Use the TaskSequence and TaskSequence.Task class methods and properties instead. Returns the number of tasks that still need to be completed in the tasksequence (including the current task).
Example
if(getnroftasks(mytasksequence) > 5)
pt("There are more than 5 tasks in the tasksequence queue.");
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(" ");
}
getnumpeopleresources (obj group [, num availability{0=available/1=acquired}, num priority])
Description
Get the number of available/acquired objects in a people resource group. If a priority value is passed resources will also be considered available if a request of that priority would preempt the resource.
Example
int numAvailable = getnumpeopleresources(Group("PodA"));
getnumstaterecords ()
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();
}
getobjectimageindex (obj object)
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.
Example
getobjectimageindex(item);
getobjectshapeindex (obj object)
Gets the index number of the 3D shape assigned to object
Description
Returns the index number of the 3D shape currently assigned to the object.
Example
getobjectshapeindex(item);
getobjecttextureindex (obj object)
Gets the index number of the image assigned as the texture for the object's 3D shape
Description
Returns the index number of the bmp or jpeg image currently assigned as the default texture for the object's 3D shape.
Example
getobjecttextureindex(item);
getoutput (obj involved)
Deprecated, use Object.stats.output.value
Description
This command is deprecated. Use Object.stats.output.value instead.

Returns the output statistic of the involved object.
Example
double outval = getoutput(current.centerObjects[1]);
getparenttoken (node token)
Description
Deprecated. Use Token.parent.
Example
treenode parentToken = getparenttoken(token);
getparentwindow (HWND window)
Description
For developer use. Returns the parent window of the specified window. Use windowfromnode as a parameter to pass into this function.
Example
getpath (str truncatedpath)
Returns the full file path of the truncated path
Description
Takes a truncated, or relative file path, and returns the full file path.
Example
string fullpath = getpath("fs3d\\texturebox.wrl");
getpeopleresourceutilization (obj object/group[, num mode{0=ByState/1=ByAcquires}])
Description
Returns the utilization percentage of a people object or the average of all members of a people group.
Example
double utilization = getpeopleresourceutilization(Group("PodA"));
getpickingdrawfocus (obj theview, num whattoget, num pickedid)
Gets the picking draw focus
Description
Gets the picking draw focus. Used in OnClick to know what was clicked. The whattoget parameter can be PICK_TYPE, PICK_OBJECT, or PICK_SECONDARY_OBJECT. pickedid should be PICK_PRESSED for the "pressed" pick, PICK_HOVERED for the "hovered" pick, PICK_RELEASED for the "released" pick, or PICK_MOVED for "mouse moved" pick.
Example
int picktype = getpickingdrawfocus(view, PICK_TYPE, 0);
getpickingmode (obj view)
Gets the picking mode for view
Description
Gets the picking mode for the specified view.
Example
int isselectionmode = getpickingmode(view);
getpreempt (node tasksequence)
Gets the preempt value of the tasksequence
Description
Returns the preempt value of the tasksequence.
Possible values are:
PREEMPT_NOT,
PREEMPT_ONLY,
PREEMPT_AND_ABORT_ACTIVE,
PREEMPT_AND_ABORT_ALL
Example
if(getpreempt(mytasksequence) == PREEMPT_ONLY)
pt("This tasksequence is a preempting task");
getpriority (node tasksequence)
Gets the priority value of the tasksequence
Description
Returns the priority value of the tasksequence.
Example
if(getpriority(mytasksequence) > 5)
pt("This tasksequence has a priority greater than 5.");
getprocessflowvar (obj/str processFlow, str varname[, node token])
Description
Gets the value for the Process Flow Variable. The processflow parameter can either be a reference to the Process Flow object in the Tools or the name of the Process Flow object.
Example
double processTime = getprocessflowvar(processflow, "processTime"); treenode processor = getprocessflowvar(processflow, "processor", token);
getproperty (str filename, num property)
Description
For developer use. Gets the value for the specified property in the specified file.
Example
getproperty(modeldir() + "MyModel.fsm",1);
getquerycolcount ()
Deprecated, use Table.query()
Description
This command is deprecated. Use Table.query() instead.

Returns the number of columns in the result table for the last call to query().
Example
getquerymatchcount ()
Deprecated, use Table.query()
Description
This command is deprecated. Use Table.query() instead.

Returns the total number of rows in the result table for the last call to query()
Example
getquerymatchtablerow (str/num table, num matchRow)
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.
Example
getqueryvalue (num row, num/str col)
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.
Example
getrank (node thenode)
Deprecated, use treenode.rank
Description
This command is deprecated. Use treenode.rank instead.

Gets the rank of a child node in its parent's sub-tree.
Example
getreportnum (node report, int column, int rowsback)
For Dynamo use
Description
For Dynamo use. Returns the value from a Report object that is in the specified column. The row is determined by subtracting the rowsback parameter from the number of rows in the table.
Example
double myval = getreportnum(current,3,0);
getrunstate ([int checkProcessingEvent])
Returns 1 if the model is currently running, 0 if not
Description
Returns 1 if the model is currently running, 0 if not. If you pass a true value, returns whether an event is currently executing.
Example
if(!getrunstate()){msg("Model Stopped", "The model is not running right now.",1);}

If executed from the script window, this message will only appear if the model is stopped.
gets (node thenode)
Deprecated, use treenode.value
Description
This command is deprecated. Use treenode.value instead.

Gets the value of a node with string data.
Example
getsdtvalue (node sdtNode, str valName)
For developer use
Description
Primarily for developer use only. Returns the value of the named class member of a node that has "SimpleDataType" data. We discourage using this command in model code because you risk breaking forward-compatibility. Future versions may redefine class members and their names, so model code that accesses these values by name may not work in future versions.
Example
getshapeindex (str name)
Gets the index of a loaded 3D shape
Description
Get the index of a loaded shape by its file path name. The file path name used in this command must use double backslashes as shown in the example. Use View -> Media Files to see a complete list of currently loaded shapes with their associated file path names and indexes.
Example
getshapeindex("fs3d\\Operator\\BasicOperator\\Chest.3ds");
getsoundindex (str name)
Gets the index of a loaded sound
Description
Returns the index of a loaded sound by the name associated with it in the project/media/sounds folder.
Example
getsoundindex("C:/My Sounds/APPLAUSE.WAV");
getstat (node object, str name, int flag [, var p1, var p2, var p3])
Returns the statistic value for the given object
Description
It is preferred to use Object.stats instead. Gets the specified statistic from the given object.
name - The name of the statistic. Valid names can be enumerated using function_s(object, "enumerateStatistics", targetNode). Documentation for the meaning of the various statistics that an object provides should be found in each object's documentation. The documentation may include spaces in the names of the statistics, for readability. In passing these as the name parameter to getstat(), you should remove all spaces.
flag - Can be one of the following values
STAT_CURRENT - returns the current value of this statistic
STAT_MIN - returns the minimum value of this statistic
STAT_MAX - returns the maximum value of this statistic
STAT_AVERAGE - returns the average value of this statistic
STAT_TIME_AT_VALUE - returns the total simulation time the stat spent at a given value (requires an additional p1/p2/p3 parameter designating the desired value). This is only valid if the stat is tracking its history or profile data, such as in objects' standard "State" statistics. See below for more information on this.

p1, p2, and p3 are for providing "requirements" to resolve the correct statistic. For example, a list has several per-partition statistics. In order to get a partition's statistic, you need to pass the desired partition ID as p1. Requirements depend on the statistic that is being retrieved.

There are also several special stat names that you can use. They are: "State", "Output", "Input", "Content", "Staytime". If you use one of these names, the command will return the corresponding standard statistic of the object. Examples:
getstat(object, "Output", STAT_CURRENT) - returns the current (total) output of the object (same as object.stats.output)
getstat(object, "Content", STAT_AVERAGE) - returns the average content of the object
getstat(object, "State", STAT_CURRENT, 0) - returns the current state of the object (same as object.stats.state().value)
getstat(object, "State", STAT_TIME_AT_VALUE, 0, STATE_IDLE) - returns the total idle time of the object (0 designates the state profile, i.e. the default state profile)
getstat(object, "Staytime", STAT_MAX) - returns the maximum recorded stay time of the object
Note that some stats that do not make sense will not return valid data, such as average state, or average output.

STAT_TIME_AT_VALUE
If you want to get the STAT_TIME_AT_VALUE access, the statistic needs to track either historical or profile data. If it is an object's standard "State" statistic, FlexSim will automatically make it track its profile data, so you don't need to do any extra work for that. For other statistics, however, you will need to explicitly "subscribe" to the statistic to make it track its profile or history data. Historical data records each change of value and the corresponding simulation time of that value change. Profile data records the total time the variable was at each value. Only non-negative integer values are valid for profile data.

To subscribe to a tracked variable, first find where the tracked variable statistic is in the tree. For example if it's the "Content" statistic, you'll likely find it at object>stats/stats_content. Then call the following command on the node: function_s(statNode, "addSubscriber", needsHistory, needsProfile, persist). The needsHistory and needsProfile parameters are booleans telling which data you want to track. The persist is a boolean that tells if you want it to track these statistics indefinitely going forward. The tracked variable tries not to continue tracking extra data if it is not needed. If nobody subscribes to its data "persistently", then it will discontinue recording the data if it doesn't get subscribers for a while (I think after 5 or so model resets with no subscribers).

Recording historical data will allow you to get the STAT_TIME_AT_VALUE access. However, using historical data for getting STAT_TIME_AT_VALUE is slower than if you track profile data. With historical data, it must traverse the entire history to calculate STAT_TIME_AT_VALUE, whereas if you track profile data, it stores the total time at the value directly in the profile data.
Example
getstatenum (obj object [, num stateprofilenr])
Deprecated, use Object.stats.state().value
Description
This command is deprecated. Use Object.stats.state().value instead.

Returns the state of an object in numeric form.
Example
getstatenum(current);
getstaterecord (num record)
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().
getstaterecordvalue (num record, num value)
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().
Example
See the example for getnumstaterecords().
getstatestr (obj object)
Deprecated, use Object.stats.state().valueString
Description
This command is deprecated. Use Object.stats.state().valueString instead.

Returns the state of an object as a text string.
Example
getstatestr(current);
getstatetableutilization (Table stateTable, TrackedVariable stateProfile)
Description
Returns the utilization of a state profile given a state table. See State Table for more information on how to create and modify a state table.
Example
getstatetableutilization(Table("StateTable1"), Model.find("Processor1").as(Object).stats.state())
getstream (node object)
Returns a unique random stream associated with the object
Description
Returns a unique random stream associated with the object.

Returns the number stored in the object's stream attribute. If the object does not yet own a stream attribute, or if its stream attribute is 0, FlexSim will assert the attribute and assign it a unique stream number. If the object passed into the function does not have object data, it will store the unique stream in a subnode. This subnode will be destroyed on model reset and reassigned during the model run as needed.

Assigned streams start at stream 101 and increase as they are assigned.
Example
uniform(0, 1, getstream(current))
getsystemmetric (num metric[, HWND win])
Description
For developer use. Returns system screen metrics. These values for metric return the following values (if not specified, values are in logical units):

1: desktop width
2: desktop height
3: the left position of the work area of the monitor under the cursor
4: the right position of the work area of the monitor under the cursor
5: the top position of the work area of the monitor under the cursor
6: the bottom position of the work area of the monitor under the cursor
7: the width of window win in pixels
8: the height of window win in pixels
9: the left position of the monitor under the cursor
10: the right position of the monitor under the cursor
11: the top position of the monitor under the cursor
12: the bottom position of the monitor under the cursor
13: the width of window win
14: the height of window win
Example
getsystemmetric(1)
gettablecell (str/node/num table, num row, num column)
Deprecated, use Table.cell
Description
This command is deprecated. Use Table.cell().
Example
gettablecols (str/node/num table)
Deprecated, use Table.numCols
Description
This command is deprecated. Use Table.numCols instead.

Gets the number of columns in the table.
Example
gettableheader (string/num/node table, num row/col, num rowcolnr)
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.
Example
gettablenum (str/node/num table, num row, num col)
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.
Example
gettablerows (str/node/num table)
Deprecated, use Table.numRows
Description
This command is deprecated. Use Table.numRows instead.

Gets the number of rows in the table.
Example
gettablestr (str/node/num table, num row, num col)
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.
Example
gettableviewselection (obj tableview, num val)
Description
For developer use. Returns values based on the blue selection range in a table view: val 1 returns the start row, val 2 returns the start col, val 3 returns the end row, val 4 returns the end col.
Example
int startrow = gettableviewselection(c,1);
gettaskinvolved (obj tasksequence, num taskrank, num involvednum)
Gets a reference to the first or second involved object of the task of the tasksequence
Description
This command is deprecated. Use the TaskSequence and TaskSequence.Task classes instead. Returns a reference to either the first or second involved object for the nth ranked task of the specified task sequence.
The ranking is based on the initial ranking of the task, when the task sequence was initially created and tasks were
added. It is not based on the ranking at a given time in the simulation, as tasks may have already been completed
and subsequently destroyed. The third parameter defines which involved object it is (1 or 2)


You can also pass a reference to the TaskExecuter as the first parameter, and the value 0 as the second parameter
to get the involved of the object's currently active task.
Example
treenode loaditem = getinvolved(gettasksequence(current.centerObjects[1], 0), 2, 1);
gettasksequence (obj dispatcher, num tasksequencerank)
Gets a reference to a task sequence
Description
This command is deprecated. Use the Dispatcher and TaskExecuter class methods and properties instead. Returns a reference to the task sequence that has the specified rank in the specified dispatcher's task sequence queue.
If the specified rank is zero, then the command assumes that the dispatcher is actually a TaskExecuter, and it returns
a reference to its currently active task sequence.
Example
treenode mytasksequence = gettasksequence(current.centerObjects[1], 5);
gettasksequencequeue (obj dispatcher)
Gets a reference to the dispatcher's tasksequence queue
Description
This command is deprecated. Use the Dispatcher class properties instead. Returns a reference to the specified dispatcher's task sequence queue.
Example
treenode tsqueue = gettasksequencequeue(current.centerObjects[1]);
gettaskstate (obj tasksequence, num taskrank)
Gets the state of the task at rank taskrank of tasksequence
Description
This command is deprecated. Use the TaskSequence and TaskSequence.Task class methods and properties instead. Gets the state of the task at rank taskrank of tasksequence. The following are task states:
TASKSTATE_UNFINISHED
TASKSTATE_ACTIVE
TASKSTATE_FINISHED
TASKSTATE_COORDINATED
Example
if(gettaskstate(gettasksequence(current.centerObjects[1], 0), 2) == TASKSTATE_ACTIVE)...
gettasktype (obj tasksequence, num taskrank)
Gets the task type of the task at rank taskrank of tasksequence
Description
This command is deprecated. Use the TaskSequence and TaskSequence.Task class methods and properties instead. Returns the task type for the nth ranked task of the specified task sequence.
The ranking is based on the initial ranking of the task, when the task sequence was initially created
and tasks were added. It is not based on the ranking at a given time in the simulation, as tasks
may have already been completed and subsequently destroyed.

You can also pass a reference to the TaskExecuter as the first parameter, and the value 0 as the second parameter
to get the task type of the object's currently active task.
Example
if(gettasktype(gettasksequence(current.centerObjects[1], 0), 2) == TASKTYPE_LOAD)...
gettaskvariable (obj tasksequence, num taskrank, num variablenum)
Gets the tasksequence variable for the task at rank taskrank of tasksequence
Description
This command is deprecated. Use the TaskSequence and TaskSequence.Task class methods and properties instead. Returns a reference to one of the four task variables for the nth ranked task of the specified task sequence.
The ranking is based on the initial ranking of the task, when the task sequence was initially created and tasks were
added. It is not based on the ranking at a given time in the simulation, as tasks may have already been completed
and subsequently destroyed. The third parameter defines which task variable it is (1 - 4)


You can also pass a reference to the TaskExecuter as the first parameter, and the value 0 as the second parameter
to get the task variable of the object's currently active task.
Example
double myvar = gettaskvariable(gettasksequence(current.centerObjects[1], 0), 2, 1);
gettenavigator (obj taskexecuter)
Gets the current navigator that a taskexecuter is connect to
Description
Returns the current navigator that a taskexecuter (TE) is connected to, either DefaultNavigator or DefaultNetworkNavigator.
Example
treenode navigator = gettenavigator(current);
gettenetnode (obj taskexecuter)
Gets the current network node that a taskexecuter is attached to with an A Connection
Description
Returns the current network node that a taskexecuter (TE) is attached to with a red line.
Example
treenode netnode = gettenetnode(current);
gettenetworkinfo (obj taskexecuter, obj destobj, num info)
Gets information regarding the current state of a taskexecuter on a node network
Description
Returns information regarding the current state of a taskexecuter on a node network. Valid queries are as follows:

NETWORK_INFO_DEST_NET_NODE_RANK - returns the destination column/rank of the network node that the TE would travel to were he to be given a travel task to destobj. Usually this will simply be the network node attached to destobj, but if multiple network nodes are attached to destobj, the command will find the closest one.
NETWORK_INFO_ORIGIN_NET_NODE_RANK - returns the origin column/rank of the network node that the TE would start from were he to be given a travel task to destobj. Usually this will simply be the current network node where the TE is located, but if that network node has virtual exits, the command will find the virtual exit that renders the shortest travel distance.
NETWORK_INFO_DISTANCE - returns the shortest travel distance to the destination object through the network.
NETWORK_INFO_CUR_DIST_ALONG_EDGE - Only valid when the TE is actively doing a travel task. This returns the current distance that the TE has traveled along its current network edge. For this query, destobj should be NULL.
NETWORK_INFO_CUR_TRAVEL_ORIGIN_RANK - Only valid when the TE is actively doing a travel task. This returns the rank of the origin node at which the TE starts its current travel operation. For this query, destobj should be NULL.
NETWORK_INFO_CUR_TRAVEL_DEST_RANK - Only valid when the TE is actively doing a travel task. This returns the rank of the destination node to which the TE is traveling for its current travel operation. For this query, destobj should be NULL.
Example
int destrank = gettenetworkinfo(current, NULL, NETWORK_INFO_CUR_TRAVEL_DEST_RANK);
gettextureindex (str name)
Gets the index of a loaded image
Description
Get the index of a loaded image by name. 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 a texture's name.
Example
gettextureindex("myimage")
gettoken (obj instanceObject, obj/str activity, num index)
Description
Gets the token at the index of the activity for the given owner object (instance).
Example
treenode token = gettoken(fixedResource, activity, 3);
treenode token = gettoken(processor3, "Wait for Conveyor", 2);
gettokenbyid (num id [, obj/str processFlow])
Description
Deprecated. Use Token.byID.
Example
treenode token = gettokenbyid(54);
treenode token = gettokenbyid(23, "ProcessFlow2");
gettokenid (node token)
Description
Deprecated. Use Token.id.
Example
int tokenID = gettokenid(token);
gettokens (obj instanceObject, obj activityOrAsset[, num flags])
Description
Gets all the tokens "inside" an activity or shared asset. For activities, this is the current set of tokens in the activity. For resources, it is the set of tokens who have acquired the resource. For zones, it is the set of tokens that have entered the zone. For a list, it is the set of tokens who have been pushed to the list. Returns an Array containing the result.

instanceObject - The object associated with the desired process flow instance. For general process flows this is the same as the process flow itself. For object process flows, it is the 3D object, i.e. task executer or fixed resource, associated with the process flow instance. If executed from within process flow activity logic, this will usually just be "current". If you pass NULL here, it will get tokens for all instances.

activityOrAsset - The target activity or shared asset. If NULL, the command will return all active tokens in the entire process flow instance.

flags - Defines optional flags. If GET_TOKENS_REQUESTS is passed for a shared asset, it will return the set of tokens requesting the shared asset (i.e. tokens waiting to enter a zone, tokens back ordering on a list, etc.).
Example
Array tokensInActivity = gettokens(current, getactivity(processFlow, "Wait For Exit")); Array resourceOwners = gettokens(current, getactivity(processFlow, "Resource1"));
gettotalnroftasks (obj tasksequence)
Gets the total number of tasks that were ever added to the tasksequence
Description
This command is deprecated. Use the TaskSequence and TaskSequence.Task class methods and properties instead. Returns the total number of tasks that were ever added to the tasksequence.
Example
gettotalnroftasks(mytasksequence)
gettrackedvariable (str/node trackedvar [, num valtype] )
Deprecated, use Tracked Variable class
Description
This command is deprecated. Use the TrackedVariable class instead.
Example
gettreedrawposition (node destnode, node roottree)
Description
For developer use.
Example
getundorecordid (obj record)
Description
Returns the id of the specified undo record. See Miscellaneous Concepts > Advanced Undo for more information.
Example
int id = getundorecordid(getcurrentundorecord(view));
getutilizedobject (obj dispatcher, obj involved, obj station, num utilizednr)
Gets a reference to an operator that is currently executing a utilize task
Description
Finds and returns a reference to an operator that is currently executing a utilize task with the given involved and station variables. If multiple operators are being used, then utilizednr allows you to distinguish which one you want to reference.
Example
treenode op = getutilizedobject(current.centerObjects[1], item, current, 1);
getvarnode (obj object, str/num var)
Gets a node reference to an object's variable
Description
Returns a reference to the specified variable's node in the specified object.
Example
treenode schedule = getvarnode(current,"schedule");
getvarnum (obj object, str/num var)
Gets the value of an object's numeric variable
Description
Returns the numeric value stored in the specified variable of the specified object.
Example
double speed = getvarnum(current,"speed");
getvarstr (obj object, str/num var)
Gets the value of an object's string variable
Description
Returns the string data stored on the specified variable of the specified object.
Example
pt(getvarstr(model().subnodes[2],"creationtrigger"));
getvartype (var)
Deprecated, use Variant.type
Description
This command is deprecated. Use Variant.type instead.

Example
getvartype(myVar)
getviewhwnd (obj view, int windowtype)
Gets the HWND handle for a certain window of a view
Description
Returns a windows HWND handle for a certain window of a view. Each view may use several windows to display data properly. For example, a tree view contains the main window that displays the tree as well as a window that displays the string or number data on a node for editing, as well as a window that displays/edits the name of a node. The windowtype parameter specifies which window handle you want returned, as follows:

1 - the main control (same as using windowfromnode())
2 - datacontrol - The scintilla code control that displays data of a node in a tree, and in a script view
3 - control - the control that displays/edits a highlighted node's name in the tree
4 - statusbar - the statusbar of the view if it has one
5 - tooltip - the tooltip control of the view
6 - pointercontrol - I think this is only used in a tree that displays list heads
Example
sendwindowmessage(getviewhwnd(treeview,2), SCI_SETSEL, 4, 8);
getviewmenu (obj view, int menutype)
Description
For developer use. Returns the HMENU reference of the menu based on the menutype.

Menutypes:
1: floatingtreemainmenubar
2: custommenu
3: popupmenu
4: thecustompopupmenu
Example
var menu = menubelow(getviewmenu(c, 4), 0);
getviewscale (obj view)
Description
For developer use. Returns the view scale factor.
Example
getviewscale(sv())
getviewtext (obj/num window)
Description
For developer use. Returns the text of a window.
Example
getviewtext(sv())
glBegin (num primitive)
Deprecated, use the mesh() API
Description
This command is deprecated. Do not use. Use the mesh() API instead.
Example
glColor3d (num red {0-1}, num green {0-1}, num blue {0-1})
Deprecated, use fglColor()
Description
This command is deprecated. Use fglColor() instead.
Example
glColor4d (num red {0-1}, num green {0-1}, num blue {0-1}, num alpha {0-1})
Deprecated, use fglColor()
Description
This command is deprecated. Use fglColor() instead.
Example
glDisable (num setting)
Deprecated, use fglDisable()
Description
This command is deprecated. Use fglDisable() instead.
Example
glEnable (num setting)
Deprecated, use fglEnable()
Description
This command is deprecated. Use fglEnable() instead.
Example
glEnd ()
Deprecated, use the mesh() API
Description
This command is deprecated. Do not use. Use the mesh() API instead.
Example
glIsEnabled (num setting)
Returns 1 if the OpenGL setting is enabled, 0 otherwise
Description
Returns 1 if the OpenGL setting is enabled, 0 otherwise. See fglEnable() for list of draw settings. Note that this is an extremely slow operation and is discouraged. You can refer to standard OpenGL documentation for more information if needed.
Example
glIsEnabled(GL_LIGHTING)
glLineWidth (num linewidth)
Specifies the line width for subsequent lines draw in OpenGL
Description
Specifies the line width for subsequent lines drawn in OpenGL. You can refer to standard OpenGL documentation for more information if needed.
Example
glLineWidth(3);
glLoadIdentity ()
Deprecated, use fglLoadIdentity()
Description
This command is deprecated. Use fglLoadIdentity() instead.
Example
glMatrixMode (num mode)
Deprecated, use fglMatrixMode()
Description
This command is deprecated. Use fglMatrixMode() instead.
Example
glNormal3d (num x, num y, num z)
Deprecated, use fglNormal()
Description
This command is deprecated. Use fglNormal() instead.
Example
glNormal3d(1,0,0);
globallist (str listName)
Deprecated, use List("GlobalListName")
Description
This command is deprecated. Use List("GlobalListName") instead.

References a global list by name.
Example
glPointSize (num pointsize)
Specifies the point size in pixels for subsequent vertices drawn in OpenGL
Description
Specifies the point size in pixels for subsequent vertices drawn in OpenGL. You can refer to standard OpenGL documentation for more information if needed.
Example
glPointSize(5);
glPopAttrib ()
Deprecated, do not use
Description
This command is deprecated. Do not use.
Example
glPopMatrix ()
Deprecated, use fglPopMatrix()
Description
This command is deprecated. Use fglPopMatrix() instead.
Example
glPushAttrib (num attribsetting)
Deprecated, do not use
Description
This command is deprecated. Do not use.
Example
glPushMatrix ()
Deprecated, use fglPushMatrix()
Description
This command is deprecated. Use fglPushMatrix() instead.
Example
glRotated (num degrees, num x, num y, num z)
Deprecated, use fglRotate()
Description
This command is deprecated. Use fglRotate() instead.
Example
glScaled (num x, num y, num z)
Deprecated, use fglScale()
Description
This command is deprecated. Use fglScale() instead.
Example
glTexCoord2d (num x 0-1, num y 0-1)
Deprecated, use the mesh() API
Description
This command is deprecated. Do not use. Use the mesh() API instead.
Example
glTranslated (num x, num y, num z)
Deprecated, use fglTranslate()
Description
This command is deprecated. Use fglTranslate() instead.
Example
glVertex3d (num x, num y, num z)
Deprecated, use the mesh() API
Description
This command is deprecated. Do not use. Use the mesh() API instead.
Example
go ([num fast])
Starts the simulation run
Description
This command starts the simulation run. If there are any events in the event queue, they will occur when the clock reaches them. If there are no events in the queue, the clock will stop. This command will not reset the simulation. If fast is 1, then it will not bind objects before starting. This improves speed if you are stopping and starting the simulation often. See also runfunction().
Example
stop();
if (msg("Model Stopped","Continue?")==1)
{
go();
}

This stops the model then prompts the user if it should start again. If the user presses "OK", the model continues from where it was stopped.
graphtohistogram (obj graph, obj histogram, num start, num end, num res, num xyformat)
Description
For developer use. Generate histogram data from a list of values. This command will generate a histogram inside the node histogram based on the occurrence table given by graph. Mainly used internally by objects. The starting value of the histogram is specified as start. The ending value of the histogram is specified as end. The number of buckets in the histogram is specified as res. If xyformat is 0, it assumes that the graph is a y format occurrence table. If xyformat is 1, it assumed the graph is an xy format occurrence table. Similar to makehisto(). Refer to makehisto() for more information on these similarities.
Example
graphtohistogram(so(),so().next,1,10,5,0)
groupaddmember (str group, obj member)
Deprecated, use Group.addMember()
Description
This command is deprecated. Use Group.addMember() instead.

Adds an object to a group.
Example
groupconnectfrom (obj object, str character)
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.
Example
groupconnectfrom(selectedobject(ownerview(c)),"A");
groupconnectto (obj object, str character)
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.
Example
groupconnectto(selectedobject(ownerview(c)),"A");
groupcopyconnections (obj object)
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
Example
groupcopyconnections(selectedobject(ownerview(c)));
groupmember (str group, num member)
Deprecated, use Group[]
Description
This command is deprecated. Use Group[] instead.

Gets a reference to a group member.
Example
groupnummembers (str group)
Deprecated, use Group.length()
Description
This command is deprecated. Use Group.length instead.

Gets the number of members in a group.
Example
groupremovemember (str group, num/obj member)
Deprecated, use Group.removeMember()
Description
This command is deprecated. Use Group.removeMember() instead.

Removes an object from a group.
Example
groupsetnames (node namenode, num startnum, num append)
Description
For developer use. Sets the names of all of the selected objects in the model to the string data on namenode. If append is 1, then a number is appended to the end of each name, starting at startnum and increasing by 1 for each object.
Example
groupsetnames("WeldStation",1,1);
gt (num value1, num value2)
Deprecated, use the > operator
Description
This command is deprecated. Use the > operator instead..
Example
help ()
Description
For developer use. Display the help system window.
Example
help()
helpcommands (node destnode, num what, str command)
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
Example
helpcommands(
hidelabel (obj object[, num off/on])
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.
Example
hidelabel(current,0);

This sets the object referenced by current so that its name and statistics will not be drawn.
hideports (obj object[, num off/on])
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.
Example
hideports(current,1);

This sets the current object to show its ports and connections in all view windows.
hideprogressbar ()
Description
For developer use. Hides the progress bar
Example
hideprogressbar();
highestconnection ()
Gets the highest numbered server connection index
Description
Returns the highest numbered server connection index.
Example
int highconn = highestconnection();
highlightviewtext (node view, num pos, num span, num mode span/lines)
Highlights text in a code edit window
Description
Highlights text in a scintilla code edit window. This is used by the flexscript syntax checker to go to highlight a syntax error in the code edit window. You can either highlight whole lines or individual characters. To highlight individual characters, specify mode as 2. For lines specify mode as 1. For lines, specify pos as the start line to highlight(the first line is line 1) and span the number of lines to highlight. For individual characters, specify pos as the start position and span as the number of characters to highlight (position 0 is the position to the left to the first character)
Example
highlightviewtext(c, 0, 5, 2)

This will highlight the first 5 characters of the scintilla text edit.
highlightviewtext(c, 1, 1, 1)
This will highlight the first line of the scintilla text edit.
holditem (obj item)
Holds the item if it has already been released
Description
Holds the specified item if it has already been released. This in effect "unreleases" the item so that it will not leave. This only applies if the item is in a FixedResource and it has already been released and has not been "allocated" to a downstream object (it is not waiting for a transport).
Example
holditem(item)
hours (num hours)
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.
howmanyattributes ()
Description
For developer use. Returns the number of attributes.
Example
howmanyattributes()
howmanycommands ()
Description
For developer use. Returns the number of commands.
Example
howmanycommands()
hypergeometric (num trials, num successes, num size[, num stream])
Returns a random sample from a hypergeometric distribution
Description
hypergeometric( t, m, n, stream ) is a discrete probability distribution used to represent the number of successes in t draws without replacement from a population of size n containing exactly m success states.

Example
i <no parentheses>
Description
For developer use. This command is used only in event functions. It is used to reference the object that was passed to the value of 0 is) command as the involved object.
Example
string involvedname = i.name;

This sets involvedname to the name of the object that was passed to value of 0 is) as the involved object.
if (num condition) { }
Description
If the condition is true (i.e. the conditional expression returns a 1), then the statement immediately following the closing parenthesis will be executed. If braces { } are what immediately follows the closing parenthesis, then the block of code within the braces will be executed when the condition is true. Nothing is executed if the condition is false (returns a 0), unless an "else" has been defined. Refer to the Users Manual for more information.
Example
if (item.Weight < 100)
    msg("TRUE", "");

This example will display a popup message saying "TRUE" when the item's Weight label has a value less than 100
importdataset (node datatree, str filename, num format)
Description
Import tree dataset from a Comma Separated Value (CSV) file. datatree should be the node to import the data into. There are 3 possible formats to import. If format is 1, then the data is imported as a table, meaning each sub-node of datatree is a row in the table, and each sub-node of each row is a cell in the table. This is the same as using the importtable() command. If format is 2, then the data is imported as a simple data series. The csv file is assumed to have one column, and each row's value is imported into a sub-node of datatree. If format is 3, then the data is imported as a series of x,y pairs. The csv file is assumed to have 2 columns. Row 1 column 1 of the csv file is imported as sub-node 1 of datatree, row 1 column 2 is imported as sub-node 2 of datatree, row 2 column 1 is imported as sub-node 3 of datatree, and so forth.
Example
importdataset(so(),"C:\\mydataset.csv",1)
importtable (node importnode, str filename[, num importcolheaders = 0, num importrowheaders = 0, str listseparator = 0, str decimalseparator = 0, str thousandseparator = 0])
Imports table data into importnode from a csv file. When importing both row and column headers, the first value in the file will be skipped. When importing into a bundle table, each field will use the data type of its first imported cell (row 1).
Description
Imports table data into the node from a csv (comma-separated values) file.
Example
importtable(current.labels["data"], "C:/modeldata.csv", 1, 1)
in (num inches)
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)
inc (node thenode, num amount)
Deprecated, use += operator
Description
This command is deprecated. Use += operator instead. myNode.value += 2;

Increments the value of a node by a defined amount.
Example
inc(current.mylabel,1)
inheritcode ()
Description
For developer use. This command is used for subclass function inheritance. Call this in an event function to call that same event function on the object's classobject. In C++ or DLL code, call _inheritcode(callpoint);
Example
Flexscript:        inheritcode();
C++ or DLL:        _inheritcode(callpoint);
inititem (obj item)
Initializes the FixedResource variables of a flowitem
Description
Initializes the FixedResource variables of a flowitem, usually done when the flowitem first enters the fixed resource. This is usually already done for you, but may be used in some exceptional cases when developing your own BasicFR object behavior.
Example
inititem(item)
initkinematics (node infonode, obj/num object/x[, num flags/y, num z, num rx, num ry, num rz, num flags, num unused])
Initializes a kinematic operation
Description
Initialize a kinematic operation.
Infonode is a blank node that can hold kinematic information.
Object is the object that you want kinematics to be performed on.
flags defines various flags for how you want it to behave.
The unused parameter deprecated, i.e. you can define this through the flags parameter.
Refer to kinematics documentation in the user manual for more information.
Example
initkinematics(current.labels["kinematics"], current)
inittrackedvariable (node theNode, num type[, num startValue, num flags])
Deprecated, use Tracked Variable class
Description
This command is deprecated. Use the TrackedVariable class instead.
Example
inobject (obj object, num inputportnum)
Deprecated, use Object.inObjects[]
Description
This command is deprecated. Use Object.inObjects[] instead.

Reference the upstream object connected to a downstream object's input port.
Example
inputopen (obj object)
Returns 1 if the object's input is open, 0 otherwise
Description
Returns 1 if the object's input is open, 0 otherwise. The closeinput(), stopinput(), openinput(), and resumeinput() commands affect the return value of this command. The commands like closeip() and closeallip() do NOT affect the return value.
Example
if(inputopen(current)) current.input.close;
insertallocatetask (obj tasksequence, obj dispatcher, num priority, num preempt [, num noblock] )
Inserts an allocate task into the coordinated task sequence
Description
Inserts an Allocate Task into the specified coordinated task sequence. By default the allocation task is a blocking task, but if noblock is 1, then the allocation does not block further execution of the task sequence.
Example
insertallocatetask(newts, current.centerObjects[2], 0, 0);
insertcopy (obj originalobject, obj containerobject)
Creates a copy of the flowitem and moves it into the container object
Description
Creates a copy of the flowitem and moves it into the container object, causing the OnReceive event of the container to execute.
Example
insertcopy(item, current);

Creates a duplicate of the flowitem and moves it into the current object.
insertdeallocatetask (obj tasksequence, num allocationkey [, num noblock] )
Inserts a deallocate task into the coordinated task sequence
Description
Inserts a Deallocate Task into the specified coordinated task sequence to deallocate the resource specified by allocationkey. By default this task will block, but if noblock is 1, it will not block.
Example
insertdeallocatetask(newts,forkkey);
insertproxytask (obj tasksequence, num executerkey, num type [, num/obj involved1, num/obj involved2 , num var1, num var2, num var3, num var4])
Inserts a proxy task into the coordinated task sequence
Description
Inserts a proxy task into the specified coordinated task sequence.
Example
insertproxytask(newts, dispatchkey, TASKTYPE_TRAVEL, current.centerObjects[1], NULL,0,0,0,0);
insertsynctask (obj tasksequence, num taskkey)
Inserts a sync task into the coordinated task sequence
Description
Insert a Sync Task for the specified task in a coordinated task sequence.
Example
insertsynctask(newts, travelkey);
inserttask (obj tasksequence, num type [, obj involved1, obj involved2 , num var1, num var2, num var3, num var4] )
Inserts a new task to the task sequence
Description
This command is deprecated. Use TaskSequence.addTask() instead. Inserts a task into the specified tasksequence of the specified type. Depending on the task type, the remaining parameters will have a different meaning. Refer to the Task Type Quick Reference guide in the Users Manual for an explanation of the parameters associated with each task type.
Example
inserttask(ts, TASKTYPE_TRAVEL, current, NULL);
installpackage (str path+filename)
Deprecated, use user libraries
Description
This command is deprecated. Use user libraries instead.

Install a service pack (.fpk).
Example
installpackage("C:/mypak.fpk")
integrityscan (obj class, obj start)
Description
For developer use. Checks that attributes have not been deleted from model objects, based on their class object. A search is done starting at the given starting node.
Example
integrityscan(rank(library(1)),model())
inversegaussian (num location, num scale, num shape[, num stream])
Returns a random sample from an inversegaussian distribution
Description
inversegaussian( γ, β, α, stream ) is a non-negative continuous probability distribution.

Inputs:
γ is the location parameter ∈ ( - ∞, ∞ )
β is the scale parameter ( β > 0 )
α is the shape parameter ( α > 0 )
stream is a reference to one of FlexSim's random number streams {0,1,2,...}

Outputs:
range = ( γ , ∞ )
mean = γ + β
variance = β³α

Probability Density Functions:



Possible Applications:
Used to model the time to complete some tasks.

Comments:
The inversegaussian( γ, 1, α ) and wald( γ, α ) distributions are the same.
As γ approaches infinity, the distribution becomes more like the normal (Gaussian) distribution.
The β parameter has elements of a shape parameter since it affects the skewness and kurtosis (width).
Example
double repairtime = inversegaussian(60, 2, 4, 5);

The repairtime variable is set equal to a inversegaussian distribution with a location parameter of 60, a scale parameter of 2, a shape parameter of 4, and using random stream number 5.
inverseweibull (num location, num scale, num shape[, num stream])
Returns a random sample from a inverseweibull distribution
Description
Generates a continuous random variate from a inverseweibull distribution with parameters as defined.
Example
invertedweibull (num location, num scale, num shape[, num stream])
Returns a random sample from an inverted weibull distribution
Description
Generates a continuous random variate from an inverted weibull distribution with parameters as defined.
Example
ip <no parentheses>
Description
For developer use. Node pointer meaning 'involved port'. Alias for 'eventdata'.
Example
ipavailable (obj object, num inputportnum)
Description
Returns a 1 if the upstream object through the specified object's input port is available. Particularly, it checks if the upstream object exists, if it is stopped, if its output is open, and if the connected output port is open. This function returns 0 if the upstream object isn't available.
Example
ipavailable(current,1)
ipopen (object object, num inputportnum)
Description
Returns a 1 if the inputportnum on object is open. Otherwise returns zero.
Example
ipopen(current,1)
ipopno (obj object, num inputportnum)
Output port number that is connected to inputportnum of object
Description
This command returns the output port number that is connected to inputportnum of object.
Example
int otherport = ipopno(current,1);

This sets otherport to the port number of the output port that the current object's first input port is connected to.
ipready (obj object, num inputportnum)
Description
Returns a 1 if the inputportnum of object is open and the connecting output port of the other object is also open. Otherwise a 0 is returned. This command does not take into consideration whether or not the input of this object or the output of the connecting object are currently open.
Example
ipready(current,1)
isclasstype (obj object, num/str classtype)
Compares the object to classtype, returns 1 for yes, 0 for no
Description
Returns whether or not the object is of the given classtype. 1 means yes, 0 means no. Possible classtype parameters are:
CLASSTYPE_FLEXSIMOBJECT
CLASSTYPE_FIXEDRESOURCE
CLASSTYPE_TASKEXECUTER
CLASSTYPE_NETWORKNODE
etc.
Example
isclasstype(current, CLASSTYPE_DISPATCHER);
isedgeforward (obj netnode, num edgenr)
Returns 1 if the network node's edge is forward, 0 otherwise
Description
Returns 1 if the network node's edge is "forward" meaning when created, the connection was dragged FROM this network node to the other network node. If the edge is forward, then the spline head is contained by this network node, and the spline distance values go forward from this network node.
Example
isedgeforward(current, 2)
iskeydown ([num key])
Description
For developer use. Returns 1 if the specified keyboard key is being held down. If the first parameter is not passed, then the function will return 1 if any key is being held down. Otherwise, the function returns 0.
Example
iskeydown(74)
isprojectcompiled ()
Description
For developer use. Returns 1 if the project has been compiled.
Example
isprojectcompiled()
item <no parentheses>
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.
iterate (num start, num end, num step) {}
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.
Example
iterate(1,9,2)
{
     pd(count);pr();
}

Prints the following numbers to the outputconsole: 1,3,5,7,9
johnsonbounded (num min, num max, num shape1, num shape2[, num stream])
Returns a random sample from a johnson bounded distribution
Description
Generates a continuous random variate from a johnson bounded distribution with parameters as defined.
Example
johnsonunbounded (num location, num scale, num shape1, num shape2[, num stream])
Returns a random sample from a johnson unbounded distribution
Description
Generates a continuous random variate from a johnson unbounded distribution with parameters as defined.
Example
keyboardfocus ([HWND/node focus])
Gets/Sets keyboard focus
Description
Used in GUI development. Gets/Sets the keyboard focus. If the focus parameter is left out, then this command will return a reference to the current keyboard focus as an HWND handle. Otherwise, it will set the focus to the keyboard focus to the passed parameter. Use windowfromnode() or getviewhwnd() to get access to the HWND handle of a view node.
Example
keyboardfocus(windowfromnode(edit));
keyedclick (obj object, num key[, obj view])
Description
For developer use. Executes the object's keyed click functionality (X, C, V)
Example
keyedclick(model().last, 88)
label (obj object, str/num label)
Deprecated, use treenode.labels[]
Description
This command is deprecated. Use treenode.labels[] instead.

Gets the node reference to an object's label.
Example
laplace (num location, num scale[, num stream])
Returns a random sample from a laplace distribution
Description
Generates a continuous random variate from a laplace distribution with parameters as defined.
Example
last (node container)
Deprecated, use treenode.last
Description
This command is deprecated. Use treenode.last instead.

Reference a parent node's last child node.
Example
lastclickednode ()
Description
For developer use. Returns a pointer to the last clicked node.
Example
lastclickednode()
lastkey ()
Description
For developer use. Returns the keycode of a keypress in OnKeyPress event.
Example
lastkey()
lastkeydown ()
Description
For developer use. Returns the keycode of a keypress in OnKeyPress event.
Example
lastkeydown()
lastkeyup ()
Description
For developer use. Returns the keycode of a keypress in OnKeyPress event.
Example
lastkeyup()
le (num value1, num value2)
Deprecated, use the <= operator
Description
This command is deprecated. Use the <= operator instead.
Example
library ()
Reference to the library node in the main tree
Description
This command returns a reference to the library node in the main tree. It is used as a fast way of referencing the library.
Example
treenode SourceObj = library().find("?Source");

This sets the variable SourceObj so that it references the node called Source in the library.
license ()
Gets the current license type
Description
Get the current license type
Example
licenseactivation (num operation[, str buffer, var p1, node callback])
Description
For developer use. Do various licensing operations.
Example
licenseactivation(LA_SET_ACTIVATION_SERVER_PARAMS,"@localhost",0);
listbackorders (obj list[, var partitionId])
Deprecated, use List.backOrders()
Description
This command is deprecated. Use List.backOrders() instead.

References to a list's back orders.
Example
listboxrefresh (obj listbox)
Refreshes the contents of a listbox
Description
Refreshes the contents of a listbox.
Example
listboxrefresh(c.find("../Collision Members"))
listenerinfo (int info)
Description
For developer use. This command returns information for use within the OnListen and OnPreListen event functions.
The information returned is information that was passed to the event you are listening to.
Info 1 will return the engine event code. Engine event codes have macros such as SM_MESSAGE and SM_DRAW.
Info 2 and 3 return pointers to associated treenodes.

To set up listening, you add a "listeners" attribute to the object you want to listen to (Object A). The listeners attribute should have subnodes that are couplings to the object(s) that you want to listen from (Object B). Before an event fires on Object A, Object B's OnPreListen event function will fire. After an event first on Object A, Object B's OnListen event function will fire. You can also filter events by additing a subnode with number data below Object B's coupling node. The number data should be a bitwise sum of the bitshifted event codes you want to listen for. If the coupling has no subnode, the object will default to listening to every event.
Example

treenode current = c;
treenode involved = i;
int code = listenerinfo(1);
treenode associated = tonode(listenerinfo(2));
treenode coupling = tonode(listenerinfo(3));

print("OnListen");
print("current: ", current);
print("involved: ", involved);
print("code: ", code);
print("associated: ", associated);
print("coupling: ", coupling);
listentries (obj list[, var partitionId])
Deprecated, use List.entries()
Description
This command is deprecated. Use List.entries() instead.

References to a list's pushed entries.
Example
listinlist (num qty, num val [, num a,...])
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.
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.
listmax (num qty, num val [, num a,...])
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.
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.
listmaximum (num qty, num val [, num a,...])
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.
Example
listmaximum(5,2,1,2,3,4)

This returns a 4 because it is the highest value in the list.
listmean (num qty, num val [, num a,...])
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.
Example
listmean(5,2,1,2,3,4)

This returns 2.5.
listmin (num qty, num val [, num a,...])
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.
Example
listmin(5,2,1,2,3,4)

This returns 2 because 1 is the lowest value and it is second in the list.
listminimum (num qty, num val [, num a,...])
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.
Example
listminimum(5,2,1,2,3,4)

This returns 1 because that is the lowest value in the list.
listmul (num qty, num val [, num a,...])
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.
Example
listmul(5,2,1,2,3,4)

This returns the value 48.
listpull (str/obj list, str/node query, num requestNum [, num requireNum, str/node/num puller, str/node/num partitionId, num flags])
Deprecated, use List.pull()
Description
This command is deprecated. Use List.pull() instead.

Pulls one or more entries from a list.
Example
listpush (str/obj list [, str/node/num pushVal, str/node/num partitionId, ...])
Deprecated, use List.push()
Description
This command is deprecated. Use List.push() instead.

Pushes an entry onto a list.
Example
listremove (obj entryOrBackOrder)
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.
Example
listsub (num qty, num val [, num a,...])
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.
Example
listsub(5,2,1,2,3,4)
listsum (num qty, num val [, num a,...])
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.
Example
listsum(5,2,1,2,3,4)
loadimage (str file, str name)
Description
For developer use. Load an image directly. An image 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 images. Each image has a corresponding name and an index. This command will return the index corresponding to the loaded image.
Example
loadimage("c:/myimage.bmp","myimage")
loadselectedfromfile (obj highlightedobj)
Description
For developer use. Loads previously saved tree file into the highlighted object.
Example
loadselectedfromfile(selectedobject(ownerview(c)))
loadsound (str path+filename)
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.
Example
int applauseindex = loadsound("c:/My Music/APPLAUSE.WAV");
loadstate ()
Description
For developer use. Loads the state of the project. If savestate() has been executed, then this command must be executed before you can run the model again.
Example
loadstate();
loadthreedobject (str file, str name)
Description
For developer use. Load a 3D model directly. A shape 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 shapes. Each shape has a corresponding name and an index. This command will return the index corresponding to the loaded shape.
Example
loadthreedobject("c:/myshape.wrl","myshape")
loaduserlibrary (str libfile [, obj libraryview, num reloadmedia, num changeitemcurrent, num autoinstall])
Description
For developer use. Loads a library from the path specified in libfile. If reloadmedia is true, autoloadallmedia() will be called after loading the library. If autoinstall is true, the library's load and new model autoinstall objects will be added to the model. The libraryview and changeitemcurrent parameters are no longer used.
Example
loaduserlibrary(cdir() + "libraries/mylib.fsl");
local (num index)
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.
Example
setnodenum(local(1),4);
Sets the 1st variable in the localarray to 4.
localarray (num qty[, num datatype])
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.
Example
localarray(1,4)
log (num value)
Deprecated, use Math.log()
Description
This command is deprecated. Use Math.log() instead.

Natural Logarithm of value.
Example
log10 (num value)
Deprecated, use Math.log10()
Description
This command is deprecated. Use Math.log10() instead.

Base-10 Logarithm of value.
Example
logarithmic (num theta[, num stream])
Returns a random sample from a logarithmic distribution
Description
Generates a discrete random variate from a logarithmic distribution with parameters as defined.
Example
logevent (num/str index/name[, obj object, obj involved, num p1, num p2, num p3, num p4])
Description
Logs an event as an entry in the Event Log. Use the name passed into registereventtype() or the index returned by registereventtype().
Example
logevent("MyEventType",current,item,port);
logistic (num location, num scale[, num stream])
Returns a random sample from a logistic distribution
Description
Generates a continuous random variate from a logistic distribution with parameters as defined.
Example
loglaplace (num location, num scale, num shape[, num stream])
Returns a random sample from a log laplace distribution
Description
loglaplace( γ, β, α, stream ) is a non-negative continuous probability distribution.

Inputs:
γ is the location parameter ∈ ( - ∞, ∞ )
β is the scale parameter ( β > 0 )
α is the shape parameter ( α > 0 )
stream is a reference to one of FlexSim's random number streams {0,1,2,...}

Outputs:
range = ( γ , ∞ )
mean = γ + βα² ( α²− 1) for α > 1
variance = β²α² ( 2α² + 1 ) ( α² - 1 )² ( α² - 4 ) for α > 2

Probability Density Functions:



Possible Applications:
Rarely used in defining processing times.

Comments:
This distribution is also known as the double-exponential distribution because its density curve is essentially two exponential curves back-to-back.
Example
loglaplace(0, 2, 8, 5);

A loglaplace distribution with a location parameter of 0, a scale parameter of 2, a shape parameter of 8, and random stream number 5.
loglogistic (num location, num scale, num shape[, num stream])
Returns a random sample from a log logistic distribution
Description
loglogistic(γ, β, α, stream) is a non-negative continuous probability distribution.

Inputs:
γ is the location parameter ∈ ( - ∞, ∞ )
β is the scale parameter ( 0, ∞ )
α is the shape parameter ( 0, ∞ )
stream is a reference to one of FlexSim's random number streams {0,1,2,...}

Outputs:
range = ( γ, ∞ )
mean = γ + β(πα)csc(πα) for α > 1
variance = β²(πα){2csc(2πα) − (πα)[csc(πα)]²} for α > 2

Possible Applications:
Used to model the time to perform some task.
Example
loglogistic(0, 1, 2, 5);

A loglogistic distribution with a location (shift) of 0, a scale of 1, a shape factor of 2 and random stream number 5.
lognormal (num location, num normalmean, num normalstdev[, num stream])
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.
Example
lognormal2 (num location, num scale, num shape[, num stream])
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.

Example
double cycletime = lognormal2(0, 29.8, 0.31, 5);

Set the cycletime variable to a lognormal2 distribution with location parameter 0, scale parameter 29.8, shape parameter 0.31, and random stream number 5.
lognormalmeanstdev (num mean, num stdev[, num stream])
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.
lt (num value1, num value2)
Deprecated, use the < operator
Description
This command is deprecated. Use the < operator instead.
Example
main ()
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"
Example
main()
maintenance (num command[, num state, str strparam])
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
Example
maintenance(0)
maintree ()
Reference to the main tree
Description
Returns a reference to the main tree. When defining string paths to nodes in the main tree, MAIN can be used as in the following example node("MAIN:/project/exec/globals/cppfunctions");
Example
maintree().find("project/exec/globals/cppfunctions");
makeactive (obj viewwindow)
Description
For developer use. Makes the specified window active.
Example
makeactive(ownerview(c));
makearray (num qty)
Deprecated, use the Array class
Description
This command is deprecated. Use Array(qty) instead. Array array = Array(4);

Initializes a local array.
Example
makehisto (obj datalist, obj histocontainer, num nrofbuckets)
Description
For developer use. Builds a histogram structure from the data list and puts it in the destination container node with the given number of buckets. This is similar to graphtohistogram() except that this command creates a more complete structure. To illustrate the operator instead., view a FlexSim object's attribute tree. The makehisto command will create the entire stucture of object>stats/staytime/staytimehisto, whereas graphtohistogram will only populate object>stats/staytime/staytimehisto/data. makehisto also assumes a standard, y data series structure, meaning each sub-node of datalist is its own data point (they are not paired as x/y values).
Example
makehisto(c.find("@>objectfocus+"), c.find(">histogram"), 20)
max (num value1, num value2)
Deprecated, use Math.max()
Description
This command is deprecated. Use Math.max() instead.

Gets the maximum of value1 and value2.
Example
maxof (num value1, num value2)
Deprecated, use Math.max()
Description
This command is deprecated. Use Math.max() instead.

Gets the maximum of value1 and value2.
Example
mediafile (str filename)
Description
This command will search (by default in fs3d folder) for the filename and returns the full path plus filename if found.
Example
string fullpath = mediafile("fs3d\\queue_n_color.3ds");

This example will return the string "C:\\Program Files\\Flexsim4\\fs3d\\queue_n_color.3ds"
mediapath (str projectpath, str filepath, int mode)
Description
Returns strip of the project pathfile from filepath to make it relative, where mode denotes as 1=default, 2=getfile, 3=getpath.
Example
int mode = 1; mediapath("C:\\Program Files\\Flexsim4\\program", "C:\\Program Files\\Flexsim4\\fs3d\\operator.3ds", mode);

If mode=1, returns "program"
If mode=2, returns "C:\Program Files\Flexsim4\"
If mode=3, returns "C:\Program Files\Flexsim4\fs3d\operator.3ds"
mediareset ()
Description
For developer use. Unload all media. This will unload all currently loaded media from FlexSim: images; shapes; and sounds.
Example
mediareset()
memberadd (obj childobject, str parentname, num type)
Description
If type = 1, then the childobject is added as a member to a Time Table named "parentname".
If type = 2, then the childobject is added as a member to a MTBFMTTR object named "parentname".
This is useful for dynamically assigning operators to different shifts for instance.
Example
memberadd(model().subnodes[2],"TimeTable1",1)
memberremove (obj childobject, str parentname, num type)
Description
If type = 1, then the childobject is removed as a member from a Time Table named "parentname".
If type = 2, then the childobject is removed as a member from a MTBFMTTR object named "parentname".
see memberadd()
Example
memberremove(model().subnodes[2],"TimeTable1",1)
memberremoveall (str parentname, num type)
Description
If type = 1, then all members are removed from a Time Table named "parentname".
If type = 2, then all members are removed from a MTBFMTTR object named "parentname".
see memberremove()
Example
memberremoveall("TimeTable1",1)
mergegetlanestate (obj mergeController, num laneNum)
Description
Deprecated, use Conveyor.MergeController class.
Example
mergegetlanestate(current, 5)
mergegetnumlanes (obj mergeController)
Description
Deprecated, use Conveyor.MergeController class.
Example
mergegetnumlanes(current)
mergeislaneclear (obj mergeController, num laneNum)
Description
Deprecated, use Conveyor.MergeController class.
Example
mergeislaneclear(current, 5)
mergereleaselane (obj mergeController, num laneNum)
Description
Deprecated, use Conveyor.MergeController class.
Example
mergereleaselane(current, 1)
mesh (node meshnode, int pervertexattribs, int flags)
Creates an empty mesh and assigns it to meshnode
Description
Creates an empty mesh and assigns it to meshnode. The pervertexattribs takes a bit-wise ORed combination of the following attributes:
MESH_POSITION (Added by default)
MESH_TEX_COORD2
MESH_NORMAL
MESH_DIFFUSE
MESH_DIFFUSE4
MESH_AMBIENT_AND_DIFFUSE
MESH_AMBIENT_AND_DIFFUSE4

Flags can be any of the following:
MESH_STATIC_DRAW
MESH_DYNAMIC_DRAW
MESH_INDEXED
Example
mesh(Model.find("mesh"), MESH_NORMAL | MESH_DIFFUSE, MESH_STATIC_DRAW)
meshaddindex (node meshnode, int index)
Adds an indexed vertex to a mesh
Description
Adds an indexed vertex to the mesh associated with meshnode. This command is ignored if the mesh does not have a MESH_INDEXED flag.
Example
int newindex = meshaddindex(node("/mesh",model()), 4)
meshaddvertex (node meshnode)
Adds a vertex to a mesh
Description
Adds a vertex to the mesh associated with meshnode.
Returns the index of the added vertex.
Example
meshaddvertex(Model.find("mesh"))
meshdraw (node meshnode, int drawmode, int offset, int count [, int stride])
Draws a mesh
Description
Draws the mesh associated with meshnode. The value for drawmode can be any of the following:
GL_POINTS
GL_LINES
GL_LINE_LOOP
GL_TRIANGLES
GL_TRIANGLE_STRIP
GL_TRIANGLE_FAN

Offset specifies which vertex index to begin at. Count specifies how many vertexes to set the drawmode. Stride specifies how many vertex indexes to skip between.

For an indexed meshed, stride is ignored.
Example
meshdraw(node("/mesh",model()), GLTRIANGLES, 0, 3, 0)
meshinfo (node meshnode, int type[,int index, int param])
Gets the specified information from a mesh
Description
Gets the specified information from the mesh associated with meshnode. Index is the index of the requested vertex (base 0). Type is specified as one of the following for the mesh (index and param ignored):
MESH_PER_VERTEX_ATTRIBS
MESH_PER_MESH_ATTRIBS
MESH_FLAGS
MESH_NR_VERTS
MESH_GET_INDEX - Returns the vertex index for the given index (only valid with MESH_INDEXED flag)

The following are vertex specific types:
MESH_POSITION
MESH_TEX_COORD2
MESH_NORMAL
MESH_DIFFUSE
MESH_DIFFUSE4
MESH_AMBIENT_AND_DIFFUSE
MESH_AMBIENT_AND_DIFFUSE4

If specifying a vertex, the following are valid for param:
MESH_COLOR_RED
MESH_COLOR_GREEN
MESH_COLOR_BLUE
MESH_COLOR_ALPHA
MESH_POS_X
MESH_POS_Y
MESH_POS_Z
MESH_TEX_S
MESH_TEX_T
Example
double xposition = meshinfo(Model.find("mesh"), MESH_POSITION, 6, MESH_POS_X)
meshsetattrib (node meshnode, int attribid, double param1 [, double param2, double param3, double param4])
Adds/sets the value of attribid to the vertindex of a mesh
Description
Sets the value of attribid to be applied to the entire mesh associated with meshnode. The following attributes can be used as the attribid:
MESH_NORMAL
MESH_AMBIENT
MESH_DIFFUSE
MESH_DIFFUSE4
MESH_AMBIENT_AND_DIFFUSE
MESH_AMBIENT_AND_DIFFUSE4
MESH_SPECULAR
MESH_SHININESS
MESH_EMISSIVE
Example
meshsetattrib(Model.find("mesh"), 1, MESH_DIFFUSE4, 1, 0, 0, 1)
meshsetvertexattrib (node meshnode, int vertindex, int attribid, double param1 [, double param2, double param3, double param4])
Sets the value of attribid at the vertindex of a mesh
Description
Sets the value of attribid at the vertindex of the mesh associated with meshnode. The following attributes can be used as the attribid:
MESH_POSITION
MESH_TEX_COORD2
MESH_NORMAL
MESH_DIFFUSE
MESH_DIFFUSE4
MESH_AMBIENT_AND_DIFFUSE
MESH_AMBIENT_AND_DIFFUSE4

Note: The attribid must be defined previously when creating the mesh.
Example
mesh(Model.find("mesh"), MESH_NORMAL | MESH_DIFFUSE4, MESH_STATIC_DRAW)
meshsetvertexattrib(Model.find("mesh"), 1, MESH_DIFFUSE4, 1, 0, 0, 1)
min (num value1, num value2)
Deprecated, use Math.min()
Description
This command is deprecated. Use Math.min() instead.

Gets the minimum of value1 and value2.
Example
minof (num value1, num value2)
Deprecated, use Math.min()
Description
This command is deprecated. Use Math.min() instead.

Gets the minimum of value1 and value2
Example
minutes (num minutes)
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.
model ()
Reference the model's root node
Description
This command returns a reference to the model node in the main tree. It is used as a fast way of referencing the model.
Example
treenode SourceObj = Model.find("Source1");

This sets the variable SourceObj so that it references the node called Source1 in the model.
modeldir ()
Gets the path to the currently open model's directory
Description
Returns that path of the currently open model's directory.
Example
modeldir();
modeleditmode (num/str mode)
Description
For developer use. Sets the current model edit mode. You can query the current mode with -1.
Example
modeleditmode("AConnect");
module (num type, node libnode)
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)
Example
module(MOD_UNLOAD,main.find("project/exec/dll/1"))
moveobject (obj object, obj location[, num outport])
Moves object to the specified location
Description
This command moves the object to the specified location through the specified port. The specified port does not have to actually exist, this value is used by the receiving location to be able to reference the port the object came in through. When an object moves into location, the OnReceive event function of location is executed. This includes the OnEntry trigger function. Explicitly calling this on a flowitem with events queued up for it may cause problems. Only use when you know that no events are pending for the object being moved.
Example
moveobject(current.first,current.centerObjects[1]);

This moves the first object that is inside the object referenced by current to the object connected to current's first center port.
moveselectedintohighlighted (obj highlightedobj [, node selectedcontainer])
Description
For developer use. Moves all selected objects in the model into the highlighted object.
Example
moveselectedintohighlighted(selectedobject(ownerview(c)))
movetablecol (str/num/node table, num column, num newcolumn)
Deprecated, use Table.moveCol()
Description
This command is deprecated. Use Table.moveCol(). instead.

Moves a column of a table to newcolumn.
Example
movetablerow (str/num/node table, num row, num newrow)
Deprecated, use Table.moveRow()
Description
This command is deprecated. Use Table.moveRow(). instead.

Moves a row of a table to newrow.
Example
movetasksequence (obj tasksequence, obj dispatcher)
Moves tasksequence into the dispatcher's tasksequence queue
Description
This command is deprecated. Use TaskSequence.move() instead. Moves the specified tasksequence into the specified dispatcher's tasksequence queue.
WARNING!! This command should never be called on a tasksequence that is already being executed by a TaskExecuter.
Example
movetasksequence(tasksequence, current.centerObjects[1]);
mpd (num value)
Print an integer to the system console
Description
Prints the integer value to the system console
Example
mpd(6);
mpf (num value)
Print a floating point value to the system console
Description
Prints the floating point value to the system console.
Example
mpf(7.69);
mph (num milesperhour)
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)
mpr ()
Print a new line to the system console
Description
Prints a new line to the system console
Example
mpr();
mpt (str printvalue)
Print text to the system console
Description
Prints the text printvalue to the system console.
Example
mpt("System console printout");
msg (str caption, str text [, num buttontype])
Display a message dialog
Description
This command creates a message box with a title bar displaying the caption and the text written inside the box. The buttons displayed on the message box are based on the value for buttontype. If OK or Yes are pressed, msg() returns 1. If No is pressed, msg() returns 0. The value returned when Cancel is pressed depends on the buttontype. If buttontype is 3, Cancel returns -1; otherwise it returns 0. If buttontype is not specified, it is assumed to be 0.

Values for buttontype:
0 - OK, Cancel
1 - OK
2 - OK, Cancel
3 - Yes, No, Cancel
4 - Yes, No
Example
if (msg("Finished", "Close the database?") == 1)
dbclose();
msgparam (num param)
Within an OnMessage trigger, get the value of a message parameter
Description
Returns a parameter passed to with the Object.message() method or sendmessage() or senddelayedmessage() commands. Only used in OnMessage triggers.
Example
int msgtype = msgparam(1);
treenode item = msgparam(2);
Array data = msgparam(3);
msgsendingobject ()
Within an OnMessage trigger, get a reference to the object sending the message
Description
Returns a reference to the object that sent the message as defined in the Object.message() method or sendmessage() or senddelayedmessage() command. Only used in OnMessage triggesr.
Example
treenode sender = msgsendingobject;
mul (num value1, num value2)
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.
Example
double product = mul(3,4);
multisorttable (str/node/num table, num col1[, num col2, num col3, ...])
Deprecated, use Table.sort()
Description
This command is deprecated. Use Table.sort() instead.

Sorts the table by each column (ascending for positive columns, descending for negative columns).
Example
nametomodelpath (obj node, obj object)
Deprecated, use treenode.getPath()
Description
This command is deprecated. Use treenode.getPath() instead.

Sets the name of a node to the path of the object relative to the model.
Example
nametomodelpath(curlistnode, current);
ncols (node thenode)
Deprecated, use Table.numCols
Description
This command is deprecated. Use Table.numCols instead.

Example
ne (num/node value1, num/node value2)
Deprecated, use the != operator
Description
This command is deprecated. Use the != operator instead.
Example
negbinomial (num successes, num prob[, num stream])
Returns a random sample from a negative binomial distribution
Description
Generates a discrete random variate from a negative binomial distribution with parameters as defined.
Example
netnodefromrank (num rank)
Returns the network node member at rank rank
Description
Takes a network node member rank and returns the actual reference to the network node.
Example
treenode netnode = netnodefromrank(5);
node (str relativepath[, obj startnode])
Deprecated, use treenode.find()
Description
This command is deprecated. Use treenode.find() instead.

Reference a node by named path from a root node.
Example
nodeadddata (node thenode, num type:num/str/ptr/obj)
Deprecated, use treenode.value or treenode.dataType
Description
This command is deprecated. Use treenode.value or treenode.dataType instead.

Add data to thenode, ie DATATYPE_NUMBER.
Example
nodebreak (node a)
Description
For developer use. Breaks a coupling pointer on a node that has coupling data that is pointing to another node. If the node is part of a bi-directional coupling, the other coupling is not affected.
Example
nodebreak(so())
nodedeldata (node thenode)
Deprecated, use treenode.value or treenode.dataType
Description
This command is deprecated. Use treenode.value or treenode.dataType instead.

Removes all data from the node.
Example
nodefromwindow (num window)
Description
For developer use. Get the node of a window handle
Example
nodefromwindow(windowfromnode(sv()))
nodefunction (node thenode [, par1, par2, ... par10])
Description
For developer use. This command executes a function that is defined on thenode. Thenode must be toggled as either a C++ node or a Flexscript node. If the node is C++, the model must be compiled before calling this command. Any parameters that need to be passed to the function are passed as par1, par2, etc. Up to 10 parameters may be passed. The values that are passed using this command must all be numbers, but can then be accessed and recast from within the function called using the command param(x) where x is the number of the parameter.
Example
nodefunction(node_v_entrytrigger,tonum(item),portnum);
nodefunctionlisten (node theNode, node relayNode[, num flags, par1, par2, ... par10])
Description
For developer use. This command will create a listening mechanism where whenever nodefunction() is called on theNode, relayNode will also be executed. flags is a bitwise mask of one of the following values:
NFL_PRE_LISTEN: The listening function will be called before theNode is called.
NFL_LISTEN: (default) The listening function will be called after theNode is called.
NFL_PERSIST: The listener will persist across model resets.
NFL_PASS_THROUGH_PARAMS: When theNode is called, the parameters passed into that function will also be "passed through" into the listening node. In this case, par1, par2, etc. are not used.
When the listening node is called, if it returns NFL_STOP_LISTENING, the listener mechanism will be removed and the listening node will no longer be called. The return value is a reference to a node associated with the listening. If this node is later deleted, the listening mechanism will stop.
Example
nodefunctionlisten(getvarnode(current, "entrytrigger"), current.entrylistener);
nodeinsertafter (node targetnode)
Creates a new node immediately after targetnode
Description
This command creates a new node in the tree immediately after the targetnode. The new node has no data attached to it. Data is attached using the nodeadddata() command. Any node in the tree can be passed as targetnode.
Example
nodeinsertafter(item.find(">labels").last).dataType = DATATYPE_NUMBER;

This creates a new label on the object referenced by item that holds number data.
nodeinsertinto (node containernode)
Deprecated, Creates a new node inside containernode
Description
This command is deprecated. Use treenode.subnodes.add()
Example
nodejoin (node a, node b)
Description
For developer use. Join two pointer nodes to form a bi-directional coupling. A bi-directional coupling in FlexSim is a pair of nodes who's data points to each other. FlexSim automatically manages the coupling. If either one of the endpoints is deleted or nullified, FlexSim cleans up to prevent dangling pointers. The two nodes a and b must have coupling data.
Example
nodejoin(so(),so().next)
nodepoint (node a, node b)
Deprecated, use treenode.value
Description
This command is deprecated. Use treenode.value. instead.

Points node a to node b.
Example
nodetomodelpath (node thenode [, num nameflag=1])
Deprecated, use treenode.getPath()
Description
This command is deprecated. Use treenode.getPath() instead.

Returns the text path of thenode from the model.
Example
nodetopath (node thenode [, num nameflag=0])
Deprecated, use treenode.getPath()
Description
This command is deprecated. Use treenode.getPath() instead.

Returns the text path of thenode.
Example
normal (num mean, num stddev[, num stream])
Returns a random sample from a normal distribution
Description
normal(μ, σ, stream) is an unbounded continuous probability distribution.

Inputs:
μ is the location parameter ∈ ( - ∞, ∞ )
σ is the scale parameter ( 0, ∞ )
stream is a reference to one of FlexSim's random number streams {0,1,2,...}

Outputs:
range = ( - ∞, ∞ )
mean = μ
variance = σ²

Probability Density Functions:



Possible Applications:
Used to model various types of error such as machined hole diameters for large quantities of parts. This distribution is not used much in simulation because variance found in real processes do not typically follow a symmetric distribution such as this.

Comments:
The normal distribution is completely symmetric meaning values below the mean have the same probability for occurance as values above the mean. The mode and mean are equal for the normal distribution. When using this distribution, be aware that negative values can be returned, and therefore truncating the distribution at 0 may be necessary as shown in the example below.
Example
double thickness = Math.max(0.001, normal(5, 1.2));

The thickness is set a normal distribution having a mean of 5 and a standard deviation of 1.2 that is truncated for values less than 0.001. No random stream has been declared, so the default stream number 0 will be used to generate variates from the distribution.
not (num/node value1)
Deprecated, use the ! operator
Description
This command is deprecated. Use the ! operator instead.
Example
notifylinecontroller (node object, int controllernum, num output, num sendinglast [0/1])
For Dynamo use
Description
For Dynamo use. Informs a LineController connected to the object that material has left the line so the Controller can decide if the run is complete. The number of the LineController to be notified is the contollernum parameter. The object should report how much material (of any kind) has left it since the model began running and whether or not the material leaving is the last material in the object.
Example
notifylinecontroller(current,1,current.stats.output + 1,(current.subnodes.length == 1));
nrcp (obj object)
Deprecated, use Object.centerObjects.length
Description
This command is deprecated. Use Object.centerObjects.length instead.

Number of center ports of object.
Example
nrip (obj object)
Deprecated, use Object.inObjects.length
Description
This command is deprecated. Use Object.inObjects.length instead.

Number of input ports of object
Example
nrop (obj object)
Deprecated, use Object.outObjects.length
Description
This command is deprecated. Use Object.outObjects.length instead.

Number of output ports of object.
Example
nrows (node thenode)
Deprecated, use Table.numRows
Description
This command is deprecated. Use Table.numRows instead.

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.
Example
ntravelto(current, 0, 5, 8, 0, 1, 1, 1, 0, 1)
ntraveltoupdate (obj object)
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.
Example
ntraveltoupdate(current)
numconnections ()
Gets the number of server connections that are currently active
Description
Returns the number of server connections that are currently active.
Example
int numconns = numconnections();

Sets the numconns variable to the number of server connections that are currently active.
numtostring (num value[, num width, num precision])
Deprecated, use string.fromNum()
Description
This command is deprecated. Use string.fromNum() (static method) instead.

Converts value to a string.
Example
objectconnect (obj object1, obj object2)
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.
Example
connect(so(),so().next)
objectexists (obj object)
Check if an object exists
Description
If you're trying to test if an object exists when using dot syntax you can omit the objectexists. For example, if (current.labels["MyLabel"]) or if (current.next).

This command returns true (1) if the object specified as object exists in the tree. If the object does not exist, this command returns false (0).
Example
if (objectexists(next(current)))
{
moveobject(item, next(current), 1);
}

This checks to see if there is an object in the tree after current. If there is, the object referenced by item is moved into it through port number 1.
objectshapecode (obj object)
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.
Example
objectshapecode(so())
objectsoundcode (obj object)
Gets the index of object's default sound
Description
Get the index of the object's default sound. The media list of FlexSim will keep a list of all loaded sounds. Each sound has a corresponding name and an index. This function will return the index corresponding to the objects default sound assuming the object has a sound and soundindex attribute (default objects do not at this time)
Example
objectsoundcode(current)
objecttexcode (obj object)
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).
Example
objecttexcode(current)
opavailable (obj object, num outputportnum)
Description
Returns a 1 if the downstream object through the specified object's output port is available. Particularly, it checks if the downstream object exists, if it is stopped, if its input is open, and if the connected input port is open. This function returns 0 if the downstream object isn't available.
Example
opavailable(current,1)
openallip (obj object)
Open all input ports of object
Description
Open all input ports of object. If an input port has a pass-through state as a result (both connected ports are open), both objects will be sent a notification message that the port has become "ready". The object with the input port will receive an OnInOpen message and the object with an output port will receive an OnOutOpen message. During traversal of the ports, any given port will only allow pass-through evaluation once. Modelers should only use this command when working with fluid objects because the internal behavior of discrete objects controls the opening and closing of their ports, and therefore this command may be overridden. For discrete objects the modeler is referred to openinput() and resumeinput().
Example
openallip(current)
openallop (obj object)
Open all output ports of object
Description
Open all output ports of object. If an output port has a pass-through state as a result (both connected ports are open), both objects will be sent a notification message that the port has become "ready". The object with the input port will receive an OnInOpen message and the object with an output port will receive an OnOutOpen message. During traversal of the ports, any given port will only allow pass-through evaluation once. Modelers should only use this command when working with fluid objects because the internal behavior of discrete objects controls the opening and closing of their ports, and therefore this command may be overridden. For discrete objects the modeler is referred to openoutput() and resumeoutput().
Example
openallop(current)
openflexsimchart ([str filename1] [,str filename2])
Deprecated
Description
This command is deprecated.
Example
openglcolor (num red {0-1}, num green {0-1}, num blue {0-1}, num opacity {0-1})
Deprecated, use fglColor()
Description
This command is deprecated. Use fglColor() instead.
Example
opengllighting (num on/off)
Deprecated, use fglEnable(GL_LIGHTING) and fglDisable(GL_LIGHTING)
Description
This command is deprecated. Use fglEnable(GL_LIGHTING) and fglDisable(GL_LIGHTING) instead.
Example
openinput (obj object)
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().
Example
if (current.subnodes.length < maxcontent)
openinput(current);
openip (obj object, num inputportnum)
Open one input port of object
Description
Open just inputportnum of object. Opening an input port of an object will allow entry to the object through that port. Modelers should only use this command when working with fluid objects because the internal behavior of discrete objects controls the opening and closing of their ports, and therefore this command may be overridden. For discrete objects the modeler is referred to openinput() and resumeinput().
Example
openip(so(),1)
opennodeedge (obj networknode, num edgenum)
Opens entry to the networknode's edge
Description
Opens entry to the networknode's specified edge number. Closing a node's edge with closenodeedge() blocks travelers from entry onto the edge. This command opens the edge up again.
Example
opennodeedge(current.centerObjects[1], 3);

Opens node edge 3 of a NetworkNode connected to center port 1 of the current object.
openop (obj object, num outputportnum)
Open one output port of object
Description
Open just outputportnum of object. Opening an output port of an object will allow exiting from the object through that port. Modelers should only use this command when working with fluid objects because the internal behavior of discrete objects controls the opening and closing of their ports, and therefore this command may be overridden. For discrete objects the modeler is referred to openoutput() and resumeoutput().
Example
openop(so(),1)
openoutput (obj object)
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().
Example
if (current.subnodes.length > mincontent)
openoutput(current);
opipno (obj object, num outputportnum)
Input port number that is connect to outputportnum of object
Description
This command returns the input port number that is connected to outputportnum of object.
Example
int otherport = opipno(current,1);

This sets otherport to the number of the input port that current's first output port is connected to.
opopen (obj object, num outputportnum)
Description
Returns a 1 if the outputportnum on object is open. Otherwise returns zero.
Example
opopen(current,1)
opready (obj object, num outputportnum)
Description
Returns a 1 if the outputportnum of object is open and the connecting input port of the other object is also open. Otherwise a 0 is returned. This command does not take into consideration whether or not the output of this object or the input of the connecting object are currently open.
Example
opready(current,1)
optimizenetwork ()
Causes the model's network navigator to regenerate its distance table
Description
Causes the model's network navigator to regenerate its distance table.
Use this command if you are dynamically connecting edges in your network during the simulation run.
This may take several seconds to do for large networks.
Example
optimizenetwork()
or (num/node condition1, num/node condition2)
Deprecated, use the || operator
Description
This command is deprecated. Use the || operator instead.
Example
outobject (obj object, num outputportnum)
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.
Example
outputopen (obj object)
Returns 1 if the object's output is open, 0 otherwise
Description
Returns 1 if the object's output is open, 0 otherwise. The closeoutput(), stopoutput(), openoutput(), and resumeoutput() commands affect the return value of this command. The commands like closeop() and closeallop() do NOT affect the return value.
Example
if(outputopen(current)) current.output.close;

If the output is open for the current object, then close the output.
outputtreecontent (node containernode, str path+filename)
Writes the data of all nodes in the tree under containernode to a text file
Description
Writes the data of all nodes in the tree under containernode to a text file on disk. If file does not exist, it will be created. For more functionality, use menu option: Stats | Model Documentation.
Example
outputtreecontent(model(),"C:/MyModelDocumentation.txt")
ownerobject (node thenode)
Gets the object that "owns" the executing node, usually the current object
Description
This command returns the node with object data attached to it that is the start of the sub-tree that thenode is in. In other words, it returns the object node that contains thenode. The result of this command is cached on thenode, so that subsequent calls to ownerobject(thenode) do not search in the tree, but return the cached result. If thenode subsequently changes parent, ownerobject(thenode) will return the cached result.

This command is used in most code fields and trigger fields to set the access variable current. In these fields, c references the node that contains the code, and ownerobject(c) references the object that "owns" that node.

Example
string objname = ownerobject(c).name;

This sets objname to the name of the object that contains the node referenced by c. The c usually refers to the node where the code is being written.

treenode current = ownerobject(c);

This example is present in most code fields in FlexSim, and retrieves access to the "current" object.
ownerview (obj viewobj)
Description
For developer use. Get the topmost node of a view structure.
Example
ownerview(sv())
param (num index)
Gets a parameter passed into a function
Description
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), string, int, double, stringarray, intarray, doublearray or treenodearray. The first additional parameter passed to nodefunction() is parameter 1, the second is parameter 2, etc.
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 = param(1);
Other examples include:
double quantity = param(2);
var value = param(1); //In this example value could be used as any type
pareto (num min, num scale[, num stream])
Returns a random sample from a pareto distribution
Description
Generates a continuous random variate from a pareto distribution with parameters as defined.
Example
parg ()
Description
This command is deprecated.
Example
parg()
parnode (num index)
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.
<