cad-to-dagmc 0.9.7__py3-none-any.whl → 0.9.9__py3-none-any.whl
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.
- _version.py +2 -2
- cad_to_dagmc/core.py +37 -9
- {cad_to_dagmc-0.9.7.dist-info → cad_to_dagmc-0.9.9.dist-info}/METADATA +1 -1
- cad_to_dagmc-0.9.9.dist-info/RECORD +9 -0
- cad_to_dagmc-0.9.7.dist-info/RECORD +0 -9
- {cad_to_dagmc-0.9.7.dist-info → cad_to_dagmc-0.9.9.dist-info}/WHEEL +0 -0
- {cad_to_dagmc-0.9.7.dist-info → cad_to_dagmc-0.9.9.dist-info}/licenses/LICENSE +0 -0
- {cad_to_dagmc-0.9.7.dist-info → cad_to_dagmc-0.9.9.dist-info}/top_level.txt +0 -0
_version.py
CHANGED
|
@@ -28,7 +28,7 @@ version_tuple: VERSION_TUPLE
|
|
|
28
28
|
commit_id: COMMIT_ID
|
|
29
29
|
__commit_id__: COMMIT_ID
|
|
30
30
|
|
|
31
|
-
__version__ = version = '0.9.
|
|
32
|
-
__version_tuple__ = version_tuple = (0, 9,
|
|
31
|
+
__version__ = version = '0.9.9'
|
|
32
|
+
__version_tuple__ = version_tuple = (0, 9, 9)
|
|
33
33
|
|
|
34
34
|
__commit_id__ = commit_id = None
|
cad_to_dagmc/core.py
CHANGED
|
@@ -106,6 +106,9 @@ def vertices_to_h5m(
|
|
|
106
106
|
|
|
107
107
|
moab_core, tags = define_moab_core_and_tags()
|
|
108
108
|
|
|
109
|
+
# Add the vertices once at the start
|
|
110
|
+
all_moab_verts = moab_core.create_vertices(vertices)
|
|
111
|
+
|
|
109
112
|
volume_sets_by_solid_id = {}
|
|
110
113
|
for material_tag, (solid_id, triangles_on_each_face) in zip(
|
|
111
114
|
material_tags, triangles_by_solid_by_face.items()
|
|
@@ -145,14 +148,21 @@ def vertices_to_h5m(
|
|
|
145
148
|
|
|
146
149
|
moab_core.tag_set_data(tags["surf_sense"], face_set, sense_data)
|
|
147
150
|
|
|
148
|
-
|
|
151
|
+
# Collect only the vertices that lie on triangles on this face
|
|
152
|
+
face_vertices_set = set()
|
|
153
|
+
for triangle in triangles_on_face:
|
|
154
|
+
face_vertices_set.update(triangle)
|
|
155
|
+
face_vertices_list = sorted(face_vertices_set)
|
|
156
|
+
|
|
157
|
+
# Only add these to the MOAB face
|
|
158
|
+
moab_verts = [all_moab_verts[ii] for ii in face_vertices_list]
|
|
149
159
|
moab_core.add_entity(face_set, moab_verts)
|
|
150
160
|
|
|
151
161
|
for triangle in triangles_on_face:
|
|
152
162
|
tri = (
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
163
|
+
all_moab_verts[int(triangle[0])],
|
|
164
|
+
all_moab_verts[int(triangle[1])],
|
|
165
|
+
all_moab_verts[int(triangle[2])],
|
|
156
166
|
)
|
|
157
167
|
|
|
158
168
|
moab_triangle = moab_core.create_element(types.MBTRI, tri)
|
|
@@ -580,7 +590,7 @@ class CadToDagmc:
|
|
|
580
590
|
cadquery_object: (
|
|
581
591
|
cq.assembly.Assembly | cq.occ_impl.shapes.Compound | cq.occ_impl.shapes.Solid
|
|
582
592
|
),
|
|
583
|
-
material_tags: list[str] | None,
|
|
593
|
+
material_tags: list[str] | None = None,
|
|
584
594
|
scale_factor: float = 1.0,
|
|
585
595
|
) -> int:
|
|
586
596
|
"""Loads the parts from CadQuery object into the model.
|
|
@@ -603,18 +613,36 @@ class CadToDagmc:
|
|
|
603
613
|
"""
|
|
604
614
|
|
|
605
615
|
if isinstance(cadquery_object, cq.assembly.Assembly):
|
|
606
|
-
|
|
616
|
+
# look for materials in each part of the assembly
|
|
617
|
+
if material_tags is None:
|
|
618
|
+
material_tags = []
|
|
619
|
+
for child in cadquery_object.children:
|
|
620
|
+
if child.material is not None and child.material.name is not None:
|
|
621
|
+
material_tags.append(child.material.name)
|
|
622
|
+
else:
|
|
623
|
+
raise ValueError(
|
|
624
|
+
f"Not all parts in the assembly have material tags assigned. "
|
|
625
|
+
f"Missing material tag for child: {child}. "
|
|
626
|
+
"Please assign material tags to all parts or provide material_tags argument when adding the assembly."
|
|
627
|
+
)
|
|
628
|
+
|
|
629
|
+
cadquery_compound = cadquery_object.toCompound()
|
|
630
|
+
else:
|
|
631
|
+
cadquery_compound = cadquery_object
|
|
607
632
|
|
|
608
|
-
if isinstance(
|
|
609
|
-
iterable_solids =
|
|
633
|
+
if isinstance(cadquery_compound, (cq.occ_impl.shapes.Compound, cq.occ_impl.shapes.Solid)):
|
|
634
|
+
iterable_solids = cadquery_compound.Solids()
|
|
610
635
|
else:
|
|
611
|
-
iterable_solids =
|
|
636
|
+
iterable_solids = cadquery_compound.val().Solids()
|
|
612
637
|
|
|
613
638
|
if scale_factor == 1.0:
|
|
614
639
|
scaled_iterable_solids = iterable_solids
|
|
615
640
|
else:
|
|
616
641
|
scaled_iterable_solids = [part.scale(scale_factor) for part in iterable_solids]
|
|
617
642
|
|
|
643
|
+
# look for materials in the
|
|
644
|
+
# if material_tags is None:
|
|
645
|
+
|
|
618
646
|
check_material_tags(material_tags, scaled_iterable_solids)
|
|
619
647
|
if material_tags:
|
|
620
648
|
self.material_tags = self.material_tags + material_tags
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
_version.py,sha256=ICJcCYYRydywQ4LYVoe5Hg1g5gm82yoqqH0yhtrP2aM,704
|
|
2
|
+
cad_to_dagmc/__init__.py,sha256=oCr1P0QnBsf6AH0RZujX7T7tdrb75NazdF70HtqXSfc,528
|
|
3
|
+
cad_to_dagmc/core.py,sha256=i9CfNmDBCGati5YzfSA9ymwcgxeleDDN71ge5laxjr8,44105
|
|
4
|
+
cad_to_dagmc/direct_mesh_plugin.py,sha256=iKPYtWQd35Ipxv6g8fZ-r7GFKd1VlCwrSfaNzrGFtf0,24131
|
|
5
|
+
cad_to_dagmc-0.9.9.dist-info/licenses/LICENSE,sha256=B8kznH_777JVNZ3HOKDc4Tj24F7wJ68ledaNYeL9sCw,1070
|
|
6
|
+
cad_to_dagmc-0.9.9.dist-info/METADATA,sha256=xhzOG-Pb2wBJB5_wHaMhNxRIREnJxVqslrFrFUlaLf0,8994
|
|
7
|
+
cad_to_dagmc-0.9.9.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
8
|
+
cad_to_dagmc-0.9.9.dist-info/top_level.txt,sha256=zTi8C64SEBsE5WOtPovnxhOzt-E6Oc5nC3RW6M_5aEA,22
|
|
9
|
+
cad_to_dagmc-0.9.9.dist-info/RECORD,,
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
_version.py,sha256=nVR1UPhFOYODT1jRbOZVkLGatCOSQLCVT4ndGPtcnZ8,704
|
|
2
|
-
cad_to_dagmc/__init__.py,sha256=oCr1P0QnBsf6AH0RZujX7T7tdrb75NazdF70HtqXSfc,528
|
|
3
|
-
cad_to_dagmc/core.py,sha256=2U7KdBCCJst3pQTbMV3qjNzV1qNIzT_Ey9OZK7NVd48,42756
|
|
4
|
-
cad_to_dagmc/direct_mesh_plugin.py,sha256=iKPYtWQd35Ipxv6g8fZ-r7GFKd1VlCwrSfaNzrGFtf0,24131
|
|
5
|
-
cad_to_dagmc-0.9.7.dist-info/licenses/LICENSE,sha256=B8kznH_777JVNZ3HOKDc4Tj24F7wJ68ledaNYeL9sCw,1070
|
|
6
|
-
cad_to_dagmc-0.9.7.dist-info/METADATA,sha256=1qZc6ys0oUghoevoLgz-YO3uODOxYocdapgnb7GBIXA,8994
|
|
7
|
-
cad_to_dagmc-0.9.7.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
8
|
-
cad_to_dagmc-0.9.7.dist-info/top_level.txt,sha256=zTi8C64SEBsE5WOtPovnxhOzt-E6Oc5nC3RW6M_5aEA,22
|
|
9
|
-
cad_to_dagmc-0.9.7.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|