2.14. Other Useful Functions

The program has several miscellaneous functions that you may find useful for working with UPFs:

  • The erhandler subroutine displays output messages (notes, warnings, and errors).

  • The RunCommand function lets you issue a command from within a user subroutine.

  • The GetStackDisp subroutine retrieves current displacement values.

  • The /UNDO command writes an "undo" file at critical points as a user subroutine executes.

  • The /HOLD command allows you to synchronize multiple tasks.

For further descriptions of erhandler, see Subroutines for Your Convenience. For details about the GetStackDisp function, see Function GetStackDisp (Getting Current Displacement Values).

2.14.1. Using Function RunCommand

This function enables you to issue a command from within a user subroutine. Inputs and outputs for RunCommand are as follows:

*deck,RunCommand
      function RunCommand (nChar,command)

c primary function:    Execute an ansys command

c object/library: upf

c *** Notice - This file contains ANSYS Confidential information ***

c  input arguments:
c     nChar    (int,sc,in)           - Length of the command string (8 min)
c     command  (ch*(nChar),sc,in)    - A character string containing a
c                                              valid ANSYS command

c  output arguments:
c     RunCommand   (int,sc,out)      - An internally defined value, ignore


2.14.2. Using the /UNDO Command

The "undo" file you create by issuing the /UNDO command is similar to the File.db file created when you issue the SAVE command. The /UNDO command format is:

/UNDO,Action
Action
ON, to write the undo file
OFF, to prevent the undo file from being written
PROMPT, to have the program ask permission before writing the file
STATUS, to restore the file as it existed after executing the last command issued before the /UNDO command.

2.14.3. Using the /HOLD command

Issue the /HOLD command to synchronize tasks. The program can synchronize tasks at the end of each results file set.

/HOLD,Filename,TimeInterval,Timeout
Filename

The eight-character name of a message file. If the named file exists, the program reads a command from the file and then deletes the file.

TimeInterval

The length of time, in seconds, that the program waits before trying to read the message file again.

Timeout

The maximum length of time, in seconds, that the program can wait between attempts to read the file.