beautypg.com

Delta RMC151 User Manual

Page 259

background image

4 Using RMCTools

Variable Declarations
Functions can have input variables, output variables, input/output variables, and local

variables. For details, see Declaring Variables in User Functions.
Editing the Function Body
The function body contains the code that the function executes when it is called. The code

in the function body must follow the same syntax as the code used in the Expression

(113) command. For details, see the assignment expressions topic. The function body can

use all the same operators, functions, user functions, and keywords as used in

assignment expressions.
Values can be passed into and out of a function via parameters. All variables of type

Input, Output, or Input/Output that are declared in the function will be the parameters of

the function. See Declaring Variables in User Functions for more details.
The following limitations apply to the user function body:

Output variables can only be assigned to. That is, Output variables can only be used

on the left-hand side of assignment expressions.

Input variables cannot be assigned to.

Accessing Controller Tags
The code in a user function can directly reference controller tags, such as variables in the

Variable Table, axis tags, etc. However, in order to keep a user function portable between

RMCTools projects, it is good practice to limit direct referencing of controller tags and

instead pass values in and out via the Input, Output, and Input/Output function

parameters.
Function Return Value
Each function must have a return value. This is done by assigning a value to the name of

the function. For example, consider a function named Average3. The return value could

be expressed as:

Average3

:= (

Var1

+

Var2

+

Var3

) / 3;

Managing User Functions

All user functions in the project are displayed in the User Function list. To add a user
function, click the New User Function button. To delete a user function, click the
Delete User Function button.
User Functions Folders
User functions can be organized into folders in the user function list.

1. To create a new folder, click the New Folder button on the toolbar. Type the

folder name and press Enter.

2. To add new functions to the folder, select the folder, then click the New User

Function button. You can also drag existing functions into the folder with the

mouse.

Click the Delete Folder button to delete a folder and it contents.
Importing User Functions

1. Right-click in the function list pane and choose Import User Functions.
2. Browse for the user function file of type .rmcflib and click Open.
3. The user functions available in the .rmcflib file will be listed. Check the desired

functions in the file to import. The Select All and Clear All buttons may assist you.

Imported functions cannot have the same name as a user function already in the

project. These functions are labeled (duplicate). Use the Rename button to rename

a function in the import list so that it can be imported.

4. After selecting the desired user functions to import, click OK.

deltamotion.com

239

This manual is related to the following products: