Testing the Shape.split method.
(self)
| 5278 | assert r.wire().val().Closed() |
| 5279 | |
| 5280 | def testSplitShape(self): |
| 5281 | """ |
| 5282 | Testing the Shape.split method. |
| 5283 | """ |
| 5284 | # split an edge with a vertex |
| 5285 | e0 = Edge.makeCircle(1, (0, 0, 0), (0, 0, 1)) |
| 5286 | v0 = Vertex.makeVertex(0, 1, 0) |
| 5287 | list_of_edges = e0.split(v0).Edges() |
| 5288 | self.assertEqual(len(list_of_edges), 2) |
| 5289 | self.assertTrue(Vector(0, 1, 0) in [e.endPoint() for e in list_of_edges]) |
| 5290 | |
| 5291 | # split a circle with multiple vertices |
| 5292 | angles = [2 * math.pi * idx / 10 for idx in range(10)] |
| 5293 | vecs = [Vector(math.sin(a), math.cos(a), 0) for a in angles] |
| 5294 | vertices = [Vertex.makeVertex(*v.toTuple()) for v in vecs] |
| 5295 | edges = e0.split(*vertices).Edges() |
| 5296 | self.assertEqual(len(edges), len(vertices) + 1) |
| 5297 | endpoints = [e.endPoint() for e in edges] |
| 5298 | self.assertTrue(all([v in endpoints for v in vecs])) |
| 5299 | |
| 5300 | def testBrepImportExport(self): |
| 5301 |
nothing calls this directly
no test coverage detected