HyperMesh Python API Notepad ++ Template Generator
Overview
Notepad++ is a free and open-source text editor available for Microsoft Windows. It is a popular weapon of choice among engineers to write/edit code or review/modify solver input decks.
The editor supports syntax highlighting and auto-completion for many languages, including Python, via XML templates located in the autoCompletion subfolder in the Notepad++ installation folder (e.g., C:/Program Files/Notepad++/autocompletion/python.xml).
This Python package can be used to generate a python.xml file augmented by the Python API of the HyperMesh, HyperView, and HyperGraph clients. By replacing the original python.xml in the Notepad++ installation with the new one, Notepad++ will provide syntax recognition and autocompletion for the HyperMesh application API.
More methods and classes can be added and be generated from the scripts if needed. The different Python APIs for HyperMesh, HyperView and HyperGraph can be found Python API Reference Guide.
The python.xml that is attached was generated in HyperMesh 2024.0.
Usage/Installation Instructions
To generate the file, you need to run the HyperMeshPythonNPP.py inside the HyperMesh Python console or execute it via File > Load > Python Script.
You can alternate the following arguments inside the script:
- pyOrigXML - The path of the original XML file from the installation folder.
- pyFinalXML - The path of the newly created XML file. By default, it is created inside the package folder.
- hmModelstr - The name of hm.Model class instance that will be used in the XML template. This name will then have to be used when writing the code in Notepad++.
The script will generate the new python.xml file together with three temporary files inside the HyperMeshPythonNPP_package folder for a better supervision and debugging of the XML generation process:
- HMPy.xml - An XML file that contains all the XML descriptions of the HyperMesh client Python API.
- HVHGPy.xml - An XML file that contains all the XML description of the HyperView and HyperGraph client Python API.
- python_with_HMPy.xml - An XML file that contains the original python.xml content along with HMPy.xml content.
Comments
-
-0