MCPcopy Index your code
hub / github.com/CadQuery/cadquery / testMultiFaceWorkplane

Method testMultiFaceWorkplane

tests/test_cadquery.py:1620–1635  ·  view source on GitHub ↗

Test Creation of workplane from multiple co-planar face selection.

(self)

Source from the content-addressed store, hash-verified

1618 self.assertEqual(7, r.faces().size())
1619
1620 def testMultiFaceWorkplane(self):
1621 """
1622 Test Creation of workplane from multiple co-planar face
1623 selection.
1624 """
1625 s = Workplane("XY").box(1, 1, 1).faces(">Z").rect(1, 0.5).cutBlind(-0.2)
1626
1627 w = s.faces(">Z").workplane()
1628 o = w.val() # origin of the workplane
1629 self.assertAlmostEqual(o.x, 0.0, 3)
1630 self.assertAlmostEqual(o.y, 0.0, 3)
1631 self.assertAlmostEqual(o.z, 0.5, 3)
1632
1633 # Test creation with non-co-planar faces fails
1634 with raises(ValueError):
1635 w = s.faces("+Y").workplane()
1636
1637 def testTriangularPrism(self):
1638 s = Workplane("XY").lineTo(1, 0).lineTo(1, 1).close().extrude(0.2)

Callers

nothing calls this directly

Calls 7

WorkplaneClass · 0.85
cutBlindMethod · 0.80
boxMethod · 0.80
workplaneMethod · 0.80
rectMethod · 0.45
facesMethod · 0.45
valMethod · 0.45

Tested by

no test coverage detected