|
7 | 7 | from random import choice |
8 | 8 | from random import random |
9 | 9 | from random import randrange |
| 10 | +from itertools import product |
10 | 11 |
|
11 | 12 | from pytest import approx, raises |
12 | 13 |
|
@@ -2069,6 +2070,22 @@ def testWedgeCentering(self): |
2069 | 2070 | self.assertEqual(1, s.solids().size()) |
2070 | 2071 | self.assertEqual(5, s.faces().size()) |
2071 | 2072 | self.assertEqual(5, s.vertices().size()) |
| 2073 | + # check that the bottom corner is where we expect it for all possible combinations of centered |
| 2074 | + x, y, z = 10, 11, 12 |
| 2075 | + b = [True, False] |
| 2076 | + expected_x = [-x / 2, 0] |
| 2077 | + expected_y = [-y / 2, 0] |
| 2078 | + expected_z = [-z / 2, 0] |
| 2079 | + for (xopt, xval), (yopt, yval), (zopt, zval) in product( |
| 2080 | + zip(b, expected_x), zip(b, expected_y), zip(b, expected_z) |
| 2081 | + ): |
| 2082 | + s = ( |
| 2083 | + Workplane() |
| 2084 | + .wedge(x, y, z, 2, 2, x - 2, z - 2, centered=(xopt, yopt, zopt)) |
| 2085 | + .vertices("<X and <Y and <Z") |
| 2086 | + ) |
| 2087 | + self.assertEqual(s.size(), 1) |
| 2088 | + self.assertTupleAlmostEquals(s.val().toTuple(), (xval, yval, zval), 3) |
2072 | 2089 |
|
2073 | 2090 | def testWedgePointList(self): |
2074 | 2091 | s = ( |
|
0 commit comments