brepjs API Reference
    Preparing search index...

    Class Sketch

    Represent a closed or open wire profile with a default extrusion origin and direction.

    A Sketch wraps a single Wire and carries metadata (origin, direction, optional base face) so that downstream operations like Sketch.extrude, Sketch.revolve, Sketch.sweepSketch, and Sketch.loftWith know how to act on it without extra arguments.

    The class methods are thin delegations to the canonical functions in sketchFns.ts (sketchExtrude, sketchRevolve, etc.). New functionality should be added there.

    Most operations consume (delete) the sketch after producing a solid.

    Implements

    Index

    Constructors

    • Parameters

      • wire: ShapeHandle & { "[___brand]": "wire"; "[___dim]": "3D" } & {
            "[___closed]": true;
        } & { "[___planar]": true }
      • __namedParameters: { defaultDirection?: PointInput; defaultOrigin?: PointInput } = {}

      Returns Sketch

    Properties

    _baseFace: Face | null | undefined
    wire: ShapeHandle & { "[___brand]": "wire"; "[___dim]": "3D" } & {
        "[___closed]": true;
    } & { "[___planar]": true }

    The wire is typed as ClosedWire & PlanarWire to reflect the contract at Sketcher boundaries: Sketcher.close(), closeWithMirror(), closeWithCustomCorner(), and the canned-sketch factories all produce closed planar wires. Callers constructing Sketch from an arbitrary Wire must assert validity at the construction site.

    Accessors

    Methods

    • Extrudes the sketch to a certain distance (along the default direction and origin of the sketch).

      You can define another extrusion direction or origin,

      It is also possible to twist extrude with an angle (in degrees), or to give a profile to the extrusion (the endFactor will scale the face, and the profile will define how the scale is applied (either linearly or with a s-shape).

      Parameters

      • extrusionDistance: number
      • config: {
            extrusionDirection?: PointInput;
            extrusionProfile?: ExtrusionProfile;
            origin?: PointInput;
            twistAngle?: number;
        } = {}

      Returns Shape3D

      Consumes the sketch — calling this twice throws on the second call.