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

Method testWireFillet

tests/test_cad_objects.py:759–792  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

757 self.assertAlmostEqual(many_rad.radius(), 1.0)
758
759 def testWireFillet(self):
760 points = [
761 (0.000, 0.000, 0.000),
762 (-0.287, 1.183, -0.592),
763 (-1.404, 4.113, -2.787),
764 (-1.332, 1.522, 0.553),
765 (7.062, 0.433, -0.097),
766 (8.539, -0.000, -0.000),
767 ]
768 wire = Wire.makePolygon(points, close=False)
769
770 # Fillet the wire
771 wfillet = wire.fillet(radius=0.560)
772 assert len(wfillet.Edges()) == 2 * len(points) - 3
773
774 # Fillet a single vertex
775 wfillet = wire.fillet(radius=0.560, vertices=wire.Vertices()[1:2])
776 assert len(wfillet.Edges()) == len(points)
777
778 # Assert exception if trying to fillet with too big
779 # a radius
780 with self.assertRaises(ValueError):
781 wfillet = wire.fillet(radius=1.0)
782
783 # Test a closed fillet
784 points = [[0, 0, 0], [5, 4, 0], [8, 3, 1], [10, 0, 0]]
785
786 wire = Wire.makePolygon(points, close=True)
787 wfillet = wire.fillet(radius=0.5)
788 assert len(wfillet.Edges()) == 2 * len(points)
789
790 # Fillet a single vertex
791 wfillet = wire.fillet(radius=0.5, vertices=wire.Vertices()[0:1])
792 assert len(wfillet.Edges()) == len(points) + 1
793
794
795@pytest.mark.parametrize(

Callers

nothing calls this directly

Calls 4

makePolygonMethod · 0.80
EdgesMethod · 0.80
filletMethod · 0.45
VerticesMethod · 0.45

Tested by

no test coverage detected