cad-to-dagmc 0.7.2__tar.gz → 0.7.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of cad-to-dagmc might be problematic. Click here for more details.
- {cad_to_dagmc-0.7.2 → cad_to_dagmc-0.7.3}/.github/workflows/ci_with_conda_install.yml +1 -0
- {cad_to_dagmc-0.7.2 → cad_to_dagmc-0.7.3}/.github/workflows/ci_with_pip_install.yml +1 -0
- {cad_to_dagmc-0.7.2 → cad_to_dagmc-0.7.3}/PKG-INFO +1 -1
- {cad_to_dagmc-0.7.2 → cad_to_dagmc-0.7.3}/examples/surface_mesh/cadquery_assembly.py +1 -1
- cad_to_dagmc-0.7.3/examples/surface_mesh/cadquery_assembly_with_scaled_geometry.py +14 -0
- {cad_to_dagmc-0.7.2 → cad_to_dagmc-0.7.3}/src/_version.py +2 -2
- {cad_to_dagmc-0.7.2 → cad_to_dagmc-0.7.3}/src/cad_to_dagmc/core.py +32 -8
- {cad_to_dagmc-0.7.2 → cad_to_dagmc-0.7.3}/src/cad_to_dagmc.egg-info/PKG-INFO +1 -1
- {cad_to_dagmc-0.7.2 → cad_to_dagmc-0.7.3}/src/cad_to_dagmc.egg-info/SOURCES.txt +1 -0
- {cad_to_dagmc-0.7.2 → cad_to_dagmc-0.7.3}/.github/workflows/black.yml +0 -0
- {cad_to_dagmc-0.7.2 → cad_to_dagmc-0.7.3}/.github/workflows/ci_with_benchmarks.yml +0 -0
- {cad_to_dagmc-0.7.2 → cad_to_dagmc-0.7.3}/.github/workflows/python-publish.yml +0 -0
- {cad_to_dagmc-0.7.2 → cad_to_dagmc-0.7.3}/.gitignore +0 -0
- {cad_to_dagmc-0.7.2 → cad_to_dagmc-0.7.3}/CITATION.cff +0 -0
- {cad_to_dagmc-0.7.2 → cad_to_dagmc-0.7.3}/LICENSE +0 -0
- {cad_to_dagmc-0.7.2 → cad_to_dagmc-0.7.3}/README.md +0 -0
- {cad_to_dagmc-0.7.2 → cad_to_dagmc-0.7.3}/examples/surface_mesh/cadquery_compound.py +0 -0
- {cad_to_dagmc-0.7.2 → cad_to_dagmc-0.7.3}/examples/surface_mesh/cadquery_object_and_stp_file.py +0 -0
- {cad_to_dagmc-0.7.2 → cad_to_dagmc-0.7.3}/examples/surface_mesh/cadquery_text.py +0 -0
- {cad_to_dagmc-0.7.2 → cad_to_dagmc-0.7.3}/examples/surface_mesh/curved_cadquery_object_to_dagmc_surface_mesh.py +0 -0
- {cad_to_dagmc-0.7.2 → cad_to_dagmc-0.7.3}/examples/surface_mesh/from_gmsh_mesh_file.py +0 -0
- {cad_to_dagmc-0.7.2 → cad_to_dagmc-0.7.3}/examples/surface_mesh/multiple_cadquery_objects.py +0 -0
- {cad_to_dagmc-0.7.2 → cad_to_dagmc-0.7.3}/examples/surface_mesh/multiple_stp_files.py +0 -0
- {cad_to_dagmc-0.7.2 → cad_to_dagmc-0.7.3}/examples/surface_mesh/single_cadquery_object.py +0 -0
- {cad_to_dagmc-0.7.2 → cad_to_dagmc-0.7.3}/examples/surface_mesh/single_stp_file.py +0 -0
- {cad_to_dagmc-0.7.2 → cad_to_dagmc-0.7.3}/examples/surface_mesh/single_stp_file_multiple_volumes.py +0 -0
- {cad_to_dagmc-0.7.2 → cad_to_dagmc-0.7.3}/examples/unstrucutred_volume_mesh/curved_cadquery_object_to_dagmc_volume_mesh.py +0 -0
- {cad_to_dagmc-0.7.2 → cad_to_dagmc-0.7.3}/examples/unstrucutred_volume_mesh/simulate_unstrucutred_volume_mesh_with_openmc.py +0 -0
- {cad_to_dagmc-0.7.2 → cad_to_dagmc-0.7.3}/pyproject.toml +0 -0
- {cad_to_dagmc-0.7.2 → cad_to_dagmc-0.7.3}/setup.cfg +0 -0
- {cad_to_dagmc-0.7.2 → cad_to_dagmc-0.7.3}/src/cad_to_dagmc/__init__.py +0 -0
- {cad_to_dagmc-0.7.2 → cad_to_dagmc-0.7.3}/src/cad_to_dagmc.egg-info/dependency_links.txt +0 -0
- {cad_to_dagmc-0.7.2 → cad_to_dagmc-0.7.3}/src/cad_to_dagmc.egg-info/requires.txt +0 -0
- {cad_to_dagmc-0.7.2 → cad_to_dagmc-0.7.3}/src/cad_to_dagmc.egg-info/top_level.txt +0 -0
- {cad_to_dagmc-0.7.2 → cad_to_dagmc-0.7.3}/tests/ENDFB-7.1-NNDC_H1.h5 +0 -0
- {cad_to_dagmc-0.7.2 → cad_to_dagmc-0.7.3}/tests/ball_reactor.brep +0 -0
- {cad_to_dagmc-0.7.2 → cad_to_dagmc-0.7.3}/tests/curved_extrude.stp +0 -0
- {cad_to_dagmc-0.7.2 → cad_to_dagmc-0.7.3}/tests/extrude_rectangle.stp +0 -0
- {cad_to_dagmc-0.7.2 → cad_to_dagmc-0.7.3}/tests/multi_volume_cylinders.stp +0 -0
- {cad_to_dagmc-0.7.2 → cad_to_dagmc-0.7.3}/tests/one_cube.brep +0 -0
- {cad_to_dagmc-0.7.2 → cad_to_dagmc-0.7.3}/tests/single_cube.stp +0 -0
- {cad_to_dagmc-0.7.2 → cad_to_dagmc-0.7.3}/tests/single_volume_thin.stp +0 -0
- {cad_to_dagmc-0.7.2 → cad_to_dagmc-0.7.3}/tests/single_volume_thin.vtk +0 -0
- {cad_to_dagmc-0.7.2 → cad_to_dagmc-0.7.3}/tests/test_brep_file.brep +0 -0
- {cad_to_dagmc-0.7.2 → cad_to_dagmc-0.7.3}/tests/test_file_creation.py +0 -0
- {cad_to_dagmc-0.7.2 → cad_to_dagmc-0.7.3}/tests/test_h5m_in_transport.py +0 -0
- {cad_to_dagmc-0.7.2 → cad_to_dagmc-0.7.3}/tests/test_loading_from_file_vs_shape_object.py +0 -0
- {cad_to_dagmc-0.7.2 → cad_to_dagmc-0.7.3}/tests/test_python_api.py +0 -0
- {cad_to_dagmc-0.7.2 → cad_to_dagmc-0.7.3}/tests/test_two_joined_cubes.brep +0 -0
- {cad_to_dagmc-0.7.2 → cad_to_dagmc-0.7.3}/tests/test_two_sep_cubes.brep +0 -0
- {cad_to_dagmc-0.7.2 → cad_to_dagmc-0.7.3}/tests/test_version.py +0 -0
- {cad_to_dagmc-0.7.2 → cad_to_dagmc-0.7.3}/tests/two_connected_cubes.stp +0 -0
- {cad_to_dagmc-0.7.2 → cad_to_dagmc-0.7.3}/tests/two_disconnected_cubes.stp +0 -0
|
@@ -62,3 +62,4 @@ jobs:
|
|
|
62
62
|
python examples/surface_mesh/from_gmsh_mesh_file.py
|
|
63
63
|
python examples/unstrucutred_volume_mesh/curved_cadquery_object_to_dagmc_volume_mesh.py
|
|
64
64
|
python examples/unstrucutred_volume_mesh/simulate_unstrucutred_volume_mesh_with_openmc.py
|
|
65
|
+
python examples/surface_mesh/cadquery_assembly_with_scaled_geometry.py
|
|
@@ -58,3 +58,4 @@ jobs:
|
|
|
58
58
|
python examples/surface_mesh/from_gmsh_mesh_file.py
|
|
59
59
|
python examples/unstrucutred_volume_mesh/curved_cadquery_object_to_dagmc_volume_mesh.py
|
|
60
60
|
python examples/unstrucutred_volume_mesh/simulate_unstrucutred_volume_mesh_with_openmc.py
|
|
61
|
+
python examples/surface_mesh/cadquery_assembly_with_scaled_geometry.py
|
|
@@ -10,4 +10,4 @@ assembly.add(result2)
|
|
|
10
10
|
|
|
11
11
|
my_model = CadToDagmc()
|
|
12
12
|
my_model.add_cadquery_object(cadquery_object=assembly, material_tags=["mat1", "mat2"])
|
|
13
|
-
my_model.export_dagmc_h5m_file(min_mesh_size=0.5, max_mesh_size=1.
|
|
13
|
+
my_model.export_dagmc_h5m_file(min_mesh_size=0.5, max_mesh_size=1.0e6)
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import cadquery as cq
|
|
2
|
+
from cad_to_dagmc import CadToDagmc
|
|
3
|
+
|
|
4
|
+
result = cq.Workplane().sphere(5)
|
|
5
|
+
result2 = cq.Workplane().moveTo(10, 0).sphere(2)
|
|
6
|
+
|
|
7
|
+
assembly = cq.Assembly()
|
|
8
|
+
assembly.add(result)
|
|
9
|
+
assembly.add(result2)
|
|
10
|
+
|
|
11
|
+
my_model = CadToDagmc()
|
|
12
|
+
my_model.add_cadquery_object(cadquery_object=assembly, material_tags=["mat1", "mat2"])
|
|
13
|
+
# scales geometry to makie it 10 times bigger
|
|
14
|
+
my_model.export_dagmc_h5m_file(min_mesh_size=0.5, max_mesh_size=1.0e6, scale_factor=10.0)
|
|
@@ -190,16 +190,27 @@ def _vertices_to_h5m(
|
|
|
190
190
|
return h5m_filename
|
|
191
191
|
|
|
192
192
|
|
|
193
|
-
def get_volumes(gmsh, assembly, method="file"):
|
|
193
|
+
def get_volumes(gmsh, assembly, method="file", scale_factor=1.0):
|
|
194
194
|
|
|
195
195
|
if method == "in memory":
|
|
196
196
|
volumes = gmsh.model.occ.importShapesNativePointer(assembly.wrapped._address())
|
|
197
|
-
|
|
197
|
+
|
|
198
198
|
elif method == "file":
|
|
199
|
-
with tempfile.NamedTemporaryFile(suffix=".
|
|
200
|
-
|
|
199
|
+
with tempfile.NamedTemporaryFile(suffix=".brep") as temp_file:
|
|
200
|
+
if isinstance(assembly, cq.Assembly):
|
|
201
|
+
assembly.toCompound().exportBrep(temp_file.name)
|
|
202
|
+
else:
|
|
203
|
+
assembly.exportBrep(temp_file.name)
|
|
201
204
|
volumes = gmsh.model.occ.importShapes(temp_file.name)
|
|
202
|
-
|
|
205
|
+
|
|
206
|
+
# updating the model to ensure the entities in the geometry are found
|
|
207
|
+
gmsh.model.occ.synchronize()
|
|
208
|
+
|
|
209
|
+
if scale_factor != 1.0:
|
|
210
|
+
dim_tags = gmsh.model.getEntities(3)
|
|
211
|
+
gmsh.model.occ.dilate(dim_tags, 0.0, 0.0, 0.0, scale_factor, scale_factor, scale_factor)
|
|
212
|
+
# update the model to ensure the scaling factor has been applied
|
|
213
|
+
gmsh.model.occ.synchronize()
|
|
203
214
|
|
|
204
215
|
return gmsh, volumes
|
|
205
216
|
|
|
@@ -239,6 +250,7 @@ def _mesh_brep(
|
|
|
239
250
|
gmsh.option.setNumber("Mesh.Algorithm", mesh_algorithm)
|
|
240
251
|
gmsh.option.setNumber("Mesh.MeshSizeMin", min_mesh_size)
|
|
241
252
|
gmsh.option.setNumber("Mesh.MeshSizeMax", max_mesh_size)
|
|
253
|
+
gmsh.option.setNumber("General.NumThreads", 0) # Use all available cores
|
|
242
254
|
gmsh.model.mesh.generate(dimensions)
|
|
243
255
|
|
|
244
256
|
return gmsh
|
|
@@ -477,6 +489,7 @@ class CadToDagmc:
|
|
|
477
489
|
max_mesh_size: float = 5,
|
|
478
490
|
mesh_algorithm: int = 1,
|
|
479
491
|
method: str = "file",
|
|
492
|
+
scale_factor: float = 1.0,
|
|
480
493
|
):
|
|
481
494
|
|
|
482
495
|
assembly = cq.Assembly()
|
|
@@ -487,7 +500,7 @@ class CadToDagmc:
|
|
|
487
500
|
|
|
488
501
|
gmsh = init_gmsh()
|
|
489
502
|
|
|
490
|
-
gmsh, _ = get_volumes(gmsh, imprinted_assembly, method=method)
|
|
503
|
+
gmsh, _ = get_volumes(gmsh, imprinted_assembly, method=method, scale_factor=scale_factor)
|
|
491
504
|
|
|
492
505
|
gmsh = _mesh_brep(
|
|
493
506
|
gmsh=gmsh,
|
|
@@ -516,6 +529,7 @@ class CadToDagmc:
|
|
|
516
529
|
mesh_algorithm: int = 1,
|
|
517
530
|
dimensions: int = 2,
|
|
518
531
|
method: str = "file",
|
|
532
|
+
scale_factor: float = 1.0,
|
|
519
533
|
):
|
|
520
534
|
"""Saves a GMesh msh file of the geometry in either 2D surface mesh or
|
|
521
535
|
3D volume mesh.
|
|
@@ -535,6 +549,9 @@ class CadToDagmc:
|
|
|
535
549
|
the same as the version used by CadQuery. This is possible to
|
|
536
550
|
ensure when installing the package with Conda but harder when
|
|
537
551
|
installing from PyPI.
|
|
552
|
+
scale_factor: a scaling factor to apply to the geometry that can be
|
|
553
|
+
used to enlarge or shrink the geometry. Useful when converting
|
|
554
|
+
Useful when converting the geometry to cm for use in neutronics
|
|
538
555
|
"""
|
|
539
556
|
|
|
540
557
|
assembly = cq.Assembly()
|
|
@@ -545,7 +562,7 @@ class CadToDagmc:
|
|
|
545
562
|
|
|
546
563
|
gmsh = init_gmsh()
|
|
547
564
|
|
|
548
|
-
gmsh, _ = get_volumes(gmsh, imprinted_assembly, method=method)
|
|
565
|
+
gmsh, _ = get_volumes(gmsh, imprinted_assembly, method=method, scale_factor=scale_factor)
|
|
549
566
|
|
|
550
567
|
gmsh = _mesh_brep(
|
|
551
568
|
gmsh=gmsh,
|
|
@@ -569,6 +586,7 @@ class CadToDagmc:
|
|
|
569
586
|
mesh_algorithm: int = 1,
|
|
570
587
|
implicit_complement_material_tag: str | None = None,
|
|
571
588
|
method: str = "file",
|
|
589
|
+
scale_factor: float = 1.0,
|
|
572
590
|
) -> str:
|
|
573
591
|
"""Saves a DAGMC h5m file of the geometry
|
|
574
592
|
|
|
@@ -589,6 +607,10 @@ class CadToDagmc:
|
|
|
589
607
|
the same as the version used by CadQuery. This is possible to
|
|
590
608
|
ensure when installing the package with Conda but harder when
|
|
591
609
|
installing from PyPI.
|
|
610
|
+
scale_factor: a scaling factor to apply to the geometry that can be
|
|
611
|
+
used to enlarge or shrink the geometry. Useful when converting
|
|
612
|
+
Useful when converting the geometry to cm for use in neutronics
|
|
613
|
+
|
|
592
614
|
Returns:
|
|
593
615
|
str: the DAGMC filename saved
|
|
594
616
|
"""
|
|
@@ -617,7 +639,9 @@ class CadToDagmc:
|
|
|
617
639
|
|
|
618
640
|
gmsh = init_gmsh()
|
|
619
641
|
|
|
620
|
-
gmsh, volumes = get_volumes(
|
|
642
|
+
gmsh, volumes = get_volumes(
|
|
643
|
+
gmsh, imprinted_assembly, method=method, scale_factor=scale_factor
|
|
644
|
+
)
|
|
621
645
|
|
|
622
646
|
gmsh = _mesh_brep(
|
|
623
647
|
gmsh=gmsh,
|
|
@@ -9,6 +9,7 @@ pyproject.toml
|
|
|
9
9
|
.github/workflows/ci_with_pip_install.yml
|
|
10
10
|
.github/workflows/python-publish.yml
|
|
11
11
|
examples/surface_mesh/cadquery_assembly.py
|
|
12
|
+
examples/surface_mesh/cadquery_assembly_with_scaled_geometry.py
|
|
12
13
|
examples/surface_mesh/cadquery_compound.py
|
|
13
14
|
examples/surface_mesh/cadquery_object_and_stp_file.py
|
|
14
15
|
examples/surface_mesh/cadquery_text.py
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cad_to_dagmc-0.7.2 → cad_to_dagmc-0.7.3}/examples/surface_mesh/cadquery_object_and_stp_file.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cad_to_dagmc-0.7.2 → cad_to_dagmc-0.7.3}/examples/surface_mesh/multiple_cadquery_objects.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cad_to_dagmc-0.7.2 → cad_to_dagmc-0.7.3}/examples/surface_mesh/single_stp_file_multiple_volumes.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|