brepjs API Reference
    Preparing search index...

    Class Blueprint

    Represent a closed or open 2D profile as an ordered list of curves.

    A Blueprint is the fundamental 2D drawing primitive: it stores an ordered sequence of Curve2D segments that together describe a planar profile. Blueprints can be transformed (translate, rotate, scale, mirror, stretch), projected onto 3D planes or faces, combined with boolean operations, and serialized to SVG.

    Create instances via BlueprintSketcher rather than calling the constructor directly.

    const bp = new BlueprintSketcher()
    .movePointerTo([0, 0])
    .lineTo([10, 0])
    .lineTo([10, 10])
    .lineTo([0, 10])
    .close();

    // sketchOnPlane returns SketchData (wire + metadata), not a Face
    const sketch = bp.sketchOnPlane("XY");

    Implements

    Index

    Constructors

    Properties

    _boundingBox: BoundingBox2d | null
    curves: Curve2D[]

    Ordered 2D curve segments that compose this blueprint.

    Accessors

    • get orientation(): "clockwise" | "counterClockwise"

      Determine the winding direction of the blueprint via the shoelace formula.

      Returns "clockwise" | "counterClockwise"

      Uses an approximation based on curve midpoints for non-linear segments. The result is cached after the first call.

    Methods

    • Test whether this blueprint's curves intersect with another blueprint's curves.

      Parameters

      Returns boolean

      Uses bounding-box pre-filtering for early rejection.

    • Test whether a 2D point lies inside this closed blueprint.

      Uses ray-casting (intersection counting) against a segment from the point to a location guaranteed to be outside the bounding box.

      Parameters

      Returns boolean

      true if the point is strictly inside the blueprint.

      Returns false for points on the boundary.

    • Mirror the blueprint across a point or plane.

      Parameters

      • centerOrDirection: Point2D

        Mirror center (center mode) or plane normal (plane mode).

      • origin: Point2D = ...

        Origin for plane-mode mirroring.

      • mode: "center" | "plane" = 'center'

        'center' for point symmetry, 'plane' for reflection across an axis.

      Returns Blueprint

      A new mirrored Blueprint.

    • Cut a prism-shaped hole through a solid along a face using this blueprint.

      Parameters

      • shape: AnyShape

        The solid to punch through.

      • face: SingleFace

        The face on which the hole profile is placed.

      • options: { draftAngle?: number; height?: number | null; origin?: PointInput | null } = {}

        Optional hole parameters.

        • OptionaldraftAngle?: number

          Taper angle in degrees (0 = straight hole).

        • Optionalheight?: number | null

          Hole depth; null (default) cuts through the entire solid.

        • Optionalorigin?: PointInput | null

          UV origin on the face for the blueprint placement.

      Returns AnyShape

      The modified shape with the hole removed.

    • Uniformly scale the blueprint around a center point.

      Parameters

      • scaleFactor: number

        Scale multiplier (>1 enlarges, <1 shrinks).

      • Optionalcenter: Point2D

        Center of scaling (defaults to the bounding box center).

      Returns Blueprint

      A new scaled Blueprint.

    • Create a face on a target face's surface defined by this blueprint's profile.

      Parameters

      • face: Face

        The face whose surface the sub-face lies on.

      • Optionalorigin: PointInput | null

        Optional UV origin offset (defaults to the face center).

      Returns Face

      A new Face bounded by the blueprint's profile.