Skip to content

Commit

Permalink
moved material tags to export
Browse files Browse the repository at this point in the history
  • Loading branch information
shimwell committed Mar 3, 2024
1 parent 13de471 commit b092db0
Show file tree
Hide file tree
Showing 10 changed files with 43 additions and 29 deletions.
6 changes: 4 additions & 2 deletions examples/cadquery_assembly.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
)
6 changes: 4 additions & 2 deletions examples/cadquery_compound.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
)
13 changes: 10 additions & 3 deletions examples/cadquery_object_and_stp_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
)
12 changes: 7 additions & 5 deletions examples/cadquery_text.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,17 @@


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",
"mat3",
"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)
)
10 changes: 5 additions & 5 deletions examples/curved_cadquery_object_to_dagmc_surface_mesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
)
6 changes: 3 additions & 3 deletions examples/multiple_cadquery_objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"])
7 changes: 4 additions & 3 deletions examples/multiple_stp_files.py
Original file line number Diff line number Diff line change
@@ -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"]
)
4 changes: 2 additions & 2 deletions examples/single_cadquery_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"])
4 changes: 2 additions & 2 deletions examples/single_stp_file.py
Original file line number Diff line number Diff line change
@@ -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"])
4 changes: 2 additions & 2 deletions examples/single_stp_file_multiple_volumes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"])

0 comments on commit b092db0

Please sign in to comment.