Input Sources

Contents

Input Sources#

cad_to_dagmc accepts geometry from three sources:

Input Type

Description

Use Case

CadQuery Objects

Python-defined geometry

Parametric models, scripted geometry

CadQuery Assemblies

Multi-part CadQuery assemblies

Complex models with multiple components

STEP Files

Industry-standard CAD format can also contain assemblies

Importing from CAD software

GMSH Files

Pre-existing mesh files

When you already have a mesh

Basic Pattern#

All input methods follow the same pattern:

  1. Create a CadToDagmc model

  2. Add geometry using add_cadquery_object() or add_stp_file()

  3. Export to desired format

from cad_to_dagmc import CadToDagmc

model = CadToDagmc()
# Add geometry here...
model.export_dagmc_h5m_file(filename="dagmc.h5m")

For GMSH files, use the standalone function:

from cad_to_dagmc import export_gmsh_file_to_dagmc_h5m_file

export_gmsh_file_to_dagmc_h5m_file(
    gmsh_filename="mesh.msh",
    dagmc_filename="dagmc.h5m"
)