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

Function test_bool_ops

tests/test_sketch.py:810–827  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

808
809
810def test_bool_ops():
811
812 s1 = Sketch().rect(0.5, 2)
813 s2 = Sketch().rect(1, 1)
814 s3 = Sketch().segment((-1, 0), (1, 0))
815
816 # sum
817 assert (s1 + s2).val().Area() == approx(1.5)
818 # diff
819 assert (s1 - s2).val().Area() == approx(0.5)
820 assert len((s1 - s2).val().Wires()) == 2
821 # common
822 assert (s1 * s2).val().Area() == approx(0.5)
823 assert len((s1 * s2).val().Wires()) == 1
824 # split
825 assert len((s1 / s3).val().Faces()) == 2
826 assert len((s1 / s2).val().Faces()) == 3
827 assert (s1 / s2).val().Area() == approx(1)
828
829
830def test_export(tmpdir):

Callers

nothing calls this directly

Calls 7

SketchClass · 0.90
segmentMethod · 0.80
WiresMethod · 0.80
rectMethod · 0.45
AreaMethod · 0.45
valMethod · 0.45
FacesMethod · 0.45

Tested by

no test coverage detected