brepjs API Reference
    Preparing search index...

    Class BaseSketcher2d

    Base class for 2D sketchers that accumulate Curve2D segments.

    Provides the shared pen-drawing API (lines, arcs, ellipses, beziers, splines) used by FaceSketcher, BlueprintSketcher, and DrawingPen. Subclasses implement done() / close() to produce the appropriate output type.

    Hierarchy (View Summary)

    Index

    Drawing State

    • get penAngle(): number

      Returns the current pen angle in degrees

      The angle represents the tangent direction at the current pen position, based on the last drawing operation (line, arc, bezier, etc.). Returns 0 if nothing has been drawn yet.

      Returns number

    Other

    _nextCorner: ((f: Curve2D, s: Curve2D) => Curve2D[]) | null
    firstPoint: Point2D
    pendingCurves: Curve2D[]
    pointer: Point2D
    • Draw an arc to a relative end point using a bulge factor.

      Parameters

      • xDist: number
      • yDist: number
      • bulge: number

      Returns this

    • Draw an arc to an absolute end point using a bulge factor (sagitta as fraction of half-chord).

      Parameters

      Returns this

    • 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

    • Draw a half-ellipse arc to a relative end point with a given minor radius.

      Parameters

      • xDist: number
      • yDist: number
      • minorRadius: number
      • sweep: boolean = false

      Returns this

    • Draw a half-ellipse arc to an absolute end point with a given minor radius.

      Parameters

      • end: Point2D
      • minorRadius: number
      • sweep: boolean = false

      Returns this

    • Draw a horizontal bulge arc of the given distance and bulge factor.

      Parameters

      • distance: number
      • bulge: number

      Returns this

    • Draw a horizontal line of the given signed distance.

      Parameters

      • distance: number

      Returns this

    • Draw a horizontal line to an absolute X coordinate.

      Parameters

      • xPos: number

      Returns this

    • Draw a horizontal sagitta arc of the given distance and bulge.

      Parameters

      • distance: number
      • sagitta: number

      Returns this

    • Draw a straight line by relative horizontal and vertical distances.

      Parameters

      • xDist: number
      • yDist: number

      Returns this

    • Draw a line in polar coordinates (distance and angle in degrees) from the current point.

      Parameters

      • distance: number
      • angle: number

      Returns this

    • Draw a circular arc to a relative end point, bulging by the given sagitta.

      Parameters

      • xDist: number
      • yDist: number
      • sagitta: number

      Returns this

    • Draw a smooth cubic Bezier spline to a relative end point, blending tangent with the previous curve.

      Parameters

      Returns this

    • Draw a circular arc tangent to the previous curve, ending at a relative offset.

      Parameters

      • xDist: number
      • yDist: number

      Returns this

    • Draw a line tangent to the previous curve, extending by the given distance.

      Parameters

      • distance: number

      Returns this

    • Draw a circular arc through a via-point to an end point, both as relative distances.

      Parameters

      • xDist: number
      • yDist: number
      • viaXDist: number
      • viaYDist: number

      Returns this

    • Draw a vertical bulge arc of the given distance and bulge factor.

      Parameters

      • distance: number
      • bulge: number

      Returns this

    • Draw a vertical line of the given signed distance.

      Parameters

      • distance: number

      Returns this

    • Draw a vertical sagitta arc of the given distance and bulge.

      Parameters

      • distance: number
      • sagitta: number

      Returns this