Create a predefined Plane based on the conventional names. :param stdName: one of (XY|YZ|ZX|XZ|YX|ZY|front|back|left|right|top|bottom) :type stdName: string :param origin: the desired origin, specified in global coordinates :type origin: 3-tuple of the origin of the
(cls: Type["Plane"], stdName: str, origin=(0, 0, 0))
| 455 | |
| 456 | @classmethod |
| 457 | def named(cls: Type["Plane"], stdName: str, origin=(0, 0, 0)) -> "Plane": |
| 458 | """Create a predefined Plane based on the conventional names. |
| 459 | |
| 460 | :param stdName: one of (XY|YZ|ZX|XZ|YX|ZY|front|back|left|right|top|bottom) |
| 461 | :type stdName: string |
| 462 | :param origin: the desired origin, specified in global coordinates |
| 463 | :type origin: 3-tuple of the origin of the new plane, in global coordinates. |
| 464 | |
| 465 | Available named planes are as follows. Direction references refer to |
| 466 | the global directions. |
| 467 | |
| 468 | =========== ======= ======= ====== |
| 469 | Name xDir yDir zDir |
| 470 | =========== ======= ======= ====== |
| 471 | XY +x +y +z |
| 472 | YZ +y +z +x |
| 473 | ZX +z +x +y |
| 474 | XZ +x +z -y |
| 475 | YX +y +x -z |
| 476 | ZY +z +y -x |
| 477 | front +x +y +z |
| 478 | back -x +y -z |
| 479 | left +z +y -x |
| 480 | right -z +y +x |
| 481 | top +x -z +y |
| 482 | bottom +x +z -y |
| 483 | =========== ======= ======= ====== |
| 484 | """ |
| 485 | |
| 486 | namedPlanes = { |
| 487 | # origin, xDir, normal |
| 488 | "XY": Plane(origin, (1, 0, 0), (0, 0, 1)), |
| 489 | "YZ": Plane(origin, (0, 1, 0), (1, 0, 0)), |
| 490 | "ZX": Plane(origin, (0, 0, 1), (0, 1, 0)), |
| 491 | "XZ": Plane(origin, (1, 0, 0), (0, -1, 0)), |
| 492 | "YX": Plane(origin, (0, 1, 0), (0, 0, -1)), |
| 493 | "ZY": Plane(origin, (0, 0, 1), (-1, 0, 0)), |
| 494 | "front": Plane(origin, (1, 0, 0), (0, 0, 1)), |
| 495 | "back": Plane(origin, (-1, 0, 0), (0, 0, -1)), |
| 496 | "left": Plane(origin, (0, 0, 1), (-1, 0, 0)), |
| 497 | "right": Plane(origin, (0, 0, -1), (1, 0, 0)), |
| 498 | "top": Plane(origin, (1, 0, 0), (0, 1, 0)), |
| 499 | "bottom": Plane(origin, (1, 0, 0), (0, -1, 0)), |
| 500 | } |
| 501 | |
| 502 | try: |
| 503 | return namedPlanes[stdName] |
| 504 | except KeyError: |
| 505 | raise ValueError("Supported names are {}".format(list(namedPlanes.keys()))) |
| 506 | |
| 507 | @classmethod |
| 508 | def XY(cls, origin=(0, 0, 0), xDir=Vector(1, 0, 0)): |