Pythonic interface to MAPDL archive files.
Project description
Read blocked Ansys MAPDL archive files written from MAPDL using CDWRITE.
This is effectively pymapdl-reader without the binary reader. It’s been isolated to allow greater flexibility in development.
Installation
Installation through pip:
pip install mapdl-archive
Examples
Load and Plot an MAPDL Archive File
ANSYS archive files containing solid elements (both legacy and modern), can be loaded using Archive and then converted to a VTK object.
from mapdl_archive import Archive, examples
# Sample *.cdb
filename = examples.hexarchivefile
# Read ansys archive file
archive = Archive(filename)
# Print raw data from cdb
for key in archive.raw:
print("%s : %s" % (key, archive.raw[key]))
# Create an unstructured grid from the raw data and plot it
grid = archive.parse_vtk(force_linear=True)
grid.plot(color='w', show_edges=True)
# write this as a vtk xml file
grid.save('hex.vtu')
# or as a vtk binary
grid.save('hex.vtk')
You can then load this vtk file using PyVista or VTK.
import pyvista as pv
grid = pv.UnstructuredGrid('hex.vtu')
grid.plot()
Reading ANSYS Archives
MAPDL archive *.cdb and *.dat files containing elements (both legacy and modern) can be loaded using Archive and then converted to a vtk object:
import mapdl_archive
from mapdl_archive import examples
# Read a sample archive file
archive = mapdl_archive.Archive(examples.hexarchivefile)
# Print various raw data from cdb
print(archive.nnum, archive.nodes)
# access a vtk unstructured grid from the raw data and plot it
grid = archive.grid
archive.plot(color='w', show_edges=True)
You can also optionally read in any stored parameters within the archive file by enabling the read_parameters parameter.
import mapdl_archive
archive = mapdl_archive.Archive('mesh.cdb', read_parameters=True)
# parameters are stored as a dictionary
archive.parameters
Writing MAPDL Archives
Unstructured grids generated using VTK can be converted to ANSYS APDL archive files and loaded into any version of ANSYS using mapdl_archive.save_as_archive in Python followed by CDREAD in MAPDL. The following example using the built-in archive file demonstrates this capability.
import pyvista as pv
from pyvista import examples
import mapdl_archive
# load in a vtk unstructured grid
grid = pv.UnstructuredGrid(examples.hexbeamfile)
script_filename = '/tmp/grid.cdb'
mapdl_archive.save_as_archive(script_filename, grid)
# Optionally read in archive in PyMAPDL and generate cell shape
# quality report
from ansys.mapdl.core import launch_mapdl
mapdl = launch_mapdl()
mapdl.cdread('db', script_filename)
mapdl.prep7()
mapdl.shpp('SUMM')
Resulting ANSYS quality report:
------------------------------------------------------------------------------
<<<<<< SHAPE TESTING SUMMARY >>>>>>
<<<<<< FOR ALL SELECTED ELEMENTS >>>>>>
------------------------------------------------------------------------------
--------------------------------------
| Element count 40 SOLID185 |
--------------------------------------
Test Number tested Warning count Error count Warn+Err %
---- ------------- ------------- ----------- ----------
Aspect Ratio 40 0 0 0.00 %
Parallel Deviation 40 0 0 0.00 %
Maximum Angle 40 0 0 0.00 %
Jacobian Ratio 40 0 0 0.00 %
Warping Factor 40 0 0 0.00 %
Any 40 0 0 0.00 %
------------------------------------------------------------------------------
Supported Elements
At the moment, only solid elements are supported by the save_as_archive function, to include:
vtk.VTK_TETRA
vtk.VTK_QUADRATIC_TETRA
vtk.VTK_PYRAMID
vtk.VTK_QUADRATIC_PYRAMID
vtk.VTK_WEDGE
vtk.VTK_QUADRATIC_WEDGE
vtk.VTK_HEXAHEDRON
vtk.VTK_QUADRATIC_HEXAHEDRON
Linear element types will be written as SOLID185, quadratic elements will be written as SOLID186, except for quadratic tetrahedrals, which will be written as SOLID187.
License and Acknowledgments
The mapdl-archive library is licensed under the MIT license.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
File details
Details for the file mapdl-archive-0.2.2.tar.gz
.
File metadata
- Download URL: mapdl-archive-0.2.2.tar.gz
- Upload date:
- Size: 154.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9d3a1fc665803f5a80ddbfd3443a5683d8d0dad7a21ac8e9f1505e5aba9b7f83 |
|
MD5 | 50f07344a6b9c6a42aacd9d30baf70fb |
|
BLAKE2b-256 | 47ff6adff47ba21c547fec29f8ec876ce326d3ccb715d3c1b1e6d017869f56a3 |
File details
Details for the file mapdl_archive-0.2.2-cp312-cp312-win_amd64.whl
.
File metadata
- Download URL: mapdl_archive-0.2.2-cp312-cp312-win_amd64.whl
- Upload date:
- Size: 275.9 kB
- Tags: CPython 3.12, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e1baacbf70fd40e3d20592b6e39553dfb3f40b5191a3a7057f2a138ea84a3817 |
|
MD5 | d1623df693846507357fbbd16ace5cea |
|
BLAKE2b-256 | 8cee18cfc6e778255df27247daf9c6c3bf3f7e2e166fb3c4fd73b9c75fbbbff0 |
File details
Details for the file mapdl_archive-0.2.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: mapdl_archive-0.2.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 317.8 kB
- Tags: CPython 3.12, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f790edc343644f709c54e8f9d9eb05024b43658544d6ff76ec754f96e3cb1594 |
|
MD5 | dd63ac38624442e7c4ad21085a64ede4 |
|
BLAKE2b-256 | a25353b3b4ba617ed651fee6b1bbadb67937bfdfc23dd8e9419f65bd01a66846 |
File details
Details for the file mapdl_archive-0.2.2-cp312-cp312-macosx_11_0_arm64.whl
.
File metadata
- Download URL: mapdl_archive-0.2.2-cp312-cp312-macosx_11_0_arm64.whl
- Upload date:
- Size: 258.1 kB
- Tags: CPython 3.12, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c7d3a7a1d7c5d4559072feb9b3373f8e9ec5a02d47201faef20da01459066ade |
|
MD5 | d294ff70e136b5f44c7d1b9702fd041e |
|
BLAKE2b-256 | f2cb6692841678002f8434bb1584a22786d4641eb7ca44d688f288e009bd22df |
File details
Details for the file mapdl_archive-0.2.2-cp312-cp312-macosx_10_14_x86_64.whl
.
File metadata
- Download URL: mapdl_archive-0.2.2-cp312-cp312-macosx_10_14_x86_64.whl
- Upload date:
- Size: 267.4 kB
- Tags: CPython 3.12, macOS 10.14+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | eeaf09d5c0fbbb97c7f44ab7302b9d7b6f4f6d2fae6f892634f4aec5e89f9668 |
|
MD5 | 6ae88cd0f01dc5665c125b733521895a |
|
BLAKE2b-256 | dd6fbcce9db23dea95e0730379d0f8261b41b16490a04e3269531d234a80482e |
File details
Details for the file mapdl_archive-0.2.2-cp311-cp311-win_amd64.whl
.
File metadata
- Download URL: mapdl_archive-0.2.2-cp311-cp311-win_amd64.whl
- Upload date:
- Size: 279.3 kB
- Tags: CPython 3.11, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | eadf5a252e3da256c9fd0a0f7f9f8563dea15f6c1ec20c981bb130a7c4b282d8 |
|
MD5 | 04f769c4204b827ac894a8bff318c48b |
|
BLAKE2b-256 | 775ed689ffa7afbaf56c516e1766b21a20892633caea2d374610512c34b73e3c |
File details
Details for the file mapdl_archive-0.2.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: mapdl_archive-0.2.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 324.2 kB
- Tags: CPython 3.11, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3447088316c7944b65f38364278d4b5cba2173c0b6cb8d55633113b6b2825009 |
|
MD5 | 1ca5571a521cd418cbe4cf2db6cc4f51 |
|
BLAKE2b-256 | f8602901d2e0eeb204b0189a07015fd9cf28a5810c241ef62a0baea340a4ee2b |
File details
Details for the file mapdl_archive-0.2.2-cp311-cp311-macosx_11_0_arm64.whl
.
File metadata
- Download URL: mapdl_archive-0.2.2-cp311-cp311-macosx_11_0_arm64.whl
- Upload date:
- Size: 263.6 kB
- Tags: CPython 3.11, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3706c6ae695e1de4a0784a9b7ad8e6a8463c028bdc8f6cf3b732c30ef7513847 |
|
MD5 | 6cc4ee67c37b28770cf4c6011db9e482 |
|
BLAKE2b-256 | 9bee24eb92b7e1fb2bbadf55abc2facfd6d6b94aede73d5a3d2c2340fb23736e |
File details
Details for the file mapdl_archive-0.2.2-cp311-cp311-macosx_10_14_x86_64.whl
.
File metadata
- Download URL: mapdl_archive-0.2.2-cp311-cp311-macosx_10_14_x86_64.whl
- Upload date:
- Size: 273.1 kB
- Tags: CPython 3.11, macOS 10.14+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7141beed8abdf568e297fde52451a5e479edc97016edd440b2919c16f075f952 |
|
MD5 | 94ba7deb96f7a7c666f767cabb9e1b97 |
|
BLAKE2b-256 | 9a6b33188f3cdf1591ce04adaa59febf789e19d33ea75eb4dd6e8f231d04a804 |
File details
Details for the file mapdl_archive-0.2.2-cp310-cp310-win_amd64.whl
.
File metadata
- Download URL: mapdl_archive-0.2.2-cp310-cp310-win_amd64.whl
- Upload date:
- Size: 279.6 kB
- Tags: CPython 3.10, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 79a1ff7771b45d15ace6ee5afebf0beea670c2666ba66bb8938bf156f2383e82 |
|
MD5 | 0426ed404e1ed5b954b7971a785030f4 |
|
BLAKE2b-256 | 20b911d7813f385c88b2c69c9e1ccf03874c58690f2311e83bfefaa9bc775eae |
File details
Details for the file mapdl_archive-0.2.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: mapdl_archive-0.2.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 324.6 kB
- Tags: CPython 3.10, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | be9ef03273360b728c419f05eab00724c2ae59c8e586b33ab670eefeb5f863df |
|
MD5 | bc8bbd81cc7eb10bc041447b090b235a |
|
BLAKE2b-256 | 6a21ba68e8b0931f40e3f317e7e24abe5050ff6d2305111c4b6ce1552f080e02 |
File details
Details for the file mapdl_archive-0.2.2-cp310-cp310-macosx_11_0_arm64.whl
.
File metadata
- Download URL: mapdl_archive-0.2.2-cp310-cp310-macosx_11_0_arm64.whl
- Upload date:
- Size: 263.9 kB
- Tags: CPython 3.10, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fab2caeb085a570555a53ff20ec159acc5b42953f3a2270fb93669daa70d0cc3 |
|
MD5 | 7144fc31b016a44b63ba947d7e0d0dab |
|
BLAKE2b-256 | 5f39185f7632daf329a8ab87186c369a4eeb13842e072771eef6a28d4ede24f8 |
File details
Details for the file mapdl_archive-0.2.2-cp310-cp310-macosx_10_14_x86_64.whl
.
File metadata
- Download URL: mapdl_archive-0.2.2-cp310-cp310-macosx_10_14_x86_64.whl
- Upload date:
- Size: 273.4 kB
- Tags: CPython 3.10, macOS 10.14+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b961d8ff1b455050f95c1bf8dcf553b9d0eacf7d4d3ee41a8135b03a0407b165 |
|
MD5 | 22cc073d939ea3347b6d416af09b42d8 |
|
BLAKE2b-256 | a4abe0db9b393aa87fee99fc66f6d49e6077de80bacb4db63fb5197ebbccf9b3 |
File details
Details for the file mapdl_archive-0.2.2-cp39-cp39-win_amd64.whl
.
File metadata
- Download URL: mapdl_archive-0.2.2-cp39-cp39-win_amd64.whl
- Upload date:
- Size: 280.3 kB
- Tags: CPython 3.9, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c3929c9197817c0d98200fff5cd6d6e6d14adcc33bd0f77434360a2dbc1c3fab |
|
MD5 | 120536eb3569178d8b29e7a65798a585 |
|
BLAKE2b-256 | 91cbde4dd3df59ea86ae72680eef84012c102f295b288c7ad009402ded929336 |
File details
Details for the file mapdl_archive-0.2.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
.
File metadata
- Download URL: mapdl_archive-0.2.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 324.9 kB
- Tags: CPython 3.9, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b1fd7c2d8df60960501594f764c28c4e7360d38136728697a916c639dd409857 |
|
MD5 | 52ed3e2d8411ce42dccc42fb726e25de |
|
BLAKE2b-256 | eab70830aa6aa2d0bfc9dac797f9f29d7e30d121a0b3df216e2cd567fe76ebd1 |
File details
Details for the file mapdl_archive-0.2.2-cp39-cp39-macosx_11_0_arm64.whl
.
File metadata
- Download URL: mapdl_archive-0.2.2-cp39-cp39-macosx_11_0_arm64.whl
- Upload date:
- Size: 264.1 kB
- Tags: CPython 3.9, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9b8b36210270fdd97e42ca547f67ee2477184ff7cda9bda230c516a89edcc4fc |
|
MD5 | 92e99900abf49334523f048cf335ecae |
|
BLAKE2b-256 | e8390d50ce534f97c42ed0f524ff4580178981cd55ab75240570e769148c7469 |
File details
Details for the file mapdl_archive-0.2.2-cp39-cp39-macosx_10_14_x86_64.whl
.
File metadata
- Download URL: mapdl_archive-0.2.2-cp39-cp39-macosx_10_14_x86_64.whl
- Upload date:
- Size: 273.7 kB
- Tags: CPython 3.9, macOS 10.14+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 35723e00dfaa78f35f57434803d9db7d5efc06ad12166f64de7bb7e2b43cbaf8 |
|
MD5 | c6e570c65653f33426e1a1b5141add3e |
|
BLAKE2b-256 | 472e7188987d2faf3437574d176250ab154a34899b173428fd16a3d324b95472 |