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.11.tar.gz (155.9 kB view details)

Uploaded Source

Built Distributions

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

mapdl_archive-0.2.11-cp312-abi3-win_amd64.whl (469.8 kB view details)

Uploaded CPython 3.12+Windows x86-64

mapdl_archive-0.2.11-cp312-abi3-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl (286.9 kB view details)

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

mapdl_archive-0.2.11-cp312-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (325.3 kB view details)

Uploaded CPython 3.12+manylinux: glibc 2.17+ x86-64

mapdl_archive-0.2.11-cp312-abi3-macosx_11_0_arm64.whl (265.7 kB view details)

Uploaded CPython 3.12+macOS 11.0+ ARM64

mapdl_archive-0.2.11-cp312-abi3-macosx_10_14_x86_64.whl (277.2 kB view details)

Uploaded CPython 3.12+macOS 10.14+ x86-64

mapdl_archive-0.2.11-cp311-cp311-win_amd64.whl (473.7 kB view details)

Uploaded CPython 3.11Windows x86-64

mapdl_archive-0.2.11-cp311-cp311-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl (294.4 kB view details)

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

mapdl_archive-0.2.11-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (333.2 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

mapdl_archive-0.2.11-cp311-cp311-macosx_11_0_arm64.whl (269.6 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

mapdl_archive-0.2.11-cp311-cp311-macosx_10_14_x86_64.whl (280.6 kB view details)

Uploaded CPython 3.11macOS 10.14+ x86-64

mapdl_archive-0.2.11-cp310-cp310-win_amd64.whl (474.1 kB view details)

Uploaded CPython 3.10Windows x86-64

mapdl_archive-0.2.11-cp310-cp310-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl (294.7 kB view details)

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

mapdl_archive-0.2.11-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (333.6 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

mapdl_archive-0.2.11-cp310-cp310-macosx_11_0_arm64.whl (270.0 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

mapdl_archive-0.2.11-cp310-cp310-macosx_10_14_x86_64.whl (281.0 kB view details)

Uploaded CPython 3.10macOS 10.14+ x86-64

File details

Details for the file mapdl_archive-0.2.11.tar.gz.

File metadata

  • Download URL: mapdl_archive-0.2.11.tar.gz
  • Upload date:
  • Size: 155.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for mapdl_archive-0.2.11.tar.gz
Algorithm Hash digest
SHA256 9e9925b3a641ee0c3323c0a61da6b788bab687a51696bce8f8f619bfa504639e
MD5 c634f4ef541655a9cfe6f354a542f728
BLAKE2b-256 d11da465dc405480fbc01990ec358cc201dbc3fb188154bc0874324b19f6accc

See more details on using hashes here.

Provenance

The following attestation bundles were made for mapdl_archive-0.2.11.tar.gz:

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.11-cp312-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for mapdl_archive-0.2.11-cp312-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 38b52bcb13b1d349849b88765e3ec78f051d154190a418194d8bf0f62714ea0a
MD5 2114fbebae7b2d223cb4af8606f9b0f4
BLAKE2b-256 bcbefef7cea1b4bedd2d42637267d3beddbf3e0518bc96d7b6e4cde283b3a266

See more details on using hashes here.

Provenance

The following attestation bundles were made for mapdl_archive-0.2.11-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.11-cp312-abi3-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for mapdl_archive-0.2.11-cp312-abi3-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 1c420ac12ce80fec73643ac7cb5f153c8b6070fc1e9c22b6098c518e717c389d
MD5 08a8e130b1f8dc12deccf7f55354bf5e
BLAKE2b-256 d6b3bb8856c5ffe8ea52a93a1e8e138695eaf82a2d62dfc2f9fe82976a6d067a

See more details on using hashes here.

Provenance

The following attestation bundles were made for mapdl_archive-0.2.11-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.11-cp312-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for mapdl_archive-0.2.11-cp312-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 964f3cd485468ab941b730afc2f03bba9c58aabb02dab243d7ad95d6822857d3
MD5 6121d40e02cd5c708f4763a28aec8896
BLAKE2b-256 399bd75c334159b1fe2a1c01b1392ab23e08c90a41f7680e7a85bb21942f6eaa

See more details on using hashes here.

Provenance

The following attestation bundles were made for mapdl_archive-0.2.11-cp312-abi3-manylinux2014_x86_64.manylinux_2_17_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.11-cp312-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for mapdl_archive-0.2.11-cp312-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a88508f54589835d1af63df5269e8b787fa12fdac8bead38cdd4c67b41f3a207
MD5 b1d5c49c875a5b79744a3cdc72f011c9
BLAKE2b-256 3e74fd468d0991aa415a407bae3bb699d7abdff9411f69828dd122bec76a21e6

See more details on using hashes here.

Provenance

The following attestation bundles were made for mapdl_archive-0.2.11-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.11-cp312-abi3-macosx_10_14_x86_64.whl.

File metadata

File hashes

Hashes for mapdl_archive-0.2.11-cp312-abi3-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 8880c4d81929e324aff4b9eae9adf3093cbed899bd043b836c1984ea20620da1
MD5 02d3471cc4e7916e0951a0789099e3c5
BLAKE2b-256 c8ce5781c0a4c77cccc8555ec3d8be2c4016cf983439b8de446b371dc7a537cf

See more details on using hashes here.

Provenance

The following attestation bundles were made for mapdl_archive-0.2.11-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.11-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for mapdl_archive-0.2.11-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 43d15b7e76056e21bb1f2047478c386518ddf385a00b91d2bb0b7266e73bfd9f
MD5 640ab699c33d73c20b2b78e90bb04ae8
BLAKE2b-256 d4f51f44b85a92a07f1cddfa2bcc3697894be07f462e8948816c8ad860c0498b

See more details on using hashes here.

Provenance

The following attestation bundles were made for mapdl_archive-0.2.11-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.11-cp311-cp311-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for mapdl_archive-0.2.11-cp311-cp311-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 6d6e74e440dc5eeb4790ee73177f1448df2915535acb4f31495e11ed4885857a
MD5 5cd5feab943c19f107b9c93b53a05038
BLAKE2b-256 986745b16fc61a51a742787d37c4c97fe8bed712db6ab692eeeb26e9dc557e79

See more details on using hashes here.

Provenance

The following attestation bundles were made for mapdl_archive-0.2.11-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.11-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for mapdl_archive-0.2.11-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 713409ab050b1c282f620c7c422db2a84660bc5268c89b089226e75a8d3cf2b6
MD5 a15fcf9d80059d7ddd4690f74230de9d
BLAKE2b-256 ff0bae4c4c8791940b62fa19c5dc8a7ac81e0e4bbd4263d249c29e1e0da49286

See more details on using hashes here.

Provenance

The following attestation bundles were made for mapdl_archive-0.2.11-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_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.11-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for mapdl_archive-0.2.11-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 16b2800fc9a4edacf135514f3900b691645162eb681c10114f9b13d2fb272d4d
MD5 21b70ea48e8f66249a21ae2f6e301a8b
BLAKE2b-256 fe994db3d8cd5d36baa42621927b0fc96d38645e6e0b6a13537e734151e0c909

See more details on using hashes here.

Provenance

The following attestation bundles were made for mapdl_archive-0.2.11-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.11-cp311-cp311-macosx_10_14_x86_64.whl.

File metadata

File hashes

Hashes for mapdl_archive-0.2.11-cp311-cp311-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 f27b5e7c12740de5f199b43cf3995069ad09e263bd13fccb76779db95f2b96a0
MD5 3d1069930d5a3007365f22d667e4927a
BLAKE2b-256 2adb472a0fe7cb317d678acf442e2a24279486dca471384f7e06db242f50eee8

See more details on using hashes here.

Provenance

The following attestation bundles were made for mapdl_archive-0.2.11-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.11-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for mapdl_archive-0.2.11-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 517d94d26dfc65c9702e404797dc7c7a2af85f797615a6c9241af44e37e7773c
MD5 d4cb4eb95bd6dbdefe17e1d4961f2b5d
BLAKE2b-256 5b743550d616cbfa267d4546a2f9ada11b479d6863f9de7410b4c3f7d5f98908

See more details on using hashes here.

Provenance

The following attestation bundles were made for mapdl_archive-0.2.11-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.11-cp310-cp310-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for mapdl_archive-0.2.11-cp310-cp310-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 1c90a666cf14b867d65fbf7e2d1052c54939690954067a7b442fa821b3965502
MD5 268f9d0b1952ff01036690c151707cf1
BLAKE2b-256 7d95fce94ab401ef61c5e4876cf8e2563bb4985adafa0c08a3bc44c875e2398f

See more details on using hashes here.

Provenance

The following attestation bundles were made for mapdl_archive-0.2.11-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.11-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for mapdl_archive-0.2.11-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 6e271cb781f0c92e86d41f9f80fc2e766d18f5da1d66bb3ebfee368acbe6ae97
MD5 f17f381adac0a7f11c8381403be6cd77
BLAKE2b-256 e16ef6bed045321ba355f3343665cc02cd02cf4712503b9d407fd36166f484a0

See more details on using hashes here.

Provenance

The following attestation bundles were made for mapdl_archive-0.2.11-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_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.11-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for mapdl_archive-0.2.11-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0efa6ceb0ce0a62e2bf0ea74a4867acaa40dab70963ee2d96f0db9fc9d9fc7ec
MD5 0f1c4183b662520c45082ade4397d3a0
BLAKE2b-256 a0ab603c74f6132f4dc11b78d0bab2976b01c88ed2ceeddb06a75767e016df6f

See more details on using hashes here.

Provenance

The following attestation bundles were made for mapdl_archive-0.2.11-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.11-cp310-cp310-macosx_10_14_x86_64.whl.

File metadata

File hashes

Hashes for mapdl_archive-0.2.11-cp310-cp310-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 3429ca3cc5fbfa5153033fa86c555e71a685819777f58ad354f9bfcced11a616
MD5 085822a6d4d4af70560db9c30fe752c8
BLAKE2b-256 c35bf7746466193b8d763f83b4f0f0e8c142f3cbdf9fad837f916cfb26145b19

See more details on using hashes here.

Provenance

The following attestation bundles were made for mapdl_archive-0.2.11-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