| 229 | |
| 230 | |
| 231 | def test_sewing(): |
| 232 | |
| 233 | b = box(1, 1, 1) |
| 234 | ftop = b.faces(">Z") |
| 235 | sh = b.remove(ftop) |
| 236 | |
| 237 | # regular local sewing |
| 238 | history1 = History() |
| 239 | res1 = shell(sh.faces("not <Z"), ftop, ctx=(sh, ftop), history=history1) |
| 240 | |
| 241 | assert res1.isValid() |
| 242 | assert res1.Area() == approx(6) |
| 243 | assert ftop in history1[-1]._images |
| 244 | |
| 245 | # regular local sewing - with Shape context |
| 246 | history2 = History() |
| 247 | res2 = shell(sh.faces("not <Z"), ftop, ctx=compound(sh, ftop), history=history2) |
| 248 | |
| 249 | assert res2.isValid() |
| 250 | assert res2.Area() == approx(6) |
| 251 | assert ftop in history2[-1]._images |
| 252 | |
| 253 | # non-manifold sewing |
| 254 | res3 = shell(sh.faces(), ftop, ftop.moved(x=1), manifold=False) |
| 255 | |
| 256 | assert res3.isValid() |
| 257 | assert not solid(res3).isValid() |
| 258 | assert isinstance(res3, Shell) |
| 259 | |
| 260 | # manifold sewing (default) - results in a compound |
| 261 | res3 = shell(sh.faces(), ftop, ftop.moved(x=1), manifold=True) |
| 262 | |
| 263 | assert res3.isValid() |
| 264 | assert isinstance(res3, Compound) |
| 265 | |
| 266 | |
| 267 | def test_solid(): |