brepjs API Reference
    Preparing search index...

    Class Drawing

    Immutable wrapper around a 2D shape (Blueprint, CompoundBlueprint, or Blueprints).

    A Drawing can be transformed (translate, rotate, scale, mirror), combined with Boolean operations (cut, fuse, intersect), filleted/chamfered, serialized, and ultimately projected onto a 3D plane via sketchOnPlane.

    const profile = drawRectangle(40, 20)
    .fillet(3)
    .cut(drawCircle(5).translate(10, 0));
    const sketch = profile.sketchOnPlane("XY");
    Index

    Drawing Modifications

    Other

    • get repr(): string

      Return a human-readable string representation of the drawing.

      Returns string

    • Approximate the drawing curves for a target format (currently only 'svg').

      Parameters

      • target: "svg" | "arcs"
      • options: ApproximationOptions = {}

      Returns Drawing

    • Offset the drawing contour by a signed distance (positive = outward).

      Parameters

      • distance: number
      • offsetConfig: Offset2DConfig = {}

      Returns Drawing

    • Serialize the drawing to a JSON string for persistence or transfer.

      Returns string

    • Export the drawing as a complete SVG string.

      Parameters

      • Optionalmargin: number

      Returns string

    • Return the SVG <path> d attribute strings for this drawing.

      Returns string[] | string[][]

    • Return the SVG viewBox attribute string for this drawing.

      Parameters

      • margin: number = 1

      Returns string