AnsysMode

This is the text of the ANSYS-Mode README file (the formatting is targeted for the EmacsWiki)

Copyright (C) 2006 - 2012 H. Dieter Wilhelm, GPL V3

Introduction

http://duenenhof-wilhelm.de/dieter/ansys-mode_tutorial/ansys+emacs.png

This project supports your workflows with the FEA (Finite Element Analysis) suite ANSYS (ANalysis SYStem, registered TM).

It provides ‘ANSYS-Mode’, an add-on to the GNU Emacs editor for investigating and coding APDL (Ansys Parametric Design Language). The mode offers also managing and communication capabilities for various ANSYS processes, like interactive code debugging with the solver or inquiring the license manager status, etc. Some features are quite sophisticated but its documentation is targeted for ANSYS users with little Emacs experience.

Advantages compared to other APDL editors: Largest feature set, user extensible, costfree, integrated calculator, available for all OS, for in-built help no ANSYS installation necessary.

GNU (Gnu’s Not Unix) Emacs is an up-to-date, powerful and extensible - yet free - editor. High quality software available for every operating system where ANSYS is running.

The current stable version (14.5.1) of ANSYS-Mode is available at the Google Code site (The command line way, e. g.: “wget http://ansys-mode.googlecode.com/files/ansys-mode-14.5.1.tgz”). The code is partially based on ANSYS version 14.5 (completions, help strings etc.). Besides the code and Emacs you will find also in the download section two tutorials. For an immediate access have a look at the introductory on-line version, here you are able to see the images in a higher resolution as in the PDF version. And in the in-depth on-line tutorial there is the source code highlighting better preserved as in its PDF version.

Please report bugs and inconsistencies also in the documentation! Write an email to the maintainer or use Google Code’s issues list.

Requirements

It is tested with Emacs-24.1, Emacs-24.2 under XP64 and under GNU/Linux64 (here also with Emacs-23.2).

Some of ANSYS-Mode’s solver control and communication features are only implemented for Gnu/Linux systems.

Features

Example applications

Visual examples you will find in the online tutorial and the following screen-shot on EmacsWiki

http://www.duenenhof-wilhelm.de/dieter/ansys-mode.jpg

Above image shows an Emacs frame (in reversed colour mode and compiled with the GTK+ toolkit under Gnu/Linux) with a ripped off menu field. The APDL file is in the right window with the (experimental) user variable highlighting switched on and a help overlay (in yellow background) activated. The smaller windows on the left hand side are showing the ‘Variable definitions buffer’ of the same file and a preview buffer of a certain code template, respectively.

News

  Are you also tired of the ANSYS help browser?  For example try
  searching for the `F' APDL command, it is impossible!  You have to
  pick it up from the alphabetical command list. Likewise when you are
  searching for an incomplete keyword, no hint, no completion,
  nothing!  Finding and browsing relevant APDL documentation is still
  cumbersome and too slow
  As a highlight of this release you can now read immeadiately the
  detailed ANSYS help in your web browser for *all* APDL command AND
  element names around the cursor (or for the first command in the
  current line if that fails to be valid keyword).  You may input your
  search string also interactively, including its completion to ANSYS
  help keywords and of certain help categories, like `Release Notes'
  and such. This is an ideal complement to ANSYS-Mode's in-built
  `command syntax help'

Please have a look in the NEWS file for the complete history

Installation

The version scheme is a mixture of the ANSYS release (currently 14.5) on which the highlighting and completing code is based and the version increments (currently .1) of ANSYS-Mode (thus 14.5.1) for this particular ANSYS release.

Files

Sources:

(and possibly their compiled versions with the suffix ‘.elc’. In case you are using the mode with an older version of Emacs than 24.1 please remove the .elc files.)

Auxiliaries:

Short instructions

For Windows systems:

If applicable please grab the package of a pre-compiled Emacs-24.1 (Win32/64) bundled with a preconfigured ANSYS-Mode (for Windows 64 bit) at above Google Code site and unpack this archive anywhere on your system (you do not need administrator rights). You might subsequently run the program addpm.exe (located in the bin directory) to add an Emacs entry to the Windows start menu (please refer to the README.W32 file) otherwise start the Emacs executable runemacs.exe from there.

ANSYS-Mode is now immediately available, by opening (check out the `fontification.mac’ example) or by creating a new APDL file with a .mac suffix. Have fun!

