Skip to content

OCCCurve ¤

OCCCurve(native_curve, name=None)

Class representing a general curve object.

Parameters:

  • native_curve (GeomCurve) –

    An existing OCC curve handle wrapper.

  • name (str, default: None ) –

    The name of the curve.

Attributes:

  • dimension (int) –

    The dimension of the curve.

  • domain (tuple[float, float]) –

    The domain of the parameter space of the curve.

  • end (Point) –

    The end point of the curve.

  • is_closed (bool) –

    Flag indicating that the curve is closed.

  • is_periodic (bool) –

    Flag indicating that the curve is periodic.

  • start (Point) –

    The start point of the curve.

Methods:¤

aabb ¤

aabb(precision: float = 0.0) -> Box

Compute the axis aligned bounding box of the curve.

closest_parameters_curve ¤

closest_parameters_curve(curve: OCCCurve, return_distance: bool = False) -> tuple[float, float] | tuple[tuple[float, float], float]

Compute the curve parameters where this curve is closest to another curve.

closest_point ¤

closest_point(point: Point, return_parameter: bool = False) -> Point | tuple[Point, float] | None

Compute the closest point on the curve to a given point.

If an orthogonal projection is not possible, the start or end point is returned, whichever is closer.

closest_points_curve ¤

closest_points_curve(curve: OCCCurve, return_distance: bool = False) -> tuple[Point, Point] | tuple[tuple[Point, Point], float]

Compute the points where this curve is closest to another curve.

copy ¤

copy() -> OCCCurve

Make an independent copy of the current curve.

curvature_at ¤

curvature_at(t: float) -> Vector

Compute the curvature vector at a curve parameter.

Raises:

  • ValueError

    If the parameter is not in the curve domain.

divide_by_count ¤

divide_by_count(count: int, return_points: bool = False, precision: float = 1e-06) -> list[float] | tuple[list[float], list[Point]]

Divide the curve into a specific number of equal length segments.

divide_by_length ¤

divide_by_length(length: float, return_points: bool = False, precision: float = 1e-06) -> list[float] | tuple[list[float], list[Point]]

Divide the curve into segments of a given length.

Note that the end point of the last segment might not coincide with the end point of the curve.

embedded ¤

embedded(surface) -> OCCCurve2d

Return a new curve embedded in the parameter space of the surface.

frame_at ¤

frame_at(t: float) -> Frame

Compute the local frame at a curve parameter.

Raises:

  • ValueError

    If the parameter is not in the curve domain.

from_native classmethod ¤

from_native(native_curve) -> OCCCurve

Construct a curve from an existing OCC curve handle.

Parameters:

  • native_curve

Returns:

from_occ classmethod ¤

from_occ(native_curve) -> OCCCurve

Construct a curve from an existing OCC curve handle.

.. deprecated:: 1.3 Use from_native instead.

length ¤

length(precision: float = 0.001) -> float

Compute the length of the curve.

offset ¤

offset(distance: float, direction: Vector) -> OCCCurve

Return a new curve offset over a distance in the plane defined by the given normal direction.

parameter_at_distance ¤

parameter_at_distance(t: float, distance: float, precision: float = 0.1) -> float

Compute the parameter at a given distance along the curve from a starting parameter.

point_at ¤

point_at(t: float) -> Point

Compute the point at a curve parameter.

Raises:

  • ValueError

    If the parameter is not in the curve domain.

projected ¤

projected(surface) -> OCCCurve

Return a copy of the curve projected onto a surface.

reverse ¤

reverse() -> None

Reverse the parametrisation of the curve.

tangent_at ¤

tangent_at(t: float) -> Vector

Compute the tangent vector at a curve parameter.

Raises:

  • ValueError

    If the parameter is not in the curve domain.

to_points ¤

to_points(n: int = 10, domain: tuple[float, float] | None = None) -> list[Point]

Convert the curve to a list of n points (single bulk evaluation).

to_polyline ¤

to_polyline(n: int = 100) -> Polyline

Convert the curve to a polyline.

to_step ¤

to_step(filepath: str, schema: str = 'AP203') -> None

Write the curve geometry to a STP file.

transform ¤

transform(T: Transformation) -> None

Transform this curve.