()
| 181 | |
| 182 | |
| 183 | def test_constructors(): |
| 184 | |
| 185 | # wire |
| 186 | e1 = segment((0, 0), (0, 1)) |
| 187 | e2 = segment((0, 1), (1, 1)) |
| 188 | e3 = segment((1, 1), (1, 0)) |
| 189 | e4 = segment((1, 0), (0, 0)) |
| 190 | |
| 191 | w1 = wire(e1, e2, e3, e4) |
| 192 | w2 = wire((e1, e2, e3, e4)) |
| 193 | |
| 194 | assert w1.Length() == approx(4) |
| 195 | assert w2.Length() == approx(4) |
| 196 | |
| 197 | # face |
| 198 | f1 = face(w1, circle(0.1).moved(Location(0.5, 0.5, 0))) |
| 199 | f2 = face((w1,)) |
| 200 | |
| 201 | assert f1.Area() < 1 |
| 202 | assert len(f1.Wires()) == 2 |
| 203 | assert f2.Area() == approx(1) |
| 204 | assert len(f2.Wires()) == 1 |
| 205 | |
| 206 | with raises(ValueError): |
| 207 | face(e1) |
| 208 | |
| 209 | # shell |
| 210 | b = box(1, 1, 1) |
| 211 | |
| 212 | sh1 = shell(b.Faces()) |
| 213 | sh2 = shell(*b.Faces()) |
| 214 | sh3 = shell(torus(1, 0.1).Faces()) # check for issues when sewing single face |
| 215 | |
| 216 | assert sh1.Area() == approx(6) |
| 217 | assert sh2.Area() == approx(6) |
| 218 | assert sh3.isValid() |
| 219 | |
| 220 | # compound |
| 221 | c1 = compound(b.Faces()) |
| 222 | c2 = compound(*b.Faces()) |
| 223 | |
| 224 | assert len(list(c1)) == 6 |
| 225 | assert len(list(c2)) == 6 |
| 226 | |
| 227 | for f in list(c1) + list(c2): |
| 228 | assert f.ShapeType() == "Face" |
| 229 | |
| 230 | |
| 231 | def test_sewing(): |
nothing calls this directly
no test coverage detected