Skip to main content

Converts STL files to a DAGMC h5m file using PyMoab

Project description

N|Python

CI with install

Upload Python Package anaconda-publish

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.2.0.tar.gz (22.6 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.2.0-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: stl_to_h5m-0.2.0.tar.gz
  • Upload date:
  • Size: 22.6 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.2.0.tar.gz
Algorithm Hash digest
SHA256 e8b0eb4a4fc2d3d5dc7d428817d118ae7af1538f5c8d7d21fff56cfead874bb3
MD5 44ba57bbef0c80c110f88b07c2d85d1d
BLAKE2b-256 35fe9bc810bb583d1a8ea68ad1b51585ede6aa59d05eaf0963d7ec0767dece2d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: stl_to_h5m-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 5.8 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.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c91abd080638b268b654f6f627c792b064949047982e3b34685515b2ecc8bc04
MD5 91ccd886f9612657863a26c642d62a5d
BLAKE2b-256 06a053519bf7eb63ecc4eb02c6c5b5ece30e9f82c89d5dfd6890a2815aaf85be

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