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.2.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.2-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: stl_to_h5m-0.1.2.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.2.tar.gz
Algorithm Hash digest
SHA256 e484e45849e1948761de191c540e8181ee7ebf6acf428be417e7f3c76a6e5cc4
MD5 dfd9d73ad79856675a74e99f2f3aeb6b
BLAKE2b-256 fdc7ed2a6856a7f16a66a594b3463be482b27974afb572c0eb64e08b27aff651

See more details on using hashes here.

File details

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

File metadata

  • Download URL: stl_to_h5m-0.1.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 40157cfe4212027511b85d3e1b97e2daa0e20b1812acd23c252be03ca942d189
MD5 3e4f29ab6520818a93a62d62aca4e9a8
BLAKE2b-256 1a3b7af3088303d6c6670713ce91b0a21b4cef6aee99c28a8a8e1ad711a6e414

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