Skip to main content

Pythonic interface to MAPDL archive files.

Project description

pypi GH-CI MIT

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')
Hexahedral beam

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mapdl-archive-0.2.3.tar.gz (154.5 kB view details)

Uploaded Source

Built Distributions

mapdl_archive-0.2.3-cp312-cp312-win_amd64.whl (279.3 kB view details)

Uploaded CPython 3.12 Windows x86-64

mapdl_archive-0.2.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (321.0 kB view details)

Uploaded CPython 3.12 manylinux: glibc 2.17+ x86-64

mapdl_archive-0.2.3-cp312-cp312-macosx_11_0_arm64.whl (260.4 kB view details)

Uploaded CPython 3.12 macOS 11.0+ ARM64

mapdl_archive-0.2.3-cp312-cp312-macosx_10_14_x86_64.whl (270.8 kB view details)

Uploaded CPython 3.12 macOS 10.14+ x86-64

mapdl_archive-0.2.3-cp311-cp311-win_amd64.whl (282.5 kB view details)

Uploaded CPython 3.11 Windows x86-64

mapdl_archive-0.2.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (327.8 kB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

mapdl_archive-0.2.3-cp311-cp311-macosx_11_0_arm64.whl (265.9 kB view details)

Uploaded CPython 3.11 macOS 11.0+ ARM64

mapdl_archive-0.2.3-cp311-cp311-macosx_10_14_x86_64.whl (275.7 kB view details)

Uploaded CPython 3.11 macOS 10.14+ x86-64

mapdl_archive-0.2.3-cp310-cp310-win_amd64.whl (282.7 kB view details)

Uploaded CPython 3.10 Windows x86-64

mapdl_archive-0.2.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (328.2 kB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

mapdl_archive-0.2.3-cp310-cp310-macosx_11_0_arm64.whl (266.3 kB view details)

Uploaded CPython 3.10 macOS 11.0+ ARM64

mapdl_archive-0.2.3-cp310-cp310-macosx_10_14_x86_64.whl (276.0 kB view details)

Uploaded CPython 3.10 macOS 10.14+ x86-64

mapdl_archive-0.2.3-cp39-cp39-win_amd64.whl (283.6 kB view details)

Uploaded CPython 3.9 Windows x86-64

mapdl_archive-0.2.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (328.4 kB view details)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

mapdl_archive-0.2.3-cp39-cp39-macosx_11_0_arm64.whl (266.5 kB view details)

Uploaded CPython 3.9 macOS 11.0+ ARM64

mapdl_archive-0.2.3-cp39-cp39-macosx_10_14_x86_64.whl (276.3 kB view details)

Uploaded CPython 3.9 macOS 10.14+ x86-64

File details

Details for the file mapdl-archive-0.2.3.tar.gz.

File metadata

  • Download URL: mapdl-archive-0.2.3.tar.gz
  • Upload date:
  • Size: 154.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for mapdl-archive-0.2.3.tar.gz
Algorithm Hash digest
SHA256 805560abd76880c272e384a69dddac8939472ce6013335b1395404a6c62c93a2
MD5 1517dcaf538b1b3f282145e97c0f8fb2
BLAKE2b-256 22ab4083dafff1c1cc05f963241aa43039b7397559d6925581b66786778817e4

See more details on using hashes here.

Provenance

The following attestation bundles were made for mapdl-archive-0.2.3.tar.gz:

Publisher: testing-and-deployment.yml on akaszynski/mapdl-archive

Attestations:

File details

Details for the file mapdl_archive-0.2.3-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for mapdl_archive-0.2.3-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 961fdbeee9eed81b802f085e3a5df73452540a1bde7cc5f6165f42cb773a814e
MD5 0e74520d53b4e88e8dfbb90da32bf8ac
BLAKE2b-256 43c392474514461cd07a01b7cbb552b7f7ab1afabfb2c6e5e317530c4ea5101c

See more details on using hashes here.

Provenance

The following attestation bundles were made for mapdl_archive-0.2.3-cp312-cp312-win_amd64.whl:

Publisher: testing-and-deployment.yml on akaszynski/mapdl-archive

Attestations:

File details

Details for the file mapdl_archive-0.2.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for mapdl_archive-0.2.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ef482175e6636121e254993ebf527bed848818cd608da2b933739183b0c3063d
MD5 35542faac44f2e69d2bc2dffa58f3e33
BLAKE2b-256 cce781e63c162a5224109c3c032faf9aef3d31712dbe3e67cc999405e58c8ea0

See more details on using hashes here.

Provenance

The following attestation bundles were made for mapdl_archive-0.2.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: testing-and-deployment.yml on akaszynski/mapdl-archive

Attestations:

File details

Details for the file mapdl_archive-0.2.3-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for mapdl_archive-0.2.3-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1a0d417abac09b1f05e818e777fea46e15074ad1ac489c197f9dbc1a66e4e6ab
MD5 73ad3aa494d817164fd64c77a19b4194
BLAKE2b-256 0a351082eb0cad032139be230742d9f7cf8fca871d87548c987815cec02804ee

See more details on using hashes here.

Provenance

The following attestation bundles were made for mapdl_archive-0.2.3-cp312-cp312-macosx_11_0_arm64.whl:

Publisher: testing-and-deployment.yml on akaszynski/mapdl-archive

Attestations:

File details

Details for the file mapdl_archive-0.2.3-cp312-cp312-macosx_10_14_x86_64.whl.

File metadata

File hashes

Hashes for mapdl_archive-0.2.3-cp312-cp312-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 ec18fd7562415aed883410b856eebdb7e3178055a29b5f317b41452b05c36c81
MD5 d96d13bcd798f402d0a1b8d13e721a5f
BLAKE2b-256 df6ed39b2960b3160fa8814b93dea08671165d7e6846a21854c314c356ee12b1

See more details on using hashes here.

Provenance

The following attestation bundles were made for mapdl_archive-0.2.3-cp312-cp312-macosx_10_14_x86_64.whl:

Publisher: testing-and-deployment.yml on akaszynski/mapdl-archive

Attestations:

File details

Details for the file mapdl_archive-0.2.3-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for mapdl_archive-0.2.3-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 7ffdcaf2ff188b8b886ffd7a83b57bed9973081afee60c0745a8865e0b46be01
MD5 8aa9df53857d425bf9848bb45e3b9eef
BLAKE2b-256 8c03910f7bbc68d33e677548663d186baef482d1b05f9ad95ba9c5401ecae271

See more details on using hashes here.

Provenance

The following attestation bundles were made for mapdl_archive-0.2.3-cp311-cp311-win_amd64.whl:

Publisher: testing-and-deployment.yml on akaszynski/mapdl-archive

Attestations:

File details

Details for the file mapdl_archive-0.2.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for mapdl_archive-0.2.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a841866f5cc87472d7fa06f1e0bef3612f6523cb9c36ef7a93f7dfa732f10021
MD5 0b17f6f7c1d0e5d11782aaa09bcc7a54
BLAKE2b-256 234146b1cb003140bc07c5dabe58d502aa6c793406407fbe6dd47f55ac86bcce

See more details on using hashes here.

Provenance

The following attestation bundles were made for mapdl_archive-0.2.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: testing-and-deployment.yml on akaszynski/mapdl-archive

Attestations:

File details

Details for the file mapdl_archive-0.2.3-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for mapdl_archive-0.2.3-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5e4db79dcea6d707c8555a761f6442edb407668e4c636303ef52d9eb3fc9df9d
MD5 aff49f46526a6a8b886e45c30e0bf01b
BLAKE2b-256 4fe2126b1f275eb24845f7c536ef7be347e3ef87b2aabda7040e3b9e08ec8e55

See more details on using hashes here.

Provenance

The following attestation bundles were made for mapdl_archive-0.2.3-cp311-cp311-macosx_11_0_arm64.whl:

Publisher: testing-and-deployment.yml on akaszynski/mapdl-archive

Attestations:

File details

Details for the file mapdl_archive-0.2.3-cp311-cp311-macosx_10_14_x86_64.whl.

File metadata

File hashes

Hashes for mapdl_archive-0.2.3-cp311-cp311-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 3f241c442c75b29baf7e0f35211a439cbd5844e965966c9f55c8aa02fc086a58
MD5 cef35341c6e307dc2f3f5cf426198977
BLAKE2b-256 32343348ce61f6d6325ca2f6c7a409b0bf427b3f6006b827140c9d93a41eabb0

See more details on using hashes here.

Provenance

The following attestation bundles were made for mapdl_archive-0.2.3-cp311-cp311-macosx_10_14_x86_64.whl:

Publisher: testing-and-deployment.yml on akaszynski/mapdl-archive

Attestations:

File details

Details for the file mapdl_archive-0.2.3-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for mapdl_archive-0.2.3-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 16fe8bb0bcecdf74c0b99973d4eec2573a45f314d2e56d4f72ec1cceeab3c3e4
MD5 1d373530cca78f52dead432f84210f77
BLAKE2b-256 45fc3ed50b750efcd71ab1bdb31ab931a4e4bb66841e62493c98ab7ea57299ce

See more details on using hashes here.

Provenance

The following attestation bundles were made for mapdl_archive-0.2.3-cp310-cp310-win_amd64.whl:

Publisher: testing-and-deployment.yml on akaszynski/mapdl-archive

Attestations:

File details

Details for the file mapdl_archive-0.2.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for mapdl_archive-0.2.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4f359a1633fbf482a80059035815e22c3a68f393bd6fa5dd1df5b53ac36e69f5
MD5 5a02bf651d6ed1cfd0aafde771b1d127
BLAKE2b-256 b325a9bdf14a2a283c3aa3f71d45f65156337526d434b48b428113d82a58d5fb

See more details on using hashes here.

Provenance

The following attestation bundles were made for mapdl_archive-0.2.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: testing-and-deployment.yml on akaszynski/mapdl-archive

Attestations:

File details

Details for the file mapdl_archive-0.2.3-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for mapdl_archive-0.2.3-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ee239ad8c4508ec7a3670b97ac1868e6436657b68fe99b3e843dbafc90cd7c21
MD5 47b224ad0613ea642d57583b7e1ce172
BLAKE2b-256 d8be43dc3a96b0ea8b9a7e8b5fa54d5dca061f18ec3959b8da207eff7335761c

See more details on using hashes here.

Provenance

The following attestation bundles were made for mapdl_archive-0.2.3-cp310-cp310-macosx_11_0_arm64.whl:

Publisher: testing-and-deployment.yml on akaszynski/mapdl-archive

Attestations:

File details

Details for the file mapdl_archive-0.2.3-cp310-cp310-macosx_10_14_x86_64.whl.

File metadata

File hashes

Hashes for mapdl_archive-0.2.3-cp310-cp310-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 3a384e29c5eecf7146a01600c1451a715d7c01c33f70b377000088f80a472f7f
MD5 5226fafc000c646ba79209ea6feca45a
BLAKE2b-256 3f4944c6301420763ebe5597e2fcc4d4d6970e6d10121c2f0065d94990bb5e85

See more details on using hashes here.

Provenance

The following attestation bundles were made for mapdl_archive-0.2.3-cp310-cp310-macosx_10_14_x86_64.whl:

Publisher: testing-and-deployment.yml on akaszynski/mapdl-archive

Attestations:

File details

Details for the file mapdl_archive-0.2.3-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for mapdl_archive-0.2.3-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 b297906f4767f0cc1f85b0572da8da56badba63f7ac53f310c11e98d1774f4ee
MD5 65fde0e098a97ca0a8597dd15033146b
BLAKE2b-256 d56dc216f0e090d890dacea222b5006873b3e3dcd382bc3dddd04152003dab9e

See more details on using hashes here.

Provenance

The following attestation bundles were made for mapdl_archive-0.2.3-cp39-cp39-win_amd64.whl:

Publisher: testing-and-deployment.yml on akaszynski/mapdl-archive

Attestations:

File details

Details for the file mapdl_archive-0.2.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for mapdl_archive-0.2.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ea5c534ce08f8caa224e95484933b80168bbe1a28866f383807d8d573c10a2f4
MD5 12ed9d4812b3086b199ac312bd195df2
BLAKE2b-256 18f006c46cb955fa9d239297d18bfb6dd68e47e89ff08dd0d13daee27bd6d6ce

See more details on using hashes here.

Provenance

The following attestation bundles were made for mapdl_archive-0.2.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: testing-and-deployment.yml on akaszynski/mapdl-archive

Attestations:

File details

Details for the file mapdl_archive-0.2.3-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for mapdl_archive-0.2.3-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8a6f3f3661d23fab01493ad3175e7a28eac263e5f3ad4f528feb961b09556e1b
MD5 628c3f85598a76905d14b6e63ba27d07
BLAKE2b-256 57f30ffcd4bc528638fb0135b3c9944f506d0e4194bdbeb4216b3dfd1a428c3d

See more details on using hashes here.

Provenance

The following attestation bundles were made for mapdl_archive-0.2.3-cp39-cp39-macosx_11_0_arm64.whl:

Publisher: testing-and-deployment.yml on akaszynski/mapdl-archive

Attestations:

File details

Details for the file mapdl_archive-0.2.3-cp39-cp39-macosx_10_14_x86_64.whl.

File metadata

File hashes

Hashes for mapdl_archive-0.2.3-cp39-cp39-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 ff5d2e04b94a5be7c37ea79a37f3c9c2a53f25f4cb79652e054cf9400e9357b3
MD5 0e3dc041e5db3b61492ee8d0a88cff21
BLAKE2b-256 22c03b4b5b0df1809e5cc69abe1bfb2f50abb49206f3a6b9953c9b4abdef1f81

See more details on using hashes here.

Provenance

The following attestation bundles were made for mapdl_archive-0.2.3-cp39-cp39-macosx_10_14_x86_64.whl:

Publisher: testing-and-deployment.yml on akaszynski/mapdl-archive

Attestations:

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page