Test making a lofted solid
(self)
| 478 | self.assertTupleAlmostEquals(v2, v3, 3) |
| 479 | |
| 480 | def testLoft(self): |
| 481 | """ |
| 482 | Test making a lofted solid |
| 483 | """ |
| 484 | s = Workplane("XY").circle(4.0).workplane(5.0).rect(2.0, 2.0).loft() |
| 485 | self.saveModel(s) |
| 486 | # the result should have 7 faces |
| 487 | self.assertEqual(1, s.solids().size()) |
| 488 | |
| 489 | # the resulting loft had a split on the side, not sure why really, i expected only 3 faces |
| 490 | self.assertEqual(7, s.faces().size()) |
| 491 | |
| 492 | # test loft with combine="cut" |
| 493 | box = Workplane().box(10, 10, 10) |
| 494 | cut = ( |
| 495 | box.faces(">Z") |
| 496 | .workplane() |
| 497 | .circle(2) |
| 498 | .workplane(invert=True, offset=12) |
| 499 | .rect(3, 2) |
| 500 | .loft(combine="cut") |
| 501 | ) |
| 502 | |
| 503 | self.assertGreater(box.val().Volume(), cut.val().Volume()) |
| 504 | |
| 505 | # test loft with combine=True |
| 506 | box = Workplane().box(10, 10, 10) |
| 507 | add = ( |
| 508 | box.faces(">Z") |
| 509 | .workplane() |
| 510 | .circle(2) |
| 511 | .workplane(offset=12) |
| 512 | .rect(3, 2) |
| 513 | .loft(combine=True) |
| 514 | ) |
| 515 | |
| 516 | self.assertGreater(add.val().Volume(), box.val().Volume()) |
| 517 | |
| 518 | def testLoftRaisesValueError(self): |
| 519 | s0 = Workplane().hLine(1) # no wires |
nothing calls this directly
no test coverage detected