Skip to content

compas_occt.conversions ¤

Functions:¤

aabb_to_compas ¤

aabb_to_compas(aabb) -> Box

Convert OCC AABB data (cornermin, cornermax) to a COMPAS box.

array1_from_floats1 ¤

array1_from_floats1(numbers: list[float]) -> _Array1

Construct a one-dimensional float array from a list of floats.

See Also

array1_from_integers1 ¤

array1_from_integers1(numbers: list[int]) -> _Array1

Construct a one-dimensional integer array from a list of integers.

See Also

array1_from_points1 ¤

array1_from_points1(points: list[Point]) -> _Array1

Construct a one-dimensional point array from a list of points.

See Also

array2_from_floats2 ¤

array2_from_floats2(numbers: list[list[float]]) -> _Array2

Construct a two-dimensional real array from a list of lists of floats.

See Also

array2_from_points2 ¤

array2_from_points2(points: list[list[Point]]) -> _Array2

Construct a two-dimensional point array from a list of lists of points.

See Also

ax22d_to_compas ¤

ax22d_to_compas(position, cls: Type[Frame] | None = None) -> Frame

Construct a COMPAS frame from OCC ax22d data (point, xaxis, yaxis).

ax2_to_compas ¤

ax2_to_compas(position, cls: Type[Frame] | None = None) -> Frame

Construct a COMPAS frame from OCC ax2 data (point, xaxis, yaxis).

ax3_to_compas ¤

ax3_to_compas(position, cls: Type[Frame] | None = None) -> Frame

Construct a COMPAS frame from OCC ax3 data (point, xaxis, yaxis).

axis2d_to_compas ¤

axis2d_to_compas(axis) -> tuple[Point, Vector]

Convert OCC 2D axis data (location, direction) to a (Point, Vector) tuple.

axis2d_to_compas_vector ¤

axis2d_to_compas_vector(axis, cls: Type[Vector] | None = None) -> Vector

Construct a COMPAS vector from OCC 2D axis data (location, direction).

axis_to_compas ¤

axis_to_compas(axis) -> tuple[Point, Vector]

Convert OCC axis data (location, direction) to a (Point, Vector) tuple.

axis_to_compas_vector ¤

axis_to_compas_vector(axis, cls: Type[Vector] | None = None) -> Vector

Construct a COMPAS vector from OCC axis data (location, direction).

axis_to_occ ¤

axis_to_occ(axis: tuple[Point, Vector]) -> tuple

Convert a COMPAS (point, vector) to OCC axis data (location, direction).

bezier_to_compas ¤

bezier_to_compas(points) -> Bezier

Construct a COMPAS Bezier curve from a list of control points.

bspline_to_compas ¤

bspline_to_compas(bspline) -> NurbsCurve

Construct a COMPAS NURBS curve from an OCC B-spline curve handle (GeomCurve).

circle2d_to_compas ¤

circle2d_to_compas(circ, cls: Type[Circle] | None = None) -> Circle

Construct a COMPAS circle from OCC 2D circle data (frame, radius).

circle_to_compas ¤

circle_to_compas(circ, cls: Type[Circle] | None = None) -> Circle

Construct a COMPAS circle from OCC circle data (frame, radius).

circle_to_occ ¤

circle_to_occ(circle: Circle) -> tuple

Convert a COMPAS circle to OCC circle data (frame, radius).

circle_to_occ2d ¤

circle_to_occ2d(circle: Circle) -> tuple

Convert a COMPAS circle to OCC 2D circle data (frame, radius).

compas_mesh_to_occ_shell ¤

compas_mesh_to_occ_shell(mesh: Mesh)

Convert a general COMPAS mesh to an OCC shell (Shape).

compas_quadmesh_to_occ_shell ¤

compas_quadmesh_to_occ_shell(mesh: Mesh)

Convert a COMPAS quad mesh to an OCC shell (Shape).

Raises:

  • ValueError

    If the input mesh is not a quad mesh.

compas_transformation_to_trsf ¤

compas_transformation_to_trsf(matrix: Transformation) -> list[float]

Convert a COMPAS transformation to OCC transformation data.

