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

Function test_loft

tests/test_free_functions.py:1112–1143  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1110
1111
1112def test_loft():
1113
1114 w1 = circle(1)
1115 w2 = ellipse(1.5, 1).move(0, y=1)
1116 w3 = circle(1).moved(z=4, rx=15)
1117
1118 w4 = segment((0, 0), (1, 0))
1119 w5 = w4.moved(0, 0, 1)
1120
1121 f1 = face(rect(2, 1), rect(0.5, 0.2).moved(x=0.5), rect(0.5, 0.2).moved(x=-0.5))
1122 f2 = face(rect(3, 2), circle(0.5).moved(x=0.7), circle(0.5).moved(x=-0.7)).moved(
1123 z=1
1124 )
1125
1126 r1 = loft(w1, w2, w3) # loft
1127 r2 = loft(w1, w2, w3, ruled=True) # ruled loft
1128 r3 = loft([w1, w2, w3]) # overload
1129 r4 = loft(w1, w2, w3, cap=True) # capped loft
1130 r5 = loft(w4, w5) # loft with open edges
1131 r6 = loft(f1, f2) # loft with faces
1132 r7 = loft(compound(), compound()) # returns an empty compound
1133
1134 assert_all_valid(r1, r2, r3, r4, r5, r6)
1135
1136 assert len(r1.Faces()) == 1
1137 assert len(r2.Faces()) == 2
1138 assert len((r1 - r3).Faces()) == 0
1139 assert r4.Volume() > 0
1140 assert r5.Area() == approx(1)
1141 assert len(r6.Faces()) == 16
1142 assert len(r6.Faces()) == 16
1143 assert not bool(r7) and isinstance(r7, Compound)
1144
1145
1146def test_loft_vertex():

Callers

nothing calls this directly

Calls 13

circleFunction · 0.85
ellipseFunction · 0.85
segmentFunction · 0.85
faceFunction · 0.85
rectFunction · 0.85
compoundFunction · 0.85
assert_all_validFunction · 0.85
VolumeMethod · 0.80
loftFunction · 0.50
moveMethod · 0.45
movedMethod · 0.45
FacesMethod · 0.45

Tested by

no test coverage detected