In a previous blog post I introduced a new plug-in that extends the Sublime Text Editor with a syntax-detection, auto completion, auto argument notes as well as an expandable menu for Ansys APDL scripting language.
The SublimeText editor is currently the likely to be the most advanced text editor on the market. With the new plug-in APDL, programming is fun and it is no longer so easy to make syntax errors.
But what if, despite all the new APDL syntax features, you don't exactly remember, what arguments are expected for a specific command? Or what if you don't remember what Key Options has an element type? You have to first open the Ansys Help, enter the APDL command in the search box and then select from a list of hits the correct help link. Particularly with very short APDL commands (e.g. the D-Command) is very difficult to find the corresponding help file. For this you have to activate additional filters, and only then you will get there.
For this reason I have asked myself the question whether there is a possibility, for a particular APDL command to invoke the Ansys Help directly from Sublime Text. And there is indeed this possibility. You just have to know the customization options in Sublime Text for which there are plenty of examples on the net. In addition, one must understand a how the Ansys Help system is structured. Therefore, I will address the structuring of Ansys Help in the following.
The Ansys Help can be typically found at C:\Program Files\ANSYS Inc\v160\commonfiles\help\en-us\help. There you will find many subfolders, but only two folders were for me of particular interest: ans_cmd and ans_elem. The folder ans_cmd containins an HTML document for each APDL command. The folder ans_elem contain an HTML document for each element type in Ansys. For example, the Help document to the AATT command is Hlp_C_AATT.html. Similarly, the help document to the element type SOLID185 is Hlp_E_SOLID185.html. So the name of the HTML documents are derived from the name of the respective APDL commands or item types.
Based on this finding, the idea was born to develop a Sublime Text plugin, that finds the proper HTML document in the Ansys Help file system for the selected text and opens it in the default Web browser. If the file can not be found, it will be searched in the Internet using Google and the web browser.
I will not go into the technical details of programming. The result is a small Python script (about 60 lines of code), which implemented exactly the desired behavior in Sublime Text. Here's a screenshot of it:
You can download the new Sublime Text plug-in for Ansys APDL here. What to do with the files I show in the following:
- Step 1: Start the SublimeText editor and choose Menu>Preferences>Browse packages. The directory containing the packages SublimeText opens. Here you copy the six folders from SublimeText-Meshparts-Compilation.zip\SublimeText\Packages. When asked whether you want to overwrite existing folders, answer Yes.
- Step 2: Check the Ansys version number and the Ansys installation path in Users\Administrator\AppData\Roaming\Sublime Text 2\Packages\ANSYS\Ansys.py (lines 25-28) and adjust if necessary.
I hope this tip was interesting for you and look forward to your opinions and suggestions for improvement. Just simply use our contact form.