Paul Toone avatar image
Paul Toone posted

Sampler Concepts   


The Sampler is a new feature in Version 7. The Sampler is a referencing tool and is convenient for referencing objects, their variables, labels or other properties. It eliminates some need for writing code and makes model building faster and easier.

The Sampler can be used to sample or reference various things throughout FlexSim, including:

  • Nodes/Objects
  • Numbers
  • Colors
  • 3D Shapes
  • Images
  • Paths
  • Strings

When referencing through the Code Edit window or through picklists, the Sampler will insert correct code for you.

The Sampler is context sensitive, so it will only allow you to sample things in FlexSim that are valid. For instance, if you're trying to specify the Process Time of a Processor, the Sampler will only give you options that return numerical values, like the getlabel(), gettablenum, or getvarnum commands. If you are trying to reference an object for the Use Transport option of a FixedResource object, the Sampler will only sample objects and return values like centerobject(current, 1), node("/Operator1", model()).

You can even set values like a label from a Flowitem if it fits the context, simply by sampling the object and choosing the appropriate label from the list.

The Sampler is capable of sampling values from the 3D view as well as in Object Properties Windows, Quick Properties, Tree Windows and other windows throughout FlexSim.

You'll find the Sampler in many places throughout the interface. Below is a picklist option for a Processor's Process Time:

Using the Sampler

To use the Sampler, you simply left-click once on the to enter "Sample Mode". As you move the mouse over objects and fields, the mouse will display available options based on the current context. If an object has no valid data for the current context, no options will be displayed.

If more than one option is available, a menu will appear allowing you to select the code you wish to use.

Highlighting Code

You can also highlight portions of code you want to change and, instead of figuring out exactly how you're going to reference it, just sample what you need.

Sampling Colors

All of the Sampling functions are restricted to within FlexSim, except for color samplers. If you want to sample a color from another application you can click on a color sampler and click on the desired color outside of FlexSim. Because the mouse is outside of FlexSim, the RGB values will not be displayed under the mouse, however, the Sampler will pull the correct color value under the mouse.


Here are a few examples of where the Sampler is used:

  • Referencing a Transporter in an object's flow.
  • Defining Setup/Process and Load/Unload Times.
  • Choosing object colors.
  • Setting object and shape frame 3D shapes.
  • Writing code in the Code Editor.
  • Referencing objects and numbers in triggers and picklists.
  • Referencing Global Table cells.

flexsim users manual
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.



paul.t contributed to this article


FlexSim 2016.1