This classes located in module ezdxf.algebra:

from ezdxf.algebra import OCS, UCS

OCS Class

class ezdxf.algebra.OCS
OCS.__init__(extrusion=(0, 0, 1))

Establish an Object Coordinate System for a given extrusion vector.

OCS.to_wcs(point)

Calculate world coordinates for point in object coordinates.

OCS.points_to_wcs(points)

Translate multiple object coordinates into world coordinates (generator).

OCS.from_wcs(point)

Calculate object coordinates for point in world coordinates.

OCS.points_from_wcs(points)

Translate multiple world coordinates into object coordinates (generator).

See also

OCS

UCS Class

class ezdxf.algebra.UCS
UCS.__init__(origin=(0, 0, 0), ux=None, uy=None, uz=None)

Establish an User Coordinate System. The UCS is defined by the origin and two unit vectors for the x-, y- or z-axis, all axis n WCS. The missing axis is the cross product of the given axis.

If x- and y-axis are None: ux=(1, 0, 0), uy=(0, 1, 0), uz=(0, 0, 1).

Normalization of unit vectors is not required.

Parameters:
  • origin – defines the UCS origin in world coordinates
  • ux – defines the UCS x-axis as vector in WCS
  • uy – defines the UCS y-axis as vector in WCS
  • uz – defines the UCS z-axis as vector in WCS
UCS.to_wcs(point)

Calculate world coordinates for point in UCS coordinates.

UCS.points_to_wcs(points)

Translate multiple user coordinates into world coordinates (generator).

UCS.to_ocs(point)

Calculate OCS coordinates for point in UCS coordinates.

OCS is defined by the z-axis of the UCS.

UCS.points_from_wcs(points)

Translate multiple user coordinates into OCS coordinates (generator).

OCS is defined by the z-axis of the UCS.

UCS.from_wcs(point)

Calculate UCS coordinates for point in world coordinates.

UCS.points_from_wcs(points)

Translate multiple world coordinates into user coordinates (generator).

UCS.from_x_axis_and_point_in_xy(origin, axis, point)

Returns an new UCS defined by the origin, the x-axis vector and an arbitrary point in the xy-plane. (static method)

Parameters:
  • origin – UCS origin as (x, y, z) tuple in WCS
  • axis – x-axis vector as (x, y, z) tuple in WCS
  • point – arbitrary point unlike the origin in the xy-plane as (x, y, z) tuple in WCS
UCS.from_x_axis_and_point_in_xz(origin, axis, point)

Returns an new UCS defined by the origin, the x-axis vector and an arbitrary point in the xz-plane. (static method)

Parameters:
  • origin – UCS origin as (x, y, z) tuple in WCS
  • axis – x-axis vector as (x, y, z) tuple in WCS
  • point – arbitrary point unlike the origin in the xz-plane as (x, y, z) tuple in WCS
UCS.from_y_axis_and_point_in_xy(origin, axis, point)

Returns an new UCS defined by the origin, the y-axis vector and an arbitrary point in the xy-plane. (static method)

Parameters:
  • origin – UCS origin as (x, y, z) tuple in WCS
  • axis – y-axis vector as (x, y, z) tuple in WCS
  • point – arbitrary point unlike the origin in the xy-plane as (x, y, z) tuple in WCS
UCS.from_y_axis_and_point_in_yz(origin, axis, point)

Returns an new UCS defined by the origin, the y-axis vector and an arbitrary point in the yz-plane. (static method)

Parameters:
  • origin – UCS origin as (x, y, z) tuple in WCS
  • axis – y-axis vector as (x, y, z) tuple in WCS
  • point – arbitrary point unlike the origin in the yz-plane as (x, y, z) tuple in WCS
UCS.from_z_axis_and_point_in_xz(origin, axis, point)

Returns an new UCS defined by the origin, the z-axis vector and an arbitrary point in the xz-plane. (static method)

Parameters:
  • origin – UCS origin as (x, y, z) tuple in WCS
  • axis – z-axis vector as (x, y, z) tuple in WCS
  • point – arbitrary point unlike the origin in the xz-plane as (x, y, z) tuple in WCS
UCS.from_z_axis_and_point_in_yz(origin, axis, point)

Returns an new UCS defined by the origin, the z-axis vector and an arbitrary point in the yz-plane. (static method)

Parameters:
  • origin – UCS origin as (x, y, z) tuple in WCS
  • axis – z-axis vector as (x, y, z) tuple in WCS
  • point – arbitrary point unlike the origin in the yz-plane as (x, y, z) tuple in WCS

See also

UCS