3.6.1. Defining a Scheme Variable in the Text Interface

To define a scheme variable named pres_av/thread-id in the text interface, you can use the following scheme command:

   (rp-var-define ’pres_av/thread-id 2 ’integer #f) 

This will create the scheme variable as an integer type and assign it the initial value 2. Your scheme variable and its value will be saved and restored with the case file.

Before you define a scheme variable, it is often good practice to check that the variable is not already defined. You can do this by typing the following command in the text window:

  (if (not (rp-var-object ’pres_av/thread-id))
   (rp-var-define ’pres_av/thread-id 2 ’integer #f)) 

This command first checks that the variable pres_av/thread-id is not already defined, and then sets it up as an integer with an initial value of 2.

Note that the string ’/’ is allowed in Scheme variable names (as in pres_av/thread-id), and is a useful way to organize variables so that they do not interfere with each other.


Release 18.2 - © ANSYS, Inc. All rights reserved.