From b1e931783372f6b1120f491bdfc778abca649606 Mon Sep 17 00:00:00 2001 From: davidsosa Date: Fri, 15 Nov 2024 12:41:49 -0600 Subject: [PATCH] rebase to merge with up to date main branch --- parastell/invessel_build.py | 11 +++----- parastell/magnet_coils.py | 53 ++++++------------------------------- parastell/parastell.py | 8 +++--- 3 files changed, 15 insertions(+), 57 deletions(-) diff --git a/parastell/invessel_build.py b/parastell/invessel_build.py index 6a2a023..eafca22 100644 --- a/parastell/invessel_build.py +++ b/parastell/invessel_build.py @@ -293,24 +293,19 @@ def merge_layer_surfaces(self): ) prev_outer_surface_id = outer_surface_id -<<<<<<< HEAD def import_step_cubit(self): """Imports STEP files from in-vessel build into Coreform Cubit.""" for name, data in self.radial_build.radial_build.items(): vol_id = cubit_io.import_step_cubit(name, self.export_dir) data["vol_id"] = vol_id - def export_step(self, export_dir=""): - """Export CAD solids as STEP files via CadQuery. -======= - def export_components(self, filetype ="step", export_dir=""): + def export_components(self, filetype="step", export_dir=""): """Export CAD solids as STEP or STL files via CadQuery. ->>>>>>> 666c81c (export_step and export_stl merged into a single function) Arguments: - filetype (str): file extension to which solids are exported + filetype (str): file extension, excluding '.', to which solids are exported (defaults to STEP). - export_dir (str): directory to which to export the STEP output files + export_dir (str): directory to which to export the output files (optional, defaults to empty string). """ self._logger.info(f"Exporting {filetype.upper()} files for in-vessel components...") diff --git a/parastell/magnet_coils.py b/parastell/magnet_coils.py index bcf7200..2d1f072 100644 --- a/parastell/magnet_coils.py +++ b/parastell/magnet_coils.py @@ -238,7 +238,6 @@ def build_magnet_coils(self): self._cut_magnets() -<<<<<<< HEAD def import_step_cubit(self): """Import STEP file for magnet set into Coreform Cubit.""" first_vol_id = 1 @@ -251,69 +250,33 @@ def import_step_cubit(self): self.volume_ids = list(range(first_vol_id, last_vol_id + 1)) - def export_step(self, step_filename="magnet_set", export_dir=""): - """Export CAD solids as a STEP file via CadQuery. -======= def export_components(self, filetype="step", filename="magnet_set", export_dir=""): """Export CAD solids as a STEP or STL file via CadQuery. ->>>>>>> 666c81c (export_step and export_stl merged into a single function) Arguments: - step_filename (str): name of STEP output file, excluding '.step' - extension (optional, defaults to 'magnet_set'). - export_dir (str): directory to which to export the STEP output file + filetype (str): extension, excluding '.', to which to export the output file + (defaults to STEP). + filename (str): name of output file, excluding extension + (optional, defaults to 'magnet_set'). + export_dir (str): directory to which to export the output file (optional, defaults to empty string). """ self._logger.info(f"Exporting {filetype.upper()} file for magnet coils...") self.export_dir = export_dir - self.filename = filename + self.filename =filename export_path = Path(self.export_dir) / Path( -<<<<<<< HEAD - self.step_filename - ).with_suffix(".step") - - coil_set = cq.Compound.makeCompound( - [coil.solid for coil in self.magnet_coils] - ) - cq.exporters.export(coil_set, str(export_path)) - -<<<<<<< HEAD - def mesh_magnets(self, min_size=20.0, max_size=50.0, max_gradient=1.5): - """Creates tetrahedral mesh of magnet volumes via Coreform Cubit. -======= - def export_stl(self, stl_filename="magnet_set", export_dir=""): - """Export CAD solids as a STL file via CadQuery. - - Arguments: - stl_filename (str): name of STL output file, excluding '.stl' - extension (optional, defaults to 'magnet_set'). - export_dir (str): directory to which to export the STL output file - (optional, defaults to empty string). - """ - self._logger.info("Exporting STL file for magnet coils...") - - self.export_dir = export_dir - self.stl_filename = stl_filename - - export_path = Path(self.export_dir) / Path( - self.stl_filename - ).with_suffix(".stl") -======= self.filename ).with_suffix(f".{filetype}") ->>>>>>> 666c81c (export_step and export_stl merged into a single function) coil_set = cq.Compound.makeCompound( [coil.solid for coil in self.magnet_coils] ) cq.exporters.export(coil_set, str(export_path)) - def mesh_magnets(self): - """Creates tetrahedral mesh of magnet volumes via Coreform Cubit.""" - self._logger.info("Generating tetrahedral mesh of magnet coils...") ->>>>>>> b8d21a2 (export to STL format capability added) + def mesh_magnets(self, min_size=20.0, max_size=50.0, max_gradient=1.5): + """Creates tetrahedral mesh of magnet volumes via Coreform Cubit. Arguments: min_size (float): minimum size of mesh elements (defaults to 20.0). diff --git a/parastell/parastell.py b/parastell/parastell.py index 1398ccf..2c4e9d4 100644 --- a/parastell/parastell.py +++ b/parastell/parastell.py @@ -177,8 +177,8 @@ def export_invessel_build( neutronics H5M file of in-vessel components via CAD-to-DAGMC. Arguments: - filetype (str): file extension to which solids are exported - (defaults to STEP). + filetype (str): file extension, excluding '.', to which solids are + exported (defaults to STEP). export_cad_to_dagmc (bool): export DAGMC neutronics H5M file of in-vessel components via CAD-to-DAGMC (optional, defaults to False). @@ -241,9 +241,9 @@ def export_magnets( """Export magnet components. Arguments: - filetype (str): filetype (str): file extension to which solids are + filetype (str): file extension, excluding '.', to which solids are exported (defaults to STEP). - filename (str): name of export output file, excluding extension + filename (str): name of output file, excluding extension (optional, defaults to 'magnet_set'). export_mesh (bool): flag to indicate tetrahedral mesh generation for magnet volumes (optional, defaults to False).