Menu
FlexSim
  • Products
    • FlexSim
    • FlexSim HC (Healthcare)
    • + OptQuest
    • + ExpertFit
  • Applications
    • Industries
      • Manufacturing
      • Material Handling
      • Healthcare
      • Warehousing
      • Factory
      • Airport
      • Container Terminal
    • Application Areas
      • Industry 4.0
        • Digital Twin
        • PLC Emulation
      • Simulation Optimization
      • Value Stream Mapping
    • Healthcare
    • Academia / Education
      • Educational Portal
      • Students
      • Educators
      • Textbook
      • Educational Store
  • Industry 4.0
    • xMark + Industry 4.0
    • Digital Twin
    • PLC Emulation
  • Resources
    • Case Studies
      • Industrial Case Studies
      • Healthcare Case Studies
    • Blog
    • User Manual
    • Calendar
    • Videos
    • About Us
    • Newsroom
    • Store
  • Services
    • FlexSim Answers
    • Support
    • Training
    • Model Building
  • Contact
  • Account
  • Try FlexSim
Close Menu
computer-script

The Big Benefits to Syntax Changes in FlexSim 2017

General info, tool

There are some syntax changes in FlexSim 2017. Here’s a quick summary of the important stuff:

  1. We’ve made an enormous, comprehensive update to our FlexScript language.
  2. All FlexScript in models created prior to FlexSim 2017 will still execute just fine… as long as your script was correct in the first place!

Now that you’re aware of the update—and that fact that your pre-FlexSim 2017 models will still work—let’s dig a little deeper into the FlexScript syntax, something we refer to internally as “dot syntax.” We’ll cover how it works and the reasons why the change was made in the first place.

Dot syntax? What’s that?

In FlexSim 2017, scripting is more object-oriented than in previous versions, which makes the code more streamlined and intuitive. You used to define logic in FlexScript using a library of global commands; here’s what it looked like to get a label from a token in Process Flow:

getlabel(getlabel(token, “item”), “weight”);

Here’s what that looks like using dot syntax:

token.item.weight;

Little more streamlined, isn’t it? Dot syntax is focused on entities—most commonly item, token, and “current”—and they all have three important characteristics:

  • Properties, which is the data that controls aspects such as location, size, and color. Dot syntax lets you access this data.
  • Methods, which are commands that do something or change a property value (set speed, change location, etc.).
  • Labels, those dynamic, custom properties we all know and love.

So, when you see an expression written in FlexSim’s new dot syntax, it’s easy to interpret what it’s saying. The dot always means “access,” which allows you to access properties and methods associated with objects and variables. Take the following line as an example:

current.name.startsWith(“Processor”);

In this example, “current” is a reference to a 3D object we’re currently working with. A dot signifies a property we’re trying to access: the object’s name. Another dot calls a method to check if that name starts with the string “Processor.”

So why make syntax changes in FlexSim now? There are actually three critical benefits as a result of the dot syntax update.

Better, simpler scripting

As you saw in the above example, dot syntax expressions have a logical structure that’s easier to follow. It also carries a few other benefits that should improve scripting in the future. One is that dot syntax is more dynamic. Labels, which change or may not even exist during portions of a model run, used to require special treatment. Now, dynamic properties like labels work just like methods and static properties.

Expressions like token.SomeLabel.AnotherLabel? They’re possible now.

The other benefit is that the management of properties and methods (versus the old commands) just got a lot less complicated. This could empower our amazing developers to add new methods more frequently, and methods overall will require less parameters.

Simulation speed boost

That’s right, simulation runs have the potential to go much faster, and it’s a direct result of the scripting update in FlexSim 2017.

The reason? All FlexScript is now compiled to machine code and executed directly—avoiding needless interpretation makes things more efficient, leading to faster processing of simulation events.

The smartest Autocomplete yet

Finally, this change has enabled us to make some huge improvements to our built-in Autocomplete, which now provides you with a list of properties and methods to access as soon as you type a dot. You’ll also be happy to know that the Autocomplete is a little more forgiving these days—even when you misspell or are just trying to get close to a name that’s on the tip of your tongue, the closest possible matches will still appear.

It’s also smarter than ever before. Have you already declared some labels? Autocomplete will show those if they come up in the context of what you’re trying to do.

We truly believe that this update is a big step forward to helping FlexSim become the best simulation software it can possible be. Remember that if you ever need help getting familiar with dot syntax, our support team and worldwide user base can be found on FlexSim Answers and would be more than happy to help.

Related Posts

General

How to Get Better at Simulation while Helping Others

Turns out, one of the best ways to get better at simulation modeling is to give back to your fellow process improvement community members. I recently stumbled on a short post from one of the many “money advice” blogs out there. In it, the author gave an interesting recommendation on how to gain the skills […]

General

Like Learning to Ride a Bicycle

“It’s OK, right grandpa? It’s OK,” he said as tears welled up in his eyes. My five-year-old grandson was looking to me for confirmation that his crash was not a “bad one.” It was his second fall. I was beginning to worry he would either hurt himself badly or lose the nerve to keep trying. […]

General

Managing 8 Seconds

How long is eight seconds? That depends on what happens during those eight seconds. When it comes to professional bull riding, eight seconds make all the difference in the world. In today’s Professional Bull Riders (PBR) circuit, a cowboy spends a great deal of time preparing to manage just eight seconds. It’s the amount of […]

3 min read

General

All Posts

Back To Top
FlexSim
  • About
  • Privacy
© 1993- FlexSim Software Products, Inc. All Rights Reserved.
FlexSim®, FlexSim Healthcare™, Problem Solved.®, the FlexSim logo, the FlexSim X-mark, and the FlexSim Healthcare logo with stylized Caduceus mark are trademarks of FlexSim Software Products, Inc. All rights reserved.
Flexsim BBB Business Review
Dansk | English | Français | 日本語 | 한국어 | Polski | Português | Español