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

Function test_sweep

tests/test_free_functions.py:1062–1094  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1060
1061
1062def test_sweep():
1063
1064 w1 = rect(1, 1)
1065 w2 = w1.moved(Location(0, 0, 1))
1066
1067 f1 = face(rect(1, 1), circle(0.25))
1068 f2 = face(rect(2, 1), ellipse(0.9, 0.45)).moved(x=2, z=2, ry=90)
1069 f3 = face(rect(1, 1))
1070
1071 p1 = segment((0, 0, 0), (0, 0, 1))
1072 p2 = spline((w1.Center(), w2.Center()), ((-0.5, 0, 1), (0.5, 0, 1)))
1073 p3 = spline((f1.Center(), f2.Center()), ((0, 0, 1), (1, 0, 0)))
1074
1075 r1 = sweep(w1, p1) # simple sweep
1076 r2 = sweep((w1, w2), p1) # multi-section sweep
1077 r3 = sweep(w1, p1, cap=True) # simple with cap
1078 r4 = sweep((w1, w2), p1, cap=True) # multi-section with cap
1079 r5 = sweep((w1, w2), p2, cap=True) # see above
1080 r6 = sweep(f1, p3) # simple face sweep
1081 r7 = sweep((f1, f2), p3) # multi-section face sweep
1082 r8 = sweep(f3, p3) # simplest face sweep (no inner wires)
1083
1084 assert_all_valid(r1, r2, r3, r4, r5, r6, r7, r8)
1085
1086 assert r1.Area() == approx(4)
1087 assert r2.Area() == approx(4)
1088 assert r3.Volume() == approx(1)
1089 assert r4.Volume() == approx(1)
1090 assert r5.Volume() > 0
1091 assert len(r5.Faces()) == 6
1092 assert len(r6.Faces()) == 7
1093 assert len(r7.Faces()) == 7
1094 assert len(r8.Faces()) == 6
1095
1096
1097def test_sweep_aux():

Callers

nothing calls this directly

Calls 14

rectFunction · 0.85
LocationClass · 0.85
faceFunction · 0.85
circleFunction · 0.85
ellipseFunction · 0.85
segmentFunction · 0.85
splineFunction · 0.85
sweepFunction · 0.85
assert_all_validFunction · 0.85
VolumeMethod · 0.80
movedMethod · 0.45
CenterMethod · 0.45

Tested by

no test coverage detected