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

Function test_sewing

tests/test_free_functions.py:231–264  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

229
230
231def test_sewing():
232
233 b = box(1, 1, 1)
234 ftop = b.faces(">Z")
235 sh = b.remove(ftop)
236
237 # regular local sewing
238 history1 = History()
239 res1 = shell(sh.faces("not <Z"), ftop, ctx=(sh, ftop), history=history1)
240
241 assert res1.isValid()
242 assert res1.Area() == approx(6)
243 assert ftop in history1[-1]._images
244
245 # regular local sewing - with Shape context
246 history2 = History()
247 res2 = shell(sh.faces("not <Z"), ftop, ctx=compound(sh, ftop), history=history2)
248
249 assert res2.isValid()
250 assert res2.Area() == approx(6)
251 assert ftop in history2[-1]._images
252
253 # non-manifold sewing
254 res3 = shell(sh.faces(), ftop, ftop.moved(x=1), manifold=False)
255
256 assert res3.isValid()
257 assert not solid(res3).isValid()
258 assert isinstance(res3, Shell)
259
260 # manifold sewing (default) - results in a compound
261 res3 = shell(sh.faces(), ftop, ftop.moved(x=1), manifold=True)
262
263 assert res3.isValid()
264 assert isinstance(res3, Compound)
265
266
267def test_solid():

Callers

nothing calls this directly

Calls 10

HistoryClass · 0.90
boxFunction · 0.85
shellFunction · 0.85
compoundFunction · 0.85
solidFunction · 0.85
isValidMethod · 0.80
facesMethod · 0.45
removeMethod · 0.45
AreaMethod · 0.45
movedMethod · 0.45

Tested by

no test coverage detected