Most functionalities should work but if you have not installed ANSYS in its default installation directory on drive `C:Program Files’ on Win64 and you want to start for example ‘anslic_admin’ or the ANSYS help browser directly from Emacs please adjust the configuration file `default.el’ file in Emacs’ ‘site-lisp’ directory according to the commented code examples.

In case you want to download or have already installed the original version of GNU Emacs, you can also download and configure the ANSYS-Mode package separately. Please see below.

For existing Emacs installations on Windows and Gnu/Linux:

Direct way; no file configuration necessary

Important prerequisite: Emacs must know where all the code (.el or its compiled versions .elc) files reside! Extract the mode archive into an Emacs directory which is in its default load-path (a good place is the ‘site-lisp’ folder in your Emacs installation tree) or indicate the directory with the environment variable EMACSLOADPATH).

From there on you must load first the mode definitions with `M-x load-file ansys-mode RET’, i. e. typing “M-x” (first) the <Alt> key and then the <x> key simultaneously, you’ll end up in the so called Emacs minibuffer prompt, now type “load-file” (you might apply the

TAB
key for the Emacs auto-completion feature at every intermediate stage) and conclude this input with the <RET> key. Emacs will then prompt you for a file, type in the directory where you have extracted the code and “ansys-mode.el” (or better “ansys-mode.elc” for speed reasons if the compiled version is available) and press RET to execude the loading. Thereafter call the mode itself with `M-x ansys-mode RET’ for every new or existing APDL file.

More convenient way; file configuration necessary

Extract the files somewhere on disc and put the following paragraph into your `.emacs’ configuration file (in your home directory), adjust the stuff in capital letters, restart Emacs and ansys-mode will be automatically applied for all files with suffixes `.mac’, `.dat’ and `.inp’.

    (add-to-list 'load-path "C:\\DIRECTORY-PATH\\WHERE\\THE\\ANSYS-MODE\\FILES\\RESIDE")
      ;assuming you extracted the files on drive "c:"
      ;for example: "c:\\emacs\\emacs-23.1"
    (add-to-list 'auto-mode-alist '("\\.mac\\'" . ansys-mode))
    (add-to-list 'auto-mode-alist '("\\.dat\\'" . ansys-mode))
    (add-to-list 'auto-mode-alist '("\\.inp\\'" . ansys-mode))
    (autoload 'ansys-mode "ansys-mode" nil t)

Verbose instructions

Please consult the ‘direct way’ description above.

If you are unfamiliar by these concepts I suggest working through the build-in tutorial of GNU Emacs (you’ll find it in the help entry in the menu bar), it doesn’t take too much time and the investment will be worth it since it will accelerate your general editing capabilities in the future.

When it becomes tiring of loading ‘ansys-mode.el’ (or ‘ansys-mode.elc’) every time you are starting a new Emacs session, you should specify the installation path for the mode files in your ‘~/.emacs’ file (the configuration file ‘.emacs’ of GNU Emacs in your home directory ‘~\’).

     (add-to-list 'load-path
		  "C:\\YOUR\\DIRECTORY\\WHERE\\MODE\\FILES\\RECIDE")
     (autoload 'ansys-mode "ansys-mode" "Activate ANSYS-Mode." 'interactive)

From here you are able to type “M-x ansys-mode RET” to activate the mode for every interesting file.

When you intend to apply the mode automatically, for all files with the extensions `.mac’, `.dat’, `.inp’ and `.anf’ ( .dat and .inp are WorkBench?’s solver input file suffixes) you are opening, add the following to your `.emacs’ file:

     (add-to-list 'auto-mode-alist '("\\.mac$" . ansys-mode))
     (add-to-list 'auto-mode-alist '("\\.dat$" . ansys-mode))
     (add-to-list 'auto-mode-alist '("\\.inp$" . ansys-mode))
     ;; this is the suffix for "ANSYS Neutral Files" which include some APDL.
     (add-to-list 'auto-mode-alist '("\\.anf$" . ansys-mode))

The suffix below belongs to the ‘anys neutral file’ export format which contains also an APDL header and footer.

     (add-to-list 'auto-mode-alist '("\\.anf$" . ansys-mode))

In case you also want to enjoy the auto insertion feature, which puts (optionally) some predefined body of ANSYS commands to every new APDL file insert the following into ‘.emacs’:

     (setq auto-insert-mode 1)
     (setq auto-insert-query t) ;insert only after request
     (add-to-list 'auto-insert-alist '(ansys-mode . [ansys-skeleton-compilation]))

With below section you are also able to use certain ANSYS related commands in a new Emacs session without the need of previously having explicitely called ansys-mode.

     (autoload 'ansys-customise-ansys "ansys-mode" "Activate the function for calling a special ANSYS customisation buffer." 'interactive)
     (autoload 'ansys-abort-file "ansys-mode" "Activate the function for  aborting ANSYS runs." 'interactive)
     (autoload 'ansys-display-error-file "ansys-mode" "Activate the function for inspecting the ANSYS error file." 'interactive)
     (autoload 'ansys-start-ansys-help "ansys-mode" "Activate the function for starting the ANSYS help browser." 'interactive)
     (autoload 'ansys-license-status "ansys-mode" "Activate the function for displaying ANSYS license status or starting a license utility." 'interactive)

As a summary and example to these and further customisation options please have a look at the accompanying `default_el’ example. This is helpful especially if you intend to use the mode’s solver communication capabilities. This file can be used, after renaming it to `default.el’ and adjusting as as system wide startup file for Emacs in the `EMACS_INSTALLDIR/site-lisp’ directory and is therefore an alternative to customisations in `.emacs’, your personal configuration file.

Usage and customisation

When you have a file under ‘ansys-mode’ check out the menu bar’s ‘ANSYS’ entry for its possibilities and select the entry `Describe ANSYS Mode’ or type “C-h m” (i. e. the <CTRL> key together with the

h
key and subsequently the <m> key), which will display the ANSYS-Mode help which is your ‘online’ guide for its usage, keybindings and customisation options.

Templates, i.e. code snippets or so called skeletons might be extended in `ansys-template.el’ and can be used similarly or complementarily to a classical ANSYS macro library.

Experienced Emacs users

ANSYS-Mode changes the default behaviour of Emacs

globally:

(Delete Selection Mode can be switched off in the ANSYS-Mode menu.)

locally:

Acknowledgements

For their ansys-mod.el from 1997 which gave the ideas to start ANSYS-Mode (the implementation though is different and many capabilities are new or extended)

Then in mainly reversed cronological order:

Resources

Bugs and Problems

For an overview of deficiencies and outstanding issues please check the beginning of the TODO file.

The ‘user variable’ highlighting is still experimental, newly edited variable definitions are taken into account only when the variable ansys-dynamic-highlighting-flag is set (for very large files this slows Emacs and this flag is only implemented for `.mac’ files) or any times when you activate the variable display (with C-c C-v) and the maximum highlighting level. If not already the case try to use the code in compiled form, please have a look at the documentation of the Emacs function ‘byte-recompile-directory’.

ANSYS ‘format line’ (multi-line highlighting) and ‘user variable’ highlighting (when the mentioned flag above ist not set) are somewhat brittle, please use “M-o M-o” to update the fontification in case the format line and all variables are not highlighted correctly.

Getting help

If you experience problems installing or running this mode you have the following options:

local variables: word-wrap: t show-trailing-whitespace: t indicate-empty-lines: t end: