Skip to content

Commit 3bc0998

Browse files
committed
added ANSYS interface
1 parent d63096f commit 3bc0998

23 files changed

+78228
-113
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ pyansys/Interface.py
2525
*.bat
2626

2727
# Testing
28+
factory/
2829
Testing/
2930
UnitTesting/
3031
TODO

README.rst

Lines changed: 40 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
pyansys
22
=======
3-
4-
This Python module allows you to to extract data from ANSYS files and to display
5-
them if vtk is installed. Currently supports result (.rst), mass and stiffness (.full), and block archive (.cdb) files.
3+
This Python module allows you to:
4+
- Interactively control an instance of ANSYS using Python. Linux only (for now)
5+
- Extract data from ANSYS files and to display them if ``VTK`` is installed.
6+
- Read in result ``(.rst)``, mass and stiffness ``(.full)``, and block archive ``(.cdb)`` files.
67

78
See the `Documentation <http://pyansys.readthedocs.io>`_ page for more details.
89

910

1011
Installation
1112
------------
12-
1313
Installation through pip::
1414

1515
pip install pyansys
@@ -18,14 +18,11 @@ You can also visit `GitHub <https://github.com/akaszynski/pyansys>`_ to download
1818

1919
Dependencies: ``numpy``, ``cython``, ``vtkInterface``. Optional: ``vtk``
2020

21-
Minimum requirements are numpy to extract results from a results file. To
22-
convert the raw data to a VTK unstructured grid, VTK 5.0 or greater must
23-
be installed with Python bindings.
21+
Minimum requirements are numpy to extract results from a results file. To convert the raw data to a VTK unstructured grid, VTK 5.0 or greater must be installed with Python bindings.
2422

2523

2624
Quick Examples
2725
--------------
28-
2926
Many of the following examples are built in and can be run from the build-in
3027
examples module. For a quick demo, run:
3128

@@ -34,6 +31,34 @@ examples module. For a quick demo, run:
3431
from pyansys import examples
3532
examples.RunAll()
3633
34+
35+
Controlling ANSYS
36+
~~~~~~~~~~~~~~~~~
37+
Create an instance of ANSYS and send commands to it.
38+
39+
.. code:: python
40+
41+
import os
42+
import pyansys
43+
44+
path = os.getcwd()
45+
ansys = pyansys.ANSYS(run_location=path)
46+
47+
# create a square area using keypoints
48+
ansys.Prep7()
49+
ansys.K(1, 0, 0, 0)
50+
ansys.K(2, 1, 0, 0)
51+
ansys.K(3, 1, 1, 0)
52+
ansys.K(4, 0, 1, 0)
53+
ansys.L(1, 2)
54+
ansys.L(2, 3)
55+
ansys.L(3, 4)
56+
ansys.L(4, 1)
57+
ansys.Al(1, 2, 3, 4)
58+
ansys.Save()
59+
ansys.Exit()
60+
61+
3762
Loading and Plotting an ANSYS Archive File
3863
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3964

@@ -58,7 +83,7 @@ be loaded using ReadArchive and then converted to a vtk object.
5883
5984
# Create a vtk unstructured grid from the raw data and plot it
6085
archive.ParseFEM()
61-
archive.uGrid.Plot()
86+
archive.grid.Plot()
6287
6388
# write this as a vtk xml file
6489
archive.SaveAsVTK('hex.vtu')
@@ -71,7 +96,7 @@ VTK.
7196
7297
# Load this from vtk
7398
import vtkInterface
74-
grid = vtkInterface.LoadGrid('hex.vtk')
99+
grid = vtkInterface.UnstructuredGrid('hex.vtk')
75100
grid.Plot()
76101
77102
@@ -173,9 +198,10 @@ frequencies and mode shapes.
173198
5781.975 Hz
174199
6919.399 Hz
175200
176-
License
177-
-------
178-
179-
pyansys is licensed under the MIT license.
201+
License and Acknowledgments
202+
---------------------------
203+
``pyansys`` is licensed under the MIT license.
180204

205+
ANSYS documentation and functions build from html provided by `Sharcnet <https://www.sharcnet.ca/Software/Ansys/>`_. Thanks!
181206

207+
This module, ``pyansys`` makes no commercial claim over ANSYS whatsoever. This tool extends the functionality of ``ANSYS`` by adding a python interface in both file interface as well as interactive scripting without changing the core behavior or license of the original software. The use of the interactive APDL control of ``pyansys`` requires a legally licensed local copy of ANSYS.

0 commit comments

Comments
 (0)