Skip to content

ansys/pyansys-cheat-sheet

Repository files navigation

PyAnsys cheat sheets

Introduction

This repository contains cheat sheets for PyAnsys libraries. In the PyAnsys Cheat Sheet documentation, you can see the cheat sheets that have been released for various PyAnsys libraries. These cheat sheets are carefully crafted to provide concise and practical information, serving as valuable references. On the PyAnsys Cheat Sheet Issues page, you can create issues to report bugs and request new features. On the PyAnsys Cheat Sheet Discussions page or the Discussions page on the Ansys Developer portal, you can post questions, share ideas, and get community feedback..

The following sections describe how to create, generate, and deploy a PyAnsys cheat sheet.

Create a cheat sheet

You create a cheat sheet from a template as indicated in these steps:

  1. In the cheat_sheets folder, create a child folder with an appropriate project name. For example, pymapdl_cheat_sheet.

  2. In the template folder, copy pyansys_cheat_sheet.tex and then paste it into your new project folder.

  3. Rename this copy of pyansys_cheat_sheet.tex so that it uses your project folder name. For example, pymapdl_cheat_sheet.tex.

  4. Inside this LaTeX file, do the following:

    1. In the pdfinfo element, change the PDF title from PyAnsys cheat sheet to your project title and then add a subject and keywords.

    2. Under the Add the title of cheat sheet here comment, change the title from PyAnsys cheat sheet to <project title> cheat sheet.

      The next several steps explain how to complete the section element for each of the cheat sheet's three columns.

    3. Replace the Add heading here text with the column heading.

    4. Replace the Add description of code block here text with a description.

    5. Replace the Add code here text with a Python code block.

    6. If you have more than one code block, add the following code:

      \begin{lstlisting}[language=Python]
      Add code here
      \end{lstlisting}
  5. In the References from PyAnsys documentation subsection, add references to the library's documentation, replacing link names with the names of the guides. For example, this reference adds a link to the PyAnsys Developer's Guide:

    item \href{https://dev.docs.pyansys.com/}{\color{blue}{PyAnsys Developer's Guide}}

Generate the cheat sheet

For Linux users

#. In the root directory of the repository, open the makefile file and add this command in the all: $(CHEATSHEETS) section:

<your_project>_cheat_sheat:
        latexmk -f -pdf -use-make cheat_sheats/<your_folder_name>/<your_tex_file_name>.tex -cd -outdir=../../$(BUILD) -interaction=nonstopmode || true
   convert -density 150 -scene 1 $(BUILD_DIR)/<your_tex_file_name>.pdf $(BUILD_DIR)/<your_tex_file_name>.png
  1. In this new comand, replace <your_project>, <your_folder_name>, and <your_tex_file_name> with your actual project name, folder name, and TeX filename, respectively.

    This command uses latexmk to compile your TeX file into a PDF and then converts the first page of the PDF into a PNG file.

  2. At the top of the file, in the CHEATSHEETS= line, add the project name of your cheat sheet.

For Windows users

  1. In the root directory of the repository, open the makefile file and add this command in the all: $(CHEATSHEETS) section:

    :<your_project>_cheat_sheet
       pdflatex -output-directory=%BUILDDIR% cheat_sheats/<your_folder_name>/<your_tex_file_name>.tex --interaction=nonstopmode
       goto end
  2. In this new command, replace <your_project>, <your_folder_name>, and <your_tex_file_name> with your actual project name, folder name, and TeX filename, respectively.

    This command uses latexmk to compile your TeX file into a PDF.

  3. In the root directory of the repository, open the make.bat file and add the CALL command for your project to the :all section.

Generate a cheat sheet using Docker

You can use Doker to generate a cheat sheet. Using Docker allows you to generate a cheat sheet without worrying about dependencies and environment setup. The Docker container includes all the necessary dependencies for cheat sheet development. For more information, see the README.md <https://github.com/ansys/pyansys-cheat-sheet/tree/main/docker>_ file in the repository's docker folder.

Deploy a cheatsheet

Once your cheat sheet is approved for release, you can deploy it by adding it to the PyAnsys Cheat Sheets documentation.

  1. In the doc/source directory, open the index.rst file, which is the only page in the documentation.
  2. To add a new grid item card for your cheat sheet, paste this code block where your cheat sheet should appear alphabetically in the grid:
.. grid-item::

        .. card:: <your_project_name>
            :img-top: https://cheatsheets.docs.pyansys.com/<your_tex_file_name>.png
            :link: https://cheatsheets.docs.pyansys.com/<your_tex_file_name>.pdf
  1. In this code block, replace <your_project_name>, <your_tex_file_name>.png, and <your_tex_file_name>.pdf with your actual project name and the TeX filenames for your PNG file and PDF file, respectively.

Additionally, ensure that links for viewing and downloading the cheat sheet are added to a "Documentation and issues" section in both your PyAnsys library's README file and the overall index RST file for your library's documenation. For example, see this section in both the README.rst file for the PyFluent repository and the overall index RST file for the PyFluent documentation.

About

This repository contains the cheat-sheets for PyAnsys

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published