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.0.tar.gz (22.2 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.0-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: stl_to_h5m-0.1.0.tar.gz
  • Upload date:
  • Size: 22.2 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.10.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.0.tar.gz
Algorithm Hash digest
SHA256 7430fb26efcc9a3fd39c1d13196e5e737407a9bc4ec6b36a597481e880574f17
MD5 0d570f9cc6251e766037d58019ea47c8
BLAKE2b-256 625bff1ffd5599fb060c7a9458ca0e96293553e9b6bc13edf691bb005c5e5be8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: stl_to_h5m-0.1.0-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.10.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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7d83a0066078a999fe69204ed95478ad9a6a387c9653cf2f81832d492264e94d
MD5 07da1cb98462c3e1296106a64abe9179
BLAKE2b-256 a1541451c6ccbcb7f638002e1ef6dce976e7703b3da33abe5bf78d7eea65cd49

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