MCPcopy
hub / github.com/CadQuery/cadquery / testLoft

Method testLoft

tests/test_cadquery.py:480–516  ·  view source on GitHub ↗

Test making a lofted solid

(self)

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 12

saveModelMethod · 0.95
WorkplaneClass · 0.85
loftMethod · 0.80
workplaneMethod · 0.80
boxMethod · 0.80
VolumeMethod · 0.80
rectMethod · 0.45
circleMethod · 0.45
sizeMethod · 0.45
solidsMethod · 0.45
facesMethod · 0.45
valMethod · 0.45

Tested by

no test coverage detected