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 Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

mapdl_archive-0.2.8-cp312-abi3-win_amd64.whl (282.0 kB view details)

Uploaded CPython 3.12+Windows x86-64

mapdl_archive-0.2.8-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (298.5 kB view details)

Uploaded CPython 3.12+manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

mapdl_archive-0.2.8-cp312-abi3-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl (285.9 kB view details)

Uploaded CPython 3.12+manylinux: glibc 2.26+ ARM64manylinux: glibc 2.28+ ARM64

mapdl_archive-0.2.8-cp312-abi3-macosx_11_0_arm64.whl (264.9 kB view details)

Uploaded CPython 3.12+macOS 11.0+ ARM64

mapdl_archive-0.2.8-cp312-abi3-macosx_10_14_x86_64.whl (276.4 kB view details)

Uploaded CPython 3.12+macOS 10.14+ x86-64

mapdl_archive-0.2.8-cp311-cp311-win_amd64.whl (285.9 kB view details)

Uploaded CPython 3.11Windows x86-64

mapdl_archive-0.2.8-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (306.7 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

mapdl_archive-0.2.8-cp311-cp311-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl (293.4 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.26+ ARM64manylinux: glibc 2.28+ ARM64

mapdl_archive-0.2.8-cp311-cp311-macosx_11_0_arm64.whl (268.7 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

mapdl_archive-0.2.8-cp311-cp311-macosx_10_14_x86_64.whl (279.7 kB view details)

Uploaded CPython 3.11macOS 10.14+ x86-64

mapdl_archive-0.2.8-cp310-cp310-win_amd64.whl (286.2 kB view details)

Uploaded CPython 3.10Windows x86-64

mapdl_archive-0.2.8-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (307.1 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

mapdl_archive-0.2.8-cp310-cp310-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl (293.8 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.26+ ARM64manylinux: glibc 2.28+ ARM64

mapdl_archive-0.2.8-cp310-cp310-macosx_11_0_arm64.whl (269.1 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

mapdl_archive-0.2.8-cp310-cp310-macosx_10_14_x86_64.whl (280.1 kB view details)

Uploaded CPython 3.10macOS 10.14+ x86-64

File details

Details for the file mapdl_archive-0.2.8-cp312-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for mapdl_archive-0.2.8-cp312-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 2a95c0baf3ea9b283e24c3fe9382ec6e3fa6bc4b63d45c629fc6d527a398f3df
MD5 bc66439860dba1e1589493a158fbed57
BLAKE2b-256 53831ba795dd84f051960fdf77bea8945407b34c0b23e06805fd8b275bb07c25

See more details on using hashes here.

Provenance

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

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mapdl_archive-0.2.8-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for mapdl_archive-0.2.8-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 62e0c95a2a64721785561e1ed90fe3b138144a54281fb8f36356f0623048db7d
MD5 2dd92026ad98e8f03999a13088004b7e
BLAKE2b-256 051b61b22b276c78b5579e0d1b5d14dd9ed32e96ca1d373ba0b475712a53a842

See more details on using hashes here.

Provenance

The following attestation bundles were made for mapdl_archive-0.2.8-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mapdl_archive-0.2.8-cp312-abi3-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for mapdl_archive-0.2.8-cp312-abi3-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 6b8031bcd6d4d34eaa20e06d9877113fafe999debaf5f3bd5b6212ae8370cd7f
MD5 2063e25e5867479c8e404a590b036403
BLAKE2b-256 04dcefc5ac82d452433abd6242a4e4bd662dda1822b09c6cd94a658553fe721e

See more details on using hashes here.

Provenance

The following attestation bundles were made for mapdl_archive-0.2.8-cp312-abi3-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl:

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mapdl_archive-0.2.8-cp312-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for mapdl_archive-0.2.8-cp312-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 fef31392b16cd76b1f2540477f9ac7ae64fc8d11e59ec46d3fecb95bae5d9898
MD5 0bb016e7152f2ba571b0ff3f53112c52
BLAKE2b-256 864f35e3864eb85365bd4a362eff4deb529508924811842ff4fc55e823bd8f02

See more details on using hashes here.

Provenance

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

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mapdl_archive-0.2.8-cp312-abi3-macosx_10_14_x86_64.whl.

File metadata

File hashes

Hashes for mapdl_archive-0.2.8-cp312-abi3-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 d27841710ea8dca9a65981f026d3c9fd070da23cfcc5411de43d67e98028c553
MD5 cfa532b2658f6d41f46734501d225a3d
BLAKE2b-256 40af542fe62f8ca77a716a6fb032b54987c9241bef52b94edad56d501b02a283

See more details on using hashes here.

Provenance

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

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

File hashes

Hashes for mapdl_archive-0.2.8-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 33d27d4437119c71f5c7e8aaf91d1052a3f536405a95076058bfac2628ee27f7
MD5 4be7c90989a5bfcb41fc5fa8e27eb428
BLAKE2b-256 3ff87cacf081b32e435fab0e543e36359da5910fcbbfb3b52e6c6111c96cc0c6

See more details on using hashes here.

Provenance

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

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mapdl_archive-0.2.8-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for mapdl_archive-0.2.8-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 7f0027027933e10d38c39dcef822a4c4f9aa122b573e5cf1c314b3d051fbe636
MD5 c57dcce07a1c0293d414a3a3ebd06c2b
BLAKE2b-256 52476d951e0a6a90d35ba0f8e767efbea10ce031e055d1addec711622fc8ddd1

See more details on using hashes here.

Provenance

The following attestation bundles were made for mapdl_archive-0.2.8-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mapdl_archive-0.2.8-cp311-cp311-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for mapdl_archive-0.2.8-cp311-cp311-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 564e4c368dbf01150ee4604165e04a4bbc698aad3693893c8183e90b620f83b3
MD5 ab8cd0a873a715688fc007c06544a251
BLAKE2b-256 7f21044a5c7360d98bc85827531c8ac5f1842830f5412ebaf057a023e8ce18c0

See more details on using hashes here.

Provenance

The following attestation bundles were made for mapdl_archive-0.2.8-cp311-cp311-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl:

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

File hashes

Hashes for mapdl_archive-0.2.8-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a5320443f22fdbab8b5d6947a52c87e9b3330069106f7fbfb7fcdc3805c271f2
MD5 2db3abb9d974643cfa602fd66627b466
BLAKE2b-256 d38e3491a07171f73b55a98f0ae0c5dfe0f81dcbe701049b90cd7a63ce9b36fe

See more details on using hashes here.

Provenance

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

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

File hashes

Hashes for mapdl_archive-0.2.8-cp311-cp311-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 146e35df171504f339a7117cefa10ad91eee1c14298f538d49d538cf609fb338
MD5 b750c6145e8e05132cca65dfa0048c21
BLAKE2b-256 f3b10c8dd899f20611d3418d6a0a0b7e0ae5aaeadfcadc589223f318774e0a1f

See more details on using hashes here.

Provenance

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

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

File hashes

Hashes for mapdl_archive-0.2.8-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 484d46906f3cdd907f246f21179374a857f6b99cbbc43a343b6b08491aa55999
MD5 b7be54618e13d8283191a7939434f1fa
BLAKE2b-256 2c31327030a34dc30897defc015c9fbd9c3d4066e777ac2a6b44cd38902edc98

See more details on using hashes here.

Provenance

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

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mapdl_archive-0.2.8-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for mapdl_archive-0.2.8-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 2a2071729aa99ef362afa725b0c9024677c1d0ac079590b230c8f9f3b7614991
MD5 0194c373af26b55a966f18bf1e7c7b9a
BLAKE2b-256 c18a597d06248cc70ed446822409aed048acb8af1baaf757ebd9039171198ccd

See more details on using hashes here.

Provenance

The following attestation bundles were made for mapdl_archive-0.2.8-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mapdl_archive-0.2.8-cp310-cp310-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for mapdl_archive-0.2.8-cp310-cp310-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 f92de9b991ab5ed470e850c21d472b0c23d0313dca88e7ee6176958d491afd53
MD5 06733e25903431b89480e798d8516139
BLAKE2b-256 1c5c2598b46374905058f4675e0bf7bc1c70cd174235dd7f1d6afee111afed31

See more details on using hashes here.

Provenance

The following attestation bundles were made for mapdl_archive-0.2.8-cp310-cp310-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl:

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

File hashes

Hashes for mapdl_archive-0.2.8-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c774ee4b116cb6ab27c54db50af45016173368454e166ad6acca4427771cd425
MD5 ab4e69fd5214325e9b593e4621cb1f10
BLAKE2b-256 d230af050145d1b0386bd2dd28686aa2f7fce1db8218f7abebb6e89ae99c1ab3

See more details on using hashes here.

Provenance

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

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

File hashes

Hashes for mapdl_archive-0.2.8-cp310-cp310-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 4c100d322029ccea5496c8f1c3ec953bdc878809093e7b8d2e341f75c2b8599f
MD5 c065960f8ee744e63ae0da3c399b15c2
BLAKE2b-256 9bbd7540815dcfb6f1faea1f2a7a9a15a8200c58429042eb1864e83a16d72c70

See more details on using hashes here.

Provenance

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

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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