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

Method testPointList

tests/test_cadquery.py:264–287  ·  view source on GitHub ↗

Tests adding points and using them

(self)

Source from the content-addressed store, hash-verified

262 wp.nonExistentInWorkplane()
263
264 def testPointList(self):
265 """
266 Tests adding points and using them
267 """
268 c = CQ(makeUnitCube())
269
270 s = c.faces(">Z").workplane().pushPoints([(-0.3, 0.3), (0.3, 0.3), (0, 0)])
271 self.assertEqual(3, s.size())
272 # TODO: is the ability to iterate over points with circle really worth it?
273 # maybe we should just require using all() and a loop for this. the semantics and
274 # possible combinations got too hard ( ie, .circle().circle() ) was really odd
275 body = s.circle(0.05).cutThruAll()
276 self.saveModel(body)
277 self.assertEqual(9, body.faces().size())
278
279 # Test the case when using eachpoint with only a blank workplane
280 def callback_fn(loc):
281 self.assertEqual(
282 Vector(0, 0, 0), Vector(loc.wrapped.Transformation().TranslationPart())
283 )
284
285 r = Workplane("XY")
286 r.objects = []
287 r.eachpoint(callback_fn)
288
289 def testWorkplaneFromFace(self):
290 # make a workplane on the top face

Callers

nothing calls this directly

Calls 10

saveModelMethod · 0.95
eachpointMethod · 0.95
makeUnitCubeFunction · 0.90
WorkplaneClass · 0.85
pushPointsMethod · 0.80
workplaneMethod · 0.80
cutThruAllMethod · 0.80
facesMethod · 0.45
sizeMethod · 0.45
circleMethod · 0.45

Tested by

no test coverage detected