What is new—EB GUIDE Script functions part I
Markus Schnell is a Project Manager within the EB GUIDE team. This blog post is the first part of a two-part series and concentrates on scripts for math functions, fonts and labels, and images. Part II will introduce further script functions for reading items from the JSON configuration, versioning, and focus management.
One of the many strengths of EB GUIDE is its own domain-specific scripting language EB GUIDE Script.
EB GUIDE Script has a lot of built-in functions especially tailored towards creating stunning HMIs.
Users of EB GUIDE can also easily extend EB GUIDE Script by supplying functions written in C++ that are seamlessly integrated in EB GUIDE Studio.
New script functions in 6.7
We want to give you a short overview about the set of built-in script functions that we added to EB GUIDE 6.7 to make your life easier:
Convenience math functions
One of the most common things to do in scripts is calculating positions of elements in the view.
This is just one case that directly comes to mind when thinking about where the additional math convenience functions could ease your daily work. The following table is showing the math functions that we added this release:
lerp | clamps a floating-point value to the [0, 1] range (linear interpolation). |
smoothstep | computes the smooth Hermite interpolation. |
frac | retrieves the fractional part of a floating-point value. |
fmod | retrieves the remainder of a floating-point division x/y. |
mini | returns the minimum of two integer values. |
maxi | returns the maximum of two integer values. |
minf | returns the minimum of two floating-point values. |
maxf | returns the maximum of two floating-point values. |
clampf | clamps a floating-point value to a defined range. |
clampi | clamps an integer value to a defined range. |
saturate | clamps a floating-point value to the range [0, 1]. |
Fonts and labels
Positioning text depending on font attributes or with variable text length is one very common goal that almost every HMI needs to achieve. We added several functions to make this easy for you:
getLineHeight | returns the height of a line written with a specific font. |
getFontAscender | returns the ascender of a font. |
getFontDescender | returns the descender of a font. |
getFontLineGap | returns the line gap defined in a font. |
getLabelTextWidth | returns the width of the longest line of a label’s text. |
getLabelTextHeight | returns the total height in pixels of a label’s text. |
Images
Another very common use case would be displaying images that are in a folder on your device. Until now, you needed to write an own custom script function to retrieve the dimensions of the images if you wanted to use the dimensions in the layout.
These functions are now included in EB GUIDE 6.7:
getImageWidth | returns the width in pixels of an image. |
getImageHeight | returns the height in pixels of an image. |
Start modeling now!
As always, we are constantly looking for ways to improve the tool.
Download the latest version of the tool, try it out, and send us your feedback.
Also, do not forget to visit our Resources section to download examples, review tutorials, and read user documentation.
As always, get in touch with us if you have questions or feedback.