Converts STL files to a DAGMC h5m file using PyMoab
Project description
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 Paramak export_dagmc_h5m() method or cad-to-h5m to make the DAGMC geometry.
It is strongly advised to used the DAGMC overlap checker to check the resulting h5m file (see checking for overlaps section below).
Installation - Conda
This single line command should install the package and dependencies (including moab)
conda install -c fusion-energy -c fusion-energy 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file stl_to_h5m-0.2.3.tar.gz
.
File metadata
- Download URL: stl_to_h5m-0.2.3.tar.gz
- Upload date:
- Size: 24.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8c7b7113a8d7e13e8f57d91d62f0715aefa6f10d3d2e25c36dd306bdaa2eade0 |
|
MD5 | 25d7ae68fa19093b65ad9df43a63ee3e |
|
BLAKE2b-256 | 0f235833adeb5c4ab67682f33cd5bbfe911ce922b1af3365b3b184fc6c641d3f |
File details
Details for the file stl_to_h5m-0.2.3-py3-none-any.whl
.
File metadata
- Download URL: stl_to_h5m-0.2.3-py3-none-any.whl
- Upload date:
- Size: 6.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e2ea458b6e5b99511fbb1387b07578cffae4315654604fc83ed3b636741b529d |
|
MD5 | 4c5c5c665f0f7e494937751ef50b8c9d |
|
BLAKE2b-256 | 5cdf69c37b18acdbcd893eaad4a25f712079b9a0803a1a575ac9e4434d546322 |