6.1. Preparing a Macro for Encryption

www.kxcad.net Home > CAE Index > ANSYS Index > Release 11.0 Documentation for ANSYS


Your Ad Here

Before encrypting a macro, you first create and debug the macro as usual. When you create an encrypted macro, you are responsible for keeping the original source file. You cannot recreate the source file from an encrypted macro. You then add an /ENCRYPT command as the first line and last of the macro. The /ENCRYPT command for the first line of the macro has the following syntax:

/ENCRYPT,Encryption_key,File_name,File_ext,Directory_Path/

Where

Note the placement of the /ENCRYPT commands at the top and bottom of the listing in the following example:

/encrypt,mypasswd,myenfile,mac,macros/
/nopr
/prep7
/view,,-1,-2,-3
block,,arg1,,arg2,,arg3
sphere,arg4
vsbv,1,2
/gopr
finish
/encrypt

The /ENCRYPT command at the top of the macro instructs ANSYS to encrypt the file and use the string "mypasswd" as the encryption key. It will create an encrypted macro file called myenfile.mac and place it in the /macros subdirectory of the home directory. The /ENCRYPT command at the bottom instructs ANSYS to stop the encryption process and write the encrypted macro to the specified file.

Note

The encrypted macro uses a /NOPR command as its second line to turn off echoing of ANSYS commands to the session log file. This is important if you wish to prevent users from reading the contents of the macro from the session log. It's a good practice to reactivate the session log by issuing the /GOPR command as the last command in the macro before the ending /ENCRYPT command.

Your Ad Here