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

Method test_mirror_face

tests/test_workplanes.py:237–252  ·  view source on GitHub ↗

Create a triangle and mirror into a unit box

(self)

Source from the content-addressed store, hash-verified

235 )
236
237 def test_mirror_face(self):
238 """Create a triangle and mirror into a unit box"""
239 r = Workplane("XY").line(0, 1).line(1, -1).close().extrude(1)
240
241 bbBox = r.findSolid().BoundingBox()
242 self.assertTupleAlmostEquals(
243 (bbBox.xlen, bbBox.ylen, bbBox.zlen), (1.0, 1.0, 1.0), 4
244 )
245 self.assertAlmostEqual(r.findSolid().Volume(), 0.5, 5)
246
247 r = r.mirror(r.faces().objects[1], union=True)
248 bbBox = r.findSolid().BoundingBox()
249 self.assertTupleAlmostEquals(
250 (bbBox.xlen, bbBox.ylen, bbBox.zlen), (1.0, 1.0, 1.0), 4
251 )
252 self.assertAlmostEqual(r.findSolid().Volume(), 1.0, 5)
253
254 def test_bezier_curve(self):
255 # Quadratic bezier

Callers

nothing calls this directly

Calls 10

WorkplaneClass · 0.85
extrudeMethod · 0.80
lineMethod · 0.80
findSolidMethod · 0.80
VolumeMethod · 0.80
closeMethod · 0.45
BoundingBoxMethod · 0.45
mirrorMethod · 0.45
facesMethod · 0.45

Tested by

no test coverage detected