The OCC backend builds a gp_Trsf from the row-major list of the first 12 values of the 4x4 matrix (SetValues). gp_Trsf itself never crosses into Python, so this returns that 12-float list, which the C++ transform functions accept directly.

Parameters:

Returns:

  • list[float]

    The row-major list of the first 12 matrix values.

compas_trimesh_to_occ_shell ¤

compas_trimesh_to_occ_shell(mesh: Mesh)

Convert a COMPAS triangle mesh to an OCC shell (Shape).

Raises:

  • ValueError

    If the mesh is not a triangle mesh.

cone_to_occ ¤

cone_to_occ(cone: Cone) -> tuple

Convert a COMPAS cone to OCC cone data (frame, radius, height).

cylinder_to_compas ¤

cylinder_to_compas(cylinder, cls: Type[Cylinder] | None = None) -> Cylinder

Convert OCC cylinder data (frame, radius) to a COMPAS cylinder.

cylinder_to_occ ¤

cylinder_to_occ(cylinder: Cylinder) -> tuple

Convert a COMPAS cylinder to OCC cylinder data (frame, radius).

direction2d_to_compas ¤

direction2d_to_compas(direction, cls: Type[Vector] | None = None) -> Vector

Construct a COMPAS vector from OCC 2D direction data (x, y).

direction_to_compas ¤

direction_to_compas(vector, cls: Type[Vector] | None = None) -> Vector

Construct a COMPAS vector from OCC direction data (x, y, z).

direction_to_occ ¤

direction_to_occ(vector: Vector) -> tuple

Convert a COMPAS vector to OCC direction data (x, y, z).

direction_to_occ2d ¤

direction_to_occ2d(vector: Vector) -> tuple

Convert a COMPAS vector to OCC 2D direction data (x, y).

ellipse2d_to_compas ¤

ellipse2d_to_compas(elips, cls: Type[Ellipse] | None = None) -> Ellipse

Construct a COMPAS ellipse from OCC 2D ellipse data (frame, major, minor).

ellipse_to_compas ¤

ellipse_to_compas(elips, cls: Type[Ellipse] | None = None) -> Ellipse

Construct a COMPAS ellipse from OCC ellipse data (frame, major, minor).

ellipse_to_occ ¤

ellipse_to_occ(ellipse: Ellipse) -> tuple

Convert a COMPAS ellipse to OCC ellipse data (frame, major, minor).

ellipse_to_occ2d ¤

ellipse_to_occ2d(ellipse: Ellipse) -> tuple

Convert a COMPAS ellipse to OCC 2D ellipse data (frame, major, minor).

floats2_from_array2 ¤

floats2_from_array2(array: _Array2) -> list[Sequence[float]]

Construct a list of lists of floats from a two-dimensional array of real numbers.

See Also

frame_to_occ_ax2 ¤

frame_to_occ_ax2(frame: Frame) -> tuple

Convert a COMPAS frame to OCC ax2 data (point, xaxis, yaxis).

frame_to_occ_ax22d ¤

frame_to_occ_ax22d(frame: Frame) -> tuple

Convert a COMPAS frame to OCC ax22d data (point, xaxis, yaxis) (2D).

frame_to_occ_ax3 ¤

frame_to_occ_ax3(frame: Frame) -> tuple

Convert a COMPAS frame to OCC ax3 data (point, xaxis, yaxis).

harray1_from_points1 ¤

harray1_from_points1(points: list[Point]) -> _Array1

Construct a handled one-dimensional point array from a list of points.

See Also

hyperbola2d_to_compas ¤

hyperbola2d_to_compas(hypr) -> Hyperbola

Construct a COMPAS hyperbola from OCC 2D hyperbola data (frame, major, minor).

hyperbola_to_compas ¤

hyperbola_to_compas(hypr) -> Hyperbola

Construct a COMPAS hyperbola from OCC hyperbola data (frame, major, minor).

line2d_to_compas ¤

line2d_to_compas(lin, cls: Type[Line] | None = None) -> Line

Convert OCC 2D line data (location, direction) to a COMPAS line.

line_to_compas ¤

line_to_compas(lin, cls: Type[Line] | None = None) -> Line

Convert OCC line data (location, direction) to a COMPAS line.

line_to_occ ¤

