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

Function test_prism_taper

tests/test_free_functions.py:832–876  ·  view source on GitHub ↗
(box_shape)

Source from the content-addressed store, hash-verified

830
831
832def test_prism_taper(box_shape):
833
834 ftop = box_shape.faces(">Z")
835 c = circle(0.2).moved(ftop)
836
837 # additive prism
838 res1 = prism(box_shape, ftop, c, 0.1)
839
840 assert res1.isValid()
841 assert res1.Volume() > box_shape.Volume()
842 assert res1.faces().size() == 6 + 2
843
844 # additive prism with a taper
845 res2 = prism(box_shape, ftop, c, 0.1, 15)
846
847 assert res2.isValid()
848 assert res2.faces().size() == 6 + 4 # NB: side face is split into 3
849 assert res2.wire(">Z").Length() < c.Length()
850
851 # subtractive prism
852 res3 = prism(box_shape / c, ftop, c, box_shape.face("<Z"), additive=False)
853
854 assert res3.isValid()
855 assert res3.Volume() < box_shape.Volume()
856 assert res3.faces().size() == 6 + 1
857
858 # subtractive prism
859 res4 = prism(box_shape, ftop, c, None, additive=False)
860
861 assert res4.isValid()
862 assert res4.faces().size() == 6 + 1
863 assert res4.wires("<Z").edge("%CIRCLE").Length() == approx(c.Length())
864
865 # subtractive prism from to
866 res5 = prism(
867 box_shape,
868 None,
869 circle(0.2).moved(z=0.5),
870 (box_shape.face("<Z"), box_shape.face(">Z")),
871 5,
872 False,
873 )
874
875 assert res5.isValid()
876 assert res5.faces().size() == 6 + 2 * 3
877
878
879def test_draft(box_shape):

Callers

nothing calls this directly

Calls 12

circleFunction · 0.85
prismFunction · 0.85
isValidMethod · 0.80
VolumeMethod · 0.80
facesMethod · 0.45
movedMethod · 0.45
sizeMethod · 0.45
LengthMethod · 0.45
wireMethod · 0.45
faceMethod · 0.45
edgeMethod · 0.45
wiresMethod · 0.45

Tested by

no test coverage detected