Skip to main content

Converts STL files to a DAGMC h5m file using PyMoab

Project description

CI with install

This is a minimal Python package that provides a Python API interfaces for converting multiple STL files into a DAGMC h5m file ready for use in simulation.

Convert STL files to a DAGMC h5m file complete with material tags and ready for use neutronics simulations.

warning this approach does not imprint and merge the geometry and therefore requires that the STL files do not overlap. Overlaps could lead to particles being lost during transport. If imprinting and merging is required consider using cad-to-h5m.

It is strongly advised to used the DAGMC overlap checker to check the resulting h5m file (see checking for overlaps secton below).

Installation - Conda

This single line command should install the package and dependencies (including moab)

conda install -c fusion-energy -c conda-forge stl_to_h5m

Installation - Pip + Conda

These two commands should install the package and dependencies. Moab requires a separate install as it is not available on pip

conda install -c conda-forge moab
pip install stl_to_h5m

Usage - single file

To convert a single STL file into a h5m file. This also tags the volume with the material tag m1.

from stl_to_h5m import stl_to_h5m

stl_to_h5m(
    files_with_tags=[('part1.stl', 'mat1')],
    h5m_filename='dagmc.h5m',
)

Usage - multiple files

To convert multiple STL files into a h5m file. This also tags the relevant volumes with material tags called m1 and m2.

from stl_to_h5m import stl_to_h5m

stl_to_h5m(
    files_with_tags=[
        ('part1.stl', 'mat1'),
        ('part2.stl', 'mat2')
    ],
    h5m_filename='dagmc.h5m'
)

Usage - checking for overlaps

To check for overlaps in the resulting h5m file one can use the DAGMC overlap checker. -p is the number of points to check on each line

conda install -c conda-forge dagmc
overlap_check dagmc.h5m -p 1000

Acknowledgments

This package is largely based on a script by @pshriwise

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

stl_to_h5m-0.1.3.tar.gz (22.4 kB view details)

Uploaded Source

Built Distribution

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

stl_to_h5m-0.1.3-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

Details for the file stl_to_h5m-0.1.3.tar.gz.

File metadata

  • Download URL: stl_to_h5m-0.1.3.tar.gz
  • Upload date:
  • Size: 22.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.2

File hashes

Hashes for stl_to_h5m-0.1.3.tar.gz
Algorithm Hash digest
SHA256 41baa15f5bfc723517e801d04a99444803d2bcf34dbde34709349f836af23b83
MD5 811147352e53be14e80a0bdf29b947e2
BLAKE2b-256 c2958a04b4119e0aa077da32c1185db89249dac79bc623d72e8c6bea8e421546

See more details on using hashes here.

File details

Details for the file stl_to_h5m-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: stl_to_h5m-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 5.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.2

File hashes

Hashes for stl_to_h5m-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 28156deb80dafb95af05c08c9e583105c2e5abaaeb6567e724f073148d6b671c
MD5 10a7c7c5c5d8edbdd4d43528e35ff034
BLAKE2b-256 ccdcfa781346f9aa4382496b188ed43496c61c870d977bf6769024bb03688129

See more details on using hashes here.

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