A 2D coordinate system in space A 2D coordinate system in space, with the x-y axes on the plane, and a particular point as the origin. A plane allows the use of 2D coordinates, which are later converted to global, 3d coordinates when the operations are complete. Frequently, it
| 428 | |
| 429 | |
| 430 | class Plane(object): |
| 431 | """A 2D coordinate system in space |
| 432 | |
| 433 | A 2D coordinate system in space, with the x-y axes on the plane, and a |
| 434 | particular point as the origin. |
| 435 | |
| 436 | A plane allows the use of 2D coordinates, which are later converted to |
| 437 | global, 3d coordinates when the operations are complete. |
| 438 | |
| 439 | Frequently, it is not necessary to create work planes, as they can be |
| 440 | created automatically from faces. |
| 441 | """ |
| 442 | |
| 443 | xDir: Vector |
| 444 | yDir: Vector |
| 445 | zDir: Vector |
| 446 | _origin: Vector |
| 447 | |
| 448 | lcs: gp_Ax3 |
| 449 | rG: Matrix |
| 450 | fG: Matrix |
| 451 | |
| 452 | # equality tolerances |
| 453 | _eq_tolerance_origin = 1e-6 |
| 454 | _eq_tolerance_dot = 1e-6 |
| 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 |
no outgoing calls