Selects objects closest or farthest in the specified direction. Applicability: All object types. for a vertex, its point is used. for all other kinds of objects, the center of mass of the object is used. You can use the string shortcuts >(X|Y|Z) or <(X|Y|Z) if you want
| 397 | |
| 398 | |
| 399 | class DirectionMinMaxSelector(CenterNthSelector): |
| 400 | """ |
| 401 | Selects objects closest or farthest in the specified direction. |
| 402 | |
| 403 | Applicability: |
| 404 | All object types. for a vertex, its point is used. for all other kinds |
| 405 | of objects, the center of mass of the object is used. |
| 406 | |
| 407 | You can use the string shortcuts >(X|Y|Z) or <(X|Y|Z) if you want to select |
| 408 | based on a cardinal direction. |
| 409 | |
| 410 | For example this:: |
| 411 | |
| 412 | CQ(aCube).faces(DirectionMinMaxSelector((0, 0, 1), True)) |
| 413 | |
| 414 | Means to select the face having the center of mass farthest in the positive |
| 415 | z direction, and is the same as:: |
| 416 | |
| 417 | CQ(aCube).faces(">Z") |
| 418 | |
| 419 | """ |
| 420 | |
| 421 | def __init__( |
| 422 | self, vector: Vector, directionMax: bool = True, tolerance: float = 0.0001 |
| 423 | ): |
| 424 | super().__init__( |
| 425 | n=-1, vector=vector, directionMax=directionMax, tolerance=tolerance |
| 426 | ) |
| 427 | |
| 428 | |
| 429 | # inherit from CenterNthSelector to get the CenterNthSelector.key method |