Skip to content

Commit d2fbc3a

Browse files
testing cache of raw tessellation
1 parent 35608f7 commit d2fbc3a

File tree

2 files changed

+25
-3
lines changed

2 files changed

+25
-3
lines changed

src/ansys/geometry/core/_grpc/_services/v0/designs.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
build_grpc_id,
3232
from_design_file_format_to_grpc_part_export_format,
3333
from_grpc_curve_to_curve,
34+
from_grpc_edge_tess_to_raw_data,
3435
from_grpc_frame_to_frame,
3536
from_grpc_material_to_material,
3637
from_grpc_matrix_to_matrix,
@@ -481,7 +482,7 @@ def stream_design_tessellation(self, **kwargs) -> dict: # noqa: D102
481482
for face_id, face_tess in body_tess.face_tessellation.items():
482483
tess[face_id] = from_grpc_tess_to_raw_data(face_tess)
483484
for edge_id, edge_tess in body_tess.edge_tessellation.items():
484-
tess[edge_id] = from_grpc_tess_to_raw_data(edge_tess)
485+
tess[edge_id] = from_grpc_edge_tess_to_raw_data(edge_tess)
485486
tess_map[body_id] = tess
486487

487488
return {

tests/integration/test_tessellation.py

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,9 @@ def test_body_tessellate_with_edges(modeler: Modeler):
166166
assert blocks_1.bounds == pytest.approx([0.0, 4.0, -2.0, 2.0, 0.0, 4.0])
167167
assert mesh_1.n_arrays == 0
168168

169+
# Check cache with edges
170+
assert body_1._template._tessellation is not None
171+
169172

170173
@pytest.mark.skipif(
171174
not are_graphics_available(), reason="Skipping due to graphics requirements missing"
@@ -213,7 +216,6 @@ def test_component_tessellate(modeler: Modeler):
213216
)
214217

215218

216-
@pytest.mark.skip(reason="Needs ApiServer fix. Disabled until then.")
217219
def test_get_design_tessellation(modeler: Modeler):
218220
"""Test getting the entire design tessellation."""
219221
# Create a design with two bodies
@@ -246,6 +248,21 @@ def test_get_design_tessellation(modeler: Modeler):
246248
assert isinstance(design_tess, dict)
247249
assert len(design_tess) == 2 # Two bodies in the design
248250

251+
box_tess = design_tess[box.id]
252+
assert isinstance(box_tess, dict)
253+
assert len(box_tess) == 18 # Six faces + Twelve edges on the box
254+
255+
for face_id, face_tess in box_tess.items():
256+
assert isinstance(face_id, str)
257+
assert isinstance(face_tess, dict)
258+
259+
cyl_tess = design_tess[cyl.id]
260+
assert isinstance(cyl_tess, dict)
261+
assert len(cyl_tess) == 5 # Three faces + Two edges on the cylinder
262+
263+
# Check design cache
264+
assert design._design_tess == design_tess
265+
249266

250267
def test_get_body_raw_tessellation(modeler: Modeler):
251268
"""Test getting the raw tessellation from a body."""
@@ -275,4 +292,8 @@ def test_get_body_raw_tessellation(modeler: Modeler):
275292

276293
for id, tess in cyl_tess.items():
277294
assert isinstance(id, str)
278-
assert isinstance(tess, dict)
295+
assert isinstance(tess, dict)
296+
297+
# Check raw tessellation cache
298+
assert box._template._raw_tessellation == box_tess
299+
assert cylinder._template._raw_tessellation == cyl_tess

0 commit comments

Comments
 (0)