|
21 | 21 | # SOFTWARE. |
22 | 22 | """Testing of prepare tools.""" |
23 | 23 |
|
| 24 | +from pint import Quantity |
| 25 | + |
| 26 | +from ansys.geometry.core.math.point import Point2D |
| 27 | +from ansys.geometry.core.misc.measurements import UNITS |
24 | 28 | from ansys.geometry.core.modeler import Modeler |
| 29 | +from ansys.geometry.core.sketch import Sketch |
25 | 30 |
|
26 | 31 | from .conftest import FILES_DIR |
27 | 32 |
|
@@ -53,8 +58,28 @@ def test_volume_extract_from_edge_loops(modeler: Modeler): |
53 | 58 |
|
54 | 59 | def test_share_topology(modeler: Modeler): |
55 | 60 | """Test share topology operation is between two bodies.""" |
56 | | - design = modeler.open_file(FILES_DIR / "MixingTank.scdocx") |
57 | | - assert modeler.prepare_tools.share_topology(design.bodies) |
| 61 | + design = Modeler.create_design(modeler, "ShareTopoDoc") |
| 62 | + sketch = Sketch() |
| 63 | + sketch.box(Point2D([10, 10], UNITS.mm), Quantity(10, UNITS.mm), Quantity(10, UNITS.mm)) |
| 64 | + design.extrude_sketch("JustABox", sketch, Quantity(10, UNITS.mm)) |
| 65 | + sketch = Sketch() |
| 66 | + sketch.box(Point2D([20, 10], UNITS.mm), Quantity(10, UNITS.mm), Quantity(10, UNITS.mm)) |
| 67 | + design.extrude_sketch("JustABox", sketch, Quantity(5, UNITS.mm)) |
| 68 | + faces = 0 |
| 69 | + edges = 0 |
| 70 | + for body in design.bodies: |
| 71 | + faces += len(body.faces) |
| 72 | + edges += len(body.edges) |
| 73 | + assert faces == 12 |
| 74 | + assert edges == 24 |
| 75 | + modeler.prepare_tools.share_topology(design.bodies) |
| 76 | + faces = 0 |
| 77 | + edges = 0 |
| 78 | + for body in design.bodies: |
| 79 | + faces += len(body.faces) |
| 80 | + edges += len(body.edges) |
| 81 | + assert faces == 13 |
| 82 | + assert edges == 27 |
58 | 83 |
|
59 | 84 |
|
60 | 85 | def test_enhanced_share_topology(modeler: Modeler): |
|
0 commit comments