Testing package and running examples with dependencies installed via pip
Testing with Model Benchmark Zoo
A minimal package that converts CAD geometry to DAGMC (h5m) files, unstructured mesh files (vtk) and Gmsh (msh) files ready for use in neutronics simulations.
See the 👉 online documentation 👈 for installation options, usage recommendations and Python API details.
Gmsh 3D meshing controls
The Gmsh backend exposes separate controls for the surface and volume mesh:
| Argument | Default | Controls |
|---|---|---|
mesh_algorithm |
1 |
2D surface algorithm (Mesh.Algorithm) |
mesh_algorithm_3d |
1 (Delaunay) |
3D volume algorithm (Mesh.Algorithm3D); 10 selects multithreaded HXT |
volume_mesh_options |
None |
Dictionary of Gmsh option names and numeric/string values, applied after surface meshing and before volume meshing |
These controls apply to both combined conformal surface/volume export and standalone 3D export. They are Gmsh-specific; other meshing backends are unchanged. Existing calls keep their defaults and meshing sequence.
Conformal DAGMC geometry and unstructured tally mesh
When using a DAGMC geometry together with an unstructured mesh tally covering the same volumes, export both in one call. This reuses the DAGMC surface triangulation as the boundary of the tetrahedral mesh, avoiding mismatched tracking and tally boundaries from independently generated meshes.
import cadquery as cq
from cad_to_dagmc import CadToDagmc
model = CadToDagmc()
model.add_cadquery_object(
cq.Workplane("XY").sphere(10), material_tags=["steel"]
)
dagmc_filename, umesh_filename = model.export_dagmc_h5m_file(
filename="dagmc.h5m",
umesh_filename="umesh.vtk",
meshing_backend="gmsh",
unstructured_volumes=["steel"],
min_mesh_size=1.0,
max_mesh_size=5.0,
mesh_algorithm=6, # Frontal-Delaunay for the surfaces
mesh_algorithm_3d=10, # HXT for the tetrahedra
volume_mesh_options={
"Mesh.Optimize": 0,
"Mesh.MeshSizeExtendFromBoundary": 0,
"Mesh.MeshSizeMax": 1e22,
},
)
The surfaces are meshed using min_mesh_size, max_mesh_size and any
per-volume set_size values. Only then are the volume options applied. The
example relaxes interior sizing without coarsening the existing tracking
surface. unstructured_volumes can select volume IDs, material tags, or both;
the DAGMC file still includes all volumes. Keep imprint=True (the default)
for touching solids so their interfaces are shared.
Standalone 3D mesh
The same controls are available when only a volume mesh is needed:
import cadquery as cq
from cad_to_dagmc import CadToDagmc
model = CadToDagmc()
model.add_cadquery_object(
cq.Workplane("XY").sphere(10), material_tags=["steel"]
)
model.export_unstructured_mesh_file(
filename="standalone_umesh.vtk",
meshing_backend="gmsh",
min_mesh_size=1.0,
max_mesh_size=5.0,
mesh_algorithm_3d=10,
volume_mesh_options={
"Mesh.Optimize": 0,
"Mesh.MeshSizeExtendFromBoundary": 0,
"Mesh.MeshSizeMax": 1e22,
},
)
export_gmsh_mesh_file(dimensions=3, ...) accepts these arguments too.
Standalone export does not reuse a surface mesh from an earlier export;
use the combined call above when the tracking and tally meshes must conform.
With volume_mesh_options=None or {}, direct volume exports retain a single
generate(3) call. A non-empty dictionary stages this as generate(2), option
overrides, then generate(3). The combined export already creates the surface
mesh first and reuses it. Dictionary values override the corresponding named
settings during the volume step; surface-only exports ignore the dictionary.
The settings shown allow a coarser interior, but do not guarantee zero interior refinement or a particular speedup. Check mesh quality and tally resolution for your application. Other Gmsh size constraints still apply unless overridden. Use volume sizing/optimisation options compatible with a first-order tetrahedral mesh; options that change element order, recombine elements or force remeshing can invalidate the conformal DAGMC/tally pairing.
See conformal meshes and Gmsh volume options for more details.
Metadata
Release files for cad-to-dagmc 0.14.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| cad_to_dagmc-0.14.2.tar.gz | 3.6 MB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| cad_to_dagmc-0.14.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 3.7 MB
Release files / cad_to_dagmc-0.14.2.tar.gz
| Download URL | cad_to_dagmc-0.14.2.tar.gz |
|---|---|
| Size | 3.6 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9f7d3954cf0e9933fe7ce70512c6579b145ca73b9b0ebec71d470bad8363cbde
|
|
BLAKE2b-256 checksum How to use checksums |
6f9a4452a746bdc65e70df2d0f95bbee20304460bca50dd9880c5e42fc3caf4e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|
Release files / cad_to_dagmc-0.14.2-py3-none-any.whl
| Download URL | cad_to_dagmc-0.14.2-py3-none-any.whl |
|---|---|
| Size | 34.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
be63a7b7923892e7535835b418b307e315fdf60f3255c684f98bc630823f6966
|
|
BLAKE2b-256 checksum How to use checksums |
73a5ab4446f1920c15b5f6433ee132418034d63cfb0878dba3b74cff69305008
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|