Answers the list with elements that fit the point. Note None in the point will match any value in the element position. Where None in the element position with not fit any xyz of the point. >>> e1 = Element(name='Child1', x=20, y=30) >>> e2 = Element(name='Child2', x
(self, point)
| 1373 | # C H I L D E L E M E N T P O S I T I O N S |
| 1374 | |
| 1375 | def getElementsAtPoint(self, point): |
| 1376 | """Answers the list with elements that fit the point. Note None in the |
| 1377 | point will match any value in the element position. Where None in the |
| 1378 | element position with not fit any xyz of the point. |
| 1379 | |
| 1380 | >>> e1 = Element(name='Child1', x=20, y=30) |
| 1381 | >>> e2 = Element(name='Child2', x=20, y=40) |
| 1382 | >>> e = Element(name='Parent', elements=[e1, e2]) |
| 1383 | >>> e.getElementsAtPoint((20, 30)) == [e1] |
| 1384 | True |
| 1385 | >>> # Search on wildcard x |
| 1386 | >>> e.getElementsAtPoint((None, 40)) == [e2] |
| 1387 | True |
| 1388 | >>> # Find both on wildcard y |
| 1389 | >>> e.getElementsAtPoint((20, None)) == [e1, e2] |
| 1390 | True |
| 1391 | """ |
| 1392 | elements = [] |
| 1393 | # Add z if tuple is only (x,y) |
| 1394 | px, py, pz = point3D(point) |
| 1395 | for e in self.elements: |
| 1396 | ex, ey, ez = e.xyz |
| 1397 | if (ex == px or px is None) and \ |
| 1398 | (ey == py or py is None) and \ |
| 1399 | (ez == pz or pz is None): |
| 1400 | elements.append(e) |
| 1401 | return elements |
| 1402 | |
| 1403 | def getElementsPosition(self): |
| 1404 | """Answers the dictionary of element Ids as key and their position as |