line_to_occ(line: Line) -> tuple

Convert a COMPAS line to OCC line data (location, direction).

line_to_occ2d ¤

line_to_occ2d(line: Line) -> tuple

Convert a COMPAS line to OCC 2D line data (location, direction).

location_to_compas ¤

location_to_compas(matrix) -> Frame

Construct a COMPAS frame from an OCC location's 3x4 row-major matrix.

ngon_to_face ¤

ngon_to_face(ngon: NGon)

Convert an ngon to a BRep face with a best-fit surface (Shape).

obb_to_compas ¤

obb_to_compas(obb) -> Box

Convert OCC OBB data (frame, xhsize, yhsize, zhsize) to a COMPAS box.

parabola2d_to_compas ¤

parabola2d_to_compas(parab) -> Parabola

Construct a COMPAS parabola from OCC 2D parabola data (frame, focal).

parabola_to_compas ¤

parabola_to_compas(parab) -> Parabola

Construct a COMPAS parabola from OCC parabola data (frame, focal).

plane_to_compas ¤

plane_to_compas(pln, cls: Type[Plane] | None = None) -> Plane

Convert OCC plane data (point, normal) to a COMPAS plane.

plane_to_occ ¤

plane_to_occ(plane: Plane) -> tuple

Convert a COMPAS plane to OCC plane data (point, normal).

plane_to_occ_ax2 ¤

plane_to_occ_ax2(plane: Plane) -> tuple

Convert a COMPAS plane to OCC ax2 data (point, normal).

plane_to_occ_ax3 ¤

plane_to_occ_ax3(plane: Plane) -> tuple

Convert a COMPAS plane to OCC ax3 data (point, normal).

point2d_to_compas ¤

point2d_to_compas(point, cls: Type[Point] | None = None) -> Point

Construct a COMPAS point from OCC 2D point data (x, y).

point_to_compas ¤

point_to_compas(point, cls: Type[Point] | None = None) -> Point

Construct a COMPAS point from OCC point data (x, y, z).

point_to_occ ¤

point_to_occ(point: Point) -> tuple

Convert a COMPAS point to OCC point data (x, y, z).

point_to_occ2d ¤

point_to_occ2d(point: Point) -> tuple

Convert a COMPAS point to OCC 2D point data (x, y).

points1_from_array1 ¤

points1_from_array1(array: _Array1) -> list[Point]

Construct a list of points from a one-dimensional point array.

See Also

points2_from_array2 ¤

points2_from_array2(array: _Array2) -> list[list[Point]]

Construct a list of lists of points from a two-dimensional point array.

See Also

quad_to_face ¤

quad_to_face(quad: Quad)

Convert a quad (4 points) to a BRep face with a ruled surface (Shape).

Raises:

  • ValueError

    If the number of points is not 4.

sphere_to_compas ¤

sphere_to_compas(sphere, cls: Type[Sphere] | None = None) -> Sphere

Convert OCC sphere data (frame, radius) to a COMPAS sphere.

sphere_to_occ ¤

sphere_to_occ(sphere: Sphere) -> tuple

Convert a COMPAS sphere to OCC sphere data (frame, radius).

torus_to_occ ¤

torus_to_occ(torus: Torus) -> tuple

Convert a COMPAS torus to OCC torus data (frame, radius_axis, radius_pipe).

triangle_to_face ¤

triangle_to_face(triangle: Triangle)

Convert a triangle (3 points) to a BRep face (Shape).

Raises:

  • ValueError

    If the number of points is not 3.

vector2d_to_compas ¤

vector2d_to_compas(vector, cls: Type[Vector] | None = None) -> Vector

Construct a COMPAS vector from OCC 2D vector data (x, y).

vector_to_compas ¤

vector_to_compas(vector, cls: Type[Vector] | None = None) -> Vector

Construct a COMPAS vector from OCC vector data (x, y, z).

vector_to_occ ¤

vector_to_occ(vector: Vector) -> tuple

Convert a COMPAS vector to OCC vector data (x, y, z).

vector_to_occ2d ¤

vector_to_occ2d(vector: Vector) -> tuple

Convert a COMPAS vector to OCC 2D vector data (x, y).