Skip to content

compas_brep.face ¤

Classes¤

BrepFace ¤

BrepFace(
    outer_loop: BrepLoop,
    surface: Plane
    | CylindricalSurface
    | SphericalSurface
    | ToroidalSurface
    | ConicalSurface
    | NurbsSurface
    | None = None,
    is_reversed: bool = False,
    domain_u: tuple[float, float] | None = None,
    domain_v: tuple[float, float] | None = None,
)

A Brep face defined by a surface and boundary loops.

The surface can be a Plane, CylindricalSurface, or NurbsSurface. The outer loop defines the face boundary; inner loops define holes.

Attributes¤

boundary property ¤
boundary: BrepLoop

Alias of :attr:outer_loop, for compatibility with compas_rhino.

holes property ¤
holes: list[BrepLoop]

The inner loops of this face.

is_bspline property ¤
is_bspline: bool

Alias of :attr:is_nurbs, for compatibility with compas.geometry.BrepFace.

native_face property ¤
native_face: object | None

The underlying backend face, or None for a face not backed by a kernel.

nurbssurface property ¤
nurbssurface: NurbsSurface

The underlying surface of this face as a NURBS surface.

Provided for compatibility with compas.geometry.BrepFace. Like the old implementations, this returns the unflipped underlying surface - it does not account for :attr:is_reversed. Prefer :meth:frame_at where a face normal is what is wanted.

surface_type property ¤
surface_type: str

Return the surface type as a string: 'plane', 'cylinder', 'sphere', 'torus', 'cone', or 'nurbs'.

type property ¤
type: int

One of the :class:compas.geometry.SurfaceType constants.

Methods:¤

frame_at ¤
frame_at(u: float | None = None, v: float | None = None) -> Frame

The frame of the face at the given surface parameters.

The zaxis of the returned frame is the face normal: for a face whose :attr:is_reversed is True the underlying surface normal is flipped, so that opposite faces of a solid report opposite normals. Use :attr:surface directly to get the unflipped surface.

Parameters:

  • u (float | None, default: None ) –

    The u parameter, in the parametrization of :attr:surface. Defaults to the middle of :attr:domain_u.

  • v (float | None, default: None ) –

    The v parameter, in the parametrization of :attr:surface. Defaults to the middle of :attr:domain_v.

Returns:

  • class:`compas.geometry.Frame`

    A new frame; modifying it does not affect the face.

Notes

A planar face has no parametrization to speak of - :attr:surface is a :class:compas.geometry.Plane, which carries no x-direction - so for planar faces u and v are distances along the axes of the plane's own frame, measured from the plane's origin, and omitting them puts the frame on the face centroid rather than in the middle of the uv domain.

normal_at ¤
normal_at(u: float | None = None, v: float | None = None) -> Vector

The outward normal of the face at the given surface parameters.

Accounts for :attr:is_reversed, see :meth:frame_at.

Returns:

  • class:`compas.geometry.Vector`

    A new vector; modifying it does not affect the face.