Skip to content

Commit

Permalink
Merge pull request #80 from fusion-energy/making-stp-files-in-example
Browse files Browse the repository at this point in the history
Making stp files  directly in the example
  • Loading branch information
shimwell authored Apr 13, 2024
2 parents 1bf810d + 5a7413f commit 3d49f00
Show file tree
Hide file tree
Showing 10 changed files with 68 additions and 161 deletions.
1 change: 0 additions & 1 deletion .github/workflows/ci_with_install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ jobs:
python -c "import cad_to_dagmc"
python -m pip install .[tests]
pytest -v tests
python examples/surface_mesh/create_stp_files_for_examples.py
python examples/surface_mesh/cadquery_assembly.py
python examples/surface_mesh/cadquery_compound.py
python examples/surface_mesh/cadquery_object_and_stp_file.py
Expand Down
25 changes: 13 additions & 12 deletions .github/workflows/ci_with_pip_install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,16 @@ jobs:
python -m pip install .[tests]
pytest -v tests
cd examples
python create_stp_files_for_examples.py
python cadquery_assembly.py
python cadquery_compound.py
python cadquery_object_and_stp_file.py
python cadquery_text.py
python curved_cadquery_object_to_dagmc_surface_mesh.py
python curved_cadquery_object_to_dagmc_volume_mesh.py
python multiple_cadquery_objects.py
python multiple_stp_files.py
python single_stp_file_multiple_volumes.py
python single_cadquery_object.py
python single_stp_file.py
python examples/surface_mesh/cadquery_assembly.py
python examples/surface_mesh/cadquery_compound.py
python examples/surface_mesh/cadquery_object_and_stp_file.py
python examples/surface_mesh/cadquery_text.py
python examples/surface_mesh/curved_cadquery_object_to_dagmc_surface_mesh.py
python examples/surface_mesh/multiple_cadquery_objects.py
python examples/surface_mesh/multiple_stp_files.py
python examples/surface_mesh/single_stp_file_multiple_volumes.py
python examples/surface_mesh/single_cadquery_object.py
python examples/surface_mesh/single_stp_file.py
python examples/surface_mesh/from_gmsh_mesh_file.py
python examples/unstrucutred_volume_mesh/curved_cadquery_object_to_dagmc_volume_mesh.py
python examples/unstrucutred_volume_mesh/simulate_unstrucutred_volume_mesh_with_openmc.py
3 changes: 1 addition & 2 deletions examples/surface_mesh/cadquery_assembly.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import cadquery as cq
from cadquery import Assembly
from cad_to_dagmc import CadToDagmc

result = cq.Workplane().sphere(5)
result2 = cq.Workplane().moveTo(10, 0).sphere(2)

assembly = Assembly()
assembly = cq.Assembly()
assembly.add(result)
assembly.add(result2)

Expand Down
6 changes: 6 additions & 0 deletions examples/surface_mesh/cadquery_object_and_stp_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@

result = cq.Workplane("XY").moveTo(10, 0).box(3, 3, 0.5).edges("|Z").fillet(0.125)

result2 = cq.Workplane("XY").box(1.0, 1.0, 1.0)
assembly = cq.Assembly()
assembly.add(result2)
assembly.save("single_cube.stp", exportType="STEP")


my_model = CadToDagmc()

my_model.add_cadquery_object(
Expand Down
90 changes: 0 additions & 90 deletions examples/surface_mesh/create_stp_files_for_examples.py

This file was deleted.

8 changes: 8 additions & 0 deletions examples/surface_mesh/from_gmsh_mesh_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@

# making the GMESH file
from cad_to_dagmc import CadToDagmc
import cadquery as cq

result1 = cq.Workplane("XY").box(10.0, 10.0, 5.0)
result2 = cq.Workplane("XY").moveTo(10, 0).box(10.0, 10.0, 5.0)
assembly = cq.Assembly()
assembly.add(result1)
assembly.add(result2)
assembly.save("two_connected_cubes.stp", exportType="STEP")

geometry = CadToDagmc()
geometry.add_stp_file("two_connected_cubes.stp")
Expand Down
13 changes: 13 additions & 0 deletions examples/surface_mesh/multiple_stp_files.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,17 @@
from cad_to_dagmc import CadToDagmc
import cadquery as cq

result1 = cq.Workplane("XY").box(10.0, 10.0, 5.0)
result2 = cq.Workplane("XY").moveTo(10, 0).box(10.0, 10.0, 5.0)
assembly = cq.Assembly()
assembly.add(result1)
assembly.add(result2)
assembly.save("two_connected_cubes.stp", exportType="STEP")

result = cq.Workplane().moveTo(100, 0).sphere(5)
assembly = cq.Assembly()
assembly.add(result)
assembly.save("single_sphere.stp", exportType="STEP")

my_model = CadToDagmc()
my_model.add_stp_file(
Expand Down
19 changes: 19 additions & 0 deletions examples/surface_mesh/single_stp_file.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
from cad_to_dagmc import CadToDagmc

import cadquery as cq

result = cq.Workplane("XY")
spline_points = [
(2.75, 1.5),
(2.5, 1.75),
(2.0, 1.5),
(1.5, 1.0),
(1.0, 1.25),
(0.5, 1.0),
(0, 1.0),
]
r = result.lineTo(3.0, 0).lineTo(3.0, 1.0).spline(spline_points, includeCurrent=True).close()
result = r.extrude(1.5)
assembly = cq.Assembly()
assembly.add(result)
assembly.save("spline_extrude.stp", exportType="STEP")


my_model = CadToDagmc()
my_model.add_stp_file(filename="spline_extrude.stp", material_tags=["mat1"])
my_model.export_dagmc_h5m_file()
8 changes: 8 additions & 0 deletions examples/surface_mesh/single_stp_file_multiple_volumes.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
from cad_to_dagmc import CadToDagmc

import cadquery as cq

result = cq.Workplane().text(txt="DAGMC", fontsize=10, distance=1)
assembly = cq.Assembly()
assembly.add(result)
assembly.save("text_dagmc.stp", exportType="STEP")


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(
Expand Down
56 changes: 0 additions & 56 deletions tests/create_brep_file_for_testing.py

This file was deleted.

0 comments on commit 3d49f00

Please sign in to comment.