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

Function test_imprint

tests/test_free_functions.py:595–617  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

593
594
595def test_imprint():
596
597 b1 = box(1, 1, 1)
598 b2 = b1.moved(x=1)
599 b3 = box(0.5, 0.5, 0.5).moved(x=0.75)
600
601 res = imprint(b1, b2)
602
603 assert len(res.Faces()) == len(compound(b1, b2).Faces()) - 1
604
605 res_glue_full = imprint(b1, b2, glue="full")
606
607 assert len(res_glue_full.Faces()) == len(compound(b1, b2).Faces()) - 1
608
609 # imprint with history
610 history = History()
611 res_glue_partial = imprint(b1, b3, glue="partial", history=history)
612
613 b1_imp = history[0].images(b1.faces())
614 b3_imp = history[0].images(b3.faces())
615
616 assert len(b1_imp.Faces()) == len(b1.Faces()) + 1
617 assert len(res_glue_partial.Faces()) == len(b1_imp.Faces() + b3_imp.Faces()) - 1
618
619
620@fixture

Callers

nothing calls this directly

Calls 8

HistoryClass · 0.90
boxFunction · 0.85
compoundFunction · 0.85
imagesMethod · 0.80
imprintFunction · 0.50
movedMethod · 0.45
FacesMethod · 0.45
facesMethod · 0.45

Tested by

no test coverage detected