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

Method testCutEach

tests/test_cadquery.py:5008–5022  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

5006 self.assertTrue(Workplane().box(1, 1, 1).box(2, 2, 1).end(2).objects == [])
5007
5008 def testCutEach(self):
5009
5010 # base shape:
5011 w = Workplane().box(3, 2, 2)
5012 # cutter:
5013 c = Workplane().box(2, 2, 2).val()
5014 # cut all the corners off
5015 w0 = w.vertices().cutEach(lambda loc: c.located(loc))
5016 # we are left with a 1x2x2 box:
5017 self.assertAlmostEqual(w0.val().Volume(), 4, 3)
5018
5019 # test error on no solid found
5020 w1 = Workplane().hLine(1).vLine(1).close()
5021 with raises(ValueError):
5022 w1.cutEach(lambda loc: c.located(loc))
5023
5024 def testCutBlind(self):
5025 # cutBlind is already tested in several of the complicated tests, so this method is short.

Callers

nothing calls this directly

Calls 10

WorkplaneClass · 0.85
boxMethod · 0.80
cutEachMethod · 0.80
VolumeMethod · 0.80
vLineMethod · 0.80
hLineMethod · 0.80
valMethod · 0.45
verticesMethod · 0.45
locatedMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected