brepjs API Reference
    Preparing search index...

    Class Sketcher

    Build 2D wire profiles on a 3D plane using a builder-pen API.

    The Sketcher accumulates 2D curves in the local coordinate system of the chosen plane, then lifts them to 3D edges at finalization.

    const sketch = new Sketcher("XZ", 5)
    .hLine(20)
    .vLine(10)
    .hLine(-20)
    .close();
    const solid = sketch.extrude(8);

    Hierarchy (View Summary)

    Implements

    Index

    Drawing State

    Other

    _nextCorner: ((f: Curve2D, s: Curve2D) => Curve2D[]) | null
    firstPoint: Point2D
    pendingCurves: Curve2D[]
    plane: Plane
    pointer: Point2D
    • Release resources held by this sketcher (lightweight — no kernel handles during drawing).

      Returns void

    • Draw an elliptical arc to a relative end point (SVG-style parameters).

      Parameters

      • xDist: number
      • yDist: number
      • horizontalRadius: number
      • verticalRadius: number
      • rotation: number = 0
      • longAxis: boolean = false
      • sweep: boolean = false

      Returns this

    • Draw an elliptical arc to an absolute end point (SVG-style parameters).

      Parameters

      • end: Point2D
      • horizontalRadius: number
      • verticalRadius: number
      • rotation: number = 0
      • longAxis: boolean = false
      • sweep: boolean = false

      Returns this

    • Override to preserve the original Sketcher's sagitta direction convention.

      BaseSketcher2d computes the perpendicular as [-dy, dx] (counter-clockwise rotation), but the original Sketcher used cross(diff, plane.zDir) which produces [dy, -dx] (clockwise rotation) for standard planes. Negating the sagitta compensates for this, ensuring all sagitta/bulge arcs curve the same way as the original 3D implementation.

      Parameters

      Returns this