From b092db0f2560ccc74436dedb323d39060fa3b986 Mon Sep 17 00:00:00 2001 From: Jonathan Shimwell Date: Sun, 3 Mar 2024 21:26:38 +0000 Subject: [PATCH] moved material tags to export --- examples/cadquery_assembly.py | 6 ++++-- examples/cadquery_compound.py | 6 ++++-- examples/cadquery_object_and_stp_file.py | 13 ++++++++++--- examples/cadquery_text.py | 12 +++++++----- .../curved_cadquery_object_to_dagmc_surface_mesh.py | 10 +++++----- examples/multiple_cadquery_objects.py | 6 +++--- examples/multiple_stp_files.py | 7 ++++--- examples/single_cadquery_object.py | 4 ++-- examples/single_stp_file.py | 4 ++-- examples/single_stp_file_multiple_volumes.py | 4 ++-- 10 files changed, 43 insertions(+), 29 deletions(-) diff --git a/examples/cadquery_assembly.py b/examples/cadquery_assembly.py index 6de7acf..ac60f9d 100644 --- a/examples/cadquery_assembly.py +++ b/examples/cadquery_assembly.py @@ -10,5 +10,7 @@ assembly.add(result2) my_model = CadToDagmc() -my_model.add_cadquery_object(assembly, material_tags=["mat1", "mat2"]) -my_model.export_dagmc_h5m_file(min_mesh_size=0.5, max_mesh_size=1.0) +my_model.add_cadquery_object(assembly) +my_model.export_dagmc_h5m_file( + min_mesh_size=0.5, max_mesh_size=1.0, material_tags=["mat1", "mat2"] +) diff --git a/examples/cadquery_compound.py b/examples/cadquery_compound.py index aaa9573..66de324 100644 --- a/examples/cadquery_compound.py +++ b/examples/cadquery_compound.py @@ -24,5 +24,7 @@ compound_of_shapes = cq.Compound.makeCompound([cq_shape_1.val(), cq_shape_2.val()]) my_model = CadToDagmc() -my_model.add_cadquery_object(object=compound_of_shapes, material_tags=["mat1", "mat2"]) -my_model.export_dagmc_h5m_file(max_mesh_size=0.2, min_mesh_size=0.1) +my_model.add_cadquery_object(object=compound_of_shapes) +my_model.export_dagmc_h5m_file( + max_mesh_size=0.2, min_mesh_size=0.1, material_tags=["mat1", "mat2"] +) diff --git a/examples/cadquery_object_and_stp_file.py b/examples/cadquery_object_and_stp_file.py index 1a96c17..e4d23e5 100644 --- a/examples/cadquery_object_and_stp_file.py +++ b/examples/cadquery_object_and_stp_file.py @@ -4,6 +4,13 @@ result = cq.Workplane("XY").moveTo(10, 0).box(3, 3, 0.5).edges("|Z").fillet(0.125) my_model = CadToDagmc() -my_model.add_cadquery_object(object=result, material_tags=["mat1"]) -my_model.add_stp_file(filename="single_cube.stp", material_tags=["mat2"], scale_factor=0.1) -my_model.export_dagmc_h5m_file(max_mesh_size=0.2, min_mesh_size=0.1) + +my_model.add_cadquery_object(result) + +my_model.add_stp_file(filename="single_cube.stp", scale_factor=0.1) + +my_model.export_dagmc_h5m_file( + max_mesh_size=0.2, + min_mesh_size=0.1, + material_tags=["mat1", "mat2"], +) diff --git a/examples/cadquery_text.py b/examples/cadquery_text.py index d69e710..cc4f4a9 100644 --- a/examples/cadquery_text.py +++ b/examples/cadquery_text.py @@ -5,8 +5,12 @@ my_model = CadToDagmc() -my_model.add_cadquery_object( - object=text, +my_model.add_cadquery_object(object=text) + +my_model.export_dagmc_h5m_file( + filename="cadquery_text.h5m", + max_mesh_size=0.2, + min_mesh_size=0.1, material_tags=[ "mat1", "mat2", @@ -14,6 +18,4 @@ "mat4", "mat5", ], # 5 volumes one for each letter -) - -my_model.export_dagmc_h5m_file(filename="cadquery_text.h5m", max_mesh_size=0.2, min_mesh_size=0.1) +) \ No newline at end of file diff --git a/examples/curved_cadquery_object_to_dagmc_surface_mesh.py b/examples/curved_cadquery_object_to_dagmc_surface_mesh.py index 107b2e7..37dd70a 100644 --- a/examples/curved_cadquery_object_to_dagmc_surface_mesh.py +++ b/examples/curved_cadquery_object_to_dagmc_surface_mesh.py @@ -39,11 +39,11 @@ def gear(t, r1=4, r2=1): my_model = CadToDagmc() -my_model.add_cadquery_object( - result, - material_tags=["mat1"], -) +my_model.add_cadquery_object(result) my_model.export_dagmc_h5m_file( - filename="cadquery_objects_and_stp_files.h5m", max_mesh_size=1, min_mesh_size=0.1 + filename="cadquery_objects_and_stp_files.h5m", + max_mesh_size=1, + min_mesh_size=0.1, + material_tags=["mat1"], ) diff --git a/examples/multiple_cadquery_objects.py b/examples/multiple_cadquery_objects.py index a25e04a..6d8d4da 100644 --- a/examples/multiple_cadquery_objects.py +++ b/examples/multiple_cadquery_objects.py @@ -7,6 +7,6 @@ box_with_round_corners = cq.Workplane("XY").box(2, 1, 1) my_model = CadToDagmc() -my_model.add_cadquery_object(box, material_tags=["mat1"]) -my_model.add_cadquery_object(box_with_round_corners, material_tags=["mat2"]) -my_model.export_dagmc_h5m_file() +my_model.add_cadquery_object(box) +my_model.add_cadquery_object(box_with_round_corners) +my_model.export_dagmc_h5m_file(material_tags=["mat1", "mat2"]) diff --git a/examples/multiple_stp_files.py b/examples/multiple_stp_files.py index 8099094..f2a00c9 100644 --- a/examples/multiple_stp_files.py +++ b/examples/multiple_stp_files.py @@ -1,9 +1,10 @@ from cad_to_dagmc import CadToDagmc my_model = CadToDagmc() -my_model.add_stp_file("two_connected_cubes.stp", material_tags=["mat1", "mat2"]) -my_model.add_stp_file("single_sphere.stp", material_tags=["mat3"]) +my_model.add_stp_file("two_connected_cubes.stp") +my_model.add_stp_file("single_sphere.stp") my_model.export_dagmc_h5m_file( - max_mesh_size=1, min_mesh_size=0.5, implicit_complement_material_tag="air" + max_mesh_size=1, min_mesh_size=0.5, implicit_complement_material_tag="air", + material_tags=["mat1", "mat2", "mat3"] ) diff --git a/examples/single_cadquery_object.py b/examples/single_cadquery_object.py index b70923f..ba52ebd 100644 --- a/examples/single_cadquery_object.py +++ b/examples/single_cadquery_object.py @@ -4,5 +4,5 @@ result = sphere = cq.Workplane().moveTo(100, 0).sphere(5) my_model = CadToDagmc() -my_model.add_cadquery_object(result, material_tags=["mat1"]) -my_model.export_dagmc_h5m_file() +my_model.add_cadquery_object(result) +my_model.export_dagmc_h5m_file(material_tags=["mat1"]) diff --git a/examples/single_stp_file.py b/examples/single_stp_file.py index 93413eb..adbdc05 100644 --- a/examples/single_stp_file.py +++ b/examples/single_stp_file.py @@ -1,5 +1,5 @@ from cad_to_dagmc import CadToDagmc my_model = CadToDagmc() -my_model.add_stp_file("spline_extrude.stp", material_tags=["mat1"]) -my_model.export_dagmc_h5m_file() +my_model.add_stp_file("spline_extrude.stp") +my_model.export_dagmc_h5m_file(material_tags=["mat1"]) diff --git a/examples/single_stp_file_multiple_volumes.py b/examples/single_stp_file_multiple_volumes.py index 960adac..9fd9f0d 100644 --- a/examples/single_stp_file_multiple_volumes.py +++ b/examples/single_stp_file_multiple_volumes.py @@ -2,5 +2,5 @@ my_model = CadToDagmc() # the d and c from the word dagmc would be tagged with one material and the agm are tagged with another material -my_model.add_stp_file("text_dagmc.stp", material_tags=["mat1", "mat2", "mat2", "mat2", "mat1"]) -my_model.export_dagmc_h5m_file() +my_model.add_stp_file("text_dagmc.stp") +my_model.export_dagmc_h5m_file(material_tags=["mat1", "mat2", "mat2", "mat2", "mat